API Documentation | Ethereum RAW

Ethereum


The Wakaful API provides access to both the public Ethereum network and our own permission-based consortium network.

In order to access the Ethereum API endpoint you must not only remember to include a valid method but must also include a valid Wakaful API key - http://wakaful.com/api/cortex/v1/ethereum?method=blockNumber&key=your-api-key - which should produce:

{
    "code": "success",
    "message": "Successfully fetched data",
    "data": {
        "status": 200,
        "results": "0x74838a"
    },
    "_links": {
        "up": [
            {
                "href": "http://wakaful.com/api/cortex/v1"
            }
        ],
        "help": [
            {
                "name": "toc",
                "href": "http://wakaful.com/documentation/"
            },
            {
                "name": "self",
                "href": "http://wakaful.com/documentation/ethereum"
            }
        ],
        "examples": [
            {
                "name": "simple",
                "href": "http://wakaful.com/api/cortex/v1/ethereum?method=blockNumber&key=your-api-key"
            }
        ]
    }
}

By default, Ethereum API requests assume you want to query the main public network. In order to communicate with the BCE network you should set the chain parameter to bce as follows:

http://wakaful.com/api/cortex/v1/ethereum?method=blockNumber&key=your-api-key&chain=bce


Available Methods

  • blockNumber - return the current block height
  • call - execute a message call without adding it to the blockchain
  • estimateGas - return an estmation for executing a particular transaction
  • gasPrice - returns the current gas price in wei
  • getBalance - returns the balance of an address
  • getBlockByHash - return a block based on its hash
  • getBlockByNumber - return a block based on its height
  • getBlockTransactionCountByHash - returns the number of transactions
  • getBlockTransactionCountByNumber - returns the number of transactions
  • getCode - returns the compiled contract code at an address
  • getLogs - returns an array of logs based on a filter object
  • getStorageAt - returns the value from a storage position at an address
  • getTransactionByBlockHashAndIndex - returns a specific transaction
  • getTransactionByBlockNumberAndIndex - returns a specific transaction
  • getTransactionByHash - returns a specific transaction
  • getTransactionCount - the number of transactions sent from an address
  • sendRawTransaction - used to relay raw transactions to the network

Required options should be set via GET params and piped if using URLs - for example - ?params=option_one|option_two

More information on each of the available methods can be seen below:


blockNumber ( )


Although this function does not have any options, you can still use the chain parameter to switch from public to private networks.


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?method=blockNumber&key=your-api-key&chain=bce


call ( payload, block )


Both the payload and block are required.

The payload should be a valid JSON transaction object - structured something like this:

{
    "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
    "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
    "gas": "0x76c0",
    "gasPrice": "0x9184e72a000",
    "value": "0x9184e72a",
    "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}

The block should be either a hex of an integer (0x0) representing the block height or one of several reserved (string) key words.

Those keywords include "latest", "earliest" or "pending".


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?method=call&key=your-api-key&params={"from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas":"0x76c0","gasPrice":"0x9184e72a000","value":"0x9184e72a","data":"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}|latest


estimateGas ( payload )


The payload is required and should be a valid JSON transaction object - structured something like this:

{
    "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
    "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
    "gas": "0x76c0",
    "gasPrice": "0x9184e72a000",
    "value": "0x9184e72a",
    "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}

An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?method=estimateGas&key=your-api-key&params={"from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas":"0x76c0","gasPrice":"0x9184e72a000","value":"0x9184e72a","data":"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}


gasPrice ( )


Although this function does not have any options, you can still use the chain parameter to switch from public to private networks.


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?method=gasPrice&key=your-api-key&chain=bce


getBalance ( address, block )


Both the address and the block are required.

The address should be a string representation of an address (20 bytes) to check for balance.

The block should be either a hex of an integer (0x0) representing the block height or one of several reserved (string) key words.

Those keywords include "latest", "earliest" or "pending".


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?method=getBalance&key=your-api-key&params=0x742d35cc6634c0532925a3b844bc454e4438f44e|0x543FB5


getBlockByHash ( hash, showTxs )


Both the hash and the showTXs are required.

The hash should be a string representing the hash (32 bytes) of a block.

If set to true the showTxs will return full transactional objects, otherwise it will only return the transaction IDs.


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?method=getBlockByHash&key=your-api-key&params=0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35|false


getBlockByNumber ( block, showTxs )


Both the block and the showTXs are required.

The block should be either a hex of an integer (0x0) representing the block height or one of several reserved (string) key words.

Those keywords include "latest", "earliest" or "pending".

If set to true the showTxs will return full transactional objects, otherwise it will only return the transaction IDs.


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?method=getBlockByNumber&key=your-api-key&params=0xF4240|false


getBlockTransactionCountByHash ( hash )


The hash is required and should be a string representing the hash (32 bytes) of a block.


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?method=getBlockTransactionCountByHash&key=your-api-key&params=0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35


getBlockTransactionCountByNumber ( block )


The required block should be either a hex of an integer representing the block height or one of several reserved (string) key words.

Those keywords include "latest", "earliest" or "pending".


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?method=getBlockTransactionCountByNumber&key=your-api-key&params=0xF4240


getCode ( address, block )


Both the address and the block required.

The address should be a string representation of an address (20 bytes) to check for balance.

The block should be either a hex of an integer (0x0) representing the block height or one of several reserved (string) key words.

Those keywords include "latest", "earliest" or "pending".


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?method=getCode&key=your-api-key&params=0x06012c8cf97bead5deae237070f9587f8e7a266d|latest


getLogs ( payload )


The payload is required and must be a valid JSON filter object - structured something like this:

{
    "address": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
    "fromBlock": "earliest",
    "toBlock": "latest",
    "topics": "0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80"
}

An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?method=getLogs&key=your-api-key&params={"address":"0x1a94fce7ef36bc90959e206ba569a12afbc91ca1","blockHash":"0xe8548dc82649d62bd79d363c78b87bee789d461a5dac852b12de6508c3c885cc","topics":["0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80"]}


getStorageAt ( address, position, block )


The address, position and block are all required.

The address should be a string representation of an address (20 bytes) to check for balance.

The position should be a hex code of the position in the storage.

The block should be either a hex of an integer (0x0) representing the block height or one of several reserved (string) key words.

Those keywords include "latest", "earliest" or "pending".


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?key=your-api-key&method=getStorageAt&params=0x295a70b2de5e3953354a6a8344e616ed314d7251|0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9|latest


getTransactionByBlockHashAndIndex ( hash, index )


Both the hash and the index are required.

The hash should be a string representing the hash (32 bytes) of a block.

The index should be a hex of the integer representing the position in the block.


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?key=your-api-key&method=getTransactionByBlockHashAndIndex&params=0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35|0x0


getTransactionByBlockNumberAndIndex ( block, index )


Both the block and theindex are required.

The block should be either a hex of an integer (0x0) representing the block height or one of several reserved (string) key words.

Those keywords include "latest", "earliest" or "pending".

The index should be a hex of the integer representing the position in the block.


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?key=your-api-key&method=getTransactionByBlockNumberAndIndex&params=0x5BAD55|0x0


getTransactionByHash ( hash )


The hash is required and should be a string representing the hash (32 bytes) of a transaction.


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?key=your-api-key&method=getTransactionByHash&params=0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0


getTransactionCount ( address, block )


Both the address and the block are required.

The block should be either a hex of an integer (0x0) representing the block height or one of several reserved (string) key words.

Those keywords include "latest", "earliest" or "pending".


An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?key=your-api-key&method=getTransactionCount&params=0xc94770007dda54cF92009BFF0dE90c06F603a09f|latest


sendRawTransaction ( payload )


The payload is required and should be a valid JSON transaction object - structured something like this:

{
    "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
    "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
    "gas": "0x76c0",
    "gasPrice": "0x9184e72a000",
    "value": "0x9184e72a",
    "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}

An example URL request:

http://wakaful.com/api/cortex/v1/ethereum?key=your-api-key&method=sendRawTransaction&params=0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675


Table of Contents