2
  1. I created a genesis file and saved it in a folder called node1.
  2. Then I entered the following command:

    geth init "C:\rahul13615\blockchain\node1\genesis1.json"
    
  3. Folder named chaindata was created and certain space was allocated to me.

  4. Then I entered:

    geth --fast --cache 512 --networkid 321 --datadir "C:\rahul13615\blockchain\node1" --identity "FirstNode"
    
  5. Few more folders like dapp, keystore, nodes and a file named nodekey were created.

  6. Then I used personal.newAccount("Test1") to create a new account on my newly created node.
  7. I used the account's address and added the following in genesis file:

    "alloc": {
        "0xb4c55eae41809524f570be88ef9be0b108b993b8" :
        { "balance": "20000000000000000000" } 
    }
    
  8. I saved this file and re-entered commands in step 2 and 4 to read the updated genesis file.
  9. Then I entered primary = eth.accounts[0]; this returned me the address of the account I created.
  10. Then, balance = web3.fromWei(eth.getBalance(primary),"ether")

Ideally it should return 20 ethers but it is returning 0. Please help me understand where i went wrong?

2

After you change your genesis file use --init option to adopte the new one. However you could mine new blocks miner.start() to get new ethers

1

All the data in the previous blockchain(without account balance) will be stored in the chaindata folder. After step 7, you should delete all the files & folders except the keystore folder and the genesis file. This ensures that you're starting a new private blockchain and not working on the previous one.

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.