4

I have set up a private blockchain on a local network. I have a node running on an Android smartphone and another on Windows 7, I use Geth on both.

I send Ether with the method eth.sendTransaction() from the Android node and I get a Tx Hash in result. Then I start the mining on the Windows node but the transaction is not added to any block.

I know that my nodes are connected because of the return of admin.peers() and the fact that I can transfer Ether if I send transactions from the mining node.

Is there something more to do for the mining node to see the transactions of the other node(s) ?

EDIT : the information of the nodes

To run the node on Windows :

geth --identity "ethRpi" --genesis "genesis.json" --rpc --rpcport "8080" --rpccorsdomain "*" --datadir "eth" --port "30303" --rpcapi "db,eth,net,web3" --networkid 2016 console

And on Android :

geth --ipcdisable --identity "ethRpi" --genesis genesis.json --fast --rpc --rpcport 8545 --rpcaddr 0.0.0.0 --port 30303 --rpcapi admin,db,eth,miner,net,personal,web3 --networkid 2016 --datadir=eth

On Android

>admin.peers
[{
    caps: [←[32m"eth/61"←[0m, ←[32m"eth/62"←[0m, ←[32m"eth/63"←[0m],
    id: ←[32m"efaa00ffc1d7955e97f4883d8497f4705520eca5a0f7ea63b3d2e2bcf9536fa0edd0cc2ebcf9974d6b2a90790491eefb351b0e135a61e8228f042c16d57d2df0"←[0m,
    name: ←[32m"Geth/v1.5.0-unstable-4f3f6e28/windows/go1.6.2/ethRpi"←[0m,
    network: {
      localAddress: ←[32m"192.168.68.111:30303"←[0m,
      remoteAddress: ←[32m"192.168.68.107:50740"←[0m
    },
    protocols: {
      eth: {
        difficulty: ←[31m9659008←[0m,
        head: ←[32m"163f33b0b9ba7c04cbef8e36796b6b2ef0bcb9af1fe1fa5be8fd05979cbcdc57"←[0m,
        version: ←[31m63←[0m
      }
    }
}]
>eth.pendingTransactions
[{
    blockHash: ←[1mnull←[0m,
    blockNumber: ←[1mnull←[0m,
    from: ←[32m"0xacc8770ed788bcb76fc14c570251585dd83925a8"←[0m,
    gas: ←[31m90000←[0m,
    gasPrice: ←[31m20000000000←[0m,
    hash: ←[32m"0x1d5ec2db286c52440b94e0d596467a15076c1a3ea2cb0995639d85677d051d69"←[0m,
    input: ←[32m"0x"←[0m,
    nonce: ←[31m0←[0m,
    to: ←[32m"0x52fa5791e401a4a33f045d5e34aea9976e5afd4f"←[0m,
    transactionIndex: ←[1mnull←[0m,
    value: ←[31m1000000000000000000←[0m
}]

On windows

> admin.peers
[{
    caps: ["eth/61", "eth/62", "eth/63"],
    id: "a7ae958bf83ad6c659567110abd8a15535a23acd66cd2ccc5bf2333b5f2b4a49a35e80450c9848e658b625b69078ab675882b51e44c17cea4c278746381c0447",
    name: "Geth/v1.5.0-unstable-4f3f6e28/android/go1.6.2/\"ethRpi\"",
    network: {
      localAddress: "192.168.68.107:50740",
      remoteAddress: "192.168.68.111:30303"
    },
    protocols: {
      eth: {
        difficulty: 9659008,
        head: "163f33b0b9ba7c04cbef8e36796b6b2ef0bcb9af1fe1fa5be8fd05979cbcdc57",
        version: 63
      }
    }
}]
> eth.pendingTransactions
[]
>miner.start()
I0628 09:54:58.658192 miner/miner.go:119] Starting mining operation (CPU=4 TOT=5)
I0628 09:54:58.660192 miner/worker.go:555] commit new work on block 74 with 0 txs & 0 uncles. Took 999.8µs
I0628 10:00:26.560682 miner/worker.go:337] ??  Mined block (#74 / 0bebfb50). Wait 5 blocks for confirmatio
I0628 10:00:26.562682 miner/worker.go:555] commit new work on block 75 with 0 txs & 0 uncles. Took 999.9µs
I0628 10:00:26.562682 miner/worker.go:555] commit new work on block 75 with 0 txs & 0 uncles. Took 0
I0628 10:00:26.608677 miner/worker.go:337] ??  Mined stale block (#74 / 0bd0e716).
I0628 10:00:26.647674 miner/worker.go:555] commit new work on block 75 with 0 txs & 0 uncles. Took 0
I0628 10:00:29.670371 miner/worker.go:337] ??  Mined block (#74 / cd692c59). Wait 5 blocks for confirmation
I0628 10:00:29.671371 miner/worker.go:555] commit new work on block 75 with 0 txs & 0 uncles. Took 0
I0628 10:00:29.687370 miner/worker.go:337] ??  Mined block (#74 / c082d521). Wait 5 blocks for confirmation
I0628 10:00:29.688369 miner/worker.go:555] commit new work on block 75 with 0 txs & 0 uncles. Took 0
I0628 10:00:29.703368 miner/worker.go:555] commit new work on block 75 with 0 txs & 0 uncles. Took 0
I0628 10:00:31.953143 miner/worker.go:337] ??  Mined block (#75 / 542384a4). Wait 5 blocks for confirmation
I0628 10:00:35.181820 miner/worker.go:555] commit new work on block 76 with 0 txs & 2 uncles. Took 8.9991ms
I0628 10:00:35.183820 miner/worker.go:555] commit new work on block 76 with 0 txs & 2 uncles. Took 999.9µs
I0628 10:00:35.185820 miner/worker.go:555] commit new work on block 76 with 0 txs & 2 uncles. Took 0
I0628 10:00:39.623376 miner/worker.go:337] ??  Mined block (#76 / 18796f50). Wait 5 blocks for confirmation
I0628 10:00:39.743364 miner/worker.go:555] commit new work on block 77 with 0 txs & 0 uncles. Took 999.9µs
I0628 10:00:39.750363 miner/worker.go:555] commit new work on block 77 with 0 txs & 0 uncles. Took 0
I0628 10:00:42.795059 miner/worker.go:337] ??  Mined block (#77 / 651df4a0). Wait 5 blocks for confirmation
I0628 10:00:42.796059 miner/worker.go:555] commit new work on block 78 with 0 txs & 0 uncles. Took 999.9µs
I0628 10:00:42.815057 miner/worker.go:555] commit new work on block 78 with 0 txs & 0 uncles. Took 0
I0628 10:00:43.384000 miner/worker.go:337] ??  Mined block (#78 / 021c7f6a). Wait 5 blocks for confirmation
I0628 10:00:43.400998 miner/worker.go:555] commit new work on block 79 with 0 txs & 0 uncles. Took 0
I0628 10:00:43.444994 miner/worker.go:555] commit new work on block 79 with 0 txs & 0 uncles. Took 0
mI0628 10:00:43.923946 miner/worker.go:337] ??  Mined block (#79 / 8eef4802). Wait 5 blocks for confirmation
  • 1
    Did you check whether the transaction is initiated and waiting to be mined with eth.pendingTransactions? Does this command return anything? How are you starting the miner on the Windows node? – galahad Jun 27 '16 at 16:24
  • 1
    Yes the transaction is in the pendingTransactions on the Android node but not on the windows node. And the miner is started, I have new blocks but with 0 Txs – guillv Jun 28 '16 at 7:39
  • 1
    Can you post the complete commands that you used, to start geth instances on both the nodes? – galahad Jun 28 '16 at 13:05
  • 1
    I think you need to have different port numbers. Check this. – galahad Jun 28 '16 at 14:34
  • 1
    Ok, I tried to change the ports, I now have --rpcport 8080 --port 30304 on windows and --rpcport 8545 --port 30303 on android. I still can't mine the transactions from android node. I didn't erase the database, do you think it's necessary ? – guillv Jun 28 '16 at 15:32
1

I have the solution thanks to @karalabe in this message : https://gitter.im/ethereum/go-ethereum?at=57737aed1ac8bd1a4d8c8fef

Actually the mining node has to be synced before mining transactions from other nodes. If there is only one miner in the network it won't get blocks from other nodes and consider itself not synced so it doesn't include transactions before full synchronization.

So I just added a node to the network (Ubuntu Virtual Machine) and mined some blocks with it. Once both nodes are synced they can mine blocks with transactions from any node in the network.

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.