This is an external Kaspad API. The information below is intended for users who run a full Kaspa node - miners, researchers etc.
Kaspa CTL is a command-line tool for interacting with the RPC API.
To install Kaspa CTL, run the following:
git clone https://github.com/kaspanet/kaspad.git
cd kaspad/cmd/kaspactl
go install .
To run an RPC API command, open a terminal and input the command as shown in the example below:
kaspactl --testnet -s localhost '{"addPeerRequestMessage":{"address":"1.2.3.4:5678"}}'
{which one is correct?}
kaspactl --rpcserver=127.0.0.1:16616 --devnet '{"getBlockDagInfoRequest": {}}'
This command requests "getBlockDagInfo" from the Kaspad at 127.0.0.1:16616 and prints the response to the screen.
Instructs Kaspad to connect to a given IP address. Returns an empty response or an error message
- AddPeerRequestMessage
- string address
- bool isPermanent
- AddPeerResponseMessage
- RPCError error = 1000
Requests info on a block corresponding to a given block hash Returns block info if the block is known. Returns an error message otherwise
- GetBlockRequestMessage
- string hash
- string subnetworkId
- bool includeTransactionVerboseData
- GetBlockResponseMessage
- string blockHash
- BlockVerboseData blockVerboseData
- RPCError error = 1000;
Returns the amount of blocks in the DAG
- GetBlockCountRequestMessage
- GetBlockCountResponseMessage
- uint64 blockCount
- RPCError error = 1000;
Returns info on the current state of the DAG
- GetBlockDagInfoRequestMessage
- GetBlockDagInfoResponseMessage
- string networkName
- uint64 blockCount
- repeated string tipHashes
- double difficulty
- int64 pastMedianTime
- repeated string virtualParentHashes
- RPCError error = 1000;
Returns a "template" by which a miner can mine a new block
- GetBlockTemplateRequestMessage
- string payAddress
- GetBlockTemplateResponseMessage
- BlockMessage blockMessage
Returns a list of the peers currently connected to this Kaspad, along with some statistics on them
- GetConnectedPeerInfoRequestMessage
- GetConnectedPeerInfoResponseMessage
- repeated GetConnectedPeerInfoMessage infos
- RPCError error = 1000
Returns the network this Kaspad is connected to (Mainnet, Testnet)
- GetCurrentNetworkRequestMessage
- GetCurrentNetworkResponseMessage
- string currentNetwork
- RPCError error = 1000
Returns a list of all the addresses (IP, port) this Kaspad knows and a list of all addresses that are currently banned by this Kaspad
- GetPeerAddressesRequestMessage
- GetPeerAddressesResponseMessage
- repeated GetPeerAddressesKnownAddressMessage addresses
- repeated GetPeerAddressesKnownAddressMessage bannedAddresses
- RPCError error = 1000
Returns the hash of the current selected tip block of the DAG
- GetSelectedTipHashRequestMessage
- GetSelectedTipHashResponseMessage
- string selectedTipHash
- RPCError error = 1000
Instructs this node to shut down Returns an empty response or an error message
- ShutDownRequestMessage
- ShutDownResponseMessage
- RPCError error = 1000
Extracts a block out of the request message and attempts to add it to the DAG Returns an empty response or an error message
- SubmitBlockRequestMessage
- BlockMessage block
- SubmitBlockResponseMessage
- RPCError error = 1000
Extracts a transaction out of the request message and attempts to add it to the mempool Returns an empty response or an error message
- SubmitTransactionRequestMessage
- TransactionMessage transaction
- SubmitTransactionResponseMessage
- string txId
- RPCError error = 1000