[Ethereum] I am using web3j and geth. How to create default accounts with some ether allocation to it

web3j

  1. I need a default account with huge ether allocation. This I need to set up manually in genesis.json
  2. Hereafter,all accounts need to be created dynamically in java, and they should also be given some default funds.

I tried this using web3j, but its creating its own genesis block . How can I do my default setup in that genesis ?

Also, not sure whether to use smart contract here or web3j ?

Edited here

How to start geth and web3j in a private network ?

My application requires default account to be created with some default ether allocation to it. I did that using

a. "geth account new" command

b. updated genesis.json with this newly created account and allocated some balance to it

c. and then ran the init command "geth –datadir ./datadir init genesis.json"

It worked all fine.So, now I have main account with some default ether.

Now, hereafter I should be able to create new accounts dynamically. And transfer some default funds to these accounts from the main account created in the above steps.

I tried using web3j – java API ,
"geth –rpcapi personal,db,eth,net,web3 –rpc –testnet"
But this should point to existing genesis.json and keystore . It is creating new genesis.json . How can I do this?

Best Answer

This tutorial cover the complete set of steps needed to develop your first smart contract in a private Ethereum node using web3j Java framework.

You can also use ganache instead of geth for development of DAPP. ganache pre-allocates 100 ethers to 10 accounts by default.