2

How to decode the JSON-RPC result of bsc-dataseed1.defibit.io?

these are two examples of output:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "difficulty": "0x2",
    "extraData": "0xd883010007846765746888676f312e31352e32856c696e7578000000fc3ca6b785b29cd6a142894c8ba58f9f7cb0e06338c1f825ac179d4ed82754edc56ff0535c152d70ee1faed5462857bf31e33d15697284d6027ffc8edcd57b9603800da301",
    "gasLimit": "0x261e004",
    "gasUsed": "0x117a68b",
    "hash": "0x6acb5427e3035c94d2b3c584cdee04365cd31f392c83349dd0532133bfb39ffe",
    "logsBloom": "0x0d2621942f0650b00068a1c383b200e9d0152550cc345d385819c0ccfc941b5e47a3b64407c28f1a779811e85e0a4b3508110dbfbe2d2511e1142a04b0b53c012539371c9134a0335392d27de561e33dbf5f0f2053de78061634b2028632cf6d1a396a2d9f2e3aaaadd862496a424cc61800200b019d172ec223e2b2d66c541210f8db34017340a649dc45804d2b092040742c51019bd588f1a3804738329cff2a2da42c195b384264705983ce5a94100656801358c5b2618332fcfd91f042c6742504265270090b0057195a38775ba2b90de040413a0b122a11e42f5209e65c2af25785a763b590f1720b0228456bf3d6b409aceb9a0ae2a32a6a0424ecaea1",
    "miner": "0xee226379db83cffc681495730c11fdde79ba4c0c",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "nonce": "0x0000000000000000",
    "number": "0x620435",
    "parentHash": "0xc4b21f5681c5c3ad9a70408159b271d69b01726bb09f444cfc81b62a385502dc",
    "receiptsRoot": "0xb4099a24bd932a1d19d43259a9c621c9b20b51a3d9fbfc6f60fe222d056c4181",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "size": "0xe9a1",
    "stateRoot": "0xff3be06a342359602c7380c8f7f571a5cbb7af4e3ced7fdaf70183e99c347799",
    "timestamp": "0x6070b279",
    "totalDifficulty": "0xc3a03e",
    "transactions": [
      {
        "blockHash": "0x6acb5427e3035c94d2b3c584cdee04365cd31f392c83349dd0532133bfb39ffe",
        "blockNumber": "0x620435",
        "from": "0x8d3d7ab70a2f05a5b8c345d077efd786dd21ec04",
        "gas": "0xcbf5",
        "gasPrice": "0x19d81d9600",
        "hash": "0x07ac6e156c59a0a586655edffb75817ad43d726cbf0b22669f62f3dc5d6f1ffd",
        "input": "0x095ea7b300000000000000000000000071ac17934b60a4610dc58b715b61e45dcbde4054ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
        "nonce": "0x10d",
        "to": "0x9a2f5556e9a637e8fbce886d8e3cf8b316a1d8a2",
        "transactionIndex": "0x0",
        "value": "0x0",
        "v": "0x93",
        "r": "0x10301e4b84583d957c7768dcae15674144932128e01633986462c662442988f4",
        "s": "0x1f5525e0e3a0932e5bcd15fceeb6e6602525308e1f641c058849aa66fd0b9d1f"
      }
    ],
    "transactionsRoot": "0x305dd4b0429c8209a0c297ef1bb86e39a9239c500ff350a8933ff46717a51f44",
    "uncles": []
  }
}

Or this other output case:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": "0x000000000000000000000000000000000000000000000000000000000061f0f800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000001d7e8d2c0a2200000000000000000000000000000000000000000000001eb21dce5a59a75379000000000000000000000000000000000000000000000000000000006070784700000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000141f9ce89a1dfef000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000628f7b87c12ddec599ba000000000000000000000000000000000000000000a8780c630715be8e62138800000000000000000000000000000000000000000000000000000000607078a7"
}

it should be possible to retrieve the currency, quantity, and other information

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.