2

I'm trying to generate a Clique POA genesis file that specifies the original sealers using automation. However, puppeth only supports user input at the moment. There's no support for command line options such as.

puppeth genesis --protocol clique --chainId 123 --period 2 --sealers 0x123...,0x234...,0x345...  --alloc 0x123...,0x234...,0x345...

Are there any alternative tools for generating the extraData value that's needed in the genesis.conf?

1
  • 1
    Oops, I just realized that the extraData is easily generated by adding 0x0 + 64 zeros + sealers addresses in sorted order + 128 zeros. Commented Nov 7, 2018 at 6:10

1 Answer 1

0

I was also seeking this so created a shell script to achieve this. You first need to install expect. I tested with puppeth with geth v1.9.5.

  1. Copy the following code, modify some if you need, and save it as automate_puppeth.sh or something.
#!/usr/bin/expect -f
spawn ./bin/puppeth --network genesis
expect "What would you like to do? (default = stats)"
send "2\r"
expect "What would you like to do? (default = create)"
send "1\r"
expect "Which consensus engine to use? (default = clique)"
send "2\r"
expect "How many seconds should blocks take? (default = 15)"
send "1\r"
expect "Which accounts are allowed to seal? (mandatory at least one)"
send "1386eb59bb0ae44fec376c98e502e0966bd86636\r"
expect "0x"
send "9fdc2ccb2741f283613c44b07dc411bc84a2484e\r"
expect "0x"
send "c981a191fb0efae956826f018792d55c02e8700e\r"
expect "0x"
send "f5fb53c8d6e661acbcfb7873ce8bcbc47150311a\r"
expect "0x"
send "\r"
expect "Which accounts should be pre-funded? (advisable at least one)"
send "1386eb59bb0ae44fec376c98e502e0966bd86636\r"
expect "0x"
send "9fdc2ccb2741f283613c44b07dc411bc84a2484e\r"
expect "0x"
send "c981a191fb0efae956826f018792d55c02e8700e\r"
expect "0x"
send "f5fb53c8d6e661acbcfb7873ce8bcbc47150311a\r"
expect "0x"
send "\r"
expect "Should the precompile-addresses (0x1 .. 0xff) be pre-funded with 1 wei? (advisable yes)"
send "yes\r"
expect "Specify your chain/network ID if you want an explicit one (default = random)"
send "138634\r"
expect "What would you like to do? (default = stats)"
send "2\r"
expect "1. Modify existing configurations"
send "2\r"
expect "Which folder to save the genesis specs into? (default = current)"
send ".\r"
expect "What would you like to do? (default = stats)"
send \x03
  1. chmod +x automate_puppeth.sh
  2. ./automate_puppeth.sh

The output json file is stored in the current directory.

I hope this will help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.