Table of contents
You can also view these commands, detailed information, and example commands in QT console with "help | <command> help" or raptoreum-cli with "raptoreum-cli help | raptoreum-cli <command> help".
Remote Procedure Calls (RPCs) are a fundamental aspect of interacting with Raptoreumcore, enabling users and developers to communicate directly with the blockchain. By using RPCs, you can perform a wide range of actions, from querying blockchain data to managing wallets and executing transactions.
Address Index
getaddressbalance
Summary: The getaddressbalance
command is used to retrieve the balance of one or more addresses on the Raptoreum blockchain. This command can be utilized to check the available, immature, and spendable balances for RTM or any specific asset associated with the given addresses.
Use Case Example: This command is useful when you need to monitor the balance of a specific address, such as for auditing purposes, wallet management, or when building applications that track user funds.
Example Commands:
- Retrieve Balance for a Single Address:
raptoreum-cli getaddressbalance '{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"]}'
- Retrieve Balance for Multiple Addresses:
raptoreum-cli getaddressbalance '{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN", "RGxvxV7RoWcx2LXDgxqtkiwd2FxW76nSgc"]}'
- Retrieve Balance for a Specific Asset:
raptoreum-cli getaddressbalance '{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"], "asset": "TheAssetName"}'
- Using
curl
to Retrieve Balance for a Single Address:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getaddressbalance", "params": [{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"]}] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
getaddressdeltas
Summary: The getaddressdeltas
command is used to retrieve all changes (deltas) in the balance of a given address or set of addresses on the Raptoreum blockchain. This includes the amount of RTM (or a specified asset) gained or lost in each transaction related to the address, along with detailed information such as transaction ID, block height, and more.
Use Case Example: This command is useful for auditing purposes, allowing users or developers to track the exact changes in balance for an address over time. It can also be used in applications that need to monitor transaction histories or calculate the net change in balance over specific periods.
- Retrieve Deltas for a Single Address:
raptoreum-cli getaddressdeltas '{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"]}'
- Retrieve Deltas for Multiple Addresses:
raptoreum-cli getaddressdeltas '{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN", "RGxvxV7RoWcx2LXDgxqtkiwd2FxW76nSgc"]}'
- Retrieve Deltas for a Specific Asset:
raptoreum-cli getaddressdeltas '{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"], "asset": "MyAsset"}'
- Using
curl
to Retrieve Deltas for a Single Address:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getaddressdeltas", "params": [{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"]}] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
getaddressmempool
Summary: The getaddressmempool
command returns all pending (unconfirmed) transaction deltas for a given address or set of addresses currently in the mempool. This includes details such as the transaction ID, the change in balance (deltas), associated assets, and the timestamp when the transaction entered the mempool.
Use Case Example: This command is useful for monitoring unconfirmed transactions related to a specific address. It can be employed to track incoming or outgoing transactions that are yet to be confirmed on the blockchain, providing real-time insight into pending changes in balance.
- Retrieve Mempool Deltas for a Single Address:
raptoreum-cli getaddressmempool '{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"]}'
- Retrieve Mempool Deltas for Multiple Addresses:
raptoreum-cli getaddressmempool '{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN", "RGxvxV7RoWcx2LXDgxqtkiwd2FxW76nSgc"]}'
- Using
curl
to Retrieve Mempool Deltas for a Single Address:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getaddressmempool", "params": [{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"]}] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
getaddresstxids
Summary: The getaddresstxids
command returns the transaction IDs (txids) associated with one or more specified addresses on the Raptoreum blockchain. This command provides a list of txids that can be used to trace transactions involving the given addresses.
Use Case Example: This command is useful for tracking all transactions related to a specific address or set of addresses. It can be used for auditing, monitoring transaction history, or for developers building applications that require transaction tracking functionality.
- Retrieve TxIDs for a Single Address:
raptoreum-cli getaddresstxids '{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"]}'
- Retrieve TxIDs for Multiple Addresses:
raptoreum-cli getaddresstxids '{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN", "RGxvxV7RoWcx2LXDgxqtkiwd2FxW76nSgc"]}'
- Using
curl
to Retrieve TxIDs for a Single Address:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getaddresstxids", "params": [{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"]}] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
getaddressutxos
Summary: The getaddressutxos
command returns all unspent transaction outputs (UTXOs) associated with a specified address or set of addresses on the Raptoreum blockchain. UTXOs represent the balance that can be spent in future transactions. This command can also retrieve UTXOs for specific assets if required.
Use Case Example: This command is essential for wallet applications, or for users who need to determine the available spendable balance in the form of UTXOs. It can also be used in building custom transaction functionalities or tracking asset-specific outputs.
- Retrieve UTXOs for a Single Address:
raptoreum-cli getaddressutxos '{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"]}'
- Retrieve UTXOs for Multiple Addresses:
raptoreum-cli getaddressutxos '{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN", "RGxvxV7RoWcx2LXDgxqtkiwd2FxW76nSgc"]}'
- Retrieve UTXOs for a Specific Asset:
raptoreum-cli getaddressutxos '{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"], "asset": "MyAsset"}'
- Using
curl
to Retrieve UTXOs for a Single Address:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getaddressutxos", "params": [{"addresses": ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"]}] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
Assets
createasset
Summary: The createasset
command is used to create a new asset on the Raptoreum blockchain. This asset can represent either a fungible or non-fungible token (NFT) depending on the metadata provided. The command allows for a range of configurations, including whether the asset can be updated, its distribution type, and the maximum number of times it can be minted.
Use Case Example: This command is ideal for developers or users who want to create custom tokens on the Raptoreum blockchain. These tokens could represent anything from digital assets like NFTs to fungible tokens for various applications.
- Creating a Fungible Asset:
raptoreum-cli createasset '{"name":"MyToken", "updatable":true, "is_root":true, "is_unique":false, "decimalpoint":2, "referenceHash":"", "maxMintCount":1000000, "type":0, "targetAddress":"RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN", "issueFrequency":0, "amount":1000, "ownerAddress":"RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"}'
- Creating a Unique Asset (NFT):
raptoreum-cli createasset '{"name":"UniqueAsset", "updatable":false, "is_root":true, "is_unique":true, "decimalpoint":0, "referenceHash":"QmTzQ1Yb2Sk9TjYVxZxE5JGFfgY5QZsJ7uH2V3TqN4HxQp", "maxMintCount":1, "type":0, "targetAddress":"RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN", "issueFrequency":0, "amount":1, "ownerAddress":"RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"}'
- Using
curl
to Create an Asset:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createasset", "params": [{"name":"MyToken", "updatable":true, "is_root":true, "is_unique":false, "decimalpoint":2, "referenceHash":"", "maxMintCount":1000000, "type":0, "targetAddress":"RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN", "issueFrequency":0, "amount":1000, "ownerAddress":"RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"}] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
In these commands, you can customize the asset metadata according to your needs. For example, setting "is_unique": true
makes the asset an NFT, while "maxMintCount"
controls how many times the asset can be minted. The "referenceHash"
can be used to link the asset to an IPFS hash or any other digital/physical reference.
getassetdetailsbyid
Summary: The getassetdetailsbyid
command retrieves detailed information about a specific asset on the Raptoreum blockchain using its asset ID. This includes metadata such as the asset's name, properties, minting status, and other relevant details.
Use Case Example: This command is useful for anyone needing to look up details about a particular asset. It can be used in applications that track or display asset information, or for auditing and verification purposes.
Example Commands:
- Retrieve Asset Details by ID:
raptoreum-cli getassetdetailsbyid 'b683eccf3267561e1d5f5ad0caeb362b50d0d3a68e71cceee69869df173fed12'
- Using
curl
to Retrieve Asset Details by ID:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getassetdetailsbyid", "params": ["b683eccf3267561e1d5f5ad0caeb362b50d0d3a68e71cceee69869df173fed12"] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
In these commands, replace 'b683eccf3267561e1d5f5ad0caeb362b50d0d3a68e71cceee69869df173fed12'
with the actual asset ID of the asset you wish to query.
getassetdetailsbyname
Summary: The getassetdetailsbyname
command retrieves detailed information about a specific asset on the Raptoreum blockchain using its name. This includes the asset's metadata, minting status, and other relevant details.
Use Case Example: This command is useful for users or developers who need to look up information about a particular asset by its name. It can be employed in applications that track asset details, or for verifying and auditing asset information.
Example Commands:
- Retrieve Asset Details by Name:
raptoreum-cli getassetdetailsbyname 'WenMoon'
- Using
curl
to Retrieve Asset Details by Name:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getassetdetailsbyname", "params": ["WenMoon"] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
In these commands, replace 'WenMoon'
with the actual name of the asset you want to query. The command will return detailed information about the asset.
listassets
Summary: The listassets
command returns a list of all assets on the Raptoreum blockchain. You can choose to retrieve either a simple list of asset names or detailed metadata about each asset.
Use Case Example: This command is useful for getting an overview of all assets on the blockchain, whether you need a quick list of asset names or detailed information for analysis or display purposes. It can be especially valuable for developers or users managing multiple assets.
Example Commands:
- List All Asset Names:
raptoreum-cli listassets false
- List Detailed Asset Metadata for All Assets:
raptoreum-cli listassets true
- List the First 10 Assets with Metadata:
raptoreum-cli listassets true "10"
- Skip the First 5 Assets and List the Next 10:
raptoreum-cli listassets true "10" 5
- Using
curl
to List All Asset Names:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listassets", "params": [false] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
In these commands, you can adjust the parameters to filter the results based on your specific needs. The "verbose"
argument determines whether you receive basic names or full asset details, while "count"
and "start"
help you navigate through a large number of assets.
listassetsbalance
Summary: The listassetsbalance
command returns the balances of all assets held by the wallet. This provides a quick overview of the different assets and their corresponding balances within the wallet.
Use Case Example: This command is useful for users who want to see the total amount of each asset they own, including RTM and any custom assets. It's ideal for monitoring asset holdings and managing portfolios.
Example Commands:
- List All Asset Balances:
raptoreum-cli listassetsbalance
- Using
curl
to List All Asset Balances:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listassetsbalance", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
These commands will display the balances for all assets held in the wallet, helping you keep track of your asset portfolio.
listunspentassets
Summary: The listunspentassets
command returns an array of unspent transaction outputs (UTXOs) for assets with a specified range of confirmations. You can filter the results by address, include or exclude unsafe outputs, and apply various query options to customize the output.
Use Case Example: This command is useful for determining which asset UTXOs are available for spending within specified confirmation parameters. It can help in managing and selecting UTXOs for transactions or for auditing purposes.
Example Commands:
- List Unspent Asset UTXOs with Default Settings:
raptoreum-cli listunspentassets
- List Unspent Asset UTXOs with Specific Confirmation Range:
raptoreum-cli listunspentassets 6 9999999
- List Unspent Asset UTXOs for Specific Addresses:
raptoreum-cli listunspentassets 1 9999999 '["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN", "RGxvxV7RoWcx2LXDgxqtkiwd2FxW76nSgc"]'
- Using
curl
to List Unspent Asset UTXOs with Specific Options:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listunspentassets", "params": [1, 9999999, ["RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"], true, {"minimumAmount": 0.1, "maximumCount": 100}] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
These commands allow you to retrieve UTXOs that match specific criteria, making it easier to manage and select UTXOs for transactions or other purposes. The filtering options provide flexibility to narrow down results based on confirmation count, address, and other attributes.
mintasset
Summary: The mintasset
command is used to mint new units of an existing asset on the Raptoreum blockchain. After creating an asset using the createasset
command, you must use mintasset
to make the asset available for use. This process involves providing the transaction ID (txid) of the asset you wish to mint.
Use Case Example: This command is for asset creators and owners who need to finalize the creation process by making the asset available for transactions. It is also used for increasing the supply of an asset over time, depending on the asset's minting rules.
Example Commands:
- Mint Additional Units of an Asset:
raptoreum-cli mintasset 'b683eccf3267561e1d5f5ad0caeb362b50d0d3a68e71cceee69869df173fed12'
- Using
curl
to Mint Additional Units of an Asset:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "mintasset", "params": ["b683eccf3267561e1d5f5ad0caeb362b50d0d3a68e71cceee69869df173fed12"] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
In these commands, replace 'b683eccf3267561e1d5f5ad0caeb362b50d0d3a68e71cceee69869df173fed12'
with the actual transaction ID of the asset you want to mint. This step is essential to activate the asset after creation or to increase its supply.
sendasset
Summary: The sendasset
command is used to transfer a specified quantity of an owned asset to a given address on the Raptoreum blockchain. You can also specify addresses for any RTM or asset change that may result from the transaction.
Use Case Example: Use this command for transferring assets you own to another address. This could be used in scenarios such as sending tokens to another user, distributing assets, or managing your asset portfolio.
Example Commands:
- Send an Asset to an Address:
raptoreum-cli sendasset "b683eccf3267561e1d5f5ad0caeb362b50d0d3a68e71cceee69869df173fed12" 10 "RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"
- Send an Asset with Specified RTM and Asset Change Addresses:
raptoreum-cli sendasset "b683eccf3267561e1d5f5ad0caeb362b50d0d3a68e71cceee69869df173fed12" 10 "RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN" "RGxvxV7RoWcx2LXDgxqtkiwd2FxW76nSgc" "RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"
- Using
curl
to Send an Asset:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendasset", "params": ["b683eccf3267561e1d5f5ad0caeb362b50d0d3a68e71cceee69869df173fed12", 10, "RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN", "RGxvxV7RoWcx2LXDgxqtkiwd2FxW76nSgc", "RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN"] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
Replace "b683eccf3267561e1d5f5ad0caeb362b50d0d3a68e71cceee69869df173fed12"
with the actual asset ID or name, and adjust the quantity and addresses as needed. This command will return the transaction ID(s) associated with the asset transfer.
updateasset
Summary: The updateasset
command is used to modify the metadata of an existing fungible (updatable) asset on the Raptoreum blockchain. Only assets that were created with the option to be updatable can be modified using this command. This allows asset owners to update properties such as the asset's name, reference hash, minting rules, and ownership details.
Use Case Example: Use this command for updating a fungible asset's metadata when changes are needed, such as altering distribution rules, updating the reference hash, or transferring ownership.
Example Commands:
- Update Asset Metadata:
raptoreum-cli updateasset '{"name":"UpdatedAsset", "updatable":true, "referenceHash":"QmTzQ1Yb2Sk9TjYVxZxE5JGFfgY5QZsJ7uH2V3TqN4HxQp", "maxMintCount":1000, "type":0, "targetAddress":"RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN", "issueFrequency":0, "amount":500, "ownerAddress":"RGxvxV7RoWcx2LXDgxqtkiwd2FxW76nSgc"}'
- Using
curl
to Update Asset Metadata:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "updateasset", "params": [{"name":"UpdatedAsset", "updatable":true, "referenceHash":"QmTzQ1Yb2Sk9TjYVxZxE5JGFfgY5QZsJ7uH2V3TqN4HxQp", "maxMintCount":1000, "type":0, "targetAddress":"RHVZ1pXvZsoMEwcTRyB1VSrPwt8w2GSsEN", "issueFrequency":0, "amount":500, "ownerAddress":"RGxvxV7RoWcx2LXDgxqtkiwd2FxW76nSgc"}] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
In these commands, adjust the asset metadata according to your needs. The command will return the transaction ID of the update, allowing you to track the changes made to the asset.
Blockchain
getbestblockhash
Summary: The getbestblockhash
command returns the hash of the most recent block (also known as the tip block) in the longest blockchain. This hash is a unique identifier for the block and is hex-encoded.
Use Case Example: Use this command for obtaining the current tip block's hash, which can be useful for monitoring the blockchain's status, verifying the latest block, or as a reference point for further blockchain operations.
Example Commands:
- Retrieve the Best Block Hash:
raptoreum-cli getbestblockhash
- Using
curl
to Retrieve the Best Block Hash:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbestblockhash", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
This command will return the hash of the most recent block in the blockchain.
getbestchainlock
Summary: The getbestchainlock
command returns information about the most recent chainlock in the Raptoreum blockchain. A chainlock is a security mechanism that ensures the finality of blocks. This command will provide details such as the block hash, block height, and the chainlock's BLS signature. If there is no known chainlock yet, an error will be thrown.
Use Case Example: Use this command for obtaining details about the best chainlock, which is important for verifying the security and finality of the current blockchain state.
Example Commands:
- Retrieve Information About the Best Chainlock:
raptoreum-cli getbestchainlock
- Using
curl
to Retrieve Information About the Best Chainlock:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbestchainlock", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
This command will return a JSON object containing the block hash, block height, BLS signature, and whether the block is known by the node. If no chainlock is known, it will return an error.
getblock
Summary: The getblock
command retrieves information about a specific block on the Raptoreum blockchain using its block hash. The level of detail in the response can be controlled by the verbosity parameter.
- verbosity = 0: Returns the block data as a serialized, hex-encoded string.
- verbosity = 1: Returns a JSON object with information about the block.
- verbosity = 2: Returns a JSON object with detailed information about the block, including data about each transaction within the block.
Use Case Example: Use this command to get detailed information about a block, such as its hash, size, height, transactions, and more. The verbosity parameter allows you to choose the level of detail required.
Example Commands:
- Retrieve Block Data with Default Verbosity (1):
raptoreum-cli getblock "0000000000000000000adf8f823d44e5d1e9a1d28218d04b7af4d3c8f2f29dd6"
- Retrieve Block Data with Full Transaction Information (verbosity = 2):
raptoreum-cli getblock "0000000000000000000adf8f823d44e5d1e9a1d28218d04b7af4d3c8f2f29dd6" 2
- Retrieve Block Data as Hex-Encoded String (verbosity = 0):
raptoreum-cli getblock "0000000000000000000adf8f823d44e5d1e9a1d28218d04b7af4d3c8f2f29dd6" 0
- Using
curl
to Retrieve Block Data:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["0000000000000000000adf8f823d44e5d1e9a1d28218d04b7af4d3c8f2f29dd6", 2] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
Replace the "blockhash"
with the hash of the block you are querying, and adjust the verbosity level to get the desired level of detail in the response.
getblockchaininfo
Summary: The getblockchaininfo
command returns detailed information about the current state of the Raptoreum blockchain, including the chain’s status, block height, difficulty, verification progress, and more. It also provides updates on softforks, including those related to the Raptoreum Improvement Proposal 1 (RIP1), which introduces additional voting mechanisms for network upgrades.
Use Case Example: Use this command for obtaining an overview of the blockchain’s current state, including monitoring network health, checking the progress of softforks, or gathering data for analysis. It is especially useful for understanding the status of ongoing softforks and RIP1-related upgrades.
Example Commands:
- Retrieve Blockchain Information:
raptoreum-cli getblockchaininfo
- Using
curl
to Retrieve Blockchain Information:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
getblockcount
Summary: The getblockcount
command returns the total number of blocks in the longest blockchain. This provides the current block height, which is an indicator of how many blocks have been mined and confirmed on the network.
Use Case Example: Use this command to quickly retrieve the current block count, which is useful for monitoring the progress of the blockchain, checking synchronization status, or simply knowing how far the blockchain has advanced.
Example Commands:
- Retrieve the Current Block Count:
raptoreum-cli getblockcount
- Using
curl
to Retrieve the Current Block Count:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
This command returns a numeric value representing the current block count in the longest blockchain.
getblockhash
Summary: The getblockhash
command returns the hash of a block at a specific height in the best-block-chain. The block hash is a unique identifier for the block at the given height.
Use Case Example: Use this command to retrieve the block hash for a specific block height. This can be useful for verifying block data, referencing specific blocks in your applications, or analyzing blockchain history.
Example Commands:
- Retrieve the Block Hash for a Specific Height:
raptoreum-cli getblockhash 100000
- Using
curl
to Retrieve the Block Hash for a Specific Height:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockhash", "params": [100000] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
In these commands, replace 100000
with the height of the block you are interested in. The command will return the block hash as a hex-encoded string for the specified height.
getblockhashes
getblockhashes
Summary: The getblockhashes
command returns an array of block hashes for blocks mined within a specified range of timestamps. You provide this range using UNIX timestamps, which represent the number of seconds since January 1, 1970 (also known as the epoch time). The command requires a newer block timestamp (high
) and an older block timestamp (low
) to define the range.
Use Case Example: Use this command to retrieve all block hashes within a specific time range, which is useful for analyzing blockchain activity, auditing transactions, or synchronizing data over a particular period.
Example Commands:
- Retrieve Block Hashes Within a Specific Timestamp Range:
raptoreum-cli getblockhashes 1625140800 1625054400
- Using
curl
to Retrieve Block Hashes Within a Specific Timestamp Range:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockhashes", "params": [1625140800, 1625054400] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
Explanation of UNIX Timestamps:
- UNIX Timestamp: A UNIX timestamp is a numeric representation of a specific point in time, measured in seconds from January 1, 1970 (UTC). For example, a timestamp of
1625140800
corresponds to a specific date and time, such as July 1, 2021, 12:00:00 AM UTC.
When using this command, replace the timestamps (1625140800
for the high and 1625054400
for the low) with the specific time range you want to query. The command will return a list of block hashes mined within that time frame.
getblockheader
Summary: The getblockheader
command retrieves the header of a specified block using its block hash. The block header contains metadata about the block, such as the block’s version, previous block hash, merkle root, and more. The level of detail in the response can be controlled by the verbose
parameter.
- verbose = true: Returns a JSON object with detailed information about the block header.
- verbose = false: Returns the block header as a serialized, hex-encoded string.
Use Case Example: Use this command to obtain metadata about a specific block without retrieving the full block data. This can be useful for verifying block integrity, analyzing blockchain data, or debugging purposes.
Example Commands:
- Retrieve Block Header with Detailed Information (Default Verbose = true):
raptoreum-cli getblockheader "0000000000000000000adf8f823d44e5d1e9a1d28218d04b7af4d3c8f2f29dd6"
- Retrieve Block Header as Hex-Encoded Data (Verbose = false):
raptoreum-cli getblockheader "0000000000000000000adf8f823d44e5d1e9a1d28218d04b7af4d3c8f2f29dd6" false
- Using
curl
to Retrieve Block Header Information:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockheader", "params": ["0000000000000000000adf8f823d44e5d1e9a1d28218d04b7af4d3c8f2f29dd6", true] }' -H 'content-type: text/plain;' http://127.0.0.1:10225/
Explanation of Key Fields:
- hash: The unique identifier of the block.
- confirmations: The number of confirmations this block has received.
- height: The position of the block in the blockchain.
- merkleroot: The root of the Merkle tree, which is used to verify the integrity of all transactions in the block.
- time: The block time, expressed as a UNIX timestamp.
- previousblockhash: The hash of the previous block in the chain.
- nextblockhash: The hash of the next block in the chain (if available).
These commands allow you to get detailed or hex-encoded information about the block header, depending on your needs.