Private network API methods
- This reference contains API methods that apply to only private networks. For API methods that apply to both private and public networks, see the public network API reference.
- All JSON-RPC HTTP examples use the default host and port endpoint
http://127.0.0.1:8545
. If using the --rpc-http-host or --rpc-http-port options, update the endpoint.
CLIQUE
methods
The CLIQUE
API methods provide access to the Clique consensus engine.
The CLIQUE
API methods are not enabled by default for JSON-RPC. To enable the CLIQUE
API methods use the --rpc-http-api
or --rpc-ws-api
options.
clique_discard
Discards a proposal to add or remove a signer with the specified address.
Parameters
address
: string - 20-byte address of proposed signer
Returns
result
: boolean - indicates if the proposal is discarded
- curl HTTP request
- wscat WS request
- JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"clique_discard","params":["0xFE3B557E8Fb62b89F4916B721be55cEb828dBd73"], "id":1}' http://127.0.0.1:8545
{"jsonrpc":"2.0","method":"clique_discard","params":["0xFE3B557E8Fb62b89F4916B721be55cEb828dBd73"], "id":1}
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
clique_getSigners
Lists signers for the specified block.
Parameters
blockNumber
: string - hexadecimal or decimal integer representing a block number or one of the string tags latest
, earliest
, pending
, finalized
, or safe
, as described in block parameter
Returns
result
: array of string - list of 20-byte addresses of signers
- curl HTTP request
- wscat WS request
- JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"clique_getSigners","params":["latest"], "id":1}' http://127.0.0.1:8545
{"jsonrpc":"2.0","method":"clique_getSigners","params":["latest"], "id":1}
{
"jsonrpc" : "2.0",
"id" : 1,
"result" : [ "0x42eb768f2244c8811c63729a21a3569731535f06", "0x7ffc57839b00206d1ad20c69a1981b489f772031", "0xb279182d99e65703f0076e4812653aab85fca0f0" ]
}
clique_getSignerMetrics
Provides the following validator metrics for the specified range:
-
Number of blocks from each validator
-
Block number of the last block proposed by each validator (if any proposed in the specified range)
-
All validators present in the last block
Parameters
-
fromBlockNumber
: string - hexadecimal or decimal integer representing a block number or the string tagslatest
,earliest
,pending
,finalized
, orsafe
, as described in block parameter -
toBlockNumber
: string - hexadecimal or decimal integer representing a block number or one of the string tagslatest
,earliest
,pending
,finalized
, orsafe
, as described in block parameter
If you specify:
-
No parameters, the call provides metrics for the last 100 blocks, or all blocks if there are less than 100 blocks.
-
Only the first parameter, the call provides metrics for all blocks from the block specified to the latest block.
Returns
result
: array of objects - list of validator objects
The proposer of the genesis block has address 0x0000000000000000000000000000000000000000
.
- curl HTTP
- wscat WS
- JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"clique_getSignerMetrics","params":["1", "100"], "id":1}' http://127.0.0.1:8545
{"jsonrpc":"2.0","method":"clique_getSignerMetrics","params":["1", "100"], "id":1}
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0x7ffc57839b00206d1ad20c69a1981b489f772031",
"proposedBlockCount": "0x21",
"lastProposedBlockNumber": "0x61"
},
{
"address": "0x42eb768f2244c8811c63729a21a3569731535f06",
"proposedBlockCount": "0x21",
"lastProposedBlockNumber": "0x63"
},
{
"address": "0xb279182d99e65703f0076e4812653aab85fca0f0",
"proposedBlockCount": "0x21",
"lastProposedBlockNumber": "0x62"
}
]
}
clique_getSignersAtHash
Lists signers for the specified block.
Parameters
hash
: string - 32-byte block hash
Returns
result
: array of string - list of 20-byte addresses of signers
- curl HTTP request
- wscat WS request
- JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"clique_getSignersAtHash","params":["0x98b2ddb5106b03649d2d337d42154702796438b3c74fd25a5782940e84237a48"], "id":1}' http://127.0.0.1:8545
{"jsonrpc":"2.0","method":"clique_getSignersAtHash","params":["0x98b2ddb5106b03649d2d337d42154702796438b3c74fd25a5782940e84237a48"], "id":1}
{
"jsonrpc": "2.0",
"id": 1,
"result": [
"0x42eb768f2244c8811c63729a21a3569731535f06",
"0x7ffc57839b00206d1ad20c69a1981b489f772031",
"0xb279182d99e65703f0076e4812653aab85fca0f0"
]
}
clique_proposals
Returns current proposals.
Parameters
None
Returns
result
: map of strings to booleans - map of account addresses to corresponding boolean values indicating the proposal for each account (if true
, the proposal is to add a signer; if false
, the proposal is to remove a signer.)
- curl HTTP request
- wscat WS request
- JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"clique_proposals","params":[], "id":1}' http://127.0.0.1:8545
{"jsonrpc":"2.0","method":"clique_proposals","params":[], "id":1}
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"0x42eb768f2244c8811c63729a21a3569731535f07": false,
"0x12eb759f2222d7711c63729a45c3585731521d01": true
}
}
clique_propose
Proposes to add or remove a signer with the specified address.
Parameters
-
address
: string - 20-byte address -
proposal
: boolean -true
to propose adding signer orfalse
to propose removing signer
Returns
result
: boolean - true
- curl HTTP request
- wscat WS request
- JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"clique_propose","params":["0xFE3B557E8Fb62b89F4916B721be55cEb828dBd73", true], "id":1}' http://127.0.0.1:8545
{"jsonrpc":"2.0","method":"clique_propose","params":["0xFE3B557E8Fb62b89F4916B721be55cEb828dBd73", true], "id":1}
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
EEA
methods
The EEA
API methods provide functionality for private transactions and privacy groups.
The EEA
API methods are not enabled by default for JSON-RPC. To enable the EEA
API methods, use the --rpc-http-api
or --rpc-ws-api
options.
eea_sendRawTransaction
Distributes the private transaction, generates the privacy marker transaction and submits it to the transaction pool, and returns the transaction hash of the privacy marker transaction.
The signed transaction passed as an input parameter includes the privateFrom
, privateFor
or privacyGroupId
, and restriction
fields.
The gas
and gasPrice
are used by the privacy marker transaction not the private transaction itself.
To avoid exposing your private key, create signed transactions offline and send the signed transaction data using eea_sendRawTransaction
.
For production systems requiring private transactions, use a network with a consensus mechanism supporting transaction finality to make sure the private state does not become inconsistent with the chain. For example, IBFT 2.0 and QBFT provide the required finality.
Using private transactions with pruning or fast sync isn't supported.
Parameters
transaction
: string - signed RLP-encoded private transaction
Returns
result
: string - 32-byte transaction hash of the privacy marker transaction
If creating a contract, use priv_getTransactionReceipt to retrieve the contract address after the transaction is finalized.
- curl HTTP request
- wscat WS request
- JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"eea_sendRawTransaction","params": ["0xf869018203e882520894f17f52151ebef6c7334fad080c5704d77216b732881bc16d674ec80000801ba02da1c48b670996dcb1f447ef9ef00b33033c48a4fe938f420bec3e56bfd24071a062e0aa78a81bf0290afbc3a9d8e9a068e6d74caa66c5e0fa8a46deaae96b0833"], "id":1}' http://127.0.0.1:8545
{"jsonrpc":"2.0","method":"eea_sendRawTransaction","params": ["0xf869018203e882520894f17f52151ebef6c7334fad080c5704d77216b732881bc16d674ec80000801ba02da1c48b670996dcb1f447ef9ef00b33033c48a4fe938f420bec3e56bfd24071a062e0aa78a81bf0290afbc3a9d8e9a068e6d74caa66c5e0fa8a46deaae96b0833"], "id":1}
{
"id": 1,
"jsonrpc": "2.0",
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}
IBFT
2.0 methods
The IBFT
API methods provide access to the IBFT 2.0 consensus engine.
The IBFT
API methods are not enabled by default for JSON-RPC. To enable the IBFT
API methods, use the --rpc-http-api
or --rpc-ws-api
options.
ibft_discardValidatorVote
Discards a proposal to add or remove a validator with the specified address.
Parameters
address
: string - 20-byte address of proposed validator
Returns
result
: boolean - indicates if the proposal is discarded
- curl HTTP request
- wscat WS request
- JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"ibft_discardValidatorVote","params":["0xef1bfb6a12794615c9b0b5a21e6741f01e570185"], "id":1}' http://127.0.0.1:8545
{"jsonrpc":"2.0","method":"ibft_discardValidatorVote","params":["0xef1bfb6a12794615c9b0b5a21e6741f01e570185"], "id":1}
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
ibft_getPendingVotes
Returns votes cast in the current epoch.
Parameters
None
Returns
result
: map of strings to booleans - map of account addresses to corresponding boolean values indicating the vote for each account; if true
, the vote is to add a validator. If false
, the proposal is to remove a validator.
- curl HTTP request
- wscat WS request
- JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"ibft_getPendingVotes","params":[], "id":1}' http://127.0.0.1:8545
{"jsonrpc":"2.0","method":"ibft_getPendingVotes","params":[], "id":1}
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"0xef1bfb6a12794615c9b0b5a21e6741f01e570185": true,
"0x42d4287eac8078828cf5f3486cfe601a275a49a5": true
}
}