[Ethereum] sendRawTransaction results in queued TXs

go-ethereumjson-rpcraw-transactiontransactions

I attempted to send raw TXs via eth.sendRawTransaction API but get stuck. I'm using EthereumJS to generate and sign TXs, and indeed, I can submit TXs through eth.sendRawTransactin, but the TXs always result in queued (non-processable, per geth doc).

I called eth.sendRawTransactin from a geth console, and it returns a hash as usual. I can get transaction details by that hash:

> eth.getTransaction(hash)
{
  blockHash: null,
  blockNumber: null,
  from: "0x89b44e4d3c81ede05d0f5de8d1a68f754d73d997",
  gas: 90000,
  gasPrice: 50000000000,
  hash: "0x69b4a0768e72c3a679a1ae6fb490a831509c3c0a04674b646362d0a3d74689a4",
  input: "0x",
  nonce: 10,
  to: "0xb7e13de69228c37cdff506ea474f31343af33c05",
  transactionIndex: null,
  value: 2000000
}

But the TXs are queued forever:

> txpool.status
{
  pending: 0,
  queued: 5
}

Also sending address is rich enough to pay off the gas:

> eth.getBalance("89b44e4d3c81ede05d0f5de8d1a68f754d73d997")
20000000000000000020

To compare, this is a valid transaction (created and sent by some client)

> eth.getTransactionFromBlock(11)
{
  blockHash: "0x41919469d7ed9232adbcacc820e61ad508b30eb5fc4750d3cebd748c22b110b8",
  blockNumber: 11,
  from: "0xb7e13de69228c37cdff506ea474f31343af33c05",
  gas: 90000,
  gasPrice: 50000000000,
  hash: "0xa4d4a22aa1fed291a7da00e24304f7093b4fc09b1c6a18692e4240d6d913d674",
  input: "0x",
  nonce: 4,
  to: "0x89b44e4d3c81ede05d0f5de8d1a68f754d73d997",
  transactionIndex: 0,
  value: 20000000000000000000
}

Since geth can parse them, the format of my TXs has to be correct. I guess the only thing left is the signature. But I'm pretty sure the TX has been properly signed.

Is there a way to get more information about why a TX can't be processed? I'm using geth on my own blockchain so I can modify the source code if that helps.

Best Answer

If the transaction is queued but not executable, that means that there's a nonce gap between your latest executed transaction and the next in line that's waiting to run.

If you pull in a develop version of geth, it has two extra txpool API endpoint (txpool.content and txpool.inspect) that allows you to list the contents of pending and queue. My guess is that your script misses a nonce, producing non-executable transactions.

Related Topic