JSON-RPC API Reference

JSON-RPC API Reference

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

All the amounts and values in JSON-RPC 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.

Example

To call JSON-RPC methods, you need to create the JSON-RPC request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "pactus.network.get_node_info",
  "params": {}
}

Make sure you always add the params field, even if no parameters are needed, and ensure you use curly braces.

Then you use the curl command to send the request to the node:

curl --location 'http://localhost:8545/' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "pactus.network.get_node_info",
    "params": {}
}'

Before sending the request, you need to enable the JSON-RPC service inside the configuration.

Using Basic Auth

If you have enabled the gRPC Basic Authentication, then you need to set the Authorization header.

curl --location 'http://localhost:8545/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <BASIC-AUTH-TOKEN>' \
--data '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "pactus.blockchain.get_account",
    "params": {
        "address": "pc1z2r0fmu8sg2ffa0tgrr08gnefcxl2kq7wvquf8z"
    }
}'

JSON-RPC Methods

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.
verbositynumeric(Enum)The verbosity level for transaction details.
Available values:
  • TRANSACTION_DATA = 0 (Request transaction data only.)
  • TRANSACTION_INFO = 1 (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_typenumeric(Enum)The type of transaction payload.
Available values:
  • UNKNOWN = 0 (Unknown payload type.)
  • TRANSFER_PAYLOAD = 1 (Transfer payload type.)
  • BOND_PAYLOAD = 2 (Bond payload type.)
  • SORTITION_PAYLOAD = 3 (Sortition payload type.)
  • UNBOND_PAYLOAD = 4 (Unbond payload type.)
  • WITHDRAW_PAYLOAD = 5 (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.bond.public_keystringThe public key of the validator.
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.validator_addressstringThe address of the validator to withdraw from.
transaction.withdraw.account_addressstringThe address of the account 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_typenumeric(Enum)The type of transaction payload.
Available values:
  • UNKNOWN = 0 (Unknown payload type.)
  • TRANSFER_PAYLOAD = 1 (Transfer payload type.)
  • BOND_PAYLOAD = 2 (Bond payload type.)
  • SORTITION_PAYLOAD = 3 (Sortition payload type.)
  • UNBOND_PAYLOAD = 4 (Unbond payload type.)
  • WITHDRAW_PAYLOAD = 5 (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_transaction

GetRawTransaction retrieves raw details of transfer, bond, unbond or withdraw transaction.

Parameters

FieldTypeDescription
lock_timenumericThe lock time for the transaction. If not set, defaults to the last block height.
memostringA memo string for the transaction.
feenumericThe fee for the transaction in NanoPAC.
transferobject(OneOf)
bondobject(OneOf)
unbondobject(OneOf)
withdrawobject(OneOf)

Result

FieldTypeDescription
raw_transactionstringThe raw transaction data.
idstringThe unique ID of the transaction.

pactus.transaction.get_raw_transfer_transaction

Deprecated: GetRawTransferTransaction retrieves raw details of a transfer transaction. Use GetRawTransaction instead.

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.
idstringThe unique ID of the transaction.

pactus.transaction.get_raw_bond_transaction

Deprecated: GetRawBondTransaction retrieves raw details of a bond transaction. Use GetRawTransaction instead.

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.
idstringThe unique ID of the transaction.

pactus.transaction.get_raw_unbond_transaction

Deprecated: GetRawUnbondTransaction retrieves raw details of an unbond transaction. Use GetRawTransaction instead.

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.
idstringThe unique ID of the transaction.

pactus.transaction.get_raw_withdraw_transaction

Deprecated: GetRawWithdrawTransaction retrieves raw details of a withdraw transaction. Use GetRawTransaction instead.

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.
idstringThe unique ID of the transaction.

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.
verbositynumeric(Enum)The verbosity level for block information.
Available values:
  • BLOCK_DATA = 0 (Request only block data.)
  • BLOCK_INFO = 1 (Request block information and transaction IDs.)
  • BLOCK_TRANSACTIONS = 2 (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_typenumeric(Enum)The type of transaction payload.
Available values:
  • UNKNOWN = 0 (Unknown payload type.)
  • TRANSFER_PAYLOAD = 1 (Transfer payload type.)
  • BOND_PAYLOAD = 2 (Bond payload type.)
  • SORTITION_PAYLOAD = 3 (Sortition payload type.)
  • UNBOND_PAYLOAD = 4 (Unbond payload type.)
  • WITHDRAW_PAYLOAD = 5 (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[].bond.public_keystringThe public key of the validator.
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.validator_addressstringThe address of the validator to withdraw from.
txs[].withdraw.account_addressstringThe address of the account 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.
is_prunedbooleanIf the blocks are subject to pruning.
pruning_heightnumericLowest-height block stored (only present if pruning is enabled)
last_block_timenumericTimestamp of the last block in Unix format

pactus.blockchain.get_consensus_info

GetConsensusInfo retrieves information about the consensus instances.

Parameters

Parameters has no fields.

Result

FieldTypeDescription
proposalobjectThe proposal of the consensus info.
proposal.heightnumericThe height of the proposal.
proposal.roundnumericThe round of the proposal.
proposal.block_datastringThe block data of the proposal.
proposal.signaturestringThe signature of the proposal, signed by the proposer.
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[].typenumeric(Enum)The type of the vote.
Available values:
  • VOTE_UNKNOWN = 0 (Unknown vote type.)
  • VOTE_PREPARE = 1 (Prepare vote type.)
  • VOTE_PRECOMMIT = 2 (Precommit vote type.)
  • VOTE_CHANGE_PROPOSER = 3 (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_typenumeric(Enum)The type of transactions to retrieve from the transaction pool. 0 means all types.
Available values:
  • UNKNOWN = 0 (Unknown payload type.)
  • TRANSFER_PAYLOAD = 1 (Transfer payload type.)
  • BOND_PAYLOAD = 2 (Bond payload type.)
  • SORTITION_PAYLOAD = 3 (Sortition payload type.)
  • UNBOND_PAYLOAD = 4 (Unbond payload type.)
  • WITHDRAW_PAYLOAD = 5 (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_typenumeric(Enum)The type of transaction payload.
Available values:
  • UNKNOWN = 0 (Unknown payload type.)
  • TRANSFER_PAYLOAD = 1 (Transfer payload type.)
  • BOND_PAYLOAD = 2 (Bond payload type.)
  • SORTITION_PAYLOAD = 3 (Sortition payload type.)
  • UNBOND_PAYLOAD = 4 (Unbond payload type.)
  • WITHDRAW_PAYLOAD = 5 (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[].bond.public_keystringThe public key of the validator.
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.validator_addressstringThe address of the validator to withdraw from.
txs[].withdraw.account_addressstringThe address of the account 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, returns only peers that are currently connected.

Result

FieldTypeDescription
network_namestringName of the network.
connected_peers_countnumericNumber of connected peers.
connected_peersrepeated objectList of connected peers.
connected_peers[].statusnumericCurrent status of the peer (e.g., connected, disconnected).
connected_peers[].monikerstringMoniker of the peer.
connected_peers[].agentstringVersion and agent details of the peer.
connected_peers[].peer_idstringPeer ID of the peer.
connected_peers[].consensus_keysrepeated stringList of consensus keys used by the peer.
connected_peers[].consensus_addressesrepeated stringList of consensus addresses used by the peer.
connected_peers[].servicesnumericBitfield representing the services 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[].last_sentnumericTime the last bundle sent to the peer (in epoch format).
connected_peers[].last_receivednumericTime the last bundle received from the peer (in epoch format).
connected_peers[].addressstringNetwork address of the peer.
connected_peers[].directionstringConnection direction (e.g., inbound, outbound).
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.
connected_peers[].metric_infoobjectMetrics related to peer activity.
connected_peers[].metric_info.TotalInvalidobjectTotal number of invalid bundles.
connected_peers[].metric_info.TotalSentobjectTotal number of bundles sent.
connected_peers[].metric_info.TotalReceivedobjectTotal number of bundles received.
connected_peers[].metric_info.MessageSentobjectNumber of sent bundles categorized by message type.
connected_peers[].metric_info.MessageReceivedobjectNumber of received bundles categorized by message type.
metric_infoobjectMetrics related to node activity.
metric_info.TotalInvalidobjectTotal number of invalid bundles.
metric_info.TotalInvalid.BytesnumericTotal number of bytes.
metric_info.TotalInvalid.BundlesnumericTotal number of bundles.
metric_info.TotalSentobjectTotal number of bundles sent.
metric_info.TotalSent.BytesnumericTotal number of bytes.
metric_info.TotalSent.BundlesnumericTotal number of bundles.
metric_info.TotalReceivedobjectTotal number of bundles received.
metric_info.TotalReceived.BytesnumericTotal number of bytes.
metric_info.TotalReceived.BundlesnumericTotal number of bundles.
metric_info.MessageSentobjectNumber of sent bundles categorized by message type.
metric_info.MessageReceivedobjectNumber of received bundles categorized by message type.

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.
agentstringVersion and agent details of the node.
peer_idstringPeer ID of the node.
started_atnumericTime the node was started (in epoch format).
reachabilitystringReachability status of the node.
servicesnumericBitfield representing the services provided by the node.
services_namesstringNames of services provided by the node.
local_addrsrepeated stringList of addresses associated with the node.
protocolsrepeated stringList of protocols supported by the node.
clock_offsetnumericOffset between the node's clock and the network's clock (in seconds).
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.

Utils Service

Utils service defines RPC methods for utility functions such as message signing and verification.

pactus.utils.sign_message_with_private_key

SignMessageWithPrivateKey sign message with provided private key.

Parameters

FieldTypeDescription
private_keystringThe private key to sign the message.
messagestringThe message to sign.

Result

FieldTypeDescription
signaturestringThe signature of the message.

pactus.utils.verify_message

VerifyMessage verify signature with public key and message

Parameters

FieldTypeDescription
messagestringThe signed message.
signaturestringThe signature of the message.
public_keystringThe public key of the signer.

Result

FieldTypeDescription
is_validbooleanIndicates if the signature is valid (true) or not (false).

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_typenumeric(Enum)The type of address to generate.
Available values:
  • ADDRESS_TYPE_TREASURY = 0 (Treasury address type. Should not be used to generate new addresses.)
  • ADDRESS_TYPE_VALIDATOR = 1 (Validator address type.)
  • ADDRESS_TYPE_BLS_ACCOUNT = 2 (Account address type with BLS signature scheme.)
  • ADDRESS_TYPE_ED25519_ACCOUNT = 3 (Account address type with Ed25519 signature scheme. Note: Generating a new Ed25519 address requires the wallet password.)
labelstringA label for the new address.
passwordstringPassword for the new address. It's required when address_type is ADDRESS_TYPE_ED25519_ACCOUNT.

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.

pactus.wallet.sign_message

SignMessage signs an arbitrary message.

Parameters

FieldTypeDescription
wallet_namestringThe name of the wallet.
passwordstringThe password for unlocking the wallet for signing.
addressstringThe account address associated with the private key.
messagestringThe arbitrary message to be signed.

Result

FieldTypeDescription
signaturestringSignature of the message.

pactus.wallet.get_total_stake

GetTotalStake return total stake of wallet.

Parameters

FieldTypeDescription
wallet_namestringThe name of the wallet.

Result

FieldTypeDescription
total_stakenumeric
wallet_namestring

pactus.wallet.get_address_info

GetAddressInfo return address information.

Parameters

FieldTypeDescription
wallet_namestringThe name of the wallet to generate a new address.
addressstring
</td>

Result

FieldTypeDescription
addressstring
</td>
labelstring
</td>
public_keystring
</td>
pathstring
</td>
wallet_namestring
</td>

pactus.wallet.set_address_label

SetAddressLabel set label for given address.

Parameters

FieldTypeDescription
wallet_namestringThe name of the wallet to generate a new address.
passwordstringThe password for unlocking the wallet for signing.
addressstring
</td>
labelstring
</td>

Result

FieldTypeDescription

pactus.wallet.list_wallet

ListWallet return list wallet name.

Parameters

Parameters has no fields.

Result

FieldTypeDescription
walletsrepeated string
</td>

pactus.wallet.get_wallet_info

GetWalletInfo return wallet information.

Parameters

FieldTypeDescription
wallet_namestring
</td>

Result

FieldTypeDescription
wallet_namestring
</td>
versionnumeric
</td>
networkstring
</td>
encryptedboolean
</td>
uuidstring
</td>
created_atnumeric
</td>

pactus.wallet.list_address

ListAddress return list address in wallet.

Parameters

FieldTypeDescription
wallet_namestring
</td>

Result

FieldTypeDescription
datarepeated object
</td>
data[].addressstringThe address string.
data[].public_keystringThe public key associated with the address.
data[].labelstringA label associated with the address.
data[].pathstringThe Hierarchical Deterministic path of the address within the wallet.
Last updated on