RPC Methods
Explore all available JSON-RPC methods for interacting with the Nimiq blockchain. Each method provides full documentation, parameters, return types, and interactive examples.
Validator
addVotingKey
Add voting key
Reference for the Add voting key RPC method.
getAddress
Get address
Returns our validator address.
isValidatorElected
Is validator elected
Returns if our validator is currently elected.
isValidatorSynced
Is validator synced
Returns if our validator is currently synced.
setAutomaticReactivation
Set automatic reactivation
Updates the configuration setting to automatically reactivate our validator.
Blockchain
getAccountByAddress
Get account by address
Tries to fetch the account at the given address.
getAccounts
Get accounts
Fetches all accounts in the accounts tree. IMPORTANT: This operation iterates over all accounts in the accounts tree and thus is extremely computationally expensive.
getActiveValidators
Get active validators
Returns a collection of the currently active validator's addresses and balances.
getBatchNumber
Get batch number
Returns the batch number for the current head.
getBlockByHash
Get block by hash
Tries to fetch a block given its hash. It has an option to include the transactions in the block, which defaults to false.
getBlockByNumber
Get block by number
Tries to fetch a block given its number. It has an option to include the transactions in the block, which defaults to false. Note that this function will only fetch blocks that are part of the main chain.
getBlockNumber
Get block number
Returns the block number for the current head.
getCurrentPenalizedSlots
Get current penalized slots
Returns information about the currently penalized slots. This includes slots that lost rewards and that were disabled.
getEpochNumber
Get epoch number
Returns the epoch number for the current head.
getInherentsByBatchNumber
Get inherents by batch number
Returns all the inherents (including reward inherents) for the given batch number. Note that this only considers blocks in the main chain.
getInherentsByBlockNumber
Get inherents by block number
Returns all the inherents (including reward inherents) for the given block number. Note that this only considers blocks in the main chain.
getLatestBlock
Get latest block
Returns the block at the head of the main chain. It has an option to include the transactions in the block, which defaults to false.
getNetworkId
Get network id
Returns the network ID.
getPreviousPenalizedSlots
Get previous penalized slots
Returns information about the penalized slots of the previous batch. This includes slots that lost rewards and that were disabled.
getSlotAt
Get slot at
Returns information about the proposer slot at the given block height and offset. The offset is optional, it will default to getting the offset for the existing block at the given height. We only have this information available for the last 2 batches at most.
getStakerByAddress
Get staker by address
Tries to fetch a staker information given its address.
getStakersByValidatorAddress
Get stakers by validator address
Fetches all stakers for a given validator. IMPORTANT: This operation iterates over all stakers of the staking contract and thus is extremely computationally expensive.
getTransactionByHash
Get transaction by hash
Tries to fetch a transaction (including reward transactions) given its hash.
getTransactionHashesByAddress
Get transaction hashes by address
Returns the hashes for the latest transactions for a given address. All the transactions where the given address is listed as a recipient or as a sender are considered. Reward transactions are also returned. It has an option to specify the maximum number of hashes to fetch, it defaults to 500. It has also an option to retrieve transactions before a given transaction hash (exclusive). If this hash is not found or does not belong to this address, it will return an empty list. The transaction hashes are returned in descending order, meaning the latest transaction is the first.
getTransactionReferencesByAddress
Get transaction references by address
Returns the transactions receipts (similar to get transactions by address)
getTransactionsByAddress
Get transactions by address
Returns the latest transactions for a given address. All the transactions where the given address is listed as a recipient or as a sender are considered. Reward transactions are also returned. It has an option to specify the maximum number of transactions to fetch, it defaults to 500. It has also an option to retrieve transactions before a given transaction hash (exclusive). If this hash is not found or does not belong to this address, it will return an empty list. The transactions are returned in descending order, meaning the latest transaction is the first.
getTransactionsByBatchNumber
Get transactions by batch number
Returns all the transactions (including reward transactions) for the given batch number. Note that this only considers blocks in the main chain.
getTransactionsByBlockNumber
Get transactions by block number
Returns all the transactions (including reward transactions) for the given block number. Note that this only considers blocks in the main chain.
getValidatorByAddress
Get validator by address
Tries to fetch a validator information given its address.
getValidators
Get validators
Fetches all validators in the staking contract. IMPORTANT: This operation iterates over all validators in the staking contract and thus is extremely computationally expensive.
subscribeForHeadBlock
Subscribe for head block
Subscribes to new block events (retrieves the full block).
subscribeForHeadBlockHash
Subscribe for head block hash
Subscribes to new block events (only retrieves the block hash).
subscribeForLogsByAddressesAndTypes
Subscribe for logs by addresses and types
Subscribes to log events related to a given list of addresses and of any of the log types provided. If addresses is empty it does not filter by address. If log_types is empty it won't filter by log types. Thus the behavior is to assume all addresses or log_types are to be provided if the corresponding vec is empty.
subscribeForValidatorElectionByAddress
Subscribe for validator election by address
Subscribes to pre epoch validators events.
Consensus
createBasicTransaction
Create basic transaction
Returns a serialized basic transaction.
createBasicTransactionWithData
Create basic transaction with data
Returns a serialized basic transaction with an arbitrary data field.
createDeactivateValidatorTransaction
Create deactivate validator transaction
Returns a serialized `deactivate_validator` transaction. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee.
createDeleteValidatorTransaction
Create delete validator transaction
Returns a serialized `delete_validator` transaction. The transaction fee will be paid from the validator deposit that is being returned. Note in order for this transaction to be accepted fee + value should be equal to the validator deposit, which is not a fixed value: Failed delete validator transactions can diminish the validator deposit
createNewHtlcTransaction
Create new htlc transaction
Returns a serialized transaction creating a new HTLC contract.
createNewStakerTransaction
Create new staker transaction
Returns a serialized `new_staker` transaction. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee.
createNewValidatorTransaction
Create new validator transaction
Returns a serialized `new_validator` transaction. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee and the validator deposit. Since JSON doesn't have a primitive for Option (it just has the null primitive), we can't have a double Option. So we use the following work-around for the signal data: \"\" = Set the signal data field to None. \"0x29a4b...\" = Set the signal data field to Some(0x29a4b...).
createNewVestingTransaction
Create new vesting transaction
Returns a serialized transaction creating a new vesting contract.
createReactivateValidatorTransaction
Create reactivate validator transaction
Returns a serialized `reactivate_validator` transaction. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee.
createRedeemEarlyHtlcTransaction
Create redeem early htlc transaction
Returns a serialized transaction redeeming a HTLC contract using the `EarlyResolve` method.
createRedeemRegularHtlcTransaction
Create redeem regular htlc transaction
Returns a serialized transaction redeeming a HTLC contract using the `RegularTransfer` method.
createRedeemTimeoutHtlcTransaction
Create redeem timeout htlc transaction
Returns a serialized transaction redeeming a HTLC contract using the `TimeoutResolve` method.
createRedeemVestingTransaction
Create redeem vesting transaction
Returns a serialized transaction redeeming a vesting contract.
createRemoveStakeTransaction
Create remove stake transaction
Returns a serialized `remove_stake` transaction. The transaction fee will be paid from the funds being removed.
createRetireStakeTransaction
Create retire stake transaction
Returns a serialized `retire_stake` transaction. You can pay the transaction fee from a basic account (by providing the sender wallet) or from the staker account's balance (by not providing a sender wallet).
createRetireValidatorTransaction
Create retire validator transaction
Returns a serialized `retire_validator` transaction. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee.
createSetActiveStakeTransaction
Create set active stake transaction
Returns a serialized `set_active_stake` transaction. You can pay the transaction fee from a basic account (by providing the sender wallet) or from the staker account's balance (by not providing a sender wallet).
createSetSignalDataTransaction
Create set signal data transaction
Returns a serialized `set_signal_data` transaction, signed with the validator's signing (warm) key. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee. The `new_signal_data` field is interpreted as follows: null = Clear the signal data field (set it to None). \"0x29a4b...\" = Set the signal data field to Some(0x29a4b...). Note: this *replaces the entire signal data field*, overwriting any protocol version previously signaled via `create_signal_version_transaction`. Use that method instead if you only want to update the version while preserving the rest of the signal data. This transaction is only valid from protocol version `upgrades::v2::WARM_KEY_SIGNALING` onwards.
createSignalVersionTransaction
Create signal version transaction
Returns a serialized `signal_version` transaction that signals support for the given protocol `version`, signed with the validator's signing (warm) key. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee. Note: this only updates the protocol-version bytes of the signal data and preserves the rest of the field; it cannot clear the field. To replace the entire signal data (including clearing it), use `create_set_signal_data_transaction`. This transaction is only valid from protocol version `upgrades::v2::WARM_KEY_SIGNALING` onwards.
createStakeTransaction
Create stake transaction
Returns a serialized `stake` transaction. The funds to be staked and the transaction fee will be paid from the `sender_wallet`.
createUpdateStakerTransaction
Create update staker transaction
Returns a serialized `update_staker` transaction. You can pay the transaction fee from a basic account (by providing the sender wallet) or from the staker account's balance (by not providing a sender wallet).
createUpdateValidatorTransaction
Create update validator transaction
Returns a serialized `update_validator` transaction. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee. Since JSON doesn't have a primitive for Option (it just has the null primitive), we can't have a double Option. So we use the following work-around for the signal data: null = No change in the signal data field. \"\" = Change the signal data field to None. \"0x29a4b...\" = Change the signal data field to Some(0x29a4b...).
getRawTransactionInfo
Get raw transaction info
Given a serialized transaction, it will return the corresponding transaction struct.
getSyncStatus
Get sync status
Returns the status of the sync process
isConsensusEstablished
Is consensus established
Returns a boolean specifying if we have established consensus with the network.
sendBasicTransaction
Send basic transaction
Sends a basic transaction to the network.
sendBasicTransactionWithData
Send basic transaction with data
Sends a basic transaction, with an arbitrary data field, to the network.
sendDeactivateValidatorTransaction
Send deactivate validator transaction
Sends a `deactivate_validator` transaction to the network. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee.
sendDeleteValidatorTransaction
Send delete validator transaction
Sends a `delete_validator` transaction to the network. The transaction fee will be paid from the validator deposit that is being returned.
sendNewHtlcTransaction
Send new htlc transaction
Sends a transaction creating a new HTLC contract to the network.
sendNewStakerTransaction
Send new staker transaction
Sends a `new_staker` transaction to the network. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee.
sendNewValidatorTransaction
Send new validator transaction
Sends a `new_validator` transaction to the network. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee and the validator deposit. Since JSON doesn't have a primitive for Option (it just has the null primitive), we can't have a double Option. So we use the following work-around for the signal data: \"\" = Set the signal data field to None. \"0x29a4b...\" = Set the signal data field to Some(0x29a4b...).
sendNewVestingTransaction
Send new vesting transaction
Sends a transaction creating a new vesting contract to the network.
sendRawTransaction
Send raw transaction
Sends the given serialized transaction to the network.
sendReactivateValidatorTransaction
Send reactivate validator transaction
Sends a `reactivate_validator` transaction to the network. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee.
sendRedeemEarlyHtlcTransaction
Send redeem early htlc transaction
Sends a transaction redeeming a HTLC contract, using the `EarlyResolve` method, to the network.
sendRedeemRegularHtlcTransaction
Send redeem regular htlc transaction
Sends a transaction redeeming a HTLC contract, using the `RegularTransfer` method, to the network.
sendRedeemTimeoutHtlcTransaction
Send redeem timeout htlc transaction
Sends a transaction redeeming a HTLC contract, using the `TimeoutResolve` method, to the network.
sendRedeemVestingTransaction
Send redeem vesting transaction
Sends a transaction redeeming a vesting contract to the network.
sendRemoveStakeTransaction
Send remove stake transaction
Sends a `remove_stake` transaction to the network. The transaction fee will be paid from the funds being removed.
sendRetireStakeTransaction
Send retire stake transaction
Sends a `retire_stake` transaction to the network. You can pay the transaction fee from a basic account (by providing the sender wallet) or from the staker account's balance (by not providing a sender wallet).
sendRetireValidatorTransaction
Send retire validator transaction
Sends a `retire_validator` transaction to the network. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee.
sendSetActiveStakeTransaction
Send set active stake transaction
Sends a `set_active_stake` transaction to the network. You can pay the transaction fee from a basic account (by providing the sender wallet) or from the staker account's balance (by not providing a sender wallet).
sendSetSignalDataTransaction
Send set signal data transaction
Sends a `set_signal_data` transaction to the network. See `create_set_signal_data_transaction` for the meaning of `new_signal_data`.
sendSignalVersionTransaction
Send signal version transaction
Sends a `signal_version` transaction that signals support for the given protocol `version` to the network.
sendStakeTransaction
Send stake transaction
Sends a `stake` transaction to the network. The funds to be staked and the transaction fee will be paid from the `sender_wallet`.
sendUpdateStakerTransaction
Send update staker transaction
Sends a `update_staker` transaction to the network. You can pay the transaction fee from a basic account (by providing the sender wallet) or from the staker account's balance (by not providing a sender wallet).
sendUpdateValidatorTransaction
Send update validator transaction
Sends a `update_validator` transaction to the network. You need to provide the address of a basic account (the sender wallet) to pay the transaction fee. Since JSON doesn't have a primitive for Option (it just has the null primitive), we can't have a double Option. So we use the following work-around for the signal data: null = No change in the signal data field. \"\" = Change the signal data field to None. \"0x29a4b...\" = Change the signal data field to Some(0x29a4b...).
signRedeemEarlyHtlcTransaction
Sign redeem early htlc transaction
Returns a serialized signature that can be used to redeem funds from a HTLC contract using the `EarlyResolve` method.
Wallet
createAccount
Create account
Generates a new account and store it.
importRawKey
Import raw key
Import an account by its private key, in hexadecimal format, and lock it with the passphrase.
isAccountImported
Is account imported
Returns if an account has been imported.
isAccountUnlocked
Is account unlocked
Returns if the account currently is unlocked.
listAccounts
List accounts
Returns the accounts that have been imported.
lockAccount
Lock account
Locks the account to prevent further usage.
removeAccount
Remove account
Removes an imported account. IMPORTANT: This action is irreversible, and the account can only be recovered with its private key.
sign
Sign
Reference for the Sign RPC method.
unlockAccount
Unlock account
Unlocks the account.
verifySignature
Verify signature
Verifies the signature based on the provided public key and message.
Policy
getBatchAt
Get batch at
Returns the batch number at a given `block_number` (height).
getBatchIndexAt
Get batch index at
Returns the batch index at a given block number. The batch index is the number of a block relative to the batch it is in. For example, the first block of any batch always has an batch index of 0.
getBlockAfterCollateralLockup
Get block after collateral lockup
Returns the first block after the collateral lock-up window of a given block number has ended.
getBlockAfterJail
Get block after jail
Returns the first block after the jail period of a given block number has ended.
getBlockAfterReportingWindow
Get block after reporting window
**Deprecated**: renamed to `getBlockAfterCollateralLockup`. This window never governed equivocation reporting; it has always been the collateral lock-up window. Kept for API backwards compatibility — prefer `getBlockAfterCollateralLockup` in new clients.
getElectionBlockAfter
Get election block after
Returns the number (height) of the next election macro block after a given block number (height).
getElectionBlockBefore
Get election block before
Returns the number block (height) of the preceding election macro block before a given block number (height). If the given block number is an election macro block, it returns the election macro block before it.
getElectionBlockOf
Get election block of
Returns the block number of the election macro block of the given epoch (which is always the last block).
getEpochAt
Get epoch at
Returns the epoch number at a given block number (height).
getEpochIndexAt
Get epoch index at
Returns the epoch index at a given block number. The epoch index is the number of a block relative to the epoch it is in. For example, the first block of any epoch always has an epoch index of 0.
getFirstBatchOfEpoch
Get first batch of epoch
Returns a boolean expressing if the batch at a given block number (height) is the first batch of the epoch.
getFirstBlockOf
Get first block of
Returns the block number of the first block of the given epoch (which is always a micro block).
getFirstBlockOfBatch
Get first block of batch
Returns the block number of the first block of the given batch (which is always a micro block).
getLastElectionBlock
Get last election block
Returns the block number (height) of the last election macro block at a given block number (height). If the given block number is an election macro block, then it returns that block number.
getLastMacroBlock
Get last macro block
Returns block the number (height) of the last macro block at a given block number (height). If the given block number is a macro block, then it returns that block number.
getMacroBlockAfter
Get macro block after
Returns the block number (height) of the next macro block after a given block number (height).
getMacroBlockBefore
Get macro block before
Returns the block number (height) of the preceding macro block before a given block number (height). If the given block number is a macro block, it returns the macro block before it.
getMacroBlockOf
Get macro block of
Returns the block number of the macro block (checkpoint or election) of the given batch (which is always the last block).
getPolicyConstants
Get policy constants
Returns a bundle of policy constants.
getSupplyAt
Get supply at
Returns the supply at a given time (as Unix time) in Lunas (1 NIM = 100,000 Lunas). It is calculated using the following formula: ```text supply(t) = total_supply - (total_supply - genesis_supply) * supply_decay^t ``` Where t is the time in milliseconds since the PoS genesis block and `genesis_supply` is the supply at the genesis of the Nimiq 2.0 chain.
isElectionBlockAt
Is election block at
Returns a boolean expressing if the block at a given block number (height) is an election macro block.
isMacroBlockAt
Is macro block at
Returns a boolean expressing if the block at a given block number (height) is a macro block.
isMicroBlockAt
Is micro block at
Returns a boolean expressing if the block at a given block number (height) is a micro block.
Mempool
getMinFeePerByte
Get min fee per byte
Obtains the minimum fee per byte as per mempool configuration.
getTransactionFromMempool
Get transaction from mempool
Tries to obtain the given transaction (using its hash) from the mempool.
mempool
Mempool
Obtains the mempool content in fee per byte buckets.
mempoolContent
Mempool content
Obtains the list of transactions that are currently in the mempool.
pushHighPriorityTransaction
Push high priority transaction
Pushes a raw transaction with a high priority assigned into the mempool and broadcast it to the network.
pushTransaction
Push transaction
Pushes a raw transaction with a default priority assigned into the mempool and broadcast it to the network.
Network
getAddressBook
Get address book
Returns the address book
getClientVersion
Get client version
Returns the version of the client the RPC server is running.
getPeerCount
Get peer count
Returns the number of peers.
getPeerId
Get peer id
Returns the peer ID for our local peer.
getPeerList
Get peer list
Returns a list with the IDs of all our peers.