3

How do I retrieve the timestamp of a mined transaction using the JSON RPC?

  • Did you try to read out the block which includes the transaction? – Afr Apr 11 '16 at 17:56
3

Call https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber and the time stamp is returned as part of the result.

The data returned by eth_getBlockByNumber is the same as the data returned by eth_getBlockByHash below:

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", true],"id":1}'

// Result
{
  "id":1,
  "jsonrpc":"2.0",
  "result": {
    "number": "0x1b4", // 436
    "hash": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331",
    ...
    "timestamp": "0x54e34e8e" // 1424182926
    ...

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.