eth_accounts

Returns a list of addresses owned by client.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}'

RESPONSE

RESULT FIELDS

  • ADDRESSES - arrays of hex codes as strings representing the addresses owned by the client

NOTE: While this JSON-RPC method is supported by CradleGate, it will not return any accounts. CradleGate does not support "unlocking" accounts. Instead, users should send already signed raw transactions using eth_sendRawTransaction.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": []
}

eth_blockNumber

Returns the current "latest" block number.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params": [],"id":1}'

RESPONSE

RESULT FIELDS

  • BLOCK NUMBER - a hex code of an integer representing the current block number the client is on.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x65a8db"
}

eth_call

Executes a new message call immediately without creating a transaction on the block chain.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PAYLOAD

  • TRANSACTION CALL OBJECT [required]
    • from: [optional] 20 Bytes - The address the transaction is sent from.
    • to: 20 Bytes - The address the transaction is directed to.
    • gas: [optional] Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.
    • gasPrice: [optional] Integer of the gasPrice used for each paid gas
    • value: [optional] Integer of the value sent with this transaction
    • data: [optional] Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI
  • BLOCK PARAMETER [required] - an integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_call","params": [{"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155","to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas": "0x76c0","gasPrice": "0x9184e72a000","value": "0x9184e72a","data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}, "latest"],"id":1}'

RESPONSE

RESULT FIELDS

  • RETURN VALUE - the return value of the executed contract method.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x"
}

eth_estimateGas

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PAYLOAD

  • TRANSACTION CALL OBJECT [required]
    • from: [optional] 20 Bytes - The address the transaction is sent from.
    • to: 20 Bytes - The address the transaction is directed to.
    • gas: [optional] Integer of the gas provided for the transaction execution. eth_estimateGas consumes zero gas, but this parameter may be needed by some executions.
    • gasPrice: [optional] Integer of the gasPrice used for each paid gas
    • value: [optional] Integer of the value sent with this transaction
    • data: [optional] Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI

If no gas limit is specified geth uses the block gas limit from the pending block as an upper bound. As a result the returned estimate might not be enough to executed the call/transaction when the amount of gas is higher than the pending block gas limit.

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_estimateGas","params": [{"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155","to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas": "0x76c0","gasPrice": "0x9184e72a000","value": "0x9184e72a","data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}],"id":1}'

RESPONSE

RESULT FIELDS

  • GAS USED - the amount of gas used.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x5cec"
}

eth_gasPrice

Returns the current gas price in wei.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your  Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_gasPrice","params": [],"id":1}'

RESPONSE

RESULT FIELDS

  • GAS PRICE - a hex code of an integer representing the current gas price in wei.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x12a05f200"
}

eth_getBalance

Returns the balance of the account of given address.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • ADDRESS [required] - a string representing the address (20 bytes) to check for balance

  • BLOCK PARAMETER [required] - an integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getBalance","params": ["0xc94770007dda54cF92009BFF0dE90c06F603a09f", "latest"],"id":1}'

RESPONSE

RESULT FIELDS

  • BALANCE - integer of the current balance in wei.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x2fe84e3113d7b"
}

eth_getBlockByHash

Returns information about a block by hash.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • BLOCK HASH [required] - a string representing the hash (32 bytes) of a block
  • SHOW TRANSACTION DETAILS FLAG [required] - if set to true, it returns the full transaction objects, if false only the hashes of the transactions.

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getBlockByHash","params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",false],"id":1}'

RESPONSE

RESULT FIELDS

  • BLOCK - A block object, or null when no block was found
    • number: the block number. Null when the returned block is the pending block.
    • hash: 32 Bytes - hash of the block. Null when the returned block is the pending block.
    • parentHash: 32 Bytes - hash of the parent block.
    • nonce: 8 Bytes - hash of the generated proof-of-work. Null when the returned block is the pending block.
    • sha3Uncles: 32 Bytes - SHA3 of the uncles data in the block.
    • logsBloom: 256 Bytes - the bloom filter for the logs of the block. Null when the returned block is the pending block.
    • transactionsRoot: 32 Bytes - the root of the transaction trie of the block.
    • stateRoot: 32 Bytes - the root of the final state trie of the block.
    • receiptsRoot: 32 Bytes - the root of the receipts trie of the block.
    • miner: 20 Bytes - the address of the beneficiary to whom the mining rewards were given.
    • difficulty: integer of the difficulty for this block.
    • totalDifficulty: integer of the total difficulty of the chain until this block.
    • extraData: the "extra data" field of this block.
    • size: integer the size of this block in bytes.
    • gasLimit: the maximum gas allowed in this block.
    • gasUsed: the total used gas by all transactions in this block.
    • timestamp: the unix timestamp for when the block was collated.
    • transactions: Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.
    • uncles: an Array of uncle hashes.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "difficulty": "0xbfabcdbd93dda",
    "extraData": "0x737061726b706f6f6c2d636e2d6e6f64652d3132",
    "gasLimit": "0x79f39e",
    "gasUsed": "0x79ccd3",
    "hash": "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
    "logsBloom": "0x4848112002a2020aaa0812180045840210020005281600c80104264300080008000491220144461026015300100000128005018401002090a824a4150015410020140400d808440106689b29d0280b1005200007480ca950b15b010908814e01911000054202a020b05880b914642a0000300003010044044082075290283516be82504082003008c4d8d14462a8800c2990c88002a030140180036c220205201860402001014040180002006860810ec0a1100a14144148408118608200060461821802c081000042d0810104a8004510020211c088200420822a082040e10104c00d010064004c122692020c408a1aa2348020445403814002c800888208b1",
    "miner": "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c",
    "mixHash": "0x3d1fdd16f15aeab72e7db1013b9f034ee33641d92f71c0736beab4e67d34c7a7",
    "nonce": "0x4db7a1c01d8a8072",
    "number": "0x5bad55",
    "parentHash": "0x61a8ad530a8a43e3583f8ec163f773ad370329b2375d66433eb82f005e1d6202",
    "receiptsRoot": "0x5eced534b3d84d3d732ddbc714f5fd51d98a941b28182b6efe6df3a0fe90004b",
    "sha3Uncles": "0x8a562e7634774d3e3a36698ac4915e37fc84a2cd0044cb84fa5d80263d2af4f6",
    "size": "0x41c7",
    "stateRoot": "0xf5208fffa2ba5a3f3a2f64ebd5ca3d098978bedd75f335f56b705d8715ee2305",
    "timestamp": "0x5b541449",
    "totalDifficulty": "0x12ac11391a2f3872fcd",
    "transactions": [
      "0x8784d99762bccd03b2086eabccee0d77f14d05463281e121a62abfebcf0d2d5f",
      "0x311be6a9b58748717ac0f70eb801d29973661aaf1365960d159e4ec4f4aa2d7f",
      "0xe42b0256058b7cad8a14b136a0364acda0b4c36f5b02dea7e69bfd82cef252a2",
      "0x4eb05376055c6456ed883fc843bc43df1dcf739c321ba431d518aecd7f98ca11",
      "0x994dd9e72b212b7dc5fd0466ab75adf7d391cf4f206a65b7ad2a1fd032bb06d7",
      "0xf6feecbb9ab0ac58591a4bc287059b1133089c499517e91a274e6a1f5e7dce53",
      "0x7e537d687a5525259480440c6ea2e1a8469cd98906eaff8597f3d2a44422ff97",
      "0xa762220e92bed6d77a2c19ffc60dad77d71bd5028c5230c896ab4b9552a39b50",
      "0xf1fa677edda7e5add8e794732c7554cd5459a5c12781dc71de73c7937dfb2775",
      "0x3220af8e317fde6dac80b1199f9ceeafe60ada4974a7e04a75fbce1ac4cb46c3",
      "0x5566528978250828168f0d30bcc8a3689d129c75d820d604f7eb84c25b34ec81",
      "0x646c98e323a05862778f0c9063a989b6aefd94f28842a3a09d2edb37a050717d",
      "0xe951ea55764f7e8e0720f7042dd1db67525965302ed974a0c8e3b769bc1818e3",
      "0x7ecf2528b7df3831712501f5c60ef156bf5fcac9912199e0a64afcb963ea91ca",
      "0xc43b89783f68b2844918ea515cc146c006e5f162c9be9aedf5e7a6ae1f32e164",
      "0xd74503ede63d6fd41367796433aa14439902e8f57293a0583e19aa6ebf3f128e",
      "0x241d89f7888fbcfadfd415ee967882fec6fdd67c07ca8a00f2ca4c910a84c7dd"
    ],
    "transactionsRoot": "0xf98631e290e88f58a46b7032f025969039aa9b5696498efc76baf436fa69b262",
    "uncles": [
      "0x824cce7c7c2ec6874b9fa9a9a898eb5f27cbaf3991dfa81084c3af60d1db618c"
    ]
  }
}

eth_getBlockByNumber

Returns information about a block by hash.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • BLOCK PARAMETER [required] - an integer block number, or the string "latest", "earliest" or "pending", see the default block parameter
  • SHOW TRANSACTION DETAILS FLAG [required] - if set to true, it returns the full transaction objects, if false only the hashes of the transactions.

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params": ["0x5BAD55",false],"id":1}'

RESPONSE

RESULT FIELDS

  • BLOCK - A block object, or null when no block was found
    • number: the block number. Null when the returned block is the pending block.
    • hash: 32 Bytes - hash of the block. Null when the returned block is the pending block.
    • parentHash: 32 Bytes - hash of the parent block.
    • nonce: 8 Bytes - hash of the generated proof-of-work. Null when the returned block is the pending block.
    • sha3Uncles: 32 Bytes - SHA3 of the uncles data in the block.
    • logsBloom: 256 Bytes - the bloom filter for the logs of the block. Null when the returned block is the pending block.
    • transactionsRoot: 32 Bytes - the root of the transaction trie of the block.
    • stateRoot: 32 Bytes - the root of the final state trie of the block.
    • receiptsRoot: 32 Bytes - the root of the receipts trie of the block.
    • miner: 20 Bytes - the address of the beneficiary to whom the mining rewards were given.
    • difficulty: integer of the difficulty for this block.
    • totalDifficulty: integer of the total difficulty of the chain until this block.
    • extraData: the "extra data" field of this block.
    • size: integer the size of this block in bytes.
    • gasLimit: the maximum gas allowed in this block.
    • gasUsed: the total used gas by all transactions in this block.
    • timestamp: the unix timestamp for when the block was collated.
    • transactions: Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.
    • uncles: an Array of uncle hashes.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "difficulty": "0xbfabcdbd93dda",
    "extraData": "0x737061726b706f6f6c2d636e2d6e6f64652d3132",
    "gasLimit": "0x79f39e",
    "gasUsed": "0x79ccd3",
    "hash": "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
    "logsBloom": "0x4848112002a2020aaa0812180045840210020005281600c80104264300080008000491220144461026015300100000128005018401002090a824a4150015410020140400d808440106689b29d0280b1005200007480ca950b15b010908814e01911000054202a020b05880b914642a0000300003010044044082075290283516be82504082003008c4d8d14462a8800c2990c88002a030140180036c220205201860402001014040180002006860810ec0a1100a14144148408118608200060461821802c081000042d0810104a8004510020211c088200420822a082040e10104c00d010064004c122692020c408a1aa2348020445403814002c800888208b1",
    "miner": "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c",
    "mixHash": "0x3d1fdd16f15aeab72e7db1013b9f034ee33641d92f71c0736beab4e67d34c7a7",
    "nonce": "0x4db7a1c01d8a8072",
    "number": "0x5bad55",
    "parentHash": "0x61a8ad530a8a43e3583f8ec163f773ad370329b2375d66433eb82f005e1d6202",
    "receiptsRoot": "0x5eced534b3d84d3d732ddbc714f5fd51d98a941b28182b6efe6df3a0fe90004b",
    "sha3Uncles": "0x8a562e7634774d3e3a36698ac4915e37fc84a2cd0044cb84fa5d80263d2af4f6",
    "size": "0x41c7",
    "stateRoot": "0xf5208fffa2ba5a3f3a2f64ebd5ca3d098978bedd75f335f56b705d8715ee2305",
    "timestamp": "0x5b541449",
    "totalDifficulty": "0x12ac11391a2f3872fcd",
    "transactions": [
      "0x8784d99762bccd03b2086eabccee0d77f14d05463281e121a62abfebcf0d2d5f",
      "0x311be6a9b58748717ac0f70eb801d29973661aaf1365960d159e4ec4f4aa2d7f",
      "0xe42b0256058b7cad8a14b136a0364acda0b4c36f5b02dea7e69bfd82cef252a2",
      "0x4eb05376055c6456ed883fc843bc43df1dcf739c321ba431d518aecd7f98ca11",
      "0x994dd9e72b212b7dc5fd0466ab75adf7d391cf4f206a65b7ad2a1fd032bb06d7",
      "0xf6feecbb9ab0ac58591a4bc287059b1133089c499517e91a274e6a1f5e7dce53",
      "0x7e537d687a5525259480440c6ea2e1a8469cd98906eaff8597f3d2a44422ff97",
      "0xa762220e92bed6d77a2c19ffc60dad77d71bd5028c5230c896ab4b9552a39b50",
      "0xf1fa677edda7e5add8e794732c7554cd5459a5c12781dc71de73c7937dfb2775",
      "0x3220af8e317fde6dac80b1199f9ceeafe60ada4974a7e04a75fbce1ac4cb46c3",
      "0x5566528978250828168f0d30bcc8a3689d129c75d820d604f7eb84c25b34ec81",
      "0x646c98e323a05862778f0c9063a989b6aefd94f28842a3a09d2edb37a050717d",
      "0xe951ea55764f7e8e0720f7042dd1db67525965302ed974a0c8e3b769bc1818e3",
      "0x7ecf2528b7df3831712501f5c60ef156bf5fcac9912199e0a64afcb963ea91ca",
      "0xc43b89783f68b2844918ea515cc146c006e5f162c9be9aedf5e7a6ae1f32e164",
      "0xd74503ede63d6fd41367796433aa14439902e8f57293a0583e19aa6ebf3f128e",
      "0x021e5b7d3ddac97b4c6cb9c3f333766a533c1ed9fbcfb8b2515c38ecd0c53f89",
      "0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0",
      "0x25f65866dba34783200c25fb1c120b36326c9ad3a47e8bc34c3edbc9208f1378",
      "0x5336f5c4132ef00e8b469ecfd4ee0d6800f6bd60aefb1c62232cbce81c085ae2",
      "0xb87410cfe0a75c004f7637736b3de1e8f4e08e9e2b05ab963622a40a5505664d",
      "0x990857a27ec7cfd6dfd88015173adf81959b5abaff6eefbe8e9df6b0f40f2711",
      "0x3563ccb5734b7b5015122a20b558723afe992ff1109a04b57e02f26edd5a6a38",
      "0xd7885d9412cc494fbe680b016bf7402b633c34c66833b35cad59af2a4aff4f0b",
      "0x48e60927d6fb9ae76f69a6400490b5ffcb2f9da3105fad6c61f21256ef0c217c",
      "0x9e30af26ff3836c4b55af62ba134bc55db662cf1d396cca437d12a8195bfcbe4",
      "0x2476eeede4764c6871f50f3235ebeb9a56d33b41bc3bb1ce3c18c5d710a0609c",
      "0x1cd3520fbb1eb6f2f6f257ab7c3cba957806b0b87182baedb4f81c62868064c1",
      "0x78ae3aee0ff16d8ea4f394b7b80021804e1d9f35cdbb9c6189bb6cbf58bc52c4",
      "0xe2989560000a1fc7c434c5e9c4bba82e1501bf435292ac25acc3cb182c1c2cd0",
      "0x348cfc85c58b7f3b2e8bdaa517dc8e3c5f8fb41e3ba235f28892b46bc3484756",
      "0x4ac009cebc1f2416b9e39bcc5b41cd53b1a9239e8f6c0ab043b8830ef1ffc563",
      "0xf2a96682362b9ffe9a77190bcbc47937743b6e1da2c56257f9b562f15bbd3cfa",
      "0xf1cd627c97746bc75727c2f0efa2d0dc66cca1b36d8e45d897e18a9b19af2f60",
      "0x241d89f7888fbcfadfd415ee967882fec6fdd67c07ca8a00f2ca4c910a84c7dd"
    ],
    "transactionsRoot": "0xf98631e290e88f58a46b7032f025969039aa9b5696498efc76baf436fa69b262",
    "uncles": [
      "0x824cce7c7c2ec6874b9fa9a9a898eb5f27cbaf3991dfa81084c3af60d1db618c"
    ]
  }
}

eth_getBlockTransactionCountByHash

Returns the number of transactions in the block with the given block hash.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • BLOCK HASH [required] - a string representing the hash (32 bytes) of a block

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByHash","params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35"],"id":1}'

RESPONSE

RESULT FIELDS

  • BLOCK TRANSACTION COUNT - a hex code of the integer representing the number of transactions in the provided block

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x50"
}

eth_getBlockTransactionCountByNumber

Returns the number of transactions in the block with the given block number.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • BLOCK PARAMETER [required] - an integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params": ["latest"],"id":1}'

RESPONSE

RESULT FIELDS

  • BLOCK TRANSACTION COUNT - a hex code of the integer representing the number of transactions in the provided block

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x9"
}

eth_getCode

Returns the compiled smart contract code, if any, at a given address.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • ADDRESS [required] - a string representing the address (20 bytes) of the code
  • BLOCK PARAMETER [required] - an integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getCode","params": ["0x06012c8cf97bead5deae237070f9587f8e7a266d", "0x65a8db"],"id":1}'

RESPONSE

RESULT FIELDS

  • CODE - a hex of the code at the given address

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x60606040..."
}

eth_getLogs

Returns an array of all logs matching a given filter object.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • FILTER OBJECT
    • address [optional] - a string representing the address (20 bytes) to check for balance
    • fromBlock [optional, default is "earliest"] - an integer block number, or the string "latest", "earliest" or "pending"
    • toBlock [optional, default is "latest"] - an integer block number, or the string "latest", "earliest" or "pending"
    • topics[optional] - Array of 32 Bytes DATA topics. Topics are order-dependent.
    • blockhash:[optional] With the addition of EIP-234, blockHash restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent to fromBlock = toBlock = the block number with hash blockHash. If blockHash is present in in the filter criteria, then neither fromBlock nor toBlock are allowed.

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"blockHash": "0x7c5a35e9cb3e8ae0e221ab470abae9d446c3a5626ce6689fc777dcffcab52c70", "topics":["0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80"]}],"id":1}'

RESPONSE

RESULT FIELDS

  • LOG OBJECTS - An array of log objects, or an empty array if nothing has changed since last poll.

    • For filters created with eth_newBlockFilter the return are block hashes of 32 Bytes), e.g. ["0x3454645634534..."]
    • For filters created with eth_newPendingTransactionFilter the return are transaction hashes of 32 Bytes), e.g. ["0x6345343454645..."].
    • For filters created with eth_newFilter logs are objects with following params:
      • removed: true when the log was removed, due to a chain reorganization. false if it's a valid log.
      • logIndex: integer of the log index position in the block. null when its pending log.
      • transactionIndex: integer of the transactions index position log was created from. null when its pending log.
      • transactionHash: 32 Bytes - hash of the transactions this log was created from. null when its pending log.
      • blockHash: 32 Bytes - hash of the block where this log was in. null when its pending. null when its pending log.
      • blockNumber: the block number where this log was in. null when its pending. null when its pending log.
      • address: 20 Bytes - address from which this log originated.
      • data: contains one or more 32 Bytes non-indexed arguments of the log.
      • topics: Array of 0 to 4 32 Bytes of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "address": "0x1a94fce7ef36bc90959e206ba569a12afbc91ca1",
      "blockHash": "0x7c5a35e9cb3e8ae0e221ab470abae9d446c3a5626ce6689fc777dcffcab52c70",
      "blockNumber": "0x5c29fb",
      "data": "0x0000000000000000000000003e3310720058c51f0de456e273c626cdd35065700000000000000000000000000000000000000000000000000000000000003185000000000000000000000000000000000000000000000000000000000000318200000000000000000000000000000000000000000000000000000000005c2a23",
      "logIndex": "0x1d",
      "removed": false,
      "topics": [
        "0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80"
      ],
      "transactionHash": "0x3dc91b98249fa9f2c5c37486a2427a3a7825be240c1c84961dfb3063d9c04d50",
      "transactionIndex": "0x1d"
    },
    {
      "address": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
      "blockHash": "0x7c5a35e9cb3e8ae0e221ab470abae9d446c3a5626ce6689fc777dcffcab52c70",
      "blockNumber": "0x5c29fb",
      "data": "0x00000000000000000000000077ea137625739598666ded665953d26b3d8e374400000000000000000000000000000000000000000000000000000000000749ff00000000000000000000000000000000000000000000000000000000000a749d00000000000000000000000000000000000000000000000000000000005c2a0f",
      "logIndex": "0x57",
      "removed": false,
      "topics": [
        "0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80"
      ],
      "transactionHash": "0x788b1442414cb9c9a36dba2abe250763161a6f6395788a2e808f1b34e92beec1",
      "transactionIndex": "0x54"
    }
  ]
}

eth_getStorageAt

Returns the value from a storage position at a given address.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • ADDRESS [required] - a string representing the address (20 bytes) of the storage
  • STORAGE POSITION [required] - a hex code of the position in the storage
  • BLOCK PARAMETER [required] - an integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getStorageAt","params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9", "0x65a8db"],"id":1}'

RESPONSE

RESULT FIELDS

  • STORAGE VALUE - a hex code of the integer indicating the value of the storage position at the provided address

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x0000000000000000000000000000000000000000000000000000000000000000"
}

Calculating the correct position depends on the storage to retrieve. Consider the following contract deployed at 0x295a70b2de5e3953354a6a8344e616ed314d7251 by address 0x391694e7e0b0cce554cb130d723a9d27458f9298,

contract Storage {
    uint pos0;
    mapping(address => uint) pos1;

    function Storage() {
        pos0 = 1234;
        pos1[msg.sender] = 5678;
    }
}

Retrieving the value of pos0 is straight forward:

curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0", "method": "eth_getStorageAt", "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x0", "0x65a8db"], "id": 1}'
{
    "jsonrpc":"2.0",
    "id":1,
    "result":"0x00000000000000000000000000000000000000000000000000000000000004d2"
}

Retrieving an element of the map is harder. The position of an element in the map is calculated with:

keccak(LeftPad32(key, 0), LeftPad32(map position, 0))

This means to retrieve the storage on pos1["0x391694e7e0b0cce554cb130d723a9d27458f9298"] we need to calculate the position with:

keccak(decodeHex("000000000000000000000000391694e7e0b0cce554cb130d723a9d27458f9298" + "0000000000000000000000000000000000000000000000000000000000000001"))

The geth console which comes with the web3 library can be used to make the calculation:

> var key = "000000000000000000000000391694e7e0b0cce554cb130d723a9d27458f9298" + "0000000000000000000000000000000000000000000000000000000000000001"
undefined
> web3.sha3(key, {"encoding": "hex"})
"0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9"

Now to fetch the storage:

curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0", "method": "eth_getStorageAt", "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9", "0x65a8db"], "id": 1}'
{
    "jsonrpc":"2.0",
    "id":1,
    "result":"0x000000000000000000000000000000000000000000000000000000000000162e"
}

eth_getTransactionByBlockHashAndIndex

Returns information about a transaction by block hash and transaction index position.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • BLOCK HASH [required] - a string representing the hash (32 bytes) of a block
  • TRANSACTION INDEX POSITION [required] - a hex of the integer representing the position in the block

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockHashAndIndex","params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35","0x0"],"id":1}'

RESPONSE

RESULT FIELDS

  • TRANSACTION - A transaction object, or null when no transaction was found
    • hash: 32 Bytes - hash of the transaction.
    • nonce: the number of transactions made by the sender prior to this one.
    • blockHash: 32 Bytes - hash of the block where this transaction was in. null when its pending.
    • blockNumber: block number where this transaction was in. null when its pending.
    • transactionIndex: integer of the transactions index position in the block. null when its pending.
    • from: 20 Bytes - address of the sender.
    • to: 20 Bytes - address of the receiver. null when its a contract creation transaction.
    • value: value transferred in Wei.
    • gasPrice: gas price provided by the sender in Wei.
    • gas: gas provided by the sender.
    • input: the data send along with the transaction.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockHash": "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
    "blockNumber": "0x5bad55",
    "from": "0xfbb1b73c4f0bda4f67dca266ce6ef42f520fbb98",
    "gas": "0x249f0",
    "gasPrice": "0x174876e800",
    "hash": "0x8784d99762bccd03b2086eabccee0d77f14d05463281e121a62abfebcf0d2d5f",
    "input": "0x6ea056a9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bd8d7fa6f8cc00",
    "nonce": "0x5e4724",
    "r": "0xd1556332df97e3bd911068651cfad6f975a30381f4ff3a55df7ab3512c78b9ec",
    "s": "0x66b51cbb10cd1b2a09aaff137d9f6d4255bf73cb7702b666ebd5af502ffa4410",
    "to": "0x4b9c25ca0224aef6a7522cabdbc3b2e125b7ca50",
    "transactionIndex": "0x0",
    "v": "0x25",
    "value": "0x0"
  }
}

eth_getTransactionByBlockNumberAndIndex

Returns information about a transaction by block number and transaction index position.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • BLOCK PARAMETER [required] - an integer block number, or the string "latest", "earliest" or "pending", see the default block parameter
  • TRANSACTION INDEX POSITION [required] - a hex of the integer representing the position in the block

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params": ["0x5BAD55","0x0"],"id":1}'

RESPONSE

RESULT FIELDS

  • TRANSACTION - A transaction object, or null when no transaction was found
    • hash: 32 Bytes - hash of the transaction.
    • nonce: the number of transactions made by the sender prior to this one.
    • blockHash: 32 Bytes - hash of the block where this transaction was in. null when its pending.
    • blockNumber: block number where this transaction was in. null when its pending.
    • transactionIndex: integer of the transactions index position in the block. null when its pending.
    • from: 20 Bytes - address of the sender.
    • to: 20 Bytes - address of the receiver. null when its a contract creation transaction.
    • value: value transferred in Wei.
    • gasPrice: gas price provided by the sender in Wei.
    • gas: gas provided by the sender.
    • input: the data send along with the transaction.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockHash": "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
    "blockNumber": "0x5bad55",
    "from": "0xfbb1b73c4f0bda4f67dca266ce6ef42f520fbb98",
    "gas": "0x249f0",
    "gasPrice": "0x174876e800",
    "hash": "0x8784d99762bccd03b2086eabccee0d77f14d05463281e121a62abfebcf0d2d5f",
    "input": "0x6ea056a9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bd8d7fa6f8cc00",
    "nonce": "0x5e4724",
    "r": "0xd1556332df97e3bd911068651cfad6f975a30381f4ff3a55df7ab3512c78b9ec",
    "s": "0x66b51cbb10cd1b2a09aaff137d9f6d4255bf73cb7702b666ebd5af502ffa4410",
    "to": "0x4b9c25ca0224aef6a7522cabdbc3b2e125b7ca50",
    "transactionIndex": "0x0",
    "v": "0x25",
    "value": "0x0"
  }
}

eth_getTransactionByHash

Returns information about a transaction for a given hash.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • TRANSACTION HASH [required] - a string representing the hash (32 bytes) of a transaction

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params": ["0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0"],"id":1}'

RESPONSE

RESULT FIELDS

  • TRANSACTION - A transaction object, or null when no transaction was found
    • hash: 32 Bytes - hash of the transaction.
    • nonce: the number of transactions made by the sender prior to this one.
    • blockHash: 32 Bytes - hash of the block where this transaction was in. null when its pending.
    • blockNumber: block number where this transaction was in. null when its pending.
    • transactionIndex: integer of the transactions index position in the block. null when its pending.
    • from: 20 Bytes - address of the sender.
    • to: 20 Bytes - address of the receiver. null when its a contract creation transaction.
    • value: value transferred in Wei.
    • gasPrice: gas price provided by the sender in Wei.
    • gas: gas provided by the sender.
    • input: the data send along with the transaction.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockHash": "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
    "blockNumber": "0x5bad55",
    "from": "0x398137383b3d25c92898c656696e41950e47316b",
    "gas": "0x1d45e",
    "gasPrice": "0xfa56ea00",
    "hash": "0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0",
    "input": "0xf7d8c88300000000000000000000000000000000000000000000000000000000000cee6100000000000000000000000000000000000000000000000000000000000ac3e1",
    "nonce": "0x18",
    "r": "0x2a378831cf81d99a3f06a18ae1b6ca366817ab4d88a70053c41d7a8f0368e031",
    "s": "0x450d831a05b6e418724436c05c155e0a1b7b921015d0fbc2f667aed709ac4fb5",
    "to": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
    "transactionIndex": "0x11",
    "v": "0x25",
    "value": "0x1c6bf526340000"
  }
}

eth_getTransactionCount

Returns the number of transactions sent from an address.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • ADDRESS [required] - a string representing the address (20 bytes) to check for transaction count for
  • BLOCK PARAMETER [required] - an integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params": ["0xc94770007dda54cF92009BFF0dE90c06F603a09f","0x5bad55"],"id":1}'

RESPONSE

RESULT FIELDS

  • TRANSACTION COUNT - a hex code of the integer representing the number of transactions sent from this address.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x1a"
}

eth_getTransactionReceipt

Returns the receipt of a transaction by transaction hash. Note that the receipt is not available for pending transactions.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • TRANSACTION HASH [required] - a string representing the hash (32 bytes) of a transaction

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params": ["0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0"],"id":1}'

RESPONSE

RESULT FIELDS

  • TRANSACTION RECEIPT - A transaction receipt object, or null when no receipt was found:
    • transactionHash: 32 Bytes - hash of the transaction.
    • transactionIndex: integer of the transactions index position in the block.
    • blockHash: 32 Bytes - hash of the block where this transaction was in.
    • blockNumber: block number where this transaction was in.
    • from: 20 Bytes - address of the sender.
    • to: 20 Bytes - address of the receiver. Null when the transaction is a contract creation transaction.
    • cumulativeGasUsed: the total amount of gas used when this transaction was executed in the block.
    • gasUsed: the amount of gas used by this specific transaction alone.
    • contractAddress: 20 Bytes - the contract address created, if the transaction was a contract creation, otherwise - null.
    • logs: Array - Array of log objects, which this transaction generated.
    • logsBloom: 256 Bytes - Bloom filter for light clients to quickly retrieve related logs.

It also returns either: - root : 32 bytes of post-transaction stateroot (pre Byzantium) - status: either 1 (success) or 0 (failure)

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockHash": "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
    "blockNumber": "0x5bad55",
    "contractAddress": null,
    "cumulativeGasUsed": "0xb90b0",
    "from": "0x398137383b3d25c92898c656696e41950e47316b",
    "gasUsed": "0x1383f",
    "logs": [
      {
        "address": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
        "blockHash": "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
        "blockNumber": "0x5bad55",
        "data": "0x000000000000000000000000398137383b3d25c92898c656696e41950e47316b00000000000000000000000000000000000000000000000000000000000cee6100000000000000000000000000000000000000000000000000000000000ac3e100000000000000000000000000000000000000000000000000000000005baf35",
        "logIndex": "0x6",
        "removed": false,
        "topics": [
          "0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80"
        ],
        "transactionHash": "0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0",
        "transactionIndex": "0x11"
      }
    ],
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000200000000000000000000000000000",
    "status": "0x1",
    "to": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
    "transactionHash": "0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0",
    "transactionIndex": "0x11"
  }
}

eth_getUncleByBlockHashAndIndex

Returns information about the 'Uncle' of a block by hash and the Uncle index position.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • BLOCK HASH [required] - a string representing the hash (32 bytes) of a block
  • UNCLE INDEX POSITION [required] - a hex of the integer indicating the uncle's index position.

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getUncleByBlockHashAndIndex","params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35","0x0"],"id":1}'

RESPONSE

RESULT FIELDS

  • BLOCK - A block object, or null when no block was found
    • number: the block number. Null when the returned block is the pending block.
    • hash: 32 Bytes - hash of the block. null when its pending block.
    • parentHash: 32 Bytes - hash of the parent block.
    • nonce: 8 Bytes - hash of the generated proof-of-work. Null when the returned block is the pending block.
    • sha3Uncles: 32 Bytes - SHA3 of the uncles data in the block.
    • logsBloom: 256 Bytes - the bloom filter for the logs of the block. Null when the returned block is the pending block.
    • transactionsRoot: 32 Bytes - the root of the transaction trie of the block.
    • stateRoot: 32 Bytes - the root of the final state trie of the block.
    • receiptsRoot: 32 Bytes - the root of the receipts trie of the block.
    • miner: 20 Bytes - the address of the beneficiary to whom the mining rewards were given.
    • difficulty: integer of the difficulty for this block.
    • totalDifficulty: integer of the total difficulty of the chain until this block.
    • extraData: the "extra data" field of this block.
    • size: integer the size of this block in bytes.
    • gasLimit: the maximum gas allowed in this block.
    • gasUsed: the total used gas by all transactions in this block.
    • timestamp: the unix timestamp for when the block was collated.
    • uncles: an Array of uncle hashes.

Note: An uncle doesn't contain individual transactions.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "difficulty": "0xbf93da424b943",
    "extraData": "0x65746865726d696e652d657539",
    "gasLimit": "0x7a121d",
    "gasUsed": "0x79ea62",
    "hash": "0x824cce7c7c2ec6874b9fa9a9a898eb5f27cbaf3991dfa81084c3af60d1db618c",
    "logsBloom": "0x0948432021200401804810002000000000381001001202440000010020000080a016262050e44850268052000400100505022305a64000054004200b0c04110000080c1055c42001054b804940a0401401008a00112d80082113400c10006580140005011a40220020000010001c0a00082300434002000050840010102082801c2000148540201004491814020480080111a0300600000003800640024200109c00202010044000880000106810a1a010000028a0100000422000140011000050a2a44b3080001060800000540c108102102600d000004730404a880100600021080100403000180000062642408b440060590400080101e046f08000000430",
    "miner": "0xea674fdde714fd979de3edf0f56aa9716b898ec8",
    "mixHash": "0x0b15fe0a9aa789c167b0f5ade7b72969d9f2193014cb4e98382254f60ffb2f4a",
    "nonce": "0xa212d6400b89b3f6",
    "number": "0x5bad54",
    "parentHash": "0x05e19fb68d9ec798073808e8b3170875cb327d4b6cde7d6f60fe194677bb26fd",
    "receiptsRoot": "0x90807b32c4aa4610c57289de57fa68ba50ed53f14dd2c25f1862aa049029dcd6",
    "sha3Uncles": "0xf763576c1ea6a8c61a206e16b1a2451bec5cba1c7545d7ff733a1e8c78715569",
    "size": "0x216",
    "stateRoot": "0xebc7a1603bfffe0a14bdb89f898e2f2824abb40f04579beb7b920c56d6e273c9",
    "timestamp": "0x5b54143f",
    "totalDifficulty": null,
    "transactionsRoot": "0x7562cba41e067b364b933e7b566fb2444f6954fef3964a5a487d4cd79d97a56c",
    "uncles": []
  }
}

eth_getUncleByBlockNumberAndIndex

Returns information about the 'Uncle' of a block by hash and the Uncle index position.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • BLOCK PARAMETER [required] - an integer block number, or the string "latest", "earliest" or "pending", see the default block parameter
  • UNCLE INDEX POSITION [required] - a hex of the integer indicating the uncle's index position.

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getUncleByBlockNumberAndIndex","params": ["0x29c","0x0"],"id":1}'

RESPONSE

RESULT FIELDS

  • BLOCK - A block object, or null when no block was found
    • number: the block number. null when its pending block.
    • hash: 32 Bytes - hash of the block. null when its pending block.
    • parentHash: 32 Bytes - hash of the parent block.
    • nonce: 8 Bytes - hash of the generated proof-of-work. null when its pending block.
    • sha3Uncles: 32 Bytes - SHA3 of the uncles data in the block.
    • logsBloom: 256 Bytes - the bloom filter for the logs of the block. null when its pending block.
    • transactionsRoot: 32 Bytes - the root of the transaction trie of the block.
    • stateRoot: 32 Bytes - the root of the final state trie of the block.
    • receiptsRoot: 32 Bytes - the root of the receipts trie of the block.
    • miner: 20 Bytes - the address of the beneficiary to whom the mining rewards were given.
    • difficulty: integer of the difficulty for this block.
    • totalDifficulty: integer of the total difficulty of the chain until this block.
    • extraData: the "extra data" field of this block.
    • size: integer the size of this block in bytes.
    • gasLimit: the maximum gas allowed in this block.
    • gasUsed: the total used gas by all transactions in this block.
    • timestamp: the unix timestamp for when the block was collated.
    • uncles: an Array of uncle hashes.

Note: An uncle doesn't contain individual transactions.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "difficulty": "0x57f117f5c",
    "extraData": "0x476574682f76312e302e302f77696e646f77732f676f312e342e32",
    "gasLimit": "0x1388",
    "gasUsed": "0x0",
    "hash": "0x932bdf904546a2287a2c9b2ede37925f698a7657484b172d4e5184f80bdd464d",
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "miner": "0x5bf5e9cf9b456d6591073513de7fd69a9bef04bc",
    "mixHash": "0x4500aa4ee2b3044a155252e35273770edeb2ab6f8cb19ca8e732771484462169",
    "nonce": "0x24732773618192ac",
    "number": "0x299",
    "parentHash": "0xa779859b1ee558258b7008bbabff272280136c5dd3eb3ea3bfa8f6ae03bf91e5",
    "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "size": "0x21d",
    "stateRoot": "0x2604fbf5183f5360da249b51f1b9f1e0f315d2ff3ffa1a4143ff221ad9ca1fec",
    "timestamp": "0x55ba4827",
    "totalDifficulty": null,
    "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "uncles": []
  }
}

eth_getUncleCountByBlockHash

Returns the number of uncles in a block from a block matching the given block hash.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • BLOCK HASH [required] - a string representing the hash (32 bytes) of a block

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getUncleCountByBlockHash","params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35"],"id":1}'

RESPONSE

RESULT FIELDS

  • BLOCK TRANSACTION COUNT - a hex code of the integer representing the number of uncles in the provided block

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x1"
}

eth_getUncleCountByBlockNumber

Returns the number of uncles in a block from a block matching the given block number.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PARAMS

  • BLOCK PARAMETER [required] - an integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getUncleCountByBlockNumber","params": ["0x5bad55"],"id":1}'

RESPONSE

RESULT FIELDS

  • BLOCK TRANSACTION COUNT - a hex code of the integer representing the number of uncles in the provided block

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x1"
}

eth_getWork

Returns the hash of the current block, the seedHash, and the boundary condition to be met ("target").

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getWork","params": [],"id":1}'

RESPONSE

RESULT FIELDS

  • WORK ARRAY
    • 32 Bytes - current block header pow-hash
    • 32 Bytes - the seed hash used for the DAG.
    • 32 Bytes - the boundary condition ("target"), 2^256 / difficulty.

BODY

NOTE: While CradleGate will allow this method, eth_getWork will never actually return mining work.

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32000,
    "message": "no mining work available yet"
  }
}

eth_hashrate

Returns the number of hashes per second that the node is mining with. Only applicable when the node is mining.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_hashrate","params": [],"id":1}'

RESPONSE

RESULT FIELDS

  • HASHRATE - a hex code of an integer representing the number of hashes per second.

BODY

NOTE: CradleGate will always return a 0x0 mining hash rate.

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x0"
}

eth_mining

Returns true if client is actively mining new blocks.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_mining","params": [],"id":1}'

RESPONSE

RESULT FIELDS

  • IS MINING FLAG - a boolean indicating if the client is mining

BODY

NOTE: CradleGate will always return false in response to eth_mining.

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": false
}

eth_protocolVersion

Returns the current ethereum protocol version.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_protocolVersion","params": [],"id":1}'

RESPONSE

RESULT FIELDS

  • PROTOCOL VERSION - a string indicating the current ethereum protocol version

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x3f"
}

eth_sendRawTransaction

Submits a pre-signed transaction for broadcast to the Ethereum network.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PAYLOAD

  • TRANSACTION DATA [required] - The signed transaction data.

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],"id":1}'

RESPONSE

RESULT FIELDS

  • TRANSACTION HASH - 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available

NOTE - Use eth_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.

BODY

{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}

eth_submitWork

Used for submitting a proof-of-work solution.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

REQUEST PAYLOAD

  • WORK ARRAY
    • 8 Bytes - The nonce found (64 bits)
    • 32 Bytes - The header's pow-hash (256 bits)
    • 32 Bytes - The mix digest (256 bits)

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_submitWork","params": ["0x0000000000000001","0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef","0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000"],"id":1}'

RESPONSE

RESULT FIELDS

  • IS VALID FLAG - returns true if the provided solution is valid, otherwise false.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": false
}

eth_syncing

Returns an object with data about the sync status or false.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_syncing","params": [],"id":1}'

RESPONSE

RESULT FIELDS

  • SYNC STATUS - a boolean as false only when not syncing
  • SYNC BLOCKS i. startingBlock - a hexcode of the integer indicating the block at which the import started (will only be reset, after the sync reached his head) ii. currentBlock - a hexcode of the integer indicating the current block, same as eth_blockNumber iii. highestBlock - a hexcode of the integer indicating the highest block

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": false
}

net_listening

Returns true if client is actively listening for network connections.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"net_listening","params": [],"id":1}'

RESPONSE

RESULT FIELDS

  • LISTENING FLAG - a boolean indicating whether the client is actively listening for network connections

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

net_peerCount

Returns the number of peers currently connected to the client.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"net_peerCount","params": [],"id":1}'

RESPONSE

RESULT FIELDS

  • PEER COUNT - integer of the number of connected peers.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x64"
}

net_version

Returns the current network id.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"net_version","params": [],"id":1}'

RESPONSE

RESULT FIELDS

  • NETWORK ID - a string representing the current network id.

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "1"
}

web3_clientVersion

Returns the current client version.

REQUEST

POST https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID

HEADERS

Content-Type: application/json

EXAMPLE

## JSON-RPC over HTTPS POST
## Replace YOUR-PROJECT-ID with a Project ID from your Dashboard
## You can also replace mainnet with a different supported network
curl https://cradlegate.com/api/mainnet/YOUR-PROJECT-ID \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}'

RESPONSE

RESULT FIELDS

  • STRING - The current client version

BODY

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Geth/v1.8.15-omnibus-255989da/linux-amd64/go1.10.1"
}