JSON-RPC API Reference

JSON-RPC API Reference

Each node in the Pactus network can be configured to use the gRPC protocol for communication. Here, you can find the list of all gRPC methods and messages.

All the amounts and values in gRPC endpoints are in NanoPAC units, which are atomic and the smallest unit in the Pactus blockchain. Each PAC is equivalent to 1,000,000,000 or 109 NanoPACs.

JSON-RPC Services

Transaction Service

Transaction service defines various RPC methods for interacting with transactions.

pactus.transaction.get_transaction

GetTransaction retrieves transaction details based on the provided request parameters.

Parameters

FieldTypeDescription
idstringThe unique ID of the transaction to retrieve.
verbositystring(Enum) The verbosity level for transaction details.
Available values:
  • TRANSACTION_DATA = Request transaction data only.
  • TRANSACTION_INFO = Request detailed transaction information.

Result

FieldTypeDescription
block_heightnumericThe height of the block containing the transaction.
block_timenumericThe UNIX timestamp of the block containing the transaction.
transactionobjectDetailed information about the transaction.
transaction.idstringThe unique ID of the transaction.
transaction.datastringThe raw transaction data.
transaction.versionnumericThe version of the transaction.
transaction.lock_timenumericThe lock time for the transaction.
transaction.valuenumericThe value of the transaction in NanoPAC.
transaction.feenumericThe fee for the transaction in NanoPAC.
transaction.payload_typestring(Enum) The type of transaction payload.
Available values:
  • UNKNOWN = Unknown payload type.
  • TRANSFER_PAYLOAD = Transfer payload type.
  • BOND_PAYLOAD = Bond payload type.
  • SORTITION_PAYLOAD = Sortition payload type.
  • UNBOND_PAYLOAD = Unbond payload type.
  • WITHDRAW_PAYLOAD = Withdraw payload type.
transaction.transferobject(OneOf) Transfer transaction payload.
transaction.transfer.senderstringThe sender's address.
transaction.transfer.receiverstringThe receiver's address.
transaction.transfer.amountnumericThe amount to be transferred in NanoPAC.
transaction.bondobject(OneOf) Bond transaction payload.
transaction.bond.senderstringThe sender's address.
transaction.bond.receiverstringThe receiver's address.
transaction.bond.stakenumericThe stake amount in NanoPAC.
transaction.sortitionobject(OneOf) Sortition transaction payload.
transaction.sortition.addressstringThe validator address associated with the sortition proof.
transaction.sortition.proofstringThe proof for the sortition.
transaction.unbondobject(OneOf) Unbond transaction payload.
transaction.unbond.validatorstringThe address of the validator to unbond from.
transaction.withdrawobject(OneOf) Withdraw transaction payload.
transaction.withdraw.fromstringThe address to withdraw from.
transaction.withdraw.tostringThe address to withdraw to.
transaction.withdraw.amountnumericThe withdrawal amount in NanoPAC.
transaction.memostringA memo string for the transaction.
transaction.public_keystringThe public key associated with the transaction.
transaction.signaturestringThe signature for the transaction.

pactus.transaction.calculate_fee

CalculateFee calculates the transaction fee based on the specified amount and payload type.

Parameters

FieldTypeDescription
amountnumericThe amount involved in the transaction, specified in NanoPAC.
payload_typestring(Enum) The type of transaction payload.
Available values:
  • UNKNOWN = Unknown payload type.
  • TRANSFER_PAYLOAD = Transfer payload type.
  • BOND_PAYLOAD = Bond payload type.
  • SORTITION_PAYLOAD = Sortition payload type.
  • UNBOND_PAYLOAD = Unbond payload type.
  • WITHDRAW_PAYLOAD = Withdraw payload type.
fixed_amountbooleanIndicates if the amount should be fixed and include the fee.

Result

FieldTypeDescription
amountnumericThe calculated amount in NanoPAC.
feenumericThe calculated transaction fee in NanoPAC.

pactus.transaction.broadcast_transaction

BroadcastTransaction broadcasts a signed transaction to the network.

Parameters

FieldTypeDescription
signed_raw_transactionstringThe signed raw transaction data to be broadcasted.

Result

FieldTypeDescription
idstringThe unique ID of the broadcasted transaction.

pactus.transaction.get_raw_transfer_transaction

GetRawTransferTransaction retrieves raw details of a transfer transaction.

Parameters

FieldTypeDescription
lock_timenumericThe lock time for the transaction. If not set, defaults to the last block height.
senderstringThe sender's account address.
receiverstringThe receiver's account address.
amountnumericThe amount to be transferred, specified in NanoPAC. Must be greater than 0.
feenumericThe transaction fee in NanoPAC. If not set, it is set to the estimated fee.
memostringA memo string for the transaction.

Result

FieldTypeDescription
raw_transactionstringThe raw transaction data.

pactus.transaction.get_raw_bond_transaction

GetRawBondTransaction retrieves raw details of a bond transaction.

Parameters

FieldTypeDescription
lock_timenumericThe lock time for the transaction. If not set, defaults to the last block height.
senderstringThe sender's account address.
receiverstringThe receiver's validator address.
stakenumericThe stake amount in NanoPAC. Must be greater than 0.
public_keystringThe public key of the validator.
feenumericThe transaction fee in NanoPAC. If not set, it is set to the estimated fee.
memostringA memo string for the transaction.

Result

FieldTypeDescription
raw_transactionstringThe raw transaction data.

pactus.transaction.get_raw_unbond_transaction

GetRawUnbondTransaction retrieves raw details of an unbond transaction.

Parameters

FieldTypeDescription
lock_timenumericThe lock time for the transaction. If not set, defaults to the last block height.
validator_addressstringThe address of the validator to unbond from.
memostringA memo string for the transaction.

Result

FieldTypeDescription
raw_transactionstringThe raw transaction data.

pactus.transaction.get_raw_withdraw_transaction

GetRawWithdrawTransaction retrieves raw details of a withdraw transaction.

Parameters

FieldTypeDescription
lock_timenumericThe lock time for the transaction. If not set, defaults to the last block height.
validator_addressstringThe address of the validator to withdraw from.
account_addressstringThe address of the account to withdraw to.
amountnumericThe withdrawal amount in NanoPAC. Must be greater than 0.
feenumericThe transaction fee in NanoPAC. If not set, it is set to the estimated fee.
memostringA memo string for the transaction.

Result

FieldTypeDescription
raw_transactionstringThe raw transaction data.

Blockchain Service

Blockchain service defines RPC methods for interacting with the blockchain.

pactus.blockchain.get_block

GetBlock retrieves information about a block based on the provided request parameters.

Parameters

FieldTypeDescription
heightnumericThe height of the block to retrieve.
verbositystring(Enum) The verbosity level for block information.
Available values:
  • BLOCK_DATA = Request only block data.
  • BLOCK_INFO = Request block information and transaction IDs.
  • BLOCK_TRANSACTIONS = Request block information and detailed transaction data.

Result

FieldTypeDescription
heightnumericThe height of the block.
hashstringThe hash of the block.
datastringBlock data, available only if verbosity level is set to BLOCK_DATA.
block_timenumericThe timestamp of the block.
headerobjectHeader information of the block.
header.versionnumericThe version of the block.
header.prev_block_hashstringThe hash of the previous block.
header.state_rootstringThe state root hash of the blockchain.
header.sortition_seedstringThe sortition seed of the block.
header.proposer_addressstringThe address of the proposer of the block.
prev_certobjectCertificate information of the previous block.
prev_cert.hashstringThe hash of the certificate.
prev_cert.roundnumericThe round of the certificate.
prev_cert.committersrepeated numericList of committers in the certificate.
prev_cert.absenteesrepeated numericList of absentees in the certificate.
prev_cert.signaturestringThe signature of the certificate.
txsrepeated objectList of transactions in the block, available when verbosity level is set to BLOCK_TRANSACTIONS.
txs[].idstringThe unique ID of the transaction.
txs[].datastringThe raw transaction data.
txs[].versionnumericThe version of the transaction.
txs[].lock_timenumericThe lock time for the transaction.
txs[].valuenumericThe value of the transaction in NanoPAC.
txs[].feenumericThe fee for the transaction in NanoPAC.
txs[].payload_typestring(Enum) The type of transaction payload.
Available values:
  • UNKNOWN = Unknown payload type.
  • TRANSFER_PAYLOAD = Transfer payload type.
  • BOND_PAYLOAD = Bond payload type.
  • SORTITION_PAYLOAD = Sortition payload type.
  • UNBOND_PAYLOAD = Unbond payload type.
  • WITHDRAW_PAYLOAD = Withdraw payload type.
txs[].transferobject(OneOf) Transfer transaction payload.
txs[].transfer.senderstringThe sender's address.
txs[].transfer.receiverstringThe receiver's address.
txs[].transfer.amountnumericThe amount to be transferred in NanoPAC.
txs[].bondobject(OneOf) Bond transaction payload.
txs[].bond.senderstringThe sender's address.
txs[].bond.receiverstringThe receiver's address.
txs[].bond.stakenumericThe stake amount in NanoPAC.
txs[].sortitionobject(OneOf) Sortition transaction payload.
txs[].sortition.addressstringThe validator address associated with the sortition proof.
txs[].sortition.proofstringThe proof for the sortition.
txs[].unbondobject(OneOf) Unbond transaction payload.
txs[].unbond.validatorstringThe address of the validator to unbond from.
txs[].withdrawobject(OneOf) Withdraw transaction payload.
txs[].withdraw.fromstringThe address to withdraw from.
txs[].withdraw.tostringThe address to withdraw to.
txs[].withdraw.amountnumericThe withdrawal amount in NanoPAC.
txs[].memostringA memo string for the transaction.
txs[].public_keystringThe public key associated with the transaction.
txs[].signaturestringThe signature for the transaction.

pactus.blockchain.get_block_hash

GetBlockHash retrieves the hash of a block at the specified height.

Parameters

FieldTypeDescription
heightnumericThe height of the block to retrieve the hash for.

Result

FieldTypeDescription
hashstringThe hash of the block.

pactus.blockchain.get_block_height

GetBlockHeight retrieves the height of a block with the specified hash.

Parameters

FieldTypeDescription
hashstringThe hash of the block to retrieve the height for.

Result

FieldTypeDescription
heightnumericThe height of the block.

pactus.blockchain.get_blockchain_info

GetBlockchainInfo retrieves general information about the blockchain.

Parameters

Parameters has no fields.

Result

FieldTypeDescription
last_block_heightnumericThe height of the last block in the blockchain.
last_block_hashstringThe hash of the last block in the blockchain.
total_accountsnumericThe total number of accounts in the blockchain.
total_validatorsnumericThe total number of validators in the blockchain.
total_powernumericThe total power of the blockchain.
committee_powernumericThe power of the committee.
committee_validatorsrepeated objectList of committee validators.
committee_validators[].hashstringThe hash of the validator.
committee_validators[].datastringThe serialized data of the validator.
committee_validators[].public_keystringThe public key of the validator.
committee_validators[].numbernumericThe unique number assigned to the validator.
committee_validators[].stakenumericThe stake of the validator in NanoPAC.
committee_validators[].last_bonding_heightnumericThe height at which the validator last bonded.
committee_validators[].last_sortition_heightnumericThe height at which the validator last participated in sortition.
committee_validators[].unbonding_heightnumericThe height at which the validator will unbond.
committee_validators[].addressstringThe address of the validator.
committee_validators[].availability_scorenumericThe availability score of the validator.

pactus.blockchain.get_consensus_info

GetConsensusInfo retrieves information about the consensus instances.

Parameters

Parameters has no fields.

Result

FieldTypeDescription
instancesrepeated objectList of consensus instances.
instances[].addressstringThe address of the consensus instance.
instances[].activebooleanIndicates whether the consensus instance is active and part of the committee.
instances[].heightnumericThe height of the consensus instance.
instances[].roundnumericThe round of the consensus instance.
instances[].votesrepeated objectList of votes in the consensus instance.
instances[].votes[].typestring(Enum) The type of the vote.
Available values:
  • VOTE_UNKNOWN = Unknown vote type.
  • VOTE_PREPARE = Prepare vote type.
  • VOTE_PRECOMMIT = Precommit vote type.
  • VOTE_CHANGE_PROPOSER = Change proposer vote type.
instances[].votes[].voterstringThe address of the voter.
instances[].votes[].block_hashstringThe hash of the block being voted on.
instances[].votes[].roundnumericThe consensus round of the vote.
instances[].votes[].cp_roundnumericThe change-proposer round of the vote.
instances[].votes[].cp_valuenumericThe change-proposer value of the vote.

pactus.blockchain.get_account

GetAccount retrieves information about an account based on the provided address.

Parameters

FieldTypeDescription
addressstringThe address of the account to retrieve information for.

Result

FieldTypeDescription
accountobjectDetailed information about the account.
account.hashstringThe hash of the account.
account.datastringThe serialized data of the account.
account.numbernumericThe unique number assigned to the account.
account.balancenumericThe balance of the account in NanoPAC.
account.addressstringThe address of the account.

pactus.blockchain.get_validator

GetValidator retrieves information about a validator based on the provided address.

Parameters

FieldTypeDescription
addressstringThe address of the validator to retrieve information for.

Result

FieldTypeDescription
validatorobjectDetailed information about the validator.
validator.hashstringThe hash of the validator.
validator.datastringThe serialized data of the validator.
validator.public_keystringThe public key of the validator.
validator.numbernumericThe unique number assigned to the validator.
validator.stakenumericThe stake of the validator in NanoPAC.
validator.last_bonding_heightnumericThe height at which the validator last bonded.
validator.last_sortition_heightnumericThe height at which the validator last participated in sortition.
validator.unbonding_heightnumericThe height at which the validator will unbond.
validator.addressstringThe address of the validator.
validator.availability_scorenumericThe availability score of the validator.

pactus.blockchain.get_validator_by_number

GetValidatorByNumber retrieves information about a validator based on the provided number.

Parameters

FieldTypeDescription
numbernumericThe unique number of the validator to retrieve information for.

Result

FieldTypeDescription
validatorobjectDetailed information about the validator.
validator.hashstringThe hash of the validator.
validator.datastringThe serialized data of the validator.
validator.public_keystringThe public key of the validator.
validator.numbernumericThe unique number assigned to the validator.
validator.stakenumericThe stake of the validator in NanoPAC.
validator.last_bonding_heightnumericThe height at which the validator last bonded.
validator.last_sortition_heightnumericThe height at which the validator last participated in sortition.
validator.unbonding_heightnumericThe height at which the validator will unbond.
validator.addressstringThe address of the validator.
validator.availability_scorenumericThe availability score of the validator.

pactus.blockchain.get_validator_addresses

GetValidatorAddresses retrieves a list of all validator addresses.

Parameters

Parameters has no fields.

Result

FieldTypeDescription
addressesrepeated stringList of validator addresses.

pactus.blockchain.get_public_key

GetPublicKey retrieves the public key of an account based on the provided address.

Parameters

FieldTypeDescription
addressstringThe address for which to retrieve the public key.

Result

FieldTypeDescription
public_keystringThe public key associated with the provided address.

pactus.blockchain.get_tx_pool_content

GetTxPoolContent retrieves current transactions in the transaction pool.

Parameters

FieldTypeDescription
payload_typestring(Enum) The type of transactions to retrieve from the transaction pool. 0 means all types.
Available values:
  • UNKNOWN = Unknown payload type.
  • TRANSFER_PAYLOAD = Transfer payload type.
  • BOND_PAYLOAD = Bond payload type.
  • SORTITION_PAYLOAD = Sortition payload type.
  • UNBOND_PAYLOAD = Unbond payload type.
  • WITHDRAW_PAYLOAD = Withdraw payload type.

Result

FieldTypeDescription
txsrepeated objectList of transactions currently in the pool.
txs[].idstringThe unique ID of the transaction.
txs[].datastringThe raw transaction data.
txs[].versionnumericThe version of the transaction.
txs[].lock_timenumericThe lock time for the transaction.
txs[].valuenumericThe value of the transaction in NanoPAC.
txs[].feenumericThe fee for the transaction in NanoPAC.
txs[].payload_typestring(Enum) The type of transaction payload.
Available values:
  • UNKNOWN = Unknown payload type.
  • TRANSFER_PAYLOAD = Transfer payload type.
  • BOND_PAYLOAD = Bond payload type.
  • SORTITION_PAYLOAD = Sortition payload type.
  • UNBOND_PAYLOAD = Unbond payload type.
  • WITHDRAW_PAYLOAD = Withdraw payload type.
txs[].transferobject(OneOf) Transfer transaction payload.
txs[].transfer.senderstringThe sender's address.
txs[].transfer.receiverstringThe receiver's address.
txs[].transfer.amountnumericThe amount to be transferred in NanoPAC.
txs[].bondobject(OneOf) Bond transaction payload.
txs[].bond.senderstringThe sender's address.
txs[].bond.receiverstringThe receiver's address.
txs[].bond.stakenumericThe stake amount in NanoPAC.
txs[].sortitionobject(OneOf) Sortition transaction payload.
txs[].sortition.addressstringThe validator address associated with the sortition proof.
txs[].sortition.proofstringThe proof for the sortition.
txs[].unbondobject(OneOf) Unbond transaction payload.
txs[].unbond.validatorstringThe address of the validator to unbond from.
txs[].withdrawobject(OneOf) Withdraw transaction payload.
txs[].withdraw.fromstringThe address to withdraw from.
txs[].withdraw.tostringThe address to withdraw to.
txs[].withdraw.amountnumericThe withdrawal amount in NanoPAC.
txs[].memostringA memo string for the transaction.
txs[].public_keystringThe public key associated with the transaction.
txs[].signaturestringThe signature for the transaction.

Network Service

Network service provides RPCs for retrieving information about the network.

pactus.network.get_network_info

GetNetworkInfo retrieves information about the overall network.

Parameters

FieldTypeDescription
only_connectedbooleanIf true, only returns peers with connected status.

Result

FieldTypeDescription
network_namestringName of the network.
total_sent_bytesnumericTotal bytes sent across the network.
total_received_bytesnumericTotal bytes received across the network.
connected_peers_countnumericNumber of connected peers.
connected_peersrepeated objectList of connected peers.
connected_peers[].statusnumericStatus of the peer.
connected_peers[].monikerstringMoniker of the peer.
connected_peers[].agentstringAgent information of the peer.
connected_peers[].peer_idstringPeer ID of the peer.
connected_peers[].consensus_keysrepeated stringConsensus keys used by the peer.
connected_peers[].consensus_addressesrepeated stringConsensus addresses of the peer.
connected_peers[].servicesnumericServices provided by the peer.
connected_peers[].last_block_hashstringHash of the last block the peer knows.
connected_peers[].heightnumericBlockchain height of the peer.
connected_peers[].received_bundlesnumericNumber of received bundles.
connected_peers[].invalid_bundlesnumericNumber of invalid bundles received.
connected_peers[].last_sentnumericTimestamp of the last sent bundle.
connected_peers[].last_receivednumericTimestamp of the last received bundle.
connected_peers[].sent_bytesobjectBytes sent per message type.
connected_peers[].received_bytesobjectBytes received per message type.
connected_peers[].addressstringNetwork address of the peer.
connected_peers[].directionstringDirection of connection with the peer.
connected_peers[].protocolsrepeated stringList of protocols supported by the peer.
connected_peers[].total_sessionsnumericTotal download sessions with the peer.
connected_peers[].completed_sessionsnumericCompleted download sessions with the peer.
sent_bytesobjectBytes sent per peer ID.
received_bytesobjectBytes received per peer ID.

pactus.network.get_node_info

GetNodeInfo retrieves information about a specific node in the network.

Parameters

Parameters has no fields.

Result

FieldTypeDescription
monikerstringMoniker of the node.
agentstringAgent information of the node.
peer_idstringPeer ID of the node.
started_atnumericTimestamp when the node started.
reachabilitystringReachability status of the node.
servicesrepeated numericList of services provided by the node.
services_namesrepeated stringNames of services provided by the node.
local_addrsrepeated stringList of addresses associated with the node.
protocolsrepeated stringList of protocols supported by the node.
clock_offsetnumericClock offset of the node.
connection_infoobjectInformation about the node's connections.
connection_info.connectionsnumericTotal number of connections.
connection_info.inbound_connectionsnumericNumber of inbound connections.
connection_info.outbound_connectionsnumericNumber of outbound connections.

Wallet Service

Define the Wallet service with various RPC methods for wallet management.

pactus.wallet.create_wallet

CreateWallet creates a new wallet with the specified parameters.

Parameters

FieldTypeDescription
wallet_namestringThe name of the new wallet.
passwordstringThe password for securing the wallet.

Result

FieldTypeDescription
mnemonicstringThe mnemonic for wallet recovery.

pactus.wallet.restore_wallet

RestoreWallet restores an existing wallet with the given mnemonic.

Parameters

FieldTypeDescription
wallet_namestringThe name of the wallet to restore.
mnemonicstringThe mnemonic for wallet recovery.
passwordstringThe password for securing the wallet.

Result

FieldTypeDescription
wallet_namestringThe name of the restored wallet.

pactus.wallet.load_wallet

LoadWallet loads an existing wallet with the given name.

Parameters

FieldTypeDescription
wallet_namestringThe name of the wallet to load.

Result

FieldTypeDescription
wallet_namestringThe name of the loaded wallet.

pactus.wallet.unload_wallet

UnloadWallet unloads a currently loaded wallet with the specified name.

Parameters

FieldTypeDescription
wallet_namestringThe name of the wallet to unload.

Result

FieldTypeDescription
wallet_namestringThe name of the unloaded wallet.

pactus.wallet.get_total_balance

GetTotalBalance returns the total available balance of the wallet.

Parameters

FieldTypeDescription
wallet_namestringThe name of the wallet to get the total balance.

Result

FieldTypeDescription
wallet_namestringThe name of the wallet.
total_balancenumericThe total balance of the wallet in NanoPAC.

pactus.wallet.sign_raw_transaction

SignRawTransaction signs a raw transaction for a specified wallet.

Parameters

FieldTypeDescription
wallet_namestringThe name of the wallet used for signing.
raw_transactionstringThe raw transaction data to be signed.
passwordstringThe password for unlocking the wallet for signing.

Result

FieldTypeDescription
transaction_idstringThe ID of the signed transaction.
signed_raw_transactionstringThe signed raw transaction data.

pactus.wallet.get_validator_address

GetValidatorAddress retrieves the validator address associated with a public key.

Parameters

FieldTypeDescription
public_keystringThe public key for which the validator address is requested.

Result

FieldTypeDescription
addressstringThe validator address associated with the public key.

pactus.wallet.get_new_address

GetNewAddress generates a new address for the specified wallet.

Parameters

FieldTypeDescription
wallet_namestringThe name of the wallet to generate a new address.
address_typestring(Enum) The type of address to generate.
Available values:
  • ADDRESS_TYPE_TREASURY =
  • ADDRESS_TYPE_VALIDATOR =
  • ADDRESS_TYPE_BLS_ACCOUNT =
labelstringA label for the new address.

Result

FieldTypeDescription
wallet_namestringThe name of the wallet from which the address is generated.
address_infoobjectInformation about the newly generated address.
address_info.addressstringThe address string.
address_info.public_keystringThe public key associated with the address.
address_info.labelstringA label associated with the address.
address_info.pathstringThe Hierarchical Deterministic path of the address within the wallet.

pactus.wallet.get_address_history

GetAddressHistory retrieves the transaction history of an address.

Parameters

FieldTypeDescription
wallet_namestringThe name of the wallet.
addressstringThe address to retrieve the transaction history for.

Result

FieldTypeDescription
history_inforepeated objectArray of history information for the address.
history_info[].transaction_idstringThe transaction ID hash.
history_info[].timenumericThe timestamp of the transaction.
history_info[].payload_typestringThe payload type of the transaction.
history_info[].descriptionstringA description of the transaction.
history_info[].amountnumericThe amount involved in the transaction.
Last updated on