QBFT Methods

The QBFT API methods provide access to the QBFT consensus engine.

Note

The QBFT API methods are not enabled by default for JSON-RPC. To enable the QBFT API methods, use the --rpc-http-api or --rpc-ws-api options.

qbft_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 -X POST --data '{"jsonrpc":"2.0","method":"qbft_discardValidatorVote","params":["0xef1bfb6a12794615c9b0b5a21e6741f01e570185"], "id":1}' http://127.0.0.1:8545

qbft_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 -X POST --data '{"jsonrpc":"2.0","method":"qbft_getPendingVotes","params":[], "id":1}' http://127.0.0.1:8545

qbft_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 of the range

Parameters

  • fromBlockNumber: string - integer representing a block number or the string tag earliest as described in Block Parameter

  • toBlockNumber: string - integer representing a block number or one of the string tags latest or pending, 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

Note

The proposer of the genesis block has address 0x0000000000000000000000000000000000000000.

curl -X POST --data '{"jsonrpc":"2.0","method":"qbft_getSignerMetrics","params":["1", "100"], "id":1}' http://127.0.0.1:8545

qbft_getValidatorsByBlockHash

Lists the validators defined in the specified block.

Parameters

block: string - 32-byte block hash

Returns

result: array of strings - list of validator addresses

curl -X POST --data '{"jsonrpc":"2.0","method":"qbft_getValidatorsByBlockHash","params":["0xbae7d3feafd743343b9a4c578cab5e5d65eb735f6855fb845c00cab356331256"], "id":1}' http://127.0.0.1:8545

qbft_getValidatorsByBlockNumber

Lists the validators defined in the specified block.

Parameters

  • blockNumber: string - integer representing a block number or one of the string tags latest, earliest, or pending, as described in Block Parameter

Returns

result: array of strings - list of validator addresses

curl -X POST --data '{"jsonrpc":"2.0","method":"qbft_getValidatorsByBlockNumber","params":["latest"], "id":1}' http://127.0.0.1:8545

qbft_proposeValidatorVote

Proposes to add or remove a validator with the specified address.

Parameters

  • address: string - account address

  • proposal: boolean - true to propose adding validator or false to propose removing validator

Returns

curl -X POST --data '{"jsonrpc":"2.0","method":"qbft_proposeValidatorVote","params":["42d4287eac8078828cf5f3486cfe601a275a49a5",true], "id":1}' http://127.0.0.1:8545

Last updated