Privacy Token Guide
Privacy Token Wallet RPC Guide
This guide explains how to register, mint, update and burn privacy tokens with beldex-wallet-rpc.
Before you begin
You need:
a synchronized
beldexdnode;a synchronized
beldex-wallet-rpcwallet;unlocked BDX to pay the network fee and the applicable token-operation charge; and
for mint and update, the wallet that owns the token.
The examples use the wallet RPC endpoint http://127.0.0.1:19092/json_rpc. Keep the RPC service private and configure --rpc-login when appropriate. If authentication is enabled, add --digest -u USERNAME:PASSWORD to each curl command.
Common transaction parameters
The four methods accept some or all of these common parameters.
account_index
unsigned integer
No
Wallet account used to pay BDX fees. Defaults to 0. update_token must use account 0.
subaddr_indices
array of unsigned integers
No
Subaddresses from which BDX fee inputs may be selected. Do not pass this field to update_token.
priority
unsigned integer
No
Transaction priority. 0 lets the wallet use its default behavior.
do_not_relay
boolean
No
If true, builds but does not broadcast the transaction. Defaults to false.
get_tx_key
boolean
No
Returns the transaction key when true. Treat the key as sensitive.
get_tx_hex
boolean
No
Returns the serialized transaction when true.
get_tx_metadata
boolean
No
Returns metadata for later transaction submission. Supported by mint, update and burn.
Amounts in these RPC calls are unsigned integers expressed in atomic token units. Native BDX values, including response fee fields, use atomic BDX units: 1 BDX = 1,000,000,000 atomic units.
Register a privacy token
register_privacy_token creates the token, assigns the wallet as its owner and returns the calculated token ID. If current_supply is greater than zero, that initial supply is issued to the registering wallet.
Inputs
json_string
string
Yes
The complete token descriptor encoded as a JSON string.
account_index
unsigned integer
No
Account used for BDX inputs. Defaults to 0.
subaddr_indices
array
No
Subaddresses used for BDX inputs.
priority
unsigned integer
No
Transaction priority.
do_not_relay
boolean
No
Build without broadcasting when true.
get_tx_key
boolean
No
Return the transaction key.
get_tx_hex
boolean
No
Return the serialized transaction in tx_hex.
Request
Outputs
token_id
string
Hex-encoded 32-byte token ID. Use it for later lifecycle operations.
tx_hash
string
Registration transaction hash.
tx_key
string
Transaction key when requested; otherwise empty.
tx_hex
string
Serialized transaction when requested; otherwise empty.
ticker
string
Accepted ticker.
full_name
string
Accepted full name.
tx_fee
unsigned integer
Total transaction fee in atomic BDX units.
Example response
Mint additional supply
mint_token creates more units of an existing token and sends them to the owner's primary wallet address. Only the token owner can mint. The resulting current_supply must not exceed total_max_supply.
Inputs
token_id
string
Yes
Hex-encoded token ID returned during registration.
amount
unsigned integer
Yes
Amount to mint in atomic token units; must be greater than zero.
account_index
unsigned integer
No
Account used for BDX fee inputs.
subaddr_indices
array
No
Subaddresses used for BDX fee inputs.
priority
unsigned integer
No
Transaction priority.
do_not_relay
boolean
No
Build without broadcasting when true.
get_tx_key
boolean
No
Return the transaction key.
get_tx_hex
boolean
No
Return the serialized transaction in tx_blob.
get_tx_metadata
boolean
No
Return relay metadata.
Request
With decimal_point: 2, the example amount 250000 represents 2,500.00 tokens.
Outputs
tx_hash
string
Mint transaction hash.
tx_key
string
Transaction key when requested.
fee
unsigned integer
Total fee in atomic BDX units.
tx_blob
string
Serialized transaction when requested.
tx_metadata
string
Relay metadata when requested.
Minting currently applies a 50 BDX mainnet operation charge in addition to the ordinary network fee.
Update token metadata
update_token changes only the descriptor's meta_info also the owner. The wallet reads the live descriptor from the daemon and preserves all immutable fields. The transaction must be issued by the token owner's primary account.
Inputs
token_id
string
Yes
Hex-encoded token ID.
json_string
string
One of these
Inline JSON containing the new meta_info or owner. Recommended for RPC clients.
json_filename
string
One of these
Path to a descriptor file on the machine running beldex-wallet-rpc.
priority
unsigned integer
No
Transaction priority.
account_index
unsigned integer
No
Must be 0.
do_not_relay
boolean
No
Build without broadcasting when true.
get_tx_key
boolean
No
Return the transaction key.
get_tx_hex
boolean
No
Return the serialized transaction in tx_blob.
get_tx_metadata
boolean
No
Return relay metadata.
Do not pass subaddr_indices to this method. The new meta_info must differ from the current value.
Request
Outputs
tx_hash
string
Update transaction hash.
tx_key
string
Transaction key when requested.
fee
unsigned integer
Total fee in atomic BDX units.
tx_blob
string
Serialized transaction when requested.
tx_metadata
string
Relay metadata when requested.
Updating currently applies a 10 BDX mainnet operation charge in addition to the ordinary network fee.
Burn token supply
burn_token permanently destroys the requested amount by spending token outputs controlled by the wallet. A burn cannot be reversed.
Inputs
token_id
string
Yes
Hex-encoded token ID.
amount
unsigned integer
Yes
Amount to burn in atomic token units; must be greater than zero.
account_index
unsigned integer
No
Account used for BDX fee inputs.
subaddr_indices
array
No
Subaddresses used for BDX fee inputs and token selection.
priority
unsigned integer
No
Transaction priority.
do_not_relay
boolean
No
Build without broadcasting when true.
get_tx_key
boolean
No
Return the transaction key.
get_tx_hex
boolean
No
Return the serialized transaction in tx_blob.
get_tx_metadata
boolean
No
Return relay metadata.
Request
Outputs
tx_hash
string
Burn transaction hash.
tx_key
string
Transaction key when requested.
fee
unsigned integer
Total fee in atomic BDX units.
tx_blob
string
Serialized transaction when requested.
tx_metadata
string
Relay metadata when requested.
There is currently no additional mainnet operation charge for burning, but the ordinary network transaction fee still applies.
Error handling
JSON-RPC failures return an error object rather than a result object.
Common causes include:
the wallet or daemon is not synchronized;
the privacy-token network upgrade is not active;
the token ID is malformed or unknown;
the wallet does not own the token for a mint or update;
the mint would exceed the maximum supply;
the wallet has insufficient unlocked BDX for fees or collateral;
the wallet has insufficient unlocked token outputs for a burn; or
an update repeats the existing
meta_infovalue.
Only treat an operation as submitted when the response contains a result and a non-empty tx_hash. If do_not_relay is true, the transaction has been built but not broadcast.
Last updated
Was this helpful?