Skip to content

API documentation

Casian Lacatusu edited this page Nov 5, 2019 · 5 revisions

Memento API

Memento makes the scraped data available through an internal API, by default accessible on port 3001 (e.g. http://localhost:3001/api/explorer)

Note: most of the fields follow the EthOn Ontology. If you don't know what a field means, search it there first.

The API is comprised of the following endpoints:

/block/[number]

Returns details about the block with the specified number including the list of transactions.

Input

  • block number - numeric format (example 1366167)
  • the string latest - returns the highest block stored in the db at the moment of interogation

Example output

{
   "data":{
      "number":1366167,
      "blockHash":"923448a9f427f1dbd084669b9d93c862b41230cc1ebe67119084849dd8567cca",
      "parentBlockHash":"64003d594cd4447fa0be0a3d2391832f118e57751c9f2a31377285a2f62b4221",
      "blockCreationTime":1569511060,
      "blockGasLimit":"8000000",
      "blockGasUsed":"391256",
      "blockDifficulty":"2",
      "totalBlockDifficulty":"2117728",
      "blockExtraData":"44505020417574686f726974790000000000000000000000000000000000000024a3ca164bd0e46423162d0047d24823182655d36a2ae7a01ccf4730f7475ba06d1ebff10e65aa578399e527c91918b2e1ff7d6dfdbb71ffd5d797fb0b653a8f01",
      "blockMixHash":"",
      "blockNonce":"",
      "blockSize":1430,
      "blockLogsBloom":"00004080000000000000000400000000000000000000002000000000000000000000000000000000000000000400000000000004004000000000000200000000000000000000008000000000000000080000000000000010400000000000000000000000000000000000000000000000100000400000000000000000000000000000000100000000000000000000000000000002000000000000000000000040000400000000000000000000000000000000000040000000001000000001000000000000100000040000002040000002080000000000000000000000000000000000410000000000080800000000000000800000000000000100000000000000",
      "includesUncle":null,
      "hasBeneficiary":"5dfe3772ceb73531357c3c747b6999cf59a59533",
      "hasReceiptsTrie":"e49804feedd0db7fd390e2068532c12a475ce2ad18caecac93ceda5295203a04",
      "hasTxTrie":"a2d34417c97ce4e4ec8a737ba39e92602d869ea97437ffe9b3f5fee3a5fbcb09",
      "sha3Uncles":"1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
      "numberOfUncles":0,
      "numberOfTxs":4,
      "txs":[
         {
            "txHash":"fc6b8ffc590c9a1e62f4841b9d9d968e732332f396b8cbeef23e8e20f30cdee2",
            "txIndex":0,
            "from":"d13e9b904c6e57ee929811f70db22cd308a56cf0",
            "to":"9526ec0e58ac5bb1e24d655e964f0eaa46054d16",
            "value":"0",
            "msgGasLimit":"127151",
            "txGasUsed":"97809",
            "txGasPrice":"30000000000"
         },
         {
            "txHash":"694ed6824748f9f9b90f2c996433a1f2202b812dcc6b2c2cc7f67bcc20e1fb66",
            "txIndex":1,
            "from":"f9572fe340ae7eba79e85d8e8fb2bed1317db729",
            "to":"9526ec0e58ac5bb1e24d655e964f0eaa46054d16",
            "value":"0",
            "msgGasLimit":"127151",
            "txGasUsed":"97809",
            "txGasPrice":"30000000000"
         },
         {
            "txHash":"5bb9129d1474132a382dab8fd9bab8ad2bbfa199dc43d04e394d7759cf354735",
            "txIndex":2,
            "from":"778ee4252b7e75380fad54caa30c0471568a4934",
            "to":"9526ec0e58ac5bb1e24d655e964f0eaa46054d16",
            "value":"0",
            "msgGasLimit":"127164",
            "txGasUsed":"97819",
            "txGasPrice":"30000000000"
         },
         {
            "txHash":"980895b385d793945a08d2053b34d81f22e2b3c57588bb0e2dba5e760d2aff8b",
            "txIndex":3,
            "from":"a2785a69945615b83e0f51e178f272bf19037bb6",
            "to":"9526ec0e58ac5bb1e24d655e964f0eaa46054d16",
            "value":"0",
            "msgGasLimit":"127164",
            "txGasUsed":"97819",
            "txGasPrice":"30000000000"
         }
      ]
   },
   "status":200
}

/block-range/[start]/[end]

Returns a list of blocks with a trimmed down list of attributes. Useful if you want to build a list of blocks.

Input

  • start - block number - must be numeric
  • end - block number - must be numeric

Example output

{
   "data":[
      {
         "blockCreationTime":1569511240,
         "hasBeneficiary":"0000000000000000000000000000000000000000",
         "number":1366179,
         "numberOfTxs":4
      },
      {
         "blockCreationTime":1569511225,
         "hasBeneficiary":"0000000000000000000000000000000000000000",
         "number":1366178,
         "numberOfTxs":1
      },
      {
         "blockCreationTime":1569511210,
         "hasBeneficiary":"0000000000000000000000000000000000000000",
         "number":1366177,
         "numberOfTxs":0
      },
      {
         "blockCreationTime":1569511195,
         "hasBeneficiary":"0000000000000000000000000000000000000000",
         "number":1366176,
         "numberOfTxs":0
      },
      {
         "blockCreationTime":1569511180,
         "hasBeneficiary":"0000000000000000000000000000000000000000",
         "number":1366175,
         "numberOfTxs":0
      },
   ],
   "status":200
}

/uncle/[hash]

Returns details about a specific uncle.

Input

  • hash - the uncle hash

Example output

{
   "data":{
      "number":1366167,
      "includedInBlock":1366167,
      "uncleIndex":0,
      "blockHash":"923448a9f427f1dbd084669b9d93c862b41230cc1ebe67119084849dd8567cca",
      "blockCreationTime":1569511060,
      "blockGasLimit":"8000000",
      "blockGasUsed":"391256",
      "blockDifficulty":"2",
      "blockExtraData":"44505020417574686f726974790000000000000000000000000000000000000024a3ca164bd0e46423162d0047d24823182655d36a2ae7a01ccf4730f7475ba06d1ebff10e65aa578399e527c91918b2e1ff7d6dfdbb71ffd5d797fb0b653a8f01",
      "blockMixHash":"",
      "blockNonce":"",
      "blockLogsBloom":"00004080000000000000000400000000000000000000002000000000000000000000000000000000000000000400000000000004004000000000000200000000000000000000008000000000000000080000000000000010400000000000000000000000000000000000000000000000100000400000000000000000000000000000000100000000000000000000000000000002000000000000000000000040000400000000000000000000000000000000000040000000001000000001000000000000100000040000002040000002080000000000000000000000000000000000410000000000080800000000000000800000000000000100000000000000",
      "hasBeneficiary":"5dfe3772ceb73531357c3c747b6999cf59a59533",
      "sha3Uncles":"1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
   },
   "status":200
}

/tx/[txHash]

Returns details about a transaction.

Input

  • txHash - the hash of the transaction

Example output

{
   "data":{
      "txHash":"fc6b8ffc590c9a1e62f4841b9d9d968e732332f396b8cbeef23e8e20f30cdee2",
      "includedInBlock":1366167,
      "txIndex":0,
      "from":"d13e9b904c6e57ee929811f70db22cd308a56cf0",
      "to":"9526ec0e58ac5bb1e24d655e964f0eaa46054d16",
      "value":"0",
      "txNonce":0,
      "msgGasLimit":"127151",
      "txGasUsed":"97809",
      "txGasPrice":"30000000000",
      "cumulativeGasUsed":"97809",
      "msgPayload":"0a798f24000000000000000000000000d13e9b904c6e57ee929811f70db22cd308a56cf0000000000000000000000000a2785a69945615b83e0f51e178f272bf19037bb600000000000000000000000000000000000000000000000000000000000001f4",
      "msgStatus":"0x1",
      "creates":"",
      "txLogsBloom":"00004080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000080000000000000010000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000040000000001000000000000000000000100000000000002040000002000000000000000000000000000000000000010000000000000800000000000000000000000000000000000000000000",
      "blockCreationTime":1569511060,
      "logEntriesTriggered":1
   },
   "status":200
}

/tx/[txHash]/log-entries

Returns details about the log entries of a transaction.

Input

  • txHash - the hash of the transaction

Example output

{
   "data":[
      {
         "txHash":"5bb9129d1474132a382dab8fd9bab8ad2bbfa199dc43d04e394d7759cf354735",
         "logIndex":0,
         "logData":"00000000000000000000000000000000000000000000000000000000000001f4",
         "loggedBy":"9526ec0e58ac5bb1e24d655e964f0eaa46054d16",
         "hasLogTopics":[
            "669a4b0ac0b9994c0f82ed4dbe07bb421fe74e5951725af4f139c7443ebf049d",
            "000000000000000000000000000000000000000000000000000000000000001f",
            "000000000000000000000000778ee4252b7e75380fad54caa30c0471568a4934",
            "000000000000000000000000d13e9b904c6e57ee929811f70db22cd308a56cf0"
         ],
         "eventDecoded":{
            "event":"",
            "inputs":[
               {
                  "indexed":true,
                  "name":"topic1",
                  "type":"raw",
                  "value":"000000000000000000000000000000000000000000000000000000000000001f"
               },
               {
                  "indexed":true,
                  "name":"topic2",
                  "type":"raw",
                  "value":"000000000000000000000000778ee4252b7e75380fad54caa30c0471568a4934"
               },
               {
                  "indexed":true,
                  "name":"topic3",
                  "type":"raw",
                  "value":"000000000000000000000000d13e9b904c6e57ee929811f70db22cd308a56cf0"
               },
               {
                  "name":"data0",
                  "type":"raw",
                  "value":"00000000000000000000000000000000000000000000000000000000000001f4"
               }
            ],
            "topic0":"0x669a4b0ac0b9994c0f82ed4dbe07bb421fe74e5951725af4f139c7443ebf049d"
         },
         "eventDecodedError":""
      }
   ],
   "status":200
}

/account/[address]/txs

Returns a list containing all the txs of an account.

Input

  • address - the address of the account

Pagination

Use the following query parameters for pagination:

  • includedInBlock + txIndex - used as cursor; api will return all txs for this account that are either in the same block but have a smaller txIndex or in older blocks.
  • limit - the maximum number of txs to return

Example call

curl http://localhost:3001/api/explorer/account/[address]/txs?includedInBlock=1340000&txIndex=15&limit=10

Example output

{
   "data":[
      {
         "txHash":"9297079dd6dad3025ef7e2f2fdb69d7642391455b19b2ff5059fcb53faf361fc",
         "includedInBlock":1366204,
         "txIndex":3,
         "from":"d13e9b904c6e57ee929811f70db22cd308a56cf0",
         "to":"9526ec0e58ac5bb1e24d655e964f0eaa46054d16",
         "value":"0",
         "txGasUsed":"60037",
         "txGasPrice":"30000000000",
         "blockCreationTime":1569511615
      },
      {
         "txHash":"73c6e382c0b2351721d5311913d0b0635934c618c520fd2900cc255544c5b971",
         "includedInBlock":1366197,
         "txIndex":0,
         "from":"d13e9b904c6e57ee929811f70db22cd308a56cf0",
         "to":"62083c80353df771426d209ef578619ee68d5c7a",
         "value":"0",
         "txGasUsed":"45419",
         "txGasPrice":"30000000000",
         "blockCreationTime":1569511510
      },
      {
         "txHash":"688b547abb156adde0295e671a756a6286c3800d271d93413fd302121ef02a01",
         "includedInBlock":1366179,
         "txIndex":3,
         "from":"d13e9b904c6e57ee929811f70db22cd308a56cf0",
         "to":"9526ec0e58ac5bb1e24d655e964f0eaa46054d16",
         "value":"0",
         "txGasUsed":"60037",
         "txGasPrice":"30000000000",
         "blockCreationTime":1569511240
      }
   ],
   "status":200
}