0

I tried to run a Geth light node, but it seems I can not retrieve transaction information from the RPC server. I'm not sure whether that's a limitation of the light node, or rather me not retrieving the information in the right way.

I run the command below to get the data, but it doesn't seem to work:

$ curl --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["tx hex hash"],"id":1}' \
-H "Content-Type: application/json" -X POST http://127.0.0.1:8545
$ {"jsonrpc":"2.0","id":1,"result":null}

Is eth_getTransactionByHash supposed to work with a light node?

If not, what's the lightest node (in terms of disk space required to sync the blockchain) capable of returning that information from the RPC server managed wallets?

2

No, in a light-node you won't be able to get transactions by hash. You can read more here. Quoting from the repo page:

The Light Ethereum Subprotocol (LES) is the protocol used by "light" clients, which only download block headers as they appear and fetch other parts of the blockchain on-demand.

A light-node depends on a full-node for other purposes when needed.

There are three 'levels' of syncing nodes with Geth:

  1. Full- verifies and archives every transaction from genesis.
  2. Fast- verifies only recent transactions and fetches a snapshot of older blocks.
  3. Light- downloads block headers to only validate the authenticity of transactions.

For your purpose, you'll need, at least, fast node sync to be able to fetch transactions by hash in Geth.

  • What about getting the block hash directly from the light node? In the get attach shell, I tried running eth.getBlock before I had really built up my peer list and it seemed like it was forwarding that call to the network. Do you know if it's possible to query the block headers that are in the light-node's db? – richardpringle Mar 29 at 22:59
  • You are using eth.getBlock, then you'll of course be requesting for a block and since blocks are not stored in light node, your node will request the network. You need to call something along the line of getBlockHash. – DaveIdito Apr 3 at 10:55

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.