5

It seems I've made a successful transaction from account[0] to account1. Why does account1 still have a 0 balance?

> var sender = eth.accounts[0];
undefined
> sender
"0x702543f4ae6d7ebdd07dc29c432a0c707b8c2cc0"
> var receiver = eth.accounts[1];
undefined
> receiver
"0xac97d0feb8b4b3bcaa2b153dff1d4eaa5b4bee9c"
> var amount = web3.toWei(1000, 'ether');
undefined
> eth.sendTransaction({from:sender, to:receiver, value: amount})
account is locked
    at web3.js:3119:20
    at web3.js:6023:15
    at web3.js:4995:36
    at <anonymous>:1:1

> personal.unlockAccount(sender, "valid_passphrase")
true
> personal.unlockAccount(receiver, "valid_passphase")
true

> eth.sendTransaction({from:sender, to:receiver, value: amount})
I0602 20:32:38.038644 eth/api.go:1193] Tx(0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8) to: 0xac97d0feb8b4b3bcaa2b153dff1d4eaa5b4bee9c
"0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8"


> eth.getBalance(eth.accounts[0])
6.79703125e+21
> eth.getBalance(eth.accounts[1])
0

eth.getTransaction("0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8")

{
  blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  blockNumber: null,
  from: "0x702543f4ae6d7ebdd07dc29c432a0c707b8c2cc0",
  gas: 90000,
  gasPrice: 20000000000,
  hash: "0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8",
  input: "0x",
  nonce: 0,
  to: "0xac97d0feb8b4b3bcaa2b153dff1d4eaa5b4bee9c",
  transactionIndex: null,
  value: 1e+21
}

SOLUTION:

miner.start(8)

Let the miner run for a couple minutes.

miner.stop()

eth.getTransaction("0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8")

{
  blockHash: "0xea06bc12fc1db50416adc90ec0856946f3e69b6bba3ec6722ecaf04538184667",
  blockNumber: 1330,
  from: "0x702543f4ae6d7ebdd07dc29c432a0c707b8c2cc0",
  gas: 90000,
  gasPrice: 20000000000,
  hash: "0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8",
  input: "0x",
  nonce: 0,
  to: "0xac97d0feb8b4b3bcaa2b153dff1d4eaa5b4bee9c",
  transactionIndex: 0,
  value: 1e+21
}
malexanders
  • 263
  • 2
  • 10
  • Can you try eth.getTransaction("0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8") and confirm that the transaction was mined? – BokkyPooBah Jun 03 '16 at 01:12
  • looks like it wasn't mined because the block number is null... – malexanders Jun 03 '16 at 01:25
  • I made the transaction in the geth console, while the miner was stopped. If I start the miner, should it eventually mine this transaction? – malexanders Jun 03 '16 at 01:26
  • It should if the transaction is still floating around in the transaction pool. If you shut down all your geth instances, the transaction will be lost. – BokkyPooBah Jun 03 '16 at 01:26
  • probably a silly question, how can I run multiple nodes on a local chain? – malexanders Jun 03 '16 at 01:29
  • ran the miner, and the transaction was mined! updated post to show results – malexanders Jun 03 '16 at 01:36
  • Great. You might want to post your results as an answer and tick it off in 2 days. To find out how to run multiple nodes, search this site for "trusted-nodes.json", "static-nodes.json", "bootnode" and private network. – BokkyPooBah Jun 03 '16 at 01:39

1 Answers1

2

miner.start(8)

Let the miner run for a couple minutes.

miner.stop()

eth.getTransaction("0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8")

{
  blockHash: "0xea06bc12fc1db50416adc90ec0856946f3e69b6bba3ec6722ecaf04538184667",
  blockNumber: 1330,
  from: "0x702543f4ae6d7ebdd07dc29c432a0c707b8c2cc0",
  gas: 90000,
  gasPrice: 20000000000,
  hash: "0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8",
  input: "0x",
  nonce: 0,
  to: "0xac97d0feb8b4b3bcaa2b153dff1d4eaa5b4bee9c",
  transactionIndex: 0,
  value: 1e+21
}
malexanders
  • 263
  • 2
  • 10