Skip to main content

Available Methods

Here is the complete list of JSON-RPC methods available in the Winnie API:

Chain Methods

eth_blockNumber

Returns the number of the most recent block. Parameters:
  • None
Returns:
  • QUANTITY - integer of the current block number the client is on
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_blockNumber",
  "params": [],
  "id": 1
}

eth_chainId

Returns the chain ID of the current network. Parameters:
  • None
Returns:
  • QUANTITY - integer of the current chain ID
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_chainId",
  "params": [],
  "id": 1
}

eth_syncing

Returns an object with data about the sync status or false. Parameters:
  • None
Returns:
  • Object|Boolean - An object with sync status data or false
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_syncing",
  "params": [],
  "id": 1
}

State Methods

eth_getBalance

Returns the balance of the account of given address. Parameters:
  • DATA, 20 Bytes - address to check for balance
  • QUANTITY|TAG - integer block number, or the string “latest”, “earliest” or “pending”
Returns:
  • QUANTITY - integer of the current balance in wei
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_getBalance",
  "params": ["0x407d73d8a49eeb85d32cf465507dd71d507100c1", "latest"],
  "id": 1
}

eth_getStorageAt

Returns the value from a storage position at a given address. Parameters:
  • DATA, 20 Bytes - address of the storage
  • QUANTITY - integer of the position in the storage
  • QUANTITY|TAG - integer block number, or the string “latest”, “earliest” or “pending”
Returns:
  • DATA - the value at this storage position
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_getStorageAt",
  "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x0", "latest"],
  "id": 1
}

eth_getTransactionCount

Returns the number of transactions sent from an address. Parameters:
  • DATA, 20 Bytes - address
  • QUANTITY|TAG - integer block number, or the string “latest”, “earliest” or “pending”
Returns:
  • QUANTITY - integer of the number of transactions send from this address
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionCount",
  "params": ["0x407d73d8a49eeb85d32cf465507dd71d507100c1", "latest"],
  "id": 1
}

eth_getCode

Returns code at a given address. Parameters:
  • DATA, 20 Bytes - address
  • QUANTITY|TAG - integer block number, or the string “latest”, “earliest” or “pending”
Returns:
  • DATA - the code from the given address
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_getCode",
  "params": ["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "0x2"],
  "id": 1
}

Block Methods

eth_getBlockByHash

Returns information about a block by hash. Parameters:
  • DATA, 32 Bytes - Hash of a block
  • Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions
Returns:
  • Object - A block object, or null when no block was found
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByHash",
  "params": ["0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae", false],
  "id": 1
}

eth_getBlockByNumber

Returns information about a block by block number. Parameters:
  • QUANTITY|TAG - integer of a block number, or the string “latest”, “earliest” or “pending”
  • Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions
Returns:
  • Object - A block object, or null when no block was found
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": ["0x1b4", true],
  "id": 1
}

Transaction Methods

eth_getTransactionByHash

Returns the information about a transaction requested by transaction hash. Parameters:
  • DATA, 32 Bytes - hash of a transaction
Returns:
  • Object - A transaction object, or null when no transaction was found
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByHash",
  "params": ["0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"],
  "id": 1
}

eth_getTransactionByBlockHashAndIndex

Returns information about a transaction by block hash and transaction index position. Parameters:
  • DATA, 32 Bytes - hash of a block
  • QUANTITY - integer of the transaction index position
Returns:
  • Object - A transaction object, or null when no transaction was found
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockHashAndIndex",
  "params": ["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", "0x0"],
  "id": 1
}

eth_getTransactionReceipt

Returns the receipt of a transaction by transaction hash. Parameters:
  • DATA, 32 Bytes - hash of a transaction
Returns:
  • Object - A transaction receipt object, or null when no receipt was found
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionReceipt",
  "params": ["0x85d995eba9763907fdf35cd2034144dd9d53ce32cbec21349d4b12823c6860c5"],
  "id": 1
}

Account Methods

eth_accounts

Returns a list of addresses owned by client. Parameters:
  • None
Returns:
  • Array of DATA, 20 Bytes - addresses owned by the client
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_accounts",
  "params": [],
  "id": 1
}

eth_sign

Signs data with a given address. Parameters:
  • DATA, 20 Bytes - address
  • DATA - message to sign
Returns:
  • DATA - signature
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_sign",
  "params": ["0x9b2055d370f73ec7d8a03e965129118dc8f5bf83", "0xdeadbeaf"],
  "id": 1
}

Gas Methods

eth_gasPrice

Returns the current price per gas in wei. Parameters:
  • None
Returns:
  • QUANTITY - integer of the current gas price in wei
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_gasPrice",
  "params": [],
  "id": 1
}

eth_estimateGas

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. Parameters:
  • Object - The transaction call object
    • from: DATA, 20 Bytes - (optional) The address the transaction is sent from
    • to: DATA, 20 Bytes - (optional) The address the transaction is directed to
    • gas: QUANTITY - (optional) Integer of the gas provided for the transaction execution
    • gasPrice: QUANTITY - (optional) Integer of the gasPrice used for each paid gas
    • value: QUANTITY - (optional) Integer of the value sent with this transaction
    • data: DATA - (optional) Hash of the method signature and encoded parameters
Returns:
  • QUANTITY - the amount of gas used
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_estimateGas",
  "params": [{
    "from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
    "to": "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe",
    "data": "0xc6888fa10000000000000000000000000000000000000000000000000000000000000003"
  }],
  "id": 1
}

Transaction Methods

eth_sendTransaction

Creates new message call transaction or a contract creation. Parameters:
  • Object - The transaction object
    • from: DATA, 20 Bytes - The address the transaction is sent from
    • to: DATA, 20 Bytes - (optional) The address the transaction is directed to
    • gas: QUANTITY - (optional) Integer of the gas provided for the transaction execution
    • gasPrice: QUANTITY - (optional) Integer of the gasPrice used for each paid gas
    • value: QUANTITY - (optional) Integer of the value sent with this transaction
    • data: DATA - (optional) Hash of the method signature and encoded parameters
    • nonce: QUANTITY - (optional) Integer of a nonce
Returns:
  • DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_sendTransaction",
  "params": [{
    "from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
    "to": "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe",
    "gas": "0x76c0",
    "gasPrice": "0x9184e72a000",
    "value": "0x9184e72a"
  }],
  "id": 1
}

eth_sendRawTransaction

Creates new message call transaction or a contract creation for signed transactions. Parameters:
  • DATA - The signed transaction data
Returns:
  • DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_sendRawTransaction",
  "params": ["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],
  "id": 1
}

Filter Methods

eth_newFilter

Creates a filter object, based on filter options, to notify when the state changes. Parameters:
  • Object - The filter options
    • fromBlock: QUANTITY|TAG - (optional, default: “latest”) Integer block number, or “latest” for the last mined block or “pending”, “earliest” for not yet mined transactions
    • toBlock: QUANTITY|TAG - (optional, default: “latest”) Integer block number, or “latest” for the last mined block or “pending”, “earliest” for not yet mined transactions
    • address: DATA|Array, 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate
    • topics: Array of DATA, - (optional) Array of 32 Bytes DATA topics
Returns:
  • QUANTITY - A filter id
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_newFilter",
  "params": [{
    "fromBlock": "0x1",
    "toBlock": "0x2",
    "address": "0x8888f1f195afa192cfee860698584c030f4c9db1",
    "topics": ["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"]
  }],
  "id": 1
}

eth_getFilterChanges

Polling method for a filter, which returns an array of logs which occurred since last poll. Parameters:
  • QUANTITY - the filter id
Returns:
  • Array - Array of log objects, or an empty array if nothing has changed since last poll
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_getFilterChanges",
  "params": ["0x16"],
  "id": 73
}

eth_getFilterLogs

Returns an array of all logs matching filter with given id. Parameters:
  • QUANTITY - the filter id
Returns:
  • Array - Array of log objects
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_getFilterLogs",
  "params": ["0x16"],
  "id": 74
}

eth_getLogs

Returns an array of all logs matching a given filter object. Parameters:
  • Object - The filter options (same as eth_newFilter)
Returns:
  • Array - Array of log objects
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_getLogs",
  "params": [{
    "topics": ["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"]
  }],
  "id": 74
}

eth_uninstallFilter

Uninstalls a filter with given id. Parameters:
  • QUANTITY - the filter id
Returns:
  • Boolean - true if the filter was successfully uninstalled, otherwise false
Example:
{
  "jsonrpc": "2.0",
  "method": "eth_uninstallFilter",
  "params": ["0xb"],
  "id": 73
}