Wallet API
You can use this API to interact with a wallet, check the balance, or build a transaction.
It contains all the necessary methods for developing an application or integrate XELIS into your system.
Setup
Connect to the wallet endpoint instead of the node.
Open your xelis_wallet and start the rpc server.
Command: start_rpc_server {bind_address} {username} {password}.
For the example below:
- The
{bind_address}is127.0.0.1:8081 - The
{username}isAladdin: - The
{password}isopen sesame
The authentication scheme is using rfc7617Â .
More info here https://en.wikipedia.org/wiki/Basic_access_authentication .
Concatenating both username and password with : gives QWxhZGRpbjpvcGVuIHNlc2FtZQ== in base64.
HTTP
Send a POST request to /json_rpc.
fetch('http://127.0.0.1:8081/json_rpc', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
},
body: JSON.stringify({
id: 1,
jsonrpc: '2.0',
method: 'get_network'
})
})Methods
get_version
Retrieve current daemon version
Parameters No parameters
Request
{
"jsonrpc": "2.0",
"method": "get_version",
"id": 1
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "1.7.0"
}get_network
Retrieve network used by the wallet
Parameters No parameters
Request
{
"jsonrpc": "2.0",
"method": "get_network",
"id": 1
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "Testnet"
}get_nonce
Retrieve account nonce saved in wallet
Parameters No parameters
Request
{
"jsonrpc": "2.0",
"method": "get_nonce",
"id": 1
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": 1462
}get_topoheight
Retrieve daemon topoheight until which the wallet scanned transactions/balances.
Parameters No parameters
Request
{
"jsonrpc": "2.0",
"method": "get_topoheight",
"id": 1
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": 69817
}get_address
Retrieve wallet address with or without integrated data in it. Without parameters set, it returns the normal wallet address.
NOTE: Integrated data can be useful for services like Exchanges to identify a user transaction by integrating an ID (or anything else) in the address (like PaymentID for Monero).
It is not mandatory and support any data formatted in JSON up to 1 KB in serialized format.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| integrated_data | JSON | Optional | Add data that will be integrated in the transfer |
Request
{
"jsonrpc": "2.0",
"method": "get_address",
"id": 1,
"params": {
"integrated_data": {
"hello": "world",
"words": [
"Hello",
"World",
"from",
"XELIS"
],
"items": {
"sword": 5
}
}
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "xet:6eadzwf5xdacts6fs4y3csmnsmy4mcxewqt3xyygwfx0hm0tm32szqsrqyzkjar9d4esyqgpq4ehwmmjvsqqypgpq45x2mrvduqqzpthdaexceqpq4mk7unywvqsgqqpq4yx2mrvduqqzp2hdaexceqqqyzxvun0d5qqzp2cg4xyj5ct5udlg"
}split_address
Split address and integrated data in two differents fields.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| address | Address | Required | Address to split in two parts: original address, and integrated data |
Request
{
"jsonrpc": "2.0",
"method": "split_address",
"id": 1,
"params": {
"address": "xet:6eadzwf5xdacts6fs4y3csmnsmy4mcxewqt3xyygwfx0hm0tm32szqsrqyzkjar9d4esyqgpq4ehwmmjvsqqypgpq45x2mrvduqqzpthdaexceqpq4mk7unywvqsgqqpq4yx2mrvduqqzp2hdaexceqqqyzxvun0d5qqzp2cg4xyj5ct5udlg"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"address": "xet:6eadzwf5xdacts6fs4y3csmnsmy4mcxewqt3xyygwfx0hm0tm32sqxdy9zk",
"integrated_data": {
"hello": "world",
"items": {
"sword": 5
},
"words": [
"Hello",
"World",
"from",
"XELIS"
]
},
"size": 55
}
}rescan
Request the wallet to rescan balances and transactions history until the specified topoheight. When no topoheight is set, it rescan until topoheight 0.
WARNING: All balances and transactions will be deleted from wallet storage to be up-to-date with the chain of the node connected to.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| until_topoheight | Integer | Optional | Until which topoheight wallet have to rescan |
| auto_reconnect | Boolean | Optional | Reconnect to the daemon after rescan. Default false |
Request
{
"jsonrpc": "2.0",
"method": "rescan",
"id": 1,
"params": {
"until_topoheight": 1337,
"auto_reconnect": false
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}get_balance
Get asset balance from wallet. When no parameter is set, default asset is XELIS.
NOTE: By default, if no balance for the requested asset is found, it will returns 0.
Use has_balance to determine if the wallet as an asset balance or not.
Balance is returned in atomic units.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| asset | Hash | Optional | Asset to use to retrieve the balance |
Request
{
"jsonrpc": "2.0",
"method": "get_balance",
"id": 1,
"params": {}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": 8660741
}has_balance
Verify if wallet has the requested asset balance. When no parameter is set, default asset is XELIS.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| asset | Hash | Optional | Asset to use |
Request
{
"jsonrpc": "2.0",
"method": "has_balance",
"id": 1,
"params": {}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}get_tracked_assets
Retrieve all assets that are tracked by the wallet.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| skip | Integer | Optional | Skip the first N assets |
| maximum | Integer | Optional | Maximum number of assets to return (max 100) |
Request
{
"jsonrpc": "2.0",
"method": "get_tracked_assets",
"id": 1,
"params": {}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
"0000000000000000000000000000000000000000000000000000000000000000"
]
}is_asset_tracked
Verify if the requested asset is tracked by the wallet.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| asset | Hash | Required | Asset to check |
Request
{
"jsonrpc": "2.0",
"method": "is_asset_tracked",
"id": 1,
"params": {
"asset": "0000000000000000000000000000000000000000000000000000000000000000"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}track_asset
Track a new asset on the wallet. If the wallet is in online mode it will fetch the balance for this asset from the daemon.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| asset | Hash | Required | Asset to track |
Request
{
"jsonrpc": "2.0",
"method": "track_asset",
"id": 1,
"params": {
"asset": "0000000000000000000000000000000000000000000000000000000000000000"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}untrack_asset
Untrack an asset from the wallet.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| asset | Hash | Required | Asset to untrack |
Request
{
"jsonrpc": "2.0",
"method": "untrack_asset",
"id": 1,
"params": {
"asset": "0000000000000000000000000000000000000000000000000000000000000000"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}get_asset_precision
Retrieve the decimals precision for the selected asset.
This is useful to format correctly the atomic units coins to human readable.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| asset | Hash | Required | Asset to use |
Request
{
"jsonrpc": "2.0",
"method": "get_asset_precision",
"id": 1,
"params": {
"asset": "0000000000000000000000000000000000000000000000000000000000000000"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": 8
}get_assets
Retrieve all assets with their data that the wallet is aware of.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| skip | Integer | Optional | Skip the first N assets |
| maximum | Integer | Optional | Maximum number of assets to return (max 100) |
Request
{
"jsonrpc": "2.0",
"method": "get_assets",
"id": 1,
"params": {}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"data": {
"decimals": 8,
"name": "XELIS",
"ticker": "XEL",
"max_supply": {
"fixed": 1840000000000000
},
"owner": "none"
}
}
]
}get_asset
Retrieve an asset data from the wallet storage using its hash.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| asset | Hash | Required | Asset hash to use |
Request
{
"jsonrpc": "2.0",
"method": "get_asset",
"id": 1,
"params": {
"asset": "0000000000000000000000000000000000000000000000000000000000000000"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"decimals": 8,
"name": "XELIS",
"ticker": "XEL",
"max_supply": {
"fixed": 1840000000000000
},
"owner": "none"
}
}get_transaction
Get transaction by hash from wallet.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| hash | Hash | Required | Transaction hash to retrieve from wallet |
Request
{
"jsonrpc": "2.0",
"method": "get_transaction",
"id": 1,
"params": {
"hash": "6e4bbd77b305fb68e2cc7576b4846d2db3617e3cbc2eb851cb2ae69b879e9d0f"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"hash": "6e4bbd77b305fb68e2cc7576b4846d2db3617e3cbc2eb851cb2ae69b879e9d0f",
"timestamp": 1711665303229,
"outgoing": {
"fee": 25000,
"nonce": 1458,
"transfers": [
{
"amount": 1,
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"destination": "xet:t23w8pp90zsj04sp5r3r9sjpz3vq7rxcwhydf5ztlk6efhnusersqvf8sny",
"extra_data": null
}
]
},
"topoheight": 11982
}
}search_transaction
Perform a debug search across all entries for a transaction from the wallet storage using its hash. This is useful when a transaction may not be directly found but exists in the raw storage.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| hash | Hash | Required | Transaction hash to search from wallet |
Request
{
"jsonrpc": "2.0",
"method": "search_transaction",
"id": 1,
"params": {
"hash": "6e4bbd77b305fb68e2cc7576b4846d2db3617e3cbc2eb851cb2ae69b879e9d0f"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"transaction": {
"hash": "6e4bbd77b305fb68e2cc7576b4846d2db3617e3cbc2eb851cb2ae69b879e9d0f",
"timestamp": 1711665303229,
"outgoing": {
"fee": 25000,
"nonce": 1458,
"transfers": [
{
"amount": 1,
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"destination": "xet:t23w8pp90zsj04sp5r3r9sjpz3vq7rxcwhydf5ztlk6efhnusersqvf8sny",
"extra_data": null
}
]
},
"topoheight": 11982
},
"index": 1458,
"is_raw_search": false
}
}dump_transaction
Dump a transaction in hex format from the wallet storage using its hash.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| hash | Hash | Required | Transaction hash to dump from wallet |
Request
{
"jsonrpc": "2.0",
"method": "dump_transaction",
"id": 1,
"params": {
"hash": "6e4bbd77b305fb68e2cc7576b4846d2db3617e3cbc2eb851cb2ae69b879e9d0f"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "00a8e2f001..."
}build_transaction
Build a transaction to be send by the wallet. It can be broadcasted or not to the network.
NOTE: Amount set are in atomic units, for XELIS it would be 100000000 to represents 1 XELIS because of 8 decimals precision.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| tx_version | Integer | Optional | Set the transaction version to use. By default take the version from wallet |
| fee | FeeBuilder | Optional | Set an exact fee value or a multiplier |
| nonce | Integer | Optional | Set the nonce to use by the transaction. By default its provided by wallet |
| broadcast | Boolean | Optional | Broadcast TX to daemon. By default set to true |
| tx_as_hex | Boolean | Optional | Serialize TX to hexadecimal. By default set to false |
<transaction_type> | TransactionType | Required | Transaction Type parameter, see below |
| signers | Array | Optional | List of signers to use for the transaction multisig. |
| fee_limit | Integer | Optional | Set a maximum fee limit to pay. If fee estimation is higher, TX fails. |
| base_fee | BaseFeeMode | Optional | Set base fee selection mode. By default, query the connected daemon. |
Fee Builder
fee field has few variants:
- Selected by default, let the wallet estimate the fee to pay with multiplier 1
{
"extra": "none"
}- To provide a multiplier to apply on estimated fee
{
"extra": {
"multiplier": 2.5
}
}- To let the wallet estimate the fee but pay an extra tip to miners to be prioritized
{
"extra": {
"tip": 5000
}
}- To provide a fixed amount of fee to pay
{
"fixed": 100
}When it’s not provided, Fee Builder is set by default to multiplier 1 to pay what is estimated.
Fee Limit
fee_limit field allows to set a maximum fee amount to pay for the transaction.
If the fee estimation is higher than the limit set, the transaction building will fail.
If the fee limit set is higher than the current estimated fee, the transaction will be built normally. This is useful in case of high network congestion where fees may rise quickly: you don’t want that your TX stay stuck because the current required fee is higher than what you are willing to pay.
You can provide a higher fee limit that will be refunded based on the minimum required fee once executed.
Base Fee
base_fee field allows to set a base fee to use for fee per kB estimation.
You have 3 options:
none: query the connected daemon for current base fee (default)- provide a specific base fee per kB in atomic units to use for estimation:
{
"fixed": 1000
}- Provide a capped base fee per kB in atomic units to use for estimation. This means if the queried base fee from daemon is higher than the cap, the cap will be used instead:
{
"cap": 2000
}MultiSig signing
When the wallet address is a multisig, you can provide the signers to use to sign the transaction.
Signers is a list of SignerId to use to sign a transaction multisig.
Example of one SignerId:
{
"private_key": "<private key in hexadecimal>",
"id": 0
}where id is the index of the signer in the multisig setup.
Example of signers list with two signers:
{
"<transaction type>": {
...
},
"signers": [
{
"private_key": "<private key in hexadecimal>",
"id": 0
},
{
"private_key": "<private key in hexadecimal>",
"id": 1
}
]
}Transaction Type
Transfers
List of transfers to include in the transaction. You can send to one or more destinations in one transaction, with a limit of 255 transfers per transaction.
Example of a TX with transfers payload:
{
"transfers": [
{
"amount": 1000,
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"destination": "xet:t23w8pp90zsj04sp5r3r9sjpz3vq7rxcwhydf5ztlk6efhnusersqvf8sny",
}
],
}Where transfers is a list of transfers to include in the transaction.
Each transfer contains a destination address, asset ID and amount in atomic units.
In case you want to include extra data in a transfer, you can add the extra_data field next to the other fields.
You can set any JSON data that will be serialized and encrypted for the recipient only.
If you don’t want to encrypt the extra data, you can set the field encrypt_extra_data to false.
Up to 1 KB of serialized data can be added in the extra data field.
Response of the built transaction payload:
{
"transfers": [
{
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"commitment": [...],
"ct_validity_proof": {
"Y_0": [...],
"Y_1": [...],
"z_r": [...],
"z_x": [...]
},
"destination": [...],
"extra_data": null,
"receiver_handle": [...],
"sender_handle": [...]
}
]
}Burn
Payload to burn coins from wallet.
If you want to burn coins, you can use the following payload:
{
"burn": {
"amount": 1000,
"asset": "0000000000000000000000000000000000000000000000000000000000000000"
}
}Please note that burning coins is irreversible.
Multisig
Payload to setup/update a multisig on the wallet address.
If you want to setup/update a multisig, you can use the following payload:
{
"multisig": {
"participants": [
"xet:6elhr5zvx5wl2ljjl82l6yxxxqkxjvcr38kcq9qef3nurm2r2arsq89z4ll",
"xet:6elhr5zvx5wl2ljjl82l6yxxxqkxjvcr38kcq9qef3nurm2r2arsq89z4ll"
],
"threshold": 2
}
}Where participants is the list of addresses that will be part of the multisig setup.
This example setup a 2-of-2 multisig (both participants are required to sign a transaction). You can setup up to 255 participants in a multisig, with a threshold up to the number of participants.
In the case of updating an existing multisig, you can provide the new list of participants and threshold to update it. But the previous multisig setup must be respected until the transaction is executed by the network.
Invoke Contract
Payload to invoke a contract method.
This payload allows to call a contract entry chunk with parameters.
{
"invoke_contract": {
"contract": "b756566452b2c7bfea785f1b87b90d7bf075cb45a0dc33fb524e5e25f7e85fb4",
"entry_id": 0,
"parameters": [
{
"type": "primitive",
"value": {
"type": "string",
"value": "Hello, World!"
}
}
],
"max_gas": 1000000,
"permission": "none"
}
}The configured max_gas is the maximum gas amount that can be consumed by the contract execution.
If the execution requires more gas, the TX will still be accepted by the network but the contract execution will fail.
If you’ve provided more gas than required, the remaining gas will be refunded to the contract caller.
In case you want to send assets along the contract invocation, you can provide a list of deposits next to the parameters.
{
"deposits": {
"0000000000000000000000000000000000000000000000000000000000000000": {
"amount": 1000000000,
"private": false
}
}
}where deposits is a list of assets to deposit to the contract during its execution.
If you want to allow the contract to call other contracts during on your behalf, you can provide a permission field.
Set it to none when the contract must not call other contracts on your behalf during its execution.
You can be precise on which contracts and which chunks the contract can call on your behalf.
Example with a specific permission setup:
{
"permission": {
"specific": [
{
"contract": "0101010101010101010101010101010101010101010101010101010101010101",
"chunk": "all"
},
{
"contract": "0202020202020202020202020202020202020202020202020202020202020202",
"chunk": {
"specific": [
0,
1,
2
]
}
},
{
"contract": "0303030303030303030303030303030303030303030303030303030303030303",
"chunk": {
"exclude": [
5,
6
]
}
}
]
}
}Replace specific permission by exclude to deny the listed contracts/chunks instead of allowing them.
Otherwise you can set the permission to all to allow the contract to call any other contract and any chunk on your behalf.
Deploy Contract
Payload to deploy a contract on the network.
{
"deploy_contract": {
"contract_version": 0,
"module": "<contract bytecode in hexadecimal>",
}
}Where module is the compiled contract bytecode in hexadecimal format. contract_version is optional and defaults to the current default contract environment version.
In case your contract has a constructor hook, you can provide an invoke payload to run it during deployment.
{
"invoke": {
"max_gas": 1000000,
"deposits": {
"0000000000000000000000000000000000000000000000000000000000000000": {
"amount": 1000000000
}
}
}
}Where invoke is the invocation payload used to execute the constructor during deployment. The constructor hook is currently the only hook. It runs once at deployment time and cannot be called again later.
Blob
Payload to store encrypted or public data for one or more destinations.
{
"blob": {
"data": {
"hello": "world"
},
"encrypt": true,
"destinations": [
"xet:t23w8pp90zsj04sp5r3r9sjpz3vq7rxcwhydf5ztlk6efhnusersqvf8sny"
]
}
}Request
Replace <transaction type> by one of the transaction type explained above.
{
"jsonrpc": "2.0",
"method": "build_transaction",
"id": 1,
"params": {
"<transaction type>": {
...
},
"broadcast": true,
"tx_as_hex": true,
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"data": {
"<transaction type>": {
...
}
},
"fee": 25000,
"fee_limit": 30000,
"hash": "f8bd7c15e3a94085f8130cc67e1fefd89192cdd208b68b10e1cc6e1a83afe5d6",
"multisig": null,
"nonce": 1463,
"range_proof": [...],
"reference": {
"hash": "000000000c1845717b0820bd32b57d1928af1b4ae80bdec71b73ab8d60f9eb74",
"topoheight": 25770
},
"signature": "6731b973cb5c06c7e4e6fa9135acf4ea7c1b2e2bd0a63e41110aad3b39174204067bf7de87f3c3e2042cbcf6899a307e480d80e7c7f96638eabbf1fe6cfded09",
"size": 1517,
"source": "xet:dn3x9yspqtuzhm874m267a3g9fkdztr3uztyx534wdx3p9rkdspqqhpss5d",
"source_commitments": [
{
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"commitment": [...],
"proof": {
"Y_0": [...],
"Y_1": [...],
"Y_2": [...],
"z_r": [...],
"z_s": [...],
"z_x": [...]
}
}
],
"tx_as_hex": "00d67ad13934337b85c34985491c437386c95de0d97017131088724cfbedebdc55010100000000000000000000000000000000000000000000000000000000000000005aa2e3842578a127d601a0e232c24114580f0cd875c8d4d04bfdb594de7c864700ee1e827a43c220f6c8502e8ddebbd02b2ef1edcbd5cd90cd6af497129fcee11b109a4e8b947caa52b1919cfad615e027a89af8adf6cb42e947b129d9ad77a00f465ca3472da66f0ad670b202f80c4adec695e8a97abb2050d1fe21d73524403122a109b128214df24d70d1323b1128496389976315248b628b21244e0d115604f6e3e1d56226b3c7c21a69ffb6fc7ed6ce527921f9af5f9b61adc01a3a7c817b84ae6344ff62dbd33519ab3aba151330460af77c22af20c72721f4be6f32e20c95c7eb09a0cafc8971e7640da47f6599c600ea7d14f5139c6b98de19817b810100000000000061a800000000000005b701345fac2a77aa1d9955170d1a24dec26d60f49bc9cdd574bfe6d7add0bf016a441ccf887fd77976d92c8be87a547e103da5167ebe4a9c99e7419251738dc3b643fe85694f0060b0cccd77a534f08108c13689d59119716450f9234fcee4f8dd2fe8e98f6f4ad6c85f13df78670c926be2043bb75dd26104816c0a32b54f00f715f0613286ae1bcf64938bb43edd3be32bf65e5816eb8444a1244013ec1cd33e03c14082bca938d54fbb4de56e36ab2806d97c56ff279346230d2c6b130c0bcb0c89a862f3398d12a5b94e1db086cde28c903cf23af135178976ecdddced617306000000000000000000000000000000000000000000000000000000000000000002e0169af51116d0631ba9706d824dfb48c244b1cd76ca1442a8e652e0b285e6492aa2857f5cf78f922213477524a67fb3e1c0d68d62f8a4b1eb2bb695e2f8e4d035a6d04b9b14d70c6e8e84684adb0ad9b8c28416db2826a9583b582c3f81cf7b224276b0aa297556816b1b4954e2cef4dc6cb4f7ca95860545b265604765c64d6aecd989896801e013ebe92c57e4a38ace5c86ec41a50c6f6ed75015f0033b5504246781c4da478fe3c9f945a56edb29899be585ba4096c4212b92425fe4cc5905cf410456db21df087eebcebe31d37c1c514b73cd561f633214921bed393fce04fceec94193840cacf90b375c41235cabfc56635f4164f6f717db538c3cc28e56e22042ea1176ce1441a9d57796cb4a27849a71a30b7aaee98002b0d63bb98024da3b24a954f08e152eb8ff84334fff0b8271e4d3b59ace30aeb21b7fd26b79382e0648211a4aec78ea9844e60bf6a730b79184ac372cb8d5d7efc8c3b447ac3c1c609c4e478abbecf59fdddbb466510173a701dde050953813f2558d3d1c485c8a74c21ffc7a6bd436133c5219caf64bd3925c47fe9f81a536d2745ed1f070131cd0508d387a8a98cce61bab9bb4708ea490e483be60eac36277458ed1d6ba776c0da7424fc2c888f1264249f3185654468d1f344470cff3776c0f5071f50065ca383a0b68561d1d9fbb4b62c052e7139151122c121bd0e667a4320c7372356dd2059e4dff4ff983c17a55d1c645a8b9841273f9b6970e5a76ae10cdcb2c7b2c8cbf0134f39a11baa708e2a2d761d7215067cd61bb282eeda651159a3c18250a2a993ef99cc450c50a1dbf070f882619ab822e3506b3039128dea3b62106263d221753d1946b786c49d6e0a677bdd512d7c502a647a7f2c71c0373d225593e2e12aeb50e5a4a9849662d9b098f86145aa742b601afa485945e6b0ff34d71a35f303981d11d7ade050220ce4be49044e8793379c38f120a9136f5d64da61b2c02f30d306e11c35051f4474063ad1aaa2cd1b599d1ac3ed60c86b8aeb7af014604000000000c1845717b0820bd32b57d1928af1b4ae80bdec71b73ab8d60f9eb7400000000000064aa6731b973cb5c06c7e4e6fa9135acf4ea7c1b2e2bd0a63e41110aad3b39174204067bf7de87f3c3e2042cbcf6899a307e480d80e7c7f96638eabbf1fe6cfded09",
"version": 0
}
}build_transaction_offline
Build a transaction offline in the wallet by providing directly exact balances and reference. It cannot be broadcasted by the wallet directly.
NOTE: Amount set are in atomic units, for XELIS it would be 100000000 to represents 1 XELIS because of 8 decimals precision.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| fee | FeeBuilder | Optional | Set an exact fee value or a multiplier |
| nonce | Integer | Required | Set the nonce to use by the transaction. By default its provided by wallet |
| tx_version | Integer | Optional | Set the transaction version to use. By default take the version from wallet |
| tx_as_hex | Boolean | Optional | Serialize TX to hexadecimal. By default set to false |
| fee_limit | Integer | Optional | Set a maximum fee limit to pay. If fee estimation is higher, TX fails. |
| base_fee | Integer | Optional | Set a fixed base fee per kB in atomic units. |
<transaction_type> | TransactionType | Required | Transaction Type parameter, see above |
| balances | Array | Required | Map of asset-to-balance to use for the transaction. |
| reference | Reference | Required | Reference to use for the transaction. It contains the hash and topoheight |
| signers | Array | Optional | List of signers to use for the transaction multisig. |
Fee Builder
Same FeeBuilder format as build_transaction.
MultiSig Signers
Signers is a list of SignerId to use to sign a transaction multisig.
Example of one SignerId:
{
"private_key": "<private key in hexadecimal>",
"id": 0
}where id is the index of the signer in the multisig setup.
Request
{
"jsonrpc": "2.0",
"method": "build_transaction_offline",
"id": 1,
"params": {
"transfers": [
{
"amount": 1000,
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"destination": "xet:t23w8pp90zsj04sp5r3r9sjpz3vq7rxcwhydf5ztlk6efhnusersqvf8sny"
}
],
"tx_version": 0,
"nonce": 1463,
"balances": {
"0000000000000000000000000000000000000000000000000000000000000000": {
"commitment": [...],
"handle": [...]
}
},
"reference": {
"hash": "000000000c1845717b0820bd32b57d1928af1b4ae80bdec71b73ab8d60f9eb74",
"topoheight": 25770
},
"tx_as_hex": true,
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"data": {
"transfers": [
{
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"commitment": [...],
"ct_validity_proof": {
"Y_0": [...],
"Y_1": [...],
"z_r": [...],
"z_x": [...]
},
"destination": "xet:t23w8pp90zsj04sp5r3r9sjpz3vq7rxcwhydf5ztlk6efhnusersqvf8sny",
"extra_data": null,
"receiver_handle": [...],
"sender_handle": [...]
}
]
},
"fee": 25000,
"fee_limit": 30000,
"hash": "f8bd7c15e3a94085f8130cc67e1fefd89192cdd208b68b10e1cc6e1a83afe5d6",
"multisig": null,
"nonce": 1463,
"range_proof": [...],
"reference": {
"hash": "000000000c1845717b0820bd32b57d1928af1b4ae80bdec71b73ab8d60f9eb74",
"topoheight": 25770
},
"signature": "6731b973cb5c06c7e4e6fa9135acf4ea7c1b2e2bd0a63e41110aad3b39174204067bf7de87f3c3e2042cbcf6899a307e480d80e7c7f96638eabbf1fe6cfded09",
"size": 1517,
"source": "xet:dn3x9yspqtuzhm874m267a3g9fkdztr3uztyx534wdx3p9rkdspqqhpss5d",
"source_commitments": [
{
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"commitment": [...],
"proof": {
"Y_0": [...],
"Y_1": [...],
"Y_2": [...],
"z_r": [...],
"z_s": [...],
"z_x": [...]
}
}
],
"tx_as_hex": "00d67ad13934337b85c34985491c437386c95de0d97017131088724cfbedebdc55010100000000000000000000000000000000000000000000000000000000000000005aa2e3842578a127d601a0e232c24114580f0cd875c8d4d04bfdb594de7c864700ee1e827a43c220f6c8502e8ddebbd02b2ef1edcbd5cd90cd6af497129fcee11b109a4e8b947caa52b1919cfad615e027a89af8adf6cb42e947b129d9ad77a00f465ca3472da66f0ad670b202f80c4adec695e8a97abb2050d1fe21d73524403122a109b128214df24d70d1323b1128496389976315248b628b21244e0d115604f6e3e1d56226b3c7c21a69ffb6fc7ed6ce527921f9af5f9b61adc01a3a7c817b84ae6344ff62dbd33519ab3aba151330460af77c22af20c72721f4be6f32e20c95c7eb09a0cafc8971e7640da47f6599c600ea7d14f5139c6b98de19817b810100000000000061a800000000000005b701345fac2a77aa1d9955170d1a24dec26d60f49bc9cdd574bfe6d7add0bf016a441ccf887fd77976d92c8be87a547e103da5167ebe4a9c99e7419251738dc3b643fe85694f0060b0cccd77a534f08108c13689d59119716450f9234fcee4f8dd2fe8e98f6f4ad6c85f13df78670c926be2043bb75dd26104816c0a32b54f00f715f0613286ae1bcf64938bb43edd3be32bf65e5816eb8444a1244013ec1cd33e03c14082bca938d54fbb4de56e36ab2806d97c56ff279346230d2c6b130c0bcb0c89a862f3398d12a5b94e1db086cde28c903cf23af135178976ecdddced617306000000000000000000000000000000000000000000000000000000000000000002e0169af51116d0631ba9706d824dfb48c244b1cd76ca1442a8e652e0b285e6492aa2857f5cf78f922213477524a67fb3e1c0d68d62f8a4b1eb2bb695e2f8e4d035a6d04b9b14d70c6e8e84684adb0ad9b8c28416db2826a9583b582c3f81cf7b224276b0aa297556816b1b4954e2cef4dc6cb4f7ca95860545b265604765c64d6aecd989896801e013ebe92c57e4a38ace5c86ec41a50c6f6ed75015f0033b5504246781c4da478fe3c9f945a56edb29899be585ba4096c4212b92425fe4cc5905cf410456db21df087eebcebe31d37c1c514b73cd561f633214921bed393fce04fceec94193840cacf90b375c41235cabfc56635f4164f6f717db538c3cc28e56e22042ea1176ce1441a9d57796cb4a27849a71a30b7aaee98002b0d63bb98024da3b24a954f08e152eb8ff84334fff0b8271e4d3b59ace30aeb21b7fd26b79382e0648211a4aec78ea9844e60bf6a730b79184ac372cb8d5d7efc8c3b447ac3c1c609c4e478abbecf59fdddbb466510173a701dde050953813f2558d3d1c485c8a74c21ffc7a6bd436133c5219caf64bd3925c47fe9f81a536d2745ed1f070131cd0508d387a8a98cce61bab9bb4708ea490e483be60eac36277458ed1d6ba776c0da7424fc2c888f1264249f3185654468d1f344470cff3776c0f5071f50065ca383a0b68561d1d9fbb4b62c052e7139151122c121bd0e667a4320c7372356dd2059e4dff4ff983c17a55d1c645a8b9841273f9b6970e5a76ae10cdcb2c7b2c8cbf0134f39a11baa708e2a2d761d7215067cd61bb282eeda651159a3c18250a2a993ef99cc450c50a1dbf070f882619ab822e3506b3039128dea3b62106263d221753d1946b786c49d6e0a677bdd512d7c502a647a7f2c71c0373d225593e2e12aeb50e5a4a9849662d9b098f86145aa742b601afa485945e6b0ff34d71a35f303981d11d7ade050220ce4be49044e8793379c38f120a9136f5d64da61b2c02f30d306e11c35051f4474063ad1aaa2cd1b599d1ac3ed60c86b8aeb7af014604000000000c1845717b0820bd32b57d1928af1b4ae80bdec71b73ab8d60f9eb7400000000000064aa6731b973cb5c06c7e4e6fa9135acf4ea7c1b2e2bd0a63e41110aad3b39174204067bf7de87f3c3e2042cbcf6899a307e480d80e7c7f96638eabbf1fe6cfded09",
"version": 0
}
}build_unsigned_transaction
Build a transaction without signing it. This is useful in case of a MultiSig setup where you need to sign the transaction with other signers.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| fee | FeeBuilder | Optional | Set an exact fee value or a multiplier |
| nonce | Integer | Optional | Set the nonce to use by the transaction. By default its provided by wallet |
| tx_version | Integer | Optional | Set the transaction version to use. By default take the version from wallet |
| tx_as_hex | Boolean | Optional | Serialize TX to hexadecimal. By default set to false |
| fee_limit | Integer | Optional | Set a maximum fee limit to pay. If fee estimation is higher, TX fails. |
| base_fee | BaseFeeMode | Optional | Set base fee selection mode. By default, query the connected daemon. |
<transaction_type> | TransactionType | Required | Transaction Type parameter, see above |
Request
{
"jsonrpc": "2.0",
"method": "build_unsigned_transaction",
"id": 1,
"params": {
"transfers": [
{
"amount": 1000,
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"destination": "xet:t23w8pp90zsj04sp5r3r9sjpz3vq7rxcwhydf5ztlk6efhnusersqvf8sny"
}
],
"tx_as_hex": true,
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"data": {
"transfers": [
{
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"commitment": [...],
"ct_validity_proof": {
"Y_0": [...],
"Y_1": [...],
"z_r": [...],
"z_x": [...]
},
"destination": [...],
"extra_data": null,
"receiver_handle": [...],
"sender_handle": [...]
}
]
},
"fee": 25000,
"fee_limit": 30000,
"hash": "f8bd7c15e3a94085f8130cc67e1fefd89192cdd208b68b10e1cc6e1a83afe5d6",
"nonce": 1463,
"range_proof": [...],
"reference": {
"hash": "000000000c1845717b0820bd32b57d1928af1b4ae80bdec71b73ab8d60f9eb74",
"topoheight": 25770
},
"source": [...],
"source_commitments": [
{
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"commitment": [...],
"proof": {
"Y_0": [...],
"Y_1": [...],
"Y_2": [...],
"z_r": [...],
"z_s": [...],
"z_x": [...]
}
}
],
"multisig": null,
"tx_as_hex": "<hexadecimal transaction>",
"version": 0,
"threshold": null
}
}NOTE: threshold is null when no multisig threshold is active.
finalize_unsigned_transaction
Finalize an unsigned transaction by signing it with the wallet key pair. Once signed, the transaction can be broadcasted to the network.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| unsigned | UnsignedTransaction | Required | Hexadecimal/JSON representation of the unsigned transaction to sign |
| signatures | Array | Optional | List of signatures to use for the transaction multisig. |
| broadcast | Boolean | Optional | Broadcast TX to daemon. By default set to true |
| tx_as_hex | Boolean | Optional | Serialize TX to hexadecimal. By default set to false |
| Request |
{
"jsonrpc": "2.0",
"method": "finalize_unsigned_transaction",
"id": 1,
"params": {
"unsigned": "<hexadecimal transaction>",
"tx_as_hex": true
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"data": {
"transfers": [
{
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"commitment": [...],
"ct_validity_proof": {
"Y_0": [...],
"Y_1": [...],
"z_r": [...],
"z_x": [...]
},
"destination": "xet:t23w8pp90zsj04sp5r3r9sjpz3vq7rxcwhydf5ztlk6efhnusersqvf8sny",
"extra_data": null,
"receiver_handle": [...],
"sender_handle": [...]
}
]
},
"fee": 25000,
"fee_limit": 30000,
"hash": "f8bd7c15e3a94085f8130cc67e1fefd89192cdd208b68b10e1cc6e1a83afe5d6",
"multisig": null,
"nonce": 1463,
"range_proof": [...],
"reference": {
"hash": "000000000c1845717b0820bd32b57d1928af1b4ae80bdec71b73ab8d60f9eb74",
"topoheight": 25770
},
"signature": "6731b973cb5c06c7e4e6fa9135acf4ea7c1b2e2bd0a63e41110aad3b39174204067bf7de87f3c3e2042cbcf6899a307e480d80e7c7f96638eabbf1fe6cfded09",
"size": 1517,
"source": "xet:dn3x9yspqtuzhm874m267a3g9fkdztr3uztyx534wdx3p9rkdspqqhpss5d",
"source_commitments": [
{
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"commitment": [...],
"proof": {
"Y_0": [...],
"Y_1": [...],
"Y_2": [...],
"z_r": [...],
"z_s": [...],
"z_x": [...]
}
}
],
"tx_as_hex": "<hexadecimal transaction>",
"version": 0
}
}NOTE:
- The response is the same as
build_transactionbut without the signature. hashfield is not the real hash of the transaction because it’s not signed yet. Its a hash used for multisig signing.
sign_unsigned_transaction
Sign an unsigned transaction hash with the wallet key pair. This is useful in case you are a part of the multisig of another wallet and you need to sign a transaction.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| hash | Hash | Required | Hash of the unsigned transaction to sign |
| signer_id | Integer | Required | Index of the signer in the multisig setup to use for signing |
Request
{
"jsonrpc": "2.0",
"method": "sign_unsigned_transaction",
"id": 1,
"params": {
"hash": "f8bd7c15e3a94085f8130cc67e1fefd89192cdd208b68b10e1cc6e",
"signer_id": 0
},
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"signature": "6731b973cb5c06c7e4e6fa9135acf4ea7c1b2e2bd0a63e41110aad3b39174204067bf7de87f3c3e2042cbcf6899a307e480d80e7c7f96638eabbf1fe6cfded09",
"id": 0
}
}NOTE: The response is the signature of the hash provided. You can use this SignatureId returned to finalize the transaction by adding it to the Unsigned Transaction multisig.
get_pending_transactions
Retrieve locally-created transactions that are not confirmed yet.
Parameters No parameters
Request
{
"jsonrpc": "2.0",
"method": "get_pending_transactions",
"id": 1
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"hash": "b84adead7fe1c0499f92826c08f4f67f8e5133981465b7b9cf0b34649e11f1e0",
"timestamp": 1723503200000,
"outgoing": {
"fee": 125000,
"nonce": 3530,
"transfers": [
{
"amount": 100000000,
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"destination": "xet:6elhr5zvx5wl2ljjl82l6yxxxqkxjvcr38kcq9qef3nurm2r2arsq89z4ll",
"extra_data": null
}
]
}
}
]
}clear_tx_cache
In case of a failure while broadcasting a TX from this wallet by yourself, you can erase the TX cache stored in the wallet.
Parameters No parameters
Request
{
"jsonrpc": "2.0",
"method": "clear_tx_cache",
"id": 1
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}list_transactions
Search transactions based on various parameters. By default it accepts every TXs.
For address param, it is compared to the sender if it’s an incoming TX, and to destination address for outgoing TX.
Topoheight range if specified is inclusive. Meaning if you set max_topoheight at 10 and you have a TX at 10 its returned.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| asset | Hash | Optional | Filter on a specific asset only. By default accept all assets |
| min_topoheight | Integer | Optional | Start from specific topo |
| max_topoheight | Integer | Optional | End at specific topo |
| min_timestamp | Integer | Optional | Start from specific timestamp (ms) |
| max_timestamp | Integer | Optional | End at specific timestamp (ms) |
| address | String | Optional | Filter with address |
| accept_incoming | Boolean | Optional | Filter incoming |
| accept_outgoing | Boolean | Optional | Filter outgoing |
| accept_coinbase | Boolean | Optional | Filter coinbase |
| accept_burn | Boolean | Optional | Filter burn |
| accept_blob | Boolean | Optional | Filter blob |
| query | Query | Optional | Allow to filter on extra data |
| limit | Integer | Optional | Maximum number of entries returned |
| skip | Integer | Optional | Skip the first N matching entries |
Request
{
"jsonrpc": "2.0",
"method": "list_transactions",
"id": 1,
"params": {
"accept_coinbase": false,
"accept_outgoing": false,
"accept_incoming": true
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"hash": "dd693bad09cb03ba0bf9a6fa7b787f918748db869c1463b7fa16e20b498dea88",
"timestamp": 1711665303229,
"incoming": {
"from": "xet:dn3x9yspqtuzhm874m267a3g9fkdztr3uztyx534wdx3p9rkdspqqhpss5d",
"transfers": [
{
"amount": 100000000,
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"extra_data": null
}
]
},
"topoheight": 10657
}
]
}sign_data
Generate a signature for the input data using your wallet key pair.
Parameters Parameter value can be anything (object, value, array…)
Request
{
"jsonrpc": "2.0",
"method": "sign_data",
"id": 1,
"params": {
"hello": "world"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "5bb7a1f33c3c89e968be9f1c343aa15393ec98905976e38087d53595a3411bd0130f9414b7e5fe4e3bcdcad03e0c6d2cbee01c10514289ad3b2b5e3b2fe8fd03"
}verify_signed_data
Verify a signature against a public key and the provided data.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| data | DataElement | Required | Data that was originally signed |
| signature | Signature | Required | Signature to verify |
| address | Address | Required | Address of the signer to verify with |
Request
{
"jsonrpc": "2.0",
"method": "verify_signed_data",
"id": 1,
"params": {
"data": {
"hello": "world"
},
"signature": "5bb7a1f33c3c89e968be9f1c343aa15393ec98905976e38087d53595a3411bd0130f9414b7e5fe4e3bcdcad03e0c6d2cbee01c10514289ad3b2b5e3b2fe8fd03",
"address": "xet:t23w8pp90zsj04sp5r3r9sjpz3vq7rxcwhydf5ztlk6efhnusersqvf8sny"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}estimate_fees
Estimate the minimum required fees for a future transaction. Returned fees are in atomic units.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
<transaction_type> | TransactionType | Required | Transaction Type parameter |
| fee | FeeBuilder | Optional | Fee mode to use for estimation |
| base_fee | BaseFeeMode | Optional | Base fee selection mode |
Request
{
"jsonrpc": "2.0",
"method": "estimate_fees",
"id": 1,
"params": {
"transfers": [
{
"amount": 1000,
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"destination": "xet:t23w8pp90zsj04sp5r3r9sjpz3vq7rxcwhydf5ztlk6efhnusersqvf8sny"
}
]
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": 25000
}estimate_extra_data_size
Estimate the extra data size for a list of destinations using their integrated data.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| destinations | Address[] | Required | List of destination addresses with integrated data |
Request
{
"jsonrpc": "2.0",
"method": "estimate_extra_data_size",
"id": 1,
"params": {
"destinations": [
"xet:t23w8pp90zsj04sp5r3r9sjpz3vq7rxcwhydf5ztlk6efhnusersqvf8sny"
]
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"size": 128
}
}is_online
Determine if the wallet is connected to a node or not (offline / online mode).
Parameters No parameter
Request
{
"jsonrpc": "2.0",
"method": "is_online",
"id": 1
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}set_online_mode
Connect the wallet to a daemon node. The wallet must not already be connected.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| daemon_address | String | Required | Address of the daemon to connect to |
| auto_reconnect | Boolean | Optional | Automatically reconnect if disconnected (default: false) |
Request
{
"jsonrpc": "2.0",
"method": "set_online_mode",
"id": 1,
"params": {
"daemon_address": "ws://127.0.0.1:8080/json_rpc",
"auto_reconnect": true
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}set_offline_mode
Disconnect the wallet from the daemon and switch to offline mode. The wallet must be in online mode.
Parameters No parameters
Request
{
"jsonrpc": "2.0",
"method": "set_offline_mode",
"id": 1
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}network_info
Fetch all information about the current node to which the wallet is connected to.
Parameters No parameter
Request
{
"jsonrpc": "2.0",
"method": "network_info",
"id": 1
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"average_block_time": 15954,
"block_reward": 137924147,
"block_time_target": 15000,
"block_version": 0,
"burned_supply": 0,
"circulating_supply": 104512595148870,
"connected_to": "ws://127.0.0.1:8080/json_rpc",
"dev_reward": 13792414,
"difficulty": "107844053400",
"emitted_supply": 104512595148870,
"height": 725025,
"maximum_supply": 1840000000000000,
"mempool_size": 0,
"miner_reward": 124131733,
"network": "Mainnet",
"pruned_topoheight": null,
"stableheight": 725017,
"stable_topoheight": 761750,
"top_block_hash": "1914802b64b28386adc37927081beb6ac4677b6f85ee2149f7a143339c99d309",
"topoheight": 761761,
"version": "1.13.4-d33986a"
}
}decrypt_extra_data
Decrypt the extra data from a transaction. This function is useful in case your wallet is offline and you want it to decrypt a extra data without having it in online mode.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| extra_data | Byte Array | Required | Byte array containing the encrypted extra data |
| role | String | Required | Role of the wallet in the transaction (sender/receiver) |
Request
{
"jsonrpc": "2.0",
"method": "decrypt_extra_data",
"id": 1,
"params": {
"role": "receiver",
"extra_data": [
...
]
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"hello": "world!"
}
}decrypt_ciphertext
Decrypt a ciphertext from its compressed format.
If you want to decrypt the ciphertext of a Transaction, you need to take the Transfer commitment field.
For the handle field, you need to select either receiver_handle or sender_handle based on the flow of the transaction.
Please note that the value returned is in atomic units.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| ciphertext | Compressed | Required | Ciphertext compressed format |
| max_supply | Integer | Optional | Maximum amount to search while decrypting |
Request
{
"jsonrpc": "2.0",
"method": "decrypt_ciphertext",
"id": 1,
"params": {
"ciphertext": {
"handle": [ ... ],
"commitment": [ ... ]
},
"max_supply": null
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": 5700000000
}create_ownership_proof
Create a cryptographic proof that you own at least a certain amount of an asset. The proof is returned as a bech32-encoded string that can be shared with other parties for verification.
If topoheight is not provided, the current wallet balance topoheight is used.
If topoheight is provided, the balance at the requested topoheight will be fetched from the daemon and used for proof creation.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| asset | Hash | Required | Asset to create the proof for |
| topoheight | Integer | Optional | Topoheight to use for the balance (defaults to current) |
| amount | Integer | Required | Amount to prove ownership of |
Request
{
"jsonrpc": "2.0",
"method": "create_ownership_proof",
"id": 1,
"params": {
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"amount": 10000
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "proof:..."
}create_balance_proof
Create a cryptographic proof of your balance for a specific asset. The proof is returned as a bech32-encoded string that can be shared with other parties for verification.
If topoheight is not provided, the current wallet balance topoheight is used.
If topoheight is provided, the balance at the requested topoheight will be fetched from the daemon and used for proof creation.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| asset | Hash | Required | Asset to create the proof for |
| topoheight | Integer | Optional | Topoheight to use for the balance (defaults to current) |
Request
{
"jsonrpc": "2.0",
"method": "create_balance_proof",
"id": 1,
"params": {
"asset": "0000000000000000000000000000000000000000000000000000000000000000"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "proof:..."
}verify_human_readable_proof
Verify a cryptographic proof (ownership or balance) against an address. The wallet must be in online mode to fetch the on-chain balance at the proof’s topoheight.
Returns true if the proof is valid.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| proof | String | Required | Bech32-encoded proof string (ownership or balance) |
| address | Address | Required | Address of the prover to verify against |
Request
{
"jsonrpc": "2.0",
"method": "verify_human_readable_proof",
"id": 1,
"params": {
"proof": "proof:...",
"address": "xel:..."
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}Storage
XELIS Wallet has the ability to have a built-in encrypted DB that can be used to store / fetch entries easily. This can be really helpful for small services / applications that don’t want to setup a whole database system.
It is a key / value DB with support of multiples Trees, everything is stored in encrypted form on the disk.
You can either access it directly through Rust code, or through the following JSON-RPC methods.
Every types are allowed and are automatically serialized.
A query system is available to make advanced filter over encrypted keys and values from DB. This feature is planned to be improved in future. For now, the follow are implemented:
- Filter over numbers values (
>=,>,<,<=,==). - Regex over stringified values
Is Of Type(built-in types arebool,string,u8,u16,u32,u64,u128,hash,blob)Starts withEnds WithContains ValueEqual to
Those filters can be used together or alone, using the Not, And, Or operations.
If key or value is a map or an array, you can also do filter on them:
Has Key(with expected key value and an optional query on the value if present)At Key(same as above but query is mandatory)Len(check the map/array size using aquery number)Contains Element(check if the array contains the requested element)At Position(check at array index if the value match using a query)Type(check which kind of type it is)
Please note that these functionalities are also available from XSWD calls, which mean, any accepted Application through XSWD can have its own DB like a local storage on web JavaScript.
This query system will be used in daemon also once Smart Contracts are deployed to easily search entries in the Smart Contract database.
Events
Events are only available through Websocket protocol.
Before listening to an event you must subscribe with an available method.
For example:
const ws = new WebSocket('ws://127.0.0.1:8081/json_rpc')
const message = {
id: 1,
jsonrpc: '2.0',
method: 'subscribe',
params: {
notify: 'new_topo_height'
}
}
ws.onmessage = (message) => {
console.log(message.data)
}
ws.send(JSON.stringify(message))new_topo_height
When a new topoheight is detected by the wallet. It may be lower than the previous one, based on how the DAG reacts
On Event
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"event": "new_topo_height",
"topoheight": 57
}
}new_asset
When a new asset is detected by the wallet.
On Event
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"event": "new_asset",
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"decimals": 8,
"max_supply": {
"fixed": 1840000000000000
},
"name": "XELIS",
"owner": "none",
"ticker": "XEL",
"topoheight": 57
}
}new_transaction
When a new transaction is detected by the wallet.
On Event
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"event": "new_transaction",
"hash": "b84adead7fe1c0499f92826c08f4f67f8e5133981465b7b9cf0b34649e11f1e0",
"timestamp": 1723503200000,
"outgoing": {
"fee": 125000,
"nonce": 3530,
"transfers": [
{
"amount": 100000000,
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"destination": "xet:6elhr5zvx5wl2ljjl82l6yxxxqkxjvcr38kcq9qef3nurm2r2arsq89z4ll",
"extra_data": null
}
]
},
"topoheight": 107853
}
}new_pending_transaction
When a locally-created transaction is added to the wallet pending set.
On Event
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"event": "new_pending_transaction",
"hash": "b84adead7fe1c0499f92826c08f4f67f8e5133981465b7b9cf0b34649e11f1e0",
"timestamp": 1723503200000,
"outgoing": {
"fee": 125000,
"nonce": 3530,
"transfers": [
{
"amount": 100000000,
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"destination": "xet:6elhr5zvx5wl2ljjl82l6yxxxqkxjvcr38kcq9qef3nurm2r2arsq89z4ll",
"extra_data": null
}
]
}
}
}balance_changed
When an asset balance has been updated.
NOTE: Balance is in atomic units.
On Event
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"event": "balance_changed",
"asset": "0000000000000000000000000000000000000000000000000000000000000000",
"balance": 178800000000
}
}rescan
When a rescan has been triggered by the wallet. The event response contains the topoheight until which the wallet rescanned and deleted the transactions.
On Event
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"event": "rescan",
"start_topoheight": 50
}
}history_synced
When the wallet history sync is complete.
On Event
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"event": "history_synced",
"topoheight": 107853
}
}online
When the wallet is in online mode (connected to a daemon).
On Event
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"event": "online"
}
}offline
When the wallet is in offline mode (not connected to any daemon).
On Event
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"event": "offline"
}
}sync_error
When the wallet sync loop reports an error.
On Event
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"event": "sync_error",
"message": "connection closed"
}
}track_asset
When an asset is tracked by the wallet.
On Event
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"event": "track_asset",
"asset": "0000000000000000000000000000000000000000000000000000000000000000"
}
}untrack_asset
When an asset is untracked by the wallet.
On Event
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"event": "untrack_asset",
"asset": "0000000000000000000000000000000000000000000000000000000000000000"
}
}JSON-RPC methods
Storage
XELIS Wallet has the ability to have a built-in encrypted DB that can be used to store / fetch entries easily. This can be really helpful for small services / applications that don’t want to setup a whole database system.
It is a key / value DB with support of multiples Trees, everything is stored in encrypted form on the disk.
You can either access it directly through Rust code, or through the following JSON-RPC methods.
Every types are allowed and are automatically serialized.
A query system is available to make advanced filter over encrypted keys and values from DB. This feature is planned to be improved in future. For now, the follow are implemented:
- Filter over numbers values (
>=,>,<,<=,==). - Regex over stringified values
Is Of Type(built-in types arebool,string,u8,u16,u32,u64,u128,hash,blob)Starts withEnds WithContains ValueEqual to
Those filters can be used together or alone, using the Not, And, Or operations.
If a key or value is a map or an array, you can also do filter on them:
Has Key(with expected key value and an optional query on the value if present)At Key(same as above but query is mandatory)Len(check the map/array size using aquery number)Contains Element(check if the array contains the requested element)At Position(check at array index if the value match using a query)Type(check which kind of type it is)
Please note that these functionalities are also available from XSWD calls, which mean, any accepted Application through XSWD can have its own DB like a local storage on web JavaScript.
This query system will also be used in daemon once Smart Contracts are deployed to easily search entries in the Smart Contract database.
get_matching_keys
Retrieve all keys available in the selected tree, with optional query filter.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| tree | String | Required | Tree name to search in |
| query | Query | Optional | Optional query filter for key values |
| limit | Integer | Optional | Maximum number of keys to return |
| skip | Integer | Optional | Number of keys to skip |
Request
{
"jsonrpc": "2.0",
"method": "get_matching_keys",
"id": 1,
"params": {
"tree": "test"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
"my_list",
"my_key"
]
}count_matching_entries
Count all entries available in the selected tree, with optional query filters on key and value.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| tree | String | Required | Tree name to count entries in |
| key | Query | Optional | Optional query filter on keys |
| value | Query | Optional | Optional query filter on values |
Request
{
"jsonrpc": "2.0",
"method": "count_matching_entries",
"id": 1,
"params": {
"tree": "test"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": 5
}delete_tree_entries
Delete all entries in the requested tree.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| tree | String | Required | Tree name to clear all entries |
Request
{
"jsonrpc": "2.0",
"method": "delete_tree_entries",
"id": 1,
"params": {
"tree": "test"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}store
Store a new key / value entry in the requested Tree.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| tree | String | Required | Tree name to store in |
| key | DataValue | Required | Entry key |
| value | DataElement | Required | Entry value |
Request
{
"jsonrpc": "2.0",
"method": "store",
"id": 1,
"params": {
"tree": "test",
"key": "my_list",
"value": ["hello", " ", "world", "!"]
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}delete
Delete a key / value entry in the requested Tree.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| tree | String | Required | Tree name to delete from |
| key | DataValue | Required | Entry key to delete |
Request
{
"jsonrpc": "2.0",
"method": "delete",
"id": 1,
"params": {
"tree": "test",
"key": "my_list"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}has_key
Verify if the key is present in the requested Tree.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| tree | String | Required | Tree name to search in |
| key | DataValue | Required | Entry key to check |
Request
{
"jsonrpc": "2.0",
"method": "has_key",
"id": 1,
"params": {
"tree": "test",
"key": "my_list"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}get_value_from_key
Get a value using its key in the requested Tree.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| tree | String | Required | Tree name to search in |
| key | DataValue | Required | Entry key to retrieve |
Request
{
"jsonrpc": "2.0",
"method": "get_value_from_key",
"id": 1,
"params": {
"tree": "test",
"key": "my_list"
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
"hello",
" ",
"world",
"!"
]
}query_db
Query the DB in the requested Tree with filters.
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| tree | String | Required | Tree name to query |
| key | Query | Optional | Optional query filter on keys |
| value | Query | Optional | Optional query filter on values |
| limit | Integer | Optional | Maximum number of entries to return |
| skip | Integer | Optional | Number of entries to skip |
Request
{
"jsonrpc": "2.0",
"method": "query_db",
"id": 1,
"params": {
"tree": "test",
"value": {
"or": [
{
"equal": "welcome"
},
{
"equal": "test"
},
{
"equal": "!"
}
]
}
}
}Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"entries": {
"my_list": [
"hello",
" ",
"world",
"!"
]
},
"next": null
}
}