Use custom chain config
This commit is contained in:
parent
6621127c41
commit
1ce7c21c86
@ -17,6 +17,10 @@ action :enable do
|
||||
config[:account] = {}
|
||||
config[:account][:password] = ["#{base_path}/password"]
|
||||
|
||||
if config[:parity][:chain] == "dev"
|
||||
config[:parity][:chain] = "#{base_path}/chain-config.json"
|
||||
end
|
||||
|
||||
directory base_path do
|
||||
recursive true
|
||||
owner "parity"
|
||||
@ -42,8 +46,10 @@ action :enable do
|
||||
|
||||
ruby_block "generate config" do
|
||||
block do
|
||||
parity_args = "--chain #{config[:parity][:chain]} --base-path #{base_path}"
|
||||
|
||||
parity_account_list = Mixlib::ShellOut.new(
|
||||
"parity account list --chain #{config[:parity][:chain]} --base-path #{base_path}",
|
||||
"parity account list #{parity_args}",
|
||||
user: "parity"
|
||||
)
|
||||
parity_account_list.run_command
|
||||
@ -52,7 +58,7 @@ action :enable do
|
||||
|
||||
if parity_account.empty?
|
||||
parity_account_create = Mixlib::ShellOut.new(
|
||||
"parity account new --chain #{config[:parity][:chain]} --base-path #{base_path} --password #{base_path}/password",
|
||||
"parity account new #{parity_args} --password #{base_path}/password",
|
||||
user: "parity"
|
||||
)
|
||||
parity_account_create.run_command
|
||||
@ -62,6 +68,18 @@ action :enable do
|
||||
|
||||
config[:account][:unlock] = [parity_account]
|
||||
|
||||
# Using our own chain config (i.e. dev)
|
||||
if config[:parity][:chain].include?(".json")
|
||||
template "#{base_path}/chain-config.json" do
|
||||
source 'chain-config.json.erb'
|
||||
variables parity_account: parity_account
|
||||
owner "parity"
|
||||
group "parity"
|
||||
mode 0640
|
||||
notifies :restart, "service[#{parity_service}]", :delayed
|
||||
end
|
||||
end
|
||||
|
||||
file "config" do
|
||||
path config_path
|
||||
content TOML::Generator.new(config).body
|
||||
|
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "KreditsChain",
|
||||
"engine": {
|
||||
"instantSeal": { "params": {} }
|
||||
},
|
||||
"params": {
|
||||
"accountStartNonce": "0x00",
|
||||
"maximumExtraDataSize": "0x20",
|
||||
"minGasLimit": "0x1388",
|
||||
"networkID" : "0x11"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
"ethereum": {
|
||||
"nonce": "0x00006d6f7264656e",
|
||||
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578"
|
||||
}
|
||||
},
|
||||
"difficulty": "0x20000",
|
||||
"author": "0x0000000000000000000000000000000000000000",
|
||||
"timestamp": "0x00",
|
||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"extraData": "0x",
|
||||
"gasLimit": "0x5B8D80"
|
||||
},
|
||||
"accounts": {
|
||||
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||
"<%= @parity_account %>":{"balance": "1606938044258990275541962092341162602522" }
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ Description=Parity Daemon (<%= @environment %>)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/parity --config <%= @config_file %> $ARGS
|
||||
ExecStart=/usr/bin/parity --config <%= @config_file %> --no-discovery $ARGS
|
||||
User=parity
|
||||
Group=parity
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user