0

I sent 1 ETH on a private chain from node1 to node2.

>eth.sendTransaction({
from: "0x30278b135d0f5c10eb0684ff18bfd84912ae0f2b",
gasPrice: "5000000000",
gas: "21000",
to: '0xdba556d4250060d8be5abc82f50653430cee5769',
value: "1000000000000000000",
data: ""
}, 'password')

Result (TxHash)

"0xfd723065f3c389b91d379450caad235066762c53749780459218218ff9129205"

But when I check TxHash

> eth.getTransaction("0xfd723065f3c389b91d379450caad235066762c53749780459218218ff9129205")
{
  blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  blockNumber: null,
  from: "0x30278b135d0f5c10eb0684ff18bfd84912ae0f2b",
  gas: 21000,
  gasPrice: 5000000000,
  hash: "0xfd723065f3c389b91d379450caad235066762c53749780459218218ff9129205",
  input: "0x",
  nonce: 8,
  r: "0xbe40d0d29d00b48459ba36933eec4338065d2eb5511855316b8fa237c43c95ca",
  s: "0x568b749c609e9dfea9d35fad8e372a747a6eeedb58bbecd20103f8a2dd88cce3",
  to: "0xdba556d4250060d8be5abc82f50653430cee5769",
  transactionIndex: 0,
  v: "0x9c8",
  value: 1000000000000000000
}

And check the number of transaction of the recipient,

> eth.getTransactionCount("0xdba556d4250060d8be5abc82f50653430cee5769")
0

Was the transaction successful?

genesis.json

{
    "config": {
   "chainID": 1234,
   "homesteadBlock": 0,
   "eip155Block": 0,
   "eip158Block": 0
 },
 "alloc": {
    "0x30278b135d0f5c10eb0684ff18bfd84912ae0f2b": {
      "balance": "100000000000000000000000000000"
    }
 },
 "difficulty": "0x4000",
 "gasLimit": "0xffffffff",
 "nonce": "0x0000000000000000",
 "coinbase": "0x0000000000000000000000000000000000000000",
 "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "extraData": "0x123458db4e347b1234537c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
 "timestamp": "0x00"
}

Transaction receipt:

> eth.getTransactionReceipt("0xfd723065f3c389b91d379450caad235066762c53749780459                       218218ff9129205")
{
  blockHash: "0x305262bbae04f2646d55724c4e87e836e558cc2c30bd874c2b2c768622113832                       ",
  blockNumber: 30198,
  contractAddress: null,
  cumulativeGasUsed: 21000,
  from: "0x30278b135d0f5c10eb0684ff18bfd84912ae0f2b",
  gasUsed: 21000,
  logs: [],
  logsBloom: "0x0000000000000000000000000000000000000000000000000000000000000000                       00000000000000000000000000000000000000000000000000000000000000000000000000000000                       00000000000000000000000000000000000000000000000000000000000000000000000000000000                       00000000000000000000000000000000000000000000000000000000000000000000000000000000                       00000000000000000000000000000000000000000000000000000000000000000000000000000000                       00000000000000000000000000000000000000000000000000000000000000000000000000000000                       000000000000000000000000000000000000000000000000",
  root: "0xafbb5fe68186740e11cab692ad5c3b88a1b450cc27f93a2a627138a8a347d155",
  to: "0xdba556d4250060d8be5abc82f50653430cee5769",
  transactionHash: "0xfd723065f3c389b91d379450caad235066762c53749780459218218ff9                       129205",
  transactionIndex: 0
}
0

It's because getTransactionCount(address) returns the number of transactions sent from the address. You are passing the address which received the eth so its count will be 0. If you try with 0x30278b135d0f5c10eb0684ff18bfd84912ae0f2b, it should give you 1.

  • I tried but it's also the same. No transaction counted for both addresses. – askingtoomuch Apr 14 at 16:59
  • Did you reset your local testnet by mistake? I just tried it myself and it works perfectly fine. – Eli Drion Apr 14 at 17:08
  • What do you mean reset testnet by mistake? I'm running a private chain with the genesis.json I just added above. – askingtoomuch Apr 14 at 17:26
0

Personally, I would not rely on getTransactionCount to verify if a transaction was successful. I would check the balance of the receiving address using getBalance.

> eth.getBalance("0xdba556d4250060d8be5abc82f50653430cee5769")

or, if you want to use web3 https://web3js.readthedocs.io/en/1.0/web3-eth.html#getbalance

  • Balance did not change for both addresses that's why I'm checking everything I can to find out what happened to the transaction – askingtoomuch Apr 14 at 17:32
  • is the private chain set up correctly? are the nodes connected on the same network? – j4ys0n Apr 14 at 17:44
  • has the transaction been included in a block? – j4ys0n Apr 14 at 17:50
  • I added transaction receipt. I don't see any status field so it means it didn't go through? – askingtoomuch Apr 15 at 1:42

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.