2

I have set automated registration smart contract to register nodes as they are added to a private network. The contract works, however I have run into a problem. When the nodes are set up they have no ether, therefore they cannot send a transaction to the smart contract.

I would like to either:

1) automatically send ether to the nodes when they appear as admin.peers on a master node or 2) set up a “bank” smart contact which I could fill with ether, which would allow the nodes to request a small amount of ether so they could subsequently send a transaction to the registration smart contract.

Is either approach feasible?

Cheers, P

1

I think you're conflating "nodes" with "accounts".

When the nodes are set up they have no ether

Specifically, they have no accounts, which have no ether. A node in the network may or may not also host one or more accounts. By default, when you first run a node (e.g. Geth, Parity, etc.) it's just the client software - you have to explicitly create the accounts.

One option in a private network, if you know how many nodes and accounts your network will ultimately have, you could preassign the account addresses and their associated balances via the genesis.json file.

1) automatically send ether to the nodes when they appear as admin.peers on a master node

You'd need a way to discover the addresses of the accounts on the node. Allowing one node to see which accounts were available on another node would be a security hole.

2) set up a “bank” smart contact which I could fill with ether, which would allow the nodes to request a small amount of ether so they could subsequently send a transaction

Chicken/egg problem. You'd need some initial balance to cover the gas cost of calling the bank contract.

  • Hi Richard, Thanks for the reply. Apologies, I should have been more specific, when the nodes are set up, I also set up an account (which acts as eth.coinbase for the node), but yes the account has no ether. Unfortunately pre-allocating is not an option as the nodes (and the associated accounts) will be not be known during the creation of the private blockchain, and I can also now see how option 2 would not be possible. I have just come across the idea of an ether faucet, so I may look into that as it seems like it may be a possible solution. – pd26 Apr 15 '17 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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