2

I tried to start a private ethereum testnet on my laptop. Then created 2 accounts and did transaction from the 1st account to the 2nd one.But he balance is not updating in the 2nd account. Here are the following details:

myGenesis.json :

    {
   "config": {
      "chainId": 1998,
      "homesteadBlock": 0,
      "eip155Block": 0,
      "eip158Block": 0,
      "byzantiumBlock": 0
   },
   "difficulty": "400",
   "gasLimit": "200000000",
   "alloc": {
      "7b684d27167d208c66584ece7f09d8bc8f86ffff": { 
          "balance": "100000000000000000000000" 
      },
      "ae13d41d66af28380c7af6d825ab557eb271ffff": { 
          "balance": "120000000000000000000000" 
      }
   }
}

I did the following commands in sequence:

  1. geth --datadir ./myDataDir init ./myGenesis.json
  2. geth --nodiscover --rpc --rpccorsdomain "*" --datadir ./myDataDir --networkid 1111 console 2>> myEth.log
  3. personal.newAccount()
  4. eth.getBalance(eth.coinbase) I got balance 0. Then I did some mining.
  5. miner.setEtherbase(web3.eth.accounts[0])
  6. miner.start()
  7. eth.getBalance(eth.coinbase) This gave me 318000000000000000000
  8. miner.stop()

Now I created another account

  1. personal.newAccount()
  2. eth.getBalance(eth.accounts[1]) I got balance 0.

My accounts are: ["0x72b04ad624b90739b68bbdbf0a1387738ef5d6d1", "0x520bb736d6340c4bb2279e6f6f6a2f74b90ac37c"]

Then I sent some ether from 1st account to 2nd one using the following:

  1. var sender = "0x72b04ad624b90739b68bbdbf0a1387738ef5d6d1"

  2. var receiver = "0x520bb736d6340c4bb2279e6f6f6a2f74b90ac37c"

  3. var amount = web3.toWei(0.0000001, "ether")

I unlocked the 1st account:

  1. personal.unlockAccount(web3.eth.accounts[0])

and then did the transaction:

  1. eth.sendTransaction({ from:sender, to:receiver, value:amount });

It returned the transaction hash but the balance is still 0 in the 2nd account(0x520bb736d6340c4bb2279e6f6f6a2f74b90ac37c)

What am I missing here ? or the procedure is wrong ? Please help

3
  • It seems to be the correct approach. Can you provide the transaction receipt also? eth.getTransactionReceipt Mar 31 '18 at 17:25
  • 1
    Did you mine new blocks after sending the transaction? You need to mine a block with the transaction for it to be confirmed.
    – Ismael
    Mar 31 '18 at 17:29
  • Thank you so much. Did mining after the transaction and the balance is updated. Mar 31 '18 at 17:52

Your Answer

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

Browse other questions tagged or ask your own question.