nr_getTransactionByAddress

This API method helps you to get transfers for any fromAddress, toAddress, contractAddress, etc.

📘

Supported on BSC and ETH mainnet only.

Parameters

  • category - example: List [ "external", "20" ]; ------ external, internal; 20, 721, 1155;
  • fromBlock - hexadecimal string or latest.
  • toBlock - hexadecimal string or latest.
  • addresses - address, must not be null
  • addressType - option: from, to, contract, null if all of addressType
  • order - option: asc or desc
  • excludeZeroValue - boolean, true for excluding zero value data, false for all data
  • maxCount - hex encoded value, define once request return data count, max value:0x3E8
  • PageKey - uuid for pagination. If more results are available, a uuid pageKey will be returned in the response. Pass that uuid into pageKey to fetch the next maxCount. For first page, don't need this param.

Returns

  • PageKey - string, page key for next page query
  • transfers - details
    • category - external or internal
    • blockNum - number
    • from - string, from addresss
    • to - string, to address
    • value - hexadecimal string, raw transfer value
    • erc721TokenId - 32-byte fixed-length hexadecimal string
    • erc1155MetaData - string, page key for next page query
      • tokenId - hexadecimal string
      • value - hexadecimal string, raw transfer value
    • asset - ETH/BNB or the token's symbol. null if not defined in the contract and not available from other sources.
    • hash - string, transaction hash
    • contractAddress - contract address (hex string). null if external transfer
    • decimal - contract decimal (hex string). null if not defined in the contract and not available from other sources.
    • blockTimestamp - timestamp of the block from which the transaction event originated
    • gasPrice - gas price for external transfer, not return when category is others
    • gasUsed - gas used for external transfer, not return when category is others
    • receiptsStatus - receipt status, 1 is success,0 is failed

API Endpoint

The format of a MegaNode API endpoint is https://{chain}-{network}.nodereal.io/v1/{API-key}
Here is an example:

https://bsc-mainnet.nodereal.io/v1/4c0a1c23661a4e26bcbcwed461e34ea9

For other chains or networks, you could refer to this guidance Find API key & endpoint.

Example

Request

curl https://eth-mainnet.nodereal.io/v1/your-api-key \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"nr_getTransactionByAddress","params":[{"category": ["external","20"],"addressType": "from","address": "0xd7cdba6d6fa60a0aa9518dc0dacd0ad896cc02bd","order": "asc","excludeZeroValue": false,"maxCount": "0x5","fromBlock": "0x4","toBlock": "0x615856d7","pageKey": "qg000000-0075-RyKy-efk2-Fx9n32gAu432"}],"id":1}'

Result

{
  "id": "1",
  "jsonrpc": "2.0",
  "result": {
    "pageKey": "qh000000-0X5j-WSqq-mCLq-kPfWRH8B1GPS",
    "transfers": [
      {
        "category": "external",
        "blockNum": "0x6c92dd",
        "from": "0x646eafba97ec6ee7631887cdee468b323dd65d4f",
        "to": "0x8f07f7312f3ede8b0094f09ab1554c8d89f47ddf",
        "value": "0x0",
        "asset": "BNB",
        "hash": "0xf7605ce61c1855348cde8512d752265a8cbbf57e0ac4c8bc259155f8c1592838",
        "blockTimeStamp": 1620089457,
        "gasPrice": 5000000000,
        "gasUsed": 35813,
        "receiptsStatus": 1
      }
    ]
  }
}