gRPC 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.

Table of Contents

Transaction Service transaction.proto

Transaction service defines various RPC methods for interacting with

transactions.

GetTransaction rpc

Request message: GetTransactionRequest
Response message: GetTransactionResponse

GetTransaction retrieves transaction details based on the provided request

parameters.

CalculateFee rpc

Request message: CalculateFeeRequest
Response message: CalculateFeeResponse

CalculateFee calculates the transaction fee based on the specified amount

and payload type.

BroadcastTransaction rpc

BroadcastTransaction broadcasts a signed transaction to the network.

GetRawTransferTransaction rpc

Response message: GetRawTransactionResponse

GetRawTransferTransaction retrieves raw details of a transfer transaction.

GetRawBondTransaction rpc

Response message: GetRawTransactionResponse

GetRawBondTransaction retrieves raw details of a bond transaction.

GetRawUnbondTransaction rpc

Response message: GetRawTransactionResponse

GetRawUnbondTransaction retrieves raw details of an unbond transaction.

GetRawWithdrawTransaction rpc

Response message: GetRawTransactionResponse

GetRawWithdrawTransaction retrieves raw details of a withdraw transaction.

Blockchain Service blockchain.proto

Blockchain service defines RPC methods for interacting with the blockchain.

GetBlock rpc

Request message: GetBlockRequest
Response message: GetBlockResponse

GetBlock retrieves information about a block based on the provided request

parameters.

GetBlockHash rpc

Request message: GetBlockHashRequest
Response message: GetBlockHashResponse

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

GetBlockHeight rpc

Request message: GetBlockHeightRequest
Response message: GetBlockHeightResponse

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

GetBlockchainInfo rpc

Request message: GetBlockchainInfoRequest
Response message: GetBlockchainInfoResponse

GetBlockchainInfo retrieves general information about the blockchain.

GetConsensusInfo rpc

Request message: GetConsensusInfoRequest
Response message: GetConsensusInfoResponse

GetConsensusInfo retrieves information about the consensus instances.

GetAccount rpc

Request message: GetAccountRequest
Response message: GetAccountResponse

GetAccount retrieves information about an account based on the provided

address.

GetValidator rpc

Request message: GetValidatorRequest
Response message: GetValidatorResponse

GetValidator retrieves information about a validator based on the provided

address.

GetValidatorByNumber rpc

Response message: GetValidatorResponse

GetValidatorByNumber retrieves information about a validator based on the

provided number.

GetValidatorAddresses rpc

GetValidatorAddresses retrieves a list of all validator addresses.

GetPublicKey rpc

Request message: GetPublicKeyRequest
Response message: GetPublicKeyResponse

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

address.

Network Service network.proto

Network service provides RPCs for retrieving information about the network.

GetNetworkInfo rpc

Request message: GetNetworkInfoRequest
Response message: GetNetworkInfoResponse

GetNetworkInfo retrieves information about the overall network.

GetNodeInfo rpc

Request message: GetNodeInfoRequest
Response message: GetNodeInfoResponse

GetNodeInfo retrieves information about a specific node in the network.

Wallet Service wallet.proto

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

CreateWallet rpc

Request message: CreateWalletRequest
Response message: CreateWalletResponse

CreateWallet creates a new wallet with the specified parameters.

LoadWallet rpc

Request message: LoadWalletRequest
Response message: LoadWalletResponse

LoadWallet loads an existing wallet with the given name.

UnloadWallet rpc

Request message: UnloadWalletRequest
Response message: UnloadWalletResponse

UnloadWallet unloads a currently loaded wallet with the specified name.

LockWallet rpc

Request message: LockWalletRequest
Response message: LockWalletResponse

LockWallet locks a currently loaded wallet with the provided password and

timeout.

UnlockWallet rpc

Request message: UnlockWalletRequest
Response message: UnlockWalletResponse

UnlockWallet unlocks a locked wallet with the provided password and

timeout.

GetTotalBalance rpc

Request message: GetTotalBalanceRequest
Response message: GetTotalBalanceResponse

GetTotalBalance returns the total available balance of the wallet.

SignRawTransaction rpc

Request message: SignRawTransactionRequest
Response message: SignRawTransactionResponse

SignRawTransaction signs a raw transaction for a specified wallet.

GetValidatorAddress rpc

Response message: GetValidatorAddressResponse

GetValidatorAddress retrieves the validator address associated with a

public key.

GetNewAddress rpc

Request message: GetNewAddressRequest
Response message: GetNewAddressResponse

GetNewAddress generates a new address for the specified wallet.

GetAddressHistory rpc

Request message: GetAddressHistoryRequest
Response message: GetAddressHistoryResponse

GetAddressHistory retrieve transaction history of an address.

Messages and Enums

BroadcastTransactionRequest msg

Request message for broadcasting a signed transaction.

FieldTypeDescription
signed_raw_transaction bytes Signed raw transaction data.

BroadcastTransactionResponse msg

Response message containing the ID of the broadcasted transaction.

FieldTypeDescription
id bytes Transaction ID.

CalculateFeeRequest msg

Request message for calculating transaction fee.

FieldTypeDescription
amount int64 Transaction amount in NanoPAC.
payload_type PayloadType Type of transaction payload.
fixed_amount bool Indicates that amount should be fixed and includes the fee.

CalculateFeeResponse msg

Response message containing the calculated transaction fee.

FieldTypeDescription
amount int64 Calculated amount in NanoPAC.
fee int64 Calculated transaction fee in NanoPAC.

GetRawBondTransactionRequest msg

Request message for retrieving raw details of a bond transaction.

FieldTypeDescription
lock_time uint32 Lock time for the transaction. If not explicitly set, it sets to the last block height.
sender string Sender's account address.
receiver string Receiver's validator address.
stake int64 Stake amount in NanoPAC. It should be greater than 0.
public_key string Public key of the validator.
fee int64 Transaction fee in NanoPAC. If not explicitly set, it is calculated based on the stake.
memo string Transaction memo.

GetRawTransactionResponse msg

Response message containing raw transaction data.

FieldTypeDescription
raw_transaction bytes Raw transaction data.

GetRawTransferTransactionRequest msg

Request message for retrieving raw details of a transfer transaction.

FieldTypeDescription
lock_time uint32 Lock time for the transaction. If not explicitly set, it sets to the last block height.
sender string Sender's account address.
receiver string Receiver's account address.
amount int64 Transfer amount in NanoPAC. It should be greater than 0.
fee int64 Transaction fee in NanoPAC. If not explicitly set, it is calculated based on the amount.
memo string Transaction memo.

GetRawUnbondTransactionRequest msg

Request message for retrieving raw details of an unbond transaction.

FieldTypeDescription
lock_time uint32 Lock time for the transaction. If not explicitly set, it sets to the last block height.
validator_address string Address of the validator to unbond from.
memo string Transaction memo.

GetRawWithdrawTransactionRequest msg

Request message for retrieving raw details of a withdraw transaction.

FieldTypeDescription
lock_time uint32 Lock time for the transaction. If not explicitly set, it sets to the last block height.
validator_address string Address of the validator to withdraw from.
account_address string Address of the account to withdraw to.
amount int64 Withdrawal amount in NanoPAC. It should be greater than 0.
fee int64 Transaction fee in NanoPAC. If not explicitly set, it is calculated based on the amount.
memo string Transaction memo.

GetTransactionRequest msg

Request message for retrieving transaction details.

FieldTypeDescription
id bytes Transaction ID.
verbosity TransactionVerbosity Verbosity level for transaction details.

GetTransactionResponse msg

Response message containing details of a transaction.

FieldTypeDescription
block_height uint32 Height of the block containing the transaction.
block_time uint32 Time of the block containing the transaction.
transaction TransactionInfo Information about the transaction.

PayloadBond msg

Payload for a bond transaction.

FieldTypeDescription
sender string Sender's address.
receiver string Receiver's address.
stake int64 Stake amount in NanoPAC.

PayloadSortition msg

Payload for a sortition transaction.

FieldTypeDescription
address string Address associated with the sortition.
proof bytes Proof for the sortition.

PayloadTransfer msg

Payload for a transfer transaction.

FieldTypeDescription
sender string Sender's address.
receiver string Receiver's address.
amount int64 Transaction amount in NanoPAC.

PayloadUnbond msg

Payload for an unbond transaction.

FieldTypeDescription
validator string Address of the validator to unbond from.

PayloadWithdraw msg

Payload for a withdraw transaction.

FieldTypeDescription
from string Address to withdraw from.
to string Address to withdraw to.
amount int64 Withdrawal amount in NanoPAC.

TransactionInfo msg

Information about a transaction.

FieldTypeDescription
id bytes Transaction ID.
data bytes Transaction data.
version int32 Transaction version.
lock_time uint32 Lock time for the transaction.
value int64 Transaction value in NanoPAC.
fee int64 Transaction fee in NanoPAC.
payload_type PayloadType Type of transaction payload.
transfer PayloadTransfer Transfer payload.
bond PayloadBond Bond payload.
sortition PayloadSortition Sortition payload.
unbond PayloadUnbond Unbond payload.
withdraw PayloadWithdraw Withdraw payload.
memo string Transaction memo.
public_key string Public key associated with the transaction.
signature bytes Transaction signature.

AccountInfo msg

Message containing information about an account.

FieldTypeDescription
hash bytes Hash of the account.
data bytes Account data.
number int32 Account number.
balance int64 Account balance in NanoPAC.
address string Address of the account.

BlockHeaderInfo msg

Message containing information about the header of a block.

FieldTypeDescription
version int32 Block version.
prev_block_hash bytes Hash of the previous block.
state_root bytes State root of the block.
sortition_seed bytes Sortition seed of the block.
proposer_address string Address of the proposer of the block.

CertificateInfo msg

Message containing information about a certificate.

FieldTypeDescription
hash bytes Hash of the certificate.
round int32 Round of the certificate.
committers repeated int32 List of committers in the certificate.
absentees repeated int32 List of absentees in the certificate.
signature bytes Certificate signature.

ConsensusInfo msg

Message containing information about consensus.

FieldTypeDescription
address string Address of the consensus instance.
Active bool Whether the consensus instance is active.
height uint32 Height of the consensus instance.
round int32 Round of the consensus instance.
votes repeated VoteInfo List of votes in the consensus instance.

GetAccountRequest msg

Message to request account information based on an address.

FieldTypeDescription
address string Address of the account.

GetAccountResponse msg

Message containing the response with account information.

FieldTypeDescription
account AccountInfo Account information.

GetBlockHashRequest msg

Message to request block hash based on height.

FieldTypeDescription
height uint32 Height of the block.

GetBlockHashResponse msg

Message containing the response with the block hash.

FieldTypeDescription
hash bytes Hash of the block.

GetBlockHeightRequest msg

Message to request block height based on hash.

FieldTypeDescription
hash bytes Hash of the block.

GetBlockHeightResponse msg

Message containing the response with the block height.

FieldTypeDescription
height uint32 Height of the block.

GetBlockRequest msg

Message to request block information based on height and verbosity.

FieldTypeDescription
height uint32 Height of the block.
verbosity BlockVerbosity Verbosity level for block information.

GetBlockResponse msg

Message containing the response with block information.

FieldTypeDescription
height uint32 Height of the block.
hash bytes Hash of the block.
data bytes Block data, only available if the verbosity level is set to BLOCK_DATA.
block_time uint32 Block timestamp.
header BlockHeaderInfo Block header information.
prev_cert CertificateInfo Certificate information of the previous block.
txs repeated TransactionInfo List of transactions in the block. Transaction information is available when the verbosity level is set to BLOCK_TRANSACTIONS.

GetBlockchainInfoRequest msg

Message to request general information about the blockchain.

Message has no fields.

GetBlockchainInfoResponse msg

Message containing the response with general blockchain information.

FieldTypeDescription
last_block_height uint32 Height of the last block.
last_block_hash bytes Hash of the last block.
total_accounts int32 Total number of accounts.
total_validators int32 Total number of validators.
total_power int64 Total power in the blockchain.
committee_power int64 Power of the committee.
committee_validators repeated ValidatorInfo List of committee validators.

GetConsensusInfoRequest msg

Message to request consensus information.

Message has no fields.

GetConsensusInfoResponse msg

Message containing the response with consensus information.

FieldTypeDescription
instances repeated ConsensusInfo List of consensus instances.

GetPublicKeyRequest msg

Message to request public key based on an address.

FieldTypeDescription
address string Address for which public key is requested.

GetPublicKeyResponse msg

Message containing the response with the public key.

FieldTypeDescription
public_key string Public key of the account.

GetValidatorAddressesRequest msg

Message to request validator addresses.

Message has no fields.

GetValidatorAddressesResponse msg

Message containing the response with a list of validator addresses.

FieldTypeDescription
addresses repeated string List of validator addresses.

GetValidatorByNumberRequest msg

Message to request validator information based on a validator number.

FieldTypeDescription
number int32 Validator number.

GetValidatorRequest msg

Message to request validator information based on an address.

FieldTypeDescription
address string Address of the validator.

GetValidatorResponse msg

Message containing the response with validator information.

FieldTypeDescription
validator ValidatorInfo Validator information.

ValidatorInfo msg

Message containing information about a validator.

FieldTypeDescription
hash bytes Hash of the validator.
data bytes Validator data.
public_key string Public key of the validator.
number int32 Validator number.
stake int64 Validator stake in NanoPAC.
last_bonding_height uint32 Last bonding height.
last_sortition_height uint32 Last sortition height.
unbonding_height uint32 Unbonding height.
address string Address of the validator.
availability_score double Availability score of the validator.

VoteInfo msg

Message containing information about a vote.

FieldTypeDescription
type VoteType Type of the vote.
voter string Voter's address.
block_hash bytes Hash of the block being voted on.
round int32 Round of the vote.
cp_round int32 Consensus round of the vote.
cp_value int32 Consensus value of the vote.

GetNetworkInfoRequest msg

Request message for retrieving overall network information.

Message has no fields.

GetNetworkInfoResponse msg

Response message containing information about the overall network.

FieldTypeDescription
network_name string Name of the network.
total_sent_bytes uint32 Total bytes sent across the network.
total_received_bytes uint32 Total bytes received across the network.
connected_peers_count uint32 Number of connected peers.
connected_peers repeated PeerInfo List of connected peers.
sent_bytes repeated GetNetworkInfoResponse.SentBytesEntry Bytes sent per peer ID.
received_bytes repeated GetNetworkInfoResponse.ReceivedBytesEntry Bytes received per peer ID.

GetNetworkInfoResponse.ReceivedBytesEntry msg

FieldTypeDescription
key uint32
value uint64

GetNetworkInfoResponse.SentBytesEntry msg

FieldTypeDescription
key uint32
value uint64

GetNodeInfoRequest msg

Request message for retrieving information about a specific node in the

network.

Message has no fields.

GetNodeInfoResponse msg

Response message containing information about a specific node in the network.

FieldTypeDescription
moniker string Moniker of the node.
agent string Agent information of the node.
peer_id bytes Peer ID of the node.
started_at uint64 Timestamp when the node started.
reachability string Reachability status of the node.
services repeated int32 List of services provided by the node.
services_names repeated string Names of services provided by the node.
addrs repeated string List of addresses associated with the node.
protocols repeated string List of protocols supported by the node.

PeerInfo msg

Information about a peer in the network.

FieldTypeDescription
status int32 Status of the peer.
moniker string Moniker of the peer.
agent string Agent information of the peer.
peer_id bytes Peer ID of the peer.
consensus_keys repeated string Consensus keys used by the peer.
consensus_address repeated string Consensus address of the peer.
services uint32 Services provided by the peer.
last_block_hash bytes Hash of the last block the peer knows.
height uint32 Height of the peer in the blockchain.
received_messages int32 Count of received messages.
invalid_messages int32 Count of invalid messages received.
last_sent int64 Timestamp of the last sent message.
last_received int64 Timestamp of the last received message.
sent_bytes repeated PeerInfo.SentBytesEntry Bytes sent per message type.
received_bytes repeated PeerInfo.ReceivedBytesEntry Bytes received per message type.
address string Network address of the peer.
direction string Direction of connection with the peer.
protocols repeated string List of protocols supported by the peer.
total_sessions int32 Total sessions with the peer.
completed_sessions int32 Completed sessions with the peer.

PeerInfo.ReceivedBytesEntry msg

FieldTypeDescription
key int32
value int64

PeerInfo.SentBytesEntry msg

FieldTypeDescription
key int32
value int64

AddressInfo msg

Message of address information.

FieldTypeDescription
address string
public_key string
label string
path string

CreateWalletRequest msg

Request message for creating a new wallet.

FieldTypeDescription
wallet_name string Name of the new wallet.
mnemonic string Mnemonic for wallet recovery.
language string Language for the mnemonic.
password string Password for securing the wallet.

CreateWalletResponse msg

Response message containing the name of the created wallet.

FieldTypeDescription
wallet_name string Name of the created wallet.

GetAddressHistoryRequest msg

Request message to get an address transaction history.

FieldTypeDescription
wallet_name string Name of the wallet.
address string Address to get the transaction history of it.

GetAddressHistoryResponse msg

Response message to get an address transaction history.

FieldTypeDescription
history_info repeated HistoryInfo Array of address history and activities.

GetNewAddressRequest msg

Request message for generating a new address.

FieldTypeDescription
wallet_name string Name of the wallet for which the new address is requested.
address_type AddressType Address type for the new address.
label string Label for the new address.

GetNewAddressResponse msg

Response message containing the new address.

FieldTypeDescription
wallet_name string Name of the wallet.
address_info AddressInfo Address information.

GetTotalBalanceRequest msg

Request message for obtaining the available balance of a wallet.

FieldTypeDescription
wallet_name string Name of the wallet.

GetTotalBalanceResponse msg

Response message containing the available balance of the wallet.

FieldTypeDescription
wallet_name string Name of the wallet.
total_balance int64 The total balance of the wallet in NanoPAC.

GetValidatorAddressRequest msg

Request message for obtaining the validator address associated with a public

key.

FieldTypeDescription
public_key string Public key for which the validator address is requested.

GetValidatorAddressResponse msg

Response message containing the validator address corresponding to a public

key.

FieldTypeDescription
address string Validator address associated with the public key.

HistoryInfo msg

Message of address history information.

FieldTypeDescription
transaction_id string Hash of transaction.
time uint32 transaction timestamp.
payload_type string payload type of transaction.
description string description of transaction.
amount int64 amount of transaction.

LoadWalletRequest msg

Request message for loading an existing wallet.

FieldTypeDescription
wallet_name string Name of the wallet to load.

LoadWalletResponse msg

Response message containing the name of the loaded wallet.

FieldTypeDescription
wallet_name string Name of the loaded wallet.

LockWalletRequest msg

Request message for locking a currently loaded wallet.

FieldTypeDescription
wallet_name string Name of the wallet to lock.

LockWalletResponse msg

Response message containing the name of the locked wallet.

FieldTypeDescription
wallet_name string Name of the locked wallet.

SignRawTransactionRequest msg

Request message for signing a raw transaction.

FieldTypeDescription
wallet_name string Name of the wallet used for signing.
raw_transaction bytes Raw transaction data to be signed.
password string Password for unlocking the wallet for signing.

SignRawTransactionResponse msg

Response message containing the transaction ID and signed raw transaction.

FieldTypeDescription
transaction_id bytes ID of the signed transaction.
signed_raw_transaction bytes Signed raw transaction data.

UnloadWalletRequest msg

Request message for unloading a currently loaded wallet.

FieldTypeDescription
wallet_name string Name of the wallet to unload.

UnloadWalletResponse msg

Response message containing the name of the unloaded wallet.

FieldTypeDescription
wallet_name string Name of the unloaded wallet.

UnlockWalletRequest msg

Request message for unlocking a wallet.

FieldTypeDescription
wallet_name string Name of the wallet to unlock.
password string Password for unlocking the wallet.
timeout int32 Timeout duration for the unlocked state.

UnlockWalletResponse msg

Response message containing the name of the unlocked wallet.

FieldTypeDescription
wallet_name string Name of the unlocked wallet.

PayloadType enum

Enumeration for different types of transaction payloads.

NameNumberDescription
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.

TransactionVerbosity enum

Enumeration for verbosity level when requesting transaction details.

NameNumberDescription
TRANSACTION_DATA 0 Request transaction data only.
TRANSACTION_INFO 1 Request transaction details.

BlockVerbosity enum

Enumeration for verbosity level when requesting block information.

NameNumberDescription
BLOCK_DATA 0 Request block data only.
BLOCK_INFO 1 Request block information and transaction IDs.
BLOCK_TRANSACTIONS 2 Request block information and transaction details.

VoteType enum

Enumeration for types of votes.

NameNumberDescription
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.

AddressType enum

Enum for the address type.

NameNumberDescription
ADDRESS_TYPE_TREASURY 0
ADDRESS_TYPE_VALIDATOR 1
ADDRESS_TYPE_BLS_ACCOUNT 2

Scalar Value Types

.proto TypeC++JavaPythonGoC#PHP
double double double float float64 double float
float float float float float32 float float
int32 int32 int int int32 int integer
int64 int64 long int/long int64 long integer/string
uint32 uint32 int int/long uint32 uint integer
uint64 uint64 long int/long uint64 ulong integer/string
sint32 int32 int int int32 int integer
sint64 int64 long int/long int64 long integer/string
fixed32 uint32 int int uint32 uint integer
fixed64 uint64 long int/long uint64 ulong integer/string
sfixed32 int32 int int int32 int integer
sfixed64 int64 long int/long int64 long integer/string
bool bool boolean boolean bool bool boolean
string string String str/unicode string string string
bytes string ByteString str []byte ByteString string