From 9adb1de60c8f4d6771fd6675f145c9ea13bd30ce Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 4 Oct 2023 12:58:50 +0800 Subject: [PATCH 01/27] update `active_swaps` method --- .../api/legacy/active_swaps/index.mdx | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/pages/atomicdex/api/legacy/active_swaps/index.mdx b/src/pages/atomicdex/api/legacy/active_swaps/index.mdx index 4349fbb7..184a5024 100644 --- a/src/pages/atomicdex/api/legacy/active_swaps/index.mdx +++ b/src/pages/atomicdex/api/legacy/active_swaps/index.mdx @@ -10,17 +10,16 @@ The `active_swaps` method returns all the swaps that are currently running on th ## Arguments -| Structure | Type | Description | -| --------------- | ---- | ----------------------------------------------------------------- | -| include\_status | bool | whether to include swap statuses in response; defaults to `false` | +| Structure | Type | Description | +| --------------- | ---- | ----------------------------------------------------------------------------- | +| include\_status | bool | Optional, defaults to `false`. Whether to include swap statuses in response; | ## Response -| Structure | Type | Description | -| --------------- | ---------------- | ----------------------------------------------------------------------------------------------------------- | -| result | result object | | -| result.uuids | array of strings | uuids of currently running swaps | -| result.statuses | object (map) | the `uuid -> swap status` map of currently running swaps; `null` if include\_status is false in the request | +| Structure | Type | Description | +| ----------- | ---------------- | ----------------------------------------------------------------------------------------------------------- | +| uuids | array of strings | A list of currently active swap UUIDs. | +| statuses | object (map) | Only visible if `include_status` request parameter is `true`. A map of standard [SwapStatus](/atomicdex/api/v20/#swap-status) objects, delineated by the related UUID. | #### 📌 Examples @@ -35,18 +34,6 @@ The `active_swaps` method returns all the swaps that are currently running on th ``` -#### Command (include\_status = true) - - - ```json - { - "userpass": "testpsw", - "method": "active_swaps", - "include_status": true - } - ``` - - #### Response (uuids only) @@ -62,7 +49,22 @@ The `active_swaps` method returns all the swaps that are currently running on th } } ``` + +#### Command (include\_status = true) + + + ```json + { + "userpass": "testpsw", + "method": "active_swaps", + "include_status": true + } + ``` + + + + #### Response (statuses included) ```json From 7d9af57aca08aa668e5973493e74b72c91339514 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 4 Oct 2023 13:02:02 +0800 Subject: [PATCH 02/27] separate common structures into sections --- .../common_structures/activation/index.mdx | 300 ++++++++++++++++++ .../atomicdex/api/common_structures/index.mdx | 210 ++++++++++++ .../api/common_structures/lightning/index.mdx | 167 ++++++++++ .../api/common_structures/nfts/index.mdx | 23 ++ .../api/common_structures/swaps/index.mdx | 60 ++++ 5 files changed, 760 insertions(+) create mode 100644 src/pages/atomicdex/api/common_structures/activation/index.mdx create mode 100644 src/pages/atomicdex/api/common_structures/index.mdx create mode 100644 src/pages/atomicdex/api/common_structures/lightning/index.mdx create mode 100644 src/pages/atomicdex/api/common_structures/nfts/index.mdx create mode 100644 src/pages/atomicdex/api/common_structures/swaps/index.mdx diff --git a/src/pages/atomicdex/api/common_structures/activation/index.mdx b/src/pages/atomicdex/api/common_structures/activation/index.mdx new file mode 100644 index 00000000..3fdd0346 --- /dev/null +++ b/src/pages/atomicdex/api/common_structures/activation/index.mdx @@ -0,0 +1,300 @@ +export const title = "Komodo DeFi SDK Common Structures: Activation"; +export const description = "The Komodo DeFi SDK uses a variety of activation methods, depending on the type of coin."; + +# Activation Structures + +### ActivationParams + +The `ActivationParams` object defines additional parameters used for activation. These params may vary depending on the coin type. + +The following methods use this structure: +- TBA + + +| Parameter | Type | Description | +| ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | +| requires\_notarization | boolean | Optional, defaults to `false`. For [dPoW](https://komodoplatform.com/en/blog/dpow-demystified/) protected coins, a `true` value will wait for transactions to be notarised when doing swaps. Overrides value if set in `coins` file. | +| priv\_key\_policy | string | Defaults to `ContextPrivkey`. Set as `Trezor` to activate in Trezor mode. | +| min\_addresses\_number | integer | HD wallets only. How many additional addreesses to generate at a minimum. | +| scan\_policy | string | HD wallets only. Whether or not to scan for new addresses. Select from `do_not_scan`, `scan_if_new_wallet` or `scan`. Note that `scan` will result in multple requests to the Komodo DeFi SDK. | +| gap\_limit | integer | HD wallets only. The max number of empty addresses in a row. If transactions were sent to an address outside the `gap_limit`, they will not be identified when scanning. | +| zcash\_params\_path | string | ZHTLC coins only. Path to folder containing Zcash parameters. Optional, defaults to standard location as defined in [this guide](https://forum.komodoplatform.com/t/installing-zcash-params/603) | +| scan\_blocks\_per\_iteration | integer | ZHTLC coins only. Sets the number of scanned blocks per iteration during `BuildingWalletDb` state. Optional, default value is 1000. | +| scan\_interval\_ms | integer | ZHTLC coins only. Sets the interval in milliseconds between iterations of `BuildingWalletDb` state. Optional, default value is 0. | +| mode | object | QTUM, UTXO & ZHTLC coins only. A standard [ActivationMode](/atomicdex/api/v20/#activation-mode) object. | + + + For ZHTLC coins, older wallets need to set the `sync_params` field to a date before its + first transaction to see all balance and history. This may take a long time on the first + activation, but subsequent activations will be much faster. + Using a smaller `scan_blocks_per_iteration` and larger `scan_interval_ms`, + will reduce the average CPU load during ZHTLC coin activation (at the cost of a + longer activation time). These optional fields are recommended when developing + for iOS, where a high CPU load may kill the activation process. Android & + desktop operating systems do not appear to have any problems with high CPU + load during ZHTLC coin activation. + + + +### ActivationMode + +Defines the activation mode for QTUM, BCH, UTXO & ZHTLC coins. + +The following methods use this structure: +- TBA + + +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------------------- | +| rpc | string | `Native` if running a native blockchain node, `Electrum` if using electrum servers or `Light` for ZHTLC coins. | +| rpc\_data | object | `Electrum` or `Light` mode only. A standard [ActivationRpcData](/atomicdex/api/v20/#activation-rpc-data) object. | + +### ActivationRpcData + +Contains information about electrum & lightwallet\_d servers for coins being used in `Electrum` or `Light` mode. + +| Parameter | Type | Description | +| ------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | +| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | +| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | +| sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a unix timestamp). | + + +### ActivationServers + +The following methods use this structure: +- TBA + +Contains information electrum servers for coins being used in `Electrum` or `Light` mode. + +| Parameter | Type | Description | +| --------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| url | string | The URL and port for an electrum server. | +| ws\_url | string | Optional, for WSS only. The URL and port for an electrum server's WSS port. | +| protocol | string | Optional, defaults to `TCP`. Transport protocol used to connect to the server. Options: `TCP` or `SSL` | +| disable\_cert\_verification | boolean | Optional, defaults to `false`. If `true`, this disables server SSL/TLS certificate verification (e.g. for self-signed certificates). Use at your own risk! | + + + #### ZHTLC Example + + ```json + { + "activation_params": { + "mode": { + "rpc": "Light", + "rpc_data": { + "electrum_servers": [ + { + "url":"zombie.dragonhound.info:10033" + } + ], + "light_wallet_d_servers": [ + "http://zombie.dragonhound.info:443" + ] + }, + "sync_params": { + "height": 2528700 + } + }, + "zcash_params_path": "/home/username/path_to/.zcash-params", + "scan_blocks_per_iteration": 100, + "scan_interval_ms": 200 + } + } + ``` + + #### HD UTXO Activation (v2) + + ```json + { + "activation_params": { + "mode": { + "rpc": "Electrum", + "rpc_data": { + "servers": [ + { + "url": "electrum2.cipig.net:10001" + }, + { + "url": "electrum3.cipig.net:20001", + "ws_url": "electrum3.cipig.net:30001", + "protocol": "SSL" + } + ] + } + }, + "scan_policy": "scan_if_new_wallet", + "priv_key_policy": "Trezor", + "min_addresses_number": 3, + "gap_limit": 20 + } + } + ``` + + +### AddressInfos + +The `addressInfos` object includes the following items for a given address. + +The following methods use this structure: +- TBA + + +| Parameter | Type | Description | +| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------ | +| balances | object | A standard [balanceInfos](/atomicdex/api/v20/#balance-infos) object. Not included in responses where `get_balances` is `false` | +| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/v20/#derivation-method) object | +| pubkey | string | The public key associated with the seed used to launch AtomicDEX | +| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | + + + #### Example with balances + + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "balances": { + "spendable": "0.11398301", + "unspendable": "0.00001" + } + } + ``` + + #### Example without balances + + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "tickers": ["ASLP-SLP"] + } + ``` + + +### BalanceInfos + +The `balanceInfos` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | +| spendable | string (numeric) | The available amount of a coin or token which is ready to be traded or withdrawn. | +| unspendable | string (numeric) | The amount of a coin or token which is awaiting confirmation on the block chain for an incoming or outgoing transaction. | + + + ```json + { + "spendable": "12.11398301", + "unspendable": "0.53" + } + ``` + + +### DerivationMethod + +The `DerivationMethod` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------------------- | +| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | + + + Using the same seed or private key to generate keypairs using different derivation methods will result in a different address and private key for each method. + + +Where the value indicates: + +* `Iguana`: The coin or token is was activated using Iguana derivation (default). +* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. + + + ```json + { + "type": "Iguana" + } + ``` + + +### EvmNode + +The `EvmNode` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------------------------------------------------------------------- | +| url | string | URL of an RPC node | +| gui\_auth | boolean | Optional, defaults to `false`. Must be set to `true` to access RPC nodes run officially by the Komodo Platform team | + + + ```json + { + "url": "http://eth1.cipig.net:8555", + "gui_auth": false + } + ``` + + +### CoinProtocol + +| Parameter | Type | Description | +| -------------- | ------- | ----------------------------------------------------------------------------- | +| type | integer | One of the supported \[coin types]\(link TBA) | +| protocol\_data | object | A standard [CoinProtocolData](/atomicdex/api/v20/#coin-protocol-data) object. | + +### CoinProtocolData + +| Parameter | Type | Description | +| --------------------- | ------ | ------------------------------------------------------------------------------------------------ | +| platform | string | Indicates the platform parent coin for EMV-like protocols, or the coin used for lightning nodes. | +| network | string | Either `mainnet` or \`testnet | +| confirmation\_targets | object | A standard [ConfirmationTargets](/atomicdex/api/v20/#confirmation-targets) object. | + + +### EvmNode + +The `EvmNode` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------------------------------------------------------------------- | +| url | string | URL of an RPC node | +| gui\_auth | boolean | Optional, defaults to `false`. Must be set to `true` to access RPC nodes run officially by the Komodo Platform team | + + + ```json + { + "url": "http://eth1.cipig.net:8555", + "gui_auth": false + } + ``` + + + +### DerivationMethod + +The `DerivationMethod` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------------------- | +| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | + + + Using the same seed or private key to generate keypairs using different derivation methods will result in a different address and private key for each method. + + +Where the value indicates: + +* `Iguana`: The coin or token is was activated using Iguana derivation (default). +* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. + + + ```json + { + "type": "Iguana" + } + ``` + diff --git a/src/pages/atomicdex/api/common_structures/index.mdx b/src/pages/atomicdex/api/common_structures/index.mdx new file mode 100644 index 00000000..0f7d385a --- /dev/null +++ b/src/pages/atomicdex/api/common_structures/index.mdx @@ -0,0 +1,210 @@ +export const title = "Komodo DeFi SDK RPC Protocol v2.0"; +export const description = "Starting with version beta-2.1.3434, the Komodo DeFi SDK supports the standardized protocol format called mmrpc 2.0."; + +# Komodo DeFi SDK RPC Protocol v2.0 + +Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the Komodo DeFi SDK supports the standardized protocol format called `mmrpc 2.0`. + +It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. + +## Request + +| Structure | Type | Description | +| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the Komodo DeFi SDK RPC protocol. Must be exactly "2.0" | +| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | +| method | string | the name of the method to be invoked | +| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | +| id | number (optional) | the identifier is established by the client. Komodo DeFi SDK will reply with the same value in the Response object if the `id` field is included and not `NULL` | + +### Response (Success) + +| Structure | Type | Description | +| --------- | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the Komodo DeFi SDK RPC protocol | +| result | object | the value of this field is determined by the method invoked on Komodo DeFi SDK | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | + +### Response (Error) + +| Structure | Type | Description | +| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| error | string | the common error description | +| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | +| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | +| error\_type | string | the string error identifier used to determine the cause of the error | +| error\_data | object | an object containing the error data of the corresponding `error_type` | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | + +### 📌 Examples + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "KMD", + "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", + "amount": "10" + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", + "block_height": 0, + "timestamp": 1566472936, + "fee_details": { + "type": "Utxo", + "amount": "0.1" + }, + "coin": "DOC", + "internal_id": "" + }, + "id": 0 + } + ``` + + + + #### Response (error) + + ```json + { + "mmrpc": "2.0", + "error": "The amount 0.000005 is too small", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:301]", + "error_type": "AmountIsTooSmall", + "error_data": { + "amount": "0.000005" + }, + "id": 0 + } + ``` + + +## Common Komodo DeFi SDK Request / Response Objects + +The objects are in the request or response of multiple Komodo DeFi SDK methods have been grouped into the following sections: +- [Activation](/atomicdex/api/common_structures/activation) +- [Swaps](/atomicdex/api/common_structures/swaps) +- [Lightning Network](/atomicdex/api/common_structures/lightning) +- [Non-fungible Tokens](/atomicdex/api/common_structures/nfts) + +Structures which are used in more than one section are listed below: + + +### AddressInfos + +The `addressInfos` object includes the following items for a given address: + +| Parameter | Type | Description | +| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------ | +| balances | object | A standard [balanceInfos](/atomicdex/api/v20/#balance-infos) object. Not included in responses where `get_balances` is `false` | +| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/v20/#derivation-method) object | +| pubkey | string | The public key associated with the seed used to launch AtomicDEX | +| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | + + + #### Example with balances + + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "balances": { + "spendable": "0.11398301", + "unspendable": "0.00001" + } + } + ``` + + #### Example without balances + + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "tickers": ["ASLP-SLP"] + } + ``` + + +### BalanceInfos + +The `balanceInfos` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | +| spendable | string (numeric) | The available amount of a coin or token which is ready to be traded or withdrawn. | +| unspendable | string (numeric) | The amount of a coin or token which is awaiting confirmation on the block chain for an incoming or outgoing transaction. | + + + ```json + { + "spendable": "12.11398301", + "unspendable": "0.53" + } + ``` + + + +### FeeInfo + +The `FeeInfo` response object includes the following items for [withdraw (v2)](/atomicdex/api/v20/withdraw/) requests: + +| Parameter | Type | Description | +| ---------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | Type of transaction fee; possible values: `UtxoFixed`, `UtxoPerKbyte`, `EthGas` | +| amount | string (numeric) | Fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) | +| gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | +| gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | + + +### Pagination + +For requests which return many results, pagination offsets may be applied. \*\* Use either value, not both. \*\* + +| Parameter | Type | Description | +| ---------- | ------- | ------------------------------------------------------- | +| PageNumber | integer | Optional, defaults to `1`. Offset for paginated results | +| FromId | integer | Optional. Ignores any results prior to this UUID | + + + #### Example + + ```json + { + "PageNumber": 1 + } + ``` + + ```json + { + "FromId": 4 + } + ``` + diff --git a/src/pages/atomicdex/api/common_structures/lightning/index.mdx b/src/pages/atomicdex/api/common_structures/lightning/index.mdx new file mode 100644 index 00000000..69c31818 --- /dev/null +++ b/src/pages/atomicdex/api/common_structures/lightning/index.mdx @@ -0,0 +1,167 @@ +export const title = "Komodo DeFi SDK Common Structures: Lightning"; +export const description = "Lightning network functionality is now available in the Komodo DeFi SDK!"; + +# Lightning Network Structures + + +### ConfirmationTargets + +This object represents the number of blocks required for an on-chain lightning-related transaction to be confirmed. +It is used for estimating the transaction fee rate (`feerate`) for different transaction types in the context of permissionless transactions performed by the node. Different target types are `background`, `normal`, and `high_priority`. + +| Parameter | Type | Description | +| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| background | integer | Used for transactions that can tolerate slower confirmation times when the transaction fee rate decreases. These transactions are not time-sensitive and can afford to wait longer for confirmation. The recommended range is `12` to `144` blocks to ensure a low `feerate`. | +| normal | integer | Used for transactions that we want to confirm promptly, without significant delay (e.g, transactions for opening payment channels). These transactions are important but not critical. Suggested value is `6` blocks to ensure a moderate `feerate`. | +| high\_priority | integer | Used for transactions that require quick confirmation to prevent potential loss of funds (e.g. redeeming a Hashed Time Lock Contract (HTLC) on the blockchain before it times out). These transactions are time-critical and must be confirmed promptly to ensure the security of funds. Recommended value for `high_priority` is 1-2 blocks to ensure a high `feerate`. | + + + Using the recommended values in the above table with a coin that has a block time of 10 minutes, the equivalent time in minutes is: + + * `background`: 120 minutes to 1440 minutes (2 hours to 1 day). + * `normal`: 60 minutes (one hour). + * `high_priority`: 10 to 20 minutes. + + +### CounterpartyChannelConfig + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| allow\_outbound\_0conf | boolean | Optional, defaults to `true`. When setting an outbound channel, it can be used straight away [without waiting](https://docs.rs/lightning/latest/lightning/util/config/struct.ChannelHandshakeLimits.html#structfield.trust_own_funding_0conf) for any on-chain confirmations. | +| force\_announced\_channel\_preference | boolean | Optional, defaults to `true`. Set to force an incoming channel to match our announced channel preference in ChannelOptions announced\_channel. | +| outbound\_channels\_confirmations | integer | Optional, defaults to `144`. Confirmations we will wait for before considering an inbound channel locked in. | +| our\_locktime\_limit | boolean | Optional, defaults to `2016`. Set to the amount of blocks we're willing to wait to claim money back to us. | +| min\_funding\_sats | boolean | Optional, defaults to `0`. Minimum allowed satoshis when an inbound channel is funded. | +| max\_funding\_sats | boolean | Optional, defaults to `16777215`. Maximum allowed satoshis when an inbound channel is funded. | +| max\_htlc\_minimum\_msat | boolean | Optional, defaults to `18446744073709551615`. The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows us to limit the maximum minimum-size they can require. | +| min\_max\_htlc\_value\_in\_flight\_msat | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum value of pending HTLCs to them at any given time to limit their funds exposure to [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract). This allows us to set a minimum such value. | +| max\_channel\_reserve\_sats | boolean | Optional, defaults to `18446744073709551615`. The remote node will require us to keep a certain amount in direct payment to ourselves at all time, ensuring that we are able to be punished if we broadcast an old state. This allows us to limit the amount which we will have to keep to ourselves (and cannot use for [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract)). | +| min\_max\_accepted\_htlcs | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum number of pending HTLCs to them at any given time. This allows us to set a minimum such value. | + + +### LightningActivationParams + +| Parameter | Type | Description | +| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | string | The name of the node that will be used in [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | +| listening port | integer | Optional, defaults to `9735`. The port that this node listens for incoming connections on. | +| color | string | Optional, defaults to `2b6680`. A hexidecimal color string which will be used in network graphs on [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | +| payment\_retries | integer | Optional, defaults to `5`. Number of times a payment will be retried if it fails. | +| backup\_path | string | Optional. The backup path for channel backups, preferably on an external drive. | + +### LightningChannelAmount + +| Parameter | Type | Description | +| --------- | ------ | -------------------------------------------------------------------------------------- | +| type | string | `Exact` for a specific amount or `Max` for whole balance. | +| value | object | Only required if type is `Exact`. The amount in BTC you want to open the channel with. | + +### LightningChannelConfig + + + The values in this object are only used if the channel is being opened by the user. If the channel is being opened by the counterparty, the values in this object are ignored. + If not specified when using the [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) methods, the values in this object will default to the values set in the `coins` configuration file. + + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| inbound\_channels\_confirmations | string | Optional, defaults to `6`. Should be set in coins file, and applies to all channels. Confirmations we will wait for before considering an inbound channel locked in. | +| max\_inbound\_in\_flight\_htlc\_percent | integer | Optional, defaults to `10`. Should be set in coins file, and applies to all channels. Sets the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. | +| our\_htlc\_minimum\_msat | integer | Optional, defaults to `1`. The smallest value HTLC we will accept to process. The channel gets closed any time our counterparty misbehaves by sending us an HTLC with a value smaller than this. | +| announced\_channel | boolean | Optional, defaults to `false`. Set to announce the channel publicly and notify all nodes that they can route via this channel. GUIs and wallet apps should be set to `false`. | +| commit\_upfront\_shutdown\_pubkey | boolean | Optional, defaults to `true`. When `true` (and the counterparty agrees), the user must use the same key for cooperative closing. This prevents a user from changing the destination address in a cooperative close, which slightly increases security (however, this option is not required if the counterparty does not support it and a channel can be accepted regardless). **Note that the key for forced closing is always fixed when opening a channel and is different from shutdown\_pubkey.** | +| counterparty\_locktime | integer | Optional, defaults to `144`. The number of blocks we require our counterparty to wait to claim their money on chainif they broadcast a revoked transaction. We have to be online at least once during this time to punish our counterparty for broadcasting a revoked transaction. We have to account also for the time to broadcast and confirm our transaction, possibly with time in between to [RBF (Replace-By-Fee)](https://bitcoinops.org/en/topics/replace-by-fee/) the spending transaction. | +| negotiate\_scid\_privacy | integer | Optional, defaults to `false`. If `true`, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the [BOLTs](https://github.com/lightning/bolts)) option for outbound private channels. This provides better privacy by not including our real on-chain channel UTXO in each invoice and requiring that our counterparty only relay HTLCs to us using the channel's SCID alias. | +| their\_channel\_reserve\_sats | boolean | Optional, defaults to `10000` or 1% of channel value. The minimum balance that the other node has to maintain on their side, at all times. This ensures that if our counterparty broadcasts a revoked state, we can punish them by claiming at least this value on chain. | + + + For GUIs and wallet apps, it is recommended to set `announced_channel` to `false` (the default value), as the node is not expected to be reliably online. + + +### LightningChannelOptions + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| proportional\_fee\_in\_millionths\_sats | integer | Optional, defaults to `0`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | +| base\_fee\_msat | integer | Optional, defaults to `1000`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | +| cltv\_expiry\_delta | integer | Optional, defaults to `72`. Blocks until [CheckLockTimeVerify (CLTV)](https://academy.bit2me.com/en/que-es-cltv-bitcoin/) expiry. | +| max\_dust\_htlc\_exposure\_msat | integer | Optional, defaults to `5000000`. Limit our total exposure to in-flight [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract) which are burned to fees as they are too small to claim on-chain. | +| force\_close\_avoidance\_max\_fee\_sats | integer | Optional, defaults to `1000`. The additional fee we're willing to pay to avoid waiting for the counterparty's locktime to reclaim funds. | + +### LightningClosedChannelsFilter + +| Parameter | Type | Description | +| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| channel\_id | string | Optional. Unique string identifying a channel by its ID. | +| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | +| funding\_tx | string | Optional. A transaction ID which added funds. | +| from\_funding\_value | integer | Optional. The minimum value of channel funding in satoshis. | +| to\_funding\_value | integer | Optional. The maximum value of channel funding in satoshis. | +| channel\_type | string | Optional. `Inbound` or `Outbound`. | +| closing\_tx | integer | Optional. A transaction ID which closed the channel. | +| closure\_reason | integer | Optional. The reason a channel was closed. | +| claiming\_tx | integer | Optional. The ID of the transaction that returned the remaining outbound funds when the channel was closed to our on-chain address. | +| from\_claimed\_balance | integer | Optional. The minimum balance of channel funds claimed in satoshis. | +| to\_claimed\_balance | integer | Optional. The maximum balance of channel funds claimed in satoshis. | +| channel\_visibility | integer | Optional. `Public` or `Private`. | + + + Response may change to be more consistent in future. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206446309](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206446309) + + +### LightningOpenChannelsFilter + +| Parameter | Type | Description | +| ------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| channel\_id | string | Optional. Unique string identifying a channel by its ID. | +| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | +| funding\_tx | string | Optional. A transaction ID which added funds. | +| from\_funding\_value\_sats | integer | Optional. The minimum value of channel funding in satoshis. | +| to\_funding\_value\_sats | integer | Optional. The maximum value of channel funding in satoshis. | +| is\_outbound | boolean | Optional. If `true`, limits the response to outbound channels only. | +| from\_balance\_msat | integer | Optional. The minimum channel balance in millisatoshis. | +| to\_balance\_msat | integer | Optional. The maximum channel balance in millisatoshis. | +| from\_outbound\_capacity\_msat | integer | Optional. The minimum outbound capacity of the channel balance in millisatoshis. | +| to\_outbound\_capacity\_msat | integer | Optional. The maximum outbound capacity of the channel balance in millisatoshis. | +| from\_inbound\_capacity\_msat | integer | Optional. The minimum inbound capacity of the channel balance in millisatoshis. | +| to\_inbound\_capacity\_msat | integer | Optional. The maximum inbound capacity of the channel balance in millisatoshis. | +| confirmed | boolean | Optional. If `true`, only channels with channel opening transactions that passed the number of confirmations required for the channel to be usable will be returned. | +| is\_usable | boolean | Optional. If `true`, only channels that are confirmed and the counterparty is online, meaning that these channels can be used for payments will be returned. | +| is\_public | boolean | Optional. If `true`, only channels that our node announces to the lightning network, these channels are visible on lightning explorers will be returned. | + +### LightningPayment + +| Parameter | Type | Description | +| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | The payment type. Accepted values are `invoice` or [`keysend`](https://cdecker-lightning.readthedocs.io/lightning-keysend.7.html). | +| invoice | string | Only used if `type` is `invoice`. An identifying string which represents the invoice. | +| destination | string | Only used if `type` is `keysend`. A `node_pubkey` (which is also the node address in lightning context). Not to be confused with an onchain address. | +| amount\_in\_msat | string | Only used if `type` is `keysend`. Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin). | +| expiry | string | Only used if `type` is `keysend`. Optional, defaults to `3600`. Seconds until the payment expires. | + +### LightningPaymentFilter + +| Parameter | Type | Description | +| --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------- | +| payment\_type | object | A standard `LightningPaymentType` object. | +| description | string | Optional. A note to indicate the purpose of the invoice. | +| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | +| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | +| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | +| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | +| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | +| from\_timestamp | string | Optional. Minimum timestamp (in milliseconds) of payment results to return. | +| to\_timestamp | string | Optional. Maximum timestamp (in milliseconds) of payment results to return. | + +### LightningPaymentType + +| Parameter | Type | Description | +| ----------- | ------ | ----------------------------------------------------------------------------------- | +| type | object | Accepted values are `Outbound Payment` or `Inbound Payment`. | +| destination | string | Only used if `type` is `Outbound Payment`. A pubkey which will receive the payment. | + + + Response may change in future. + See [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206176530](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206176530) + diff --git a/src/pages/atomicdex/api/common_structures/nfts/index.mdx b/src/pages/atomicdex/api/common_structures/nfts/index.mdx new file mode 100644 index 00000000..c3746890 --- /dev/null +++ b/src/pages/atomicdex/api/common_structures/nfts/index.mdx @@ -0,0 +1,23 @@ +export const title = "Komodo DeFi SDK Common Structures: Non-Fungible Tokens"; +export const description = "Starting with version beta-2.1.3434, the Komodo DeFi SDK supports the standardized protocol format called mmrpc 2.0."; + +# Non-Fungible Token Structures + + +### TokensRequest + +The `TokensRequest` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| ticker | string | Ticker of the token to be enabled | +| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + diff --git a/src/pages/atomicdex/api/common_structures/swaps/index.mdx b/src/pages/atomicdex/api/common_structures/swaps/index.mdx new file mode 100644 index 00000000..3e4dfb77 --- /dev/null +++ b/src/pages/atomicdex/api/common_structures/swaps/index.mdx @@ -0,0 +1,60 @@ +export const title = "Komodo DeFi SDK Common Structures: Swaps"; +export const description = "Each active or completed trade from the Komodo DeFi SDK includes an unique identifier (UUID), a summary of the trade and detailed information relating to each swap event."; + +# Swap Structures + +### SwapStatus + +Each swap status will be nested under its associated UUID. + + + We should add a "maker" resonse example also. Unsure if `uuid` on maker side is swap or order uuid in response. + + +| Parameter | Type | Description | +| -------------- | ------- | ------------------------------------------------------- | +| type | string | `Maker` or `Taker`. Indicates if the user created the order (maker), or matched with an existing order (taker). | +| uuid | string | A unique identifier for the swap. | +| events | list | A list of swap events. The structure of each event varies depending on its type, as detailed in the [SwapEvents](/atomicdex/api/v20/#swap-events) section. | +| maker_coin | string | The coin being sent by the maker and received by the taker. | +| taker_coin | string | The coin being sent by the taker and received by the maker. | +| maker_amount | numeric string | The amount of `maker_coin` being traded. | +| taker_amount | numeric string | The amount of `taker_coin` being traded. | +| gui | string | An identifier for the GUI used to initiate the swap, as defined in a user's MM2.json file. May be `null` if not defined. | +| mm_version | string | The release version and/or commit hash of the Komodo DeFi SDK used to initiate the swap. | +| success_events | list | A list of possible [swap event types for a successful swap](/atomicdex/api/v20/#success-events). | +| error_events | list | A list of possible [swap event types which may appear in a failed swap](/atomicdex/api/v20/#error-events). | + + + + #### Example + + ```json + { + "type": "Taker", + "uuid": "5d02843e-d1b4-488d-aad0-114d82020453", + "events": [ + ... + ], + "maker_amount": "1", + "maker_coin": "DOC", + "taker_amount": "1", + "taker_coin": "MARTY", + "gui": null, + "mm_version": "23c89ced5", + "success_events": [ + ... + ], + "error_events": [ + ... + ] + } + ``` + + ```json + { + "FromId": 4 + } + ``` + + From 43a40748d407ef52561cf8ddffd4527101c0d16d Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 4 Oct 2023 16:31:28 +0800 Subject: [PATCH 03/27] fix lint errors --- filepathSlugs.json | 82 +- src/data/sidebar.json | 29 + .../common_structures/activation/index.mdx | 175 +--- .../atomicdex/api/common_structures/index.mdx | 150 +--- .../api/common_structures/lightning/index.mdx | 2 - .../api/common_structures/nfts/index.mdx | 1 - .../api/common_structures/swaps/index.mdx | 30 +- src/pages/atomicdex/api/index.mdx | 2 +- .../api/legacy/active_swaps/index.mdx | 15 +- .../v20-dev/lightning/activation/index.mdx | 18 +- .../api/v20-dev/lightning/channels/index.mdx | 40 +- .../atomicdex/api/v20-dev/lightning/index.mdx | 12 +- .../api/v20-dev/lightning/payments/index.mdx | 20 +- .../api/v20-dev/task_enable_z_coin/index.mdx | 8 +- .../api/v20/enable_bch_with_tokens/index.mdx | 16 +- .../api/v20/enable_eth_with_tokens/index.mdx | 14 +- .../enable_tendermint_with_assets/index.mdx | 18 +- src/pages/atomicdex/api/v20/index.mdx | 453 ----------- utils/_fileData.json | 767 ++++++++++-------- ...validate_update_internal_links_userpass.js | 26 +- 20 files changed, 679 insertions(+), 1199 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index f632208b..df0fccd5 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -1567,6 +1567,54 @@ "creating-and-launching-with-a-pubkey", "cc-addresses" ], + "src/pages/atomicdex/api/common_structures/activation/index.mdx": [ + "activation-structures", + "activation-params", + "activation-mode", + "activation-rpc-data", + "activation-servers", + "zhtlc-example", + "hd-utxo-activation-v2", + "coin-protocol", + "coin-protocol-data", + "evm-node" + ], + "src/pages/atomicdex/api/common_structures/index.mdx": [ + "komodo-de-fi-sdk-common-structures", + "address-infos", + "example-with-balances", + "example-without-balances", + "balance-infos", + "derivation-method", + "fee-info", + "pagination", + "example" + ], + "src/pages/atomicdex/api/common_structures/lightning/index.mdx": [ + "lightning-network-structures", + "confirmation-targets", + "counterparty-channel-config", + "lightning-activation-params", + "lightning-channel-amount", + "lightning-channel-config", + "lightning-channel-options", + "lightning-closed-channels-filter", + "lightning-open-channels-filter", + "lightning-payment", + "lightning-payment-filter", + "lightning-payment-type" + ], + "src/pages/atomicdex/api/common_structures/nfts/index.mdx": [ + "non-fungible-token-structures", + "tokens-request" + ], + "src/pages/atomicdex/api/common_structures/swaps/index.mdx": [ + "swap-structures", + "swap-status", + "example", + "success-events", + "error-events" + ], "src/pages/atomicdex/api/index.mdx": [ "atomic-dex-rpc-methods" ], @@ -1576,8 +1624,8 @@ "response", "examples", "command-without-include-status", - "command-include-status-true", "response-uuids-only", + "command-include-status-true", "response-statuses-included" ], "src/pages/atomicdex/api/legacy/all_swaps_uuids_by_filter/index.mdx": [ @@ -2315,37 +2363,7 @@ "response-error", "examples", "response-success-2", - "response-error-2", - "common-komodo-de-fi-sdk-request-response-objects", - "activation-params", - "activation-mode", - "activation-rpc-data", - "activation-servers", - "zhtlc-example", - "hd-utxo-activation-v2", - "address-infos", - "example-with-balances", - "example-without-balances", - "balance-infos", - "derivation-method", - "evm-node", - "coin-protocol", - "coin-protocol-data", - "confirmation-targets", - "counterparty-channel-config", - "fee-info", - "lightning-activation-params", - "lightning-channel-amount", - "lightning-channel-config", - "lightning-channel-options", - "lightning-closed-channels-filter", - "lightning-open-channels-filter", - "lightning-payment", - "lightning-payment-filter", - "lightning-payment-type", - "pagination", - "example", - "tokens-request" + "response-error-2" ], "src/pages/atomicdex/api/v20/message_signing/index.mdx": [ "signing-and-verifying-messages", diff --git a/src/data/sidebar.json b/src/data/sidebar.json index ebce2873..5e82eaa3 100644 --- a/src/data/sidebar.json +++ b/src/data/sidebar.json @@ -706,6 +706,35 @@ } ] }, + "atomicdexApiCommonStructuresNavigation": { + "/atomicdex/api/common_structures/": [ + { + "title": "Komodo DeFi SDK Common Structures", + "titleLink": "/atomicdex/api/common_structures/", + "links": [] + }, + { + "title": "Activation Structures", + "titleLink": "/atomicdex/api/common_structures/activation/", + "links": [] + }, + { + "title": "Lightning Network Structures", + "titleLink": "/atomicdex/api/common_structures/lightning/", + "links": [] + }, + { + "title": "NFT Structures", + "titleLink": "/atomicdex/api/common_structures/nfts/", + "links": [] + }, + { + "title": "Swap Structures", + "titleLink": "/atomicdex/api/common_structures/swaps/", + "links": [] + } + ] + }, "antaraFrameworkPageNavigation": { "/antara/": [ { diff --git a/src/pages/atomicdex/api/common_structures/activation/index.mdx b/src/pages/atomicdex/api/common_structures/activation/index.mdx index 3fdd0346..29173e14 100644 --- a/src/pages/atomicdex/api/common_structures/activation/index.mdx +++ b/src/pages/atomicdex/api/common_structures/activation/index.mdx @@ -8,8 +8,8 @@ export const description = "The Komodo DeFi SDK uses a variety of activation met The `ActivationParams` object defines additional parameters used for activation. These params may vary depending on the coin type. The following methods use this structure: -- TBA +* TBA | Parameter | Type | Description | | ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | @@ -22,7 +22,7 @@ The following methods use this structure: | zcash\_params\_path | string | ZHTLC coins only. Path to folder containing Zcash parameters. Optional, defaults to standard location as defined in [this guide](https://forum.komodoplatform.com/t/installing-zcash-params/603) | | scan\_blocks\_per\_iteration | integer | ZHTLC coins only. Sets the number of scanned blocks per iteration during `BuildingWalletDb` state. Optional, default value is 1000. | | scan\_interval\_ms | integer | ZHTLC coins only. Sets the interval in milliseconds between iterations of `BuildingWalletDb` state. Optional, default value is 0. | -| mode | object | QTUM, UTXO & ZHTLC coins only. A standard [ActivationMode](/atomicdex/api/v20/#activation-mode) object. | +| mode | object | QTUM, UTXO & ZHTLC coins only. A standard [ActivationMode](/atomicdex/api/common_structures/activation/#activation-mode) object. | For ZHTLC coins, older wallets need to set the `sync_params` field to a date before its @@ -36,19 +36,18 @@ The following methods use this structure: load during ZHTLC coin activation. - ### ActivationMode Defines the activation mode for QTUM, BCH, UTXO & ZHTLC coins. The following methods use this structure: -- TBA +* TBA -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------------------------------------------------------------------------------- | -| rpc | string | `Native` if running a native blockchain node, `Electrum` if using electrum servers or `Light` for ZHTLC coins. | -| rpc\_data | object | `Electrum` or `Light` mode only. A standard [ActivationRpcData](/atomicdex/api/v20/#activation-rpc-data) object. | +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------- | +| rpc | string | `Native` if running a native blockchain node, `Electrum` if using electrum servers or `Light` for ZHTLC coins. | +| rpc\_data | object | `Electrum` or `Light` mode only. A standard [ActivationRpcData](/atomicdex/api/common_structures/activation/#activation-rpc-data) object. | ### ActivationRpcData @@ -57,15 +56,19 @@ Contains information about electrum & lightwallet\_d servers for coins being use | Parameter | Type | Description | | ------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | -| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | -| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | +| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/common_structures/activation/#activation-servers) objects. | +| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/common_structures/activation/#activation-servers) objects. | | sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a unix timestamp). | + + `electrum` and `electrum_servers` are both used for the same purpose. This should be consolidated in the API. + ### ActivationServers The following methods use this structure: -- TBA + +* TBA Contains information electrum servers for coins being used in `Electrum` or `Light` mode. @@ -134,126 +137,20 @@ Contains information electrum servers for coins being used in `Electrum` or `Lig ``` -### AddressInfos - -The `addressInfos` object includes the following items for a given address. - -The following methods use this structure: -- TBA - - -| Parameter | Type | Description | -| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------ | -| balances | object | A standard [balanceInfos](/atomicdex/api/v20/#balance-infos) object. Not included in responses where `get_balances` is `false` | -| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/v20/#derivation-method) object | -| pubkey | string | The public key associated with the seed used to launch AtomicDEX | -| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | - - - #### Example with balances - - ```json - "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { - "derivation_method": { - "type": "Iguana" - }, - "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", - "balances": { - "spendable": "0.11398301", - "unspendable": "0.00001" - } - } - ``` - - #### Example without balances - - ```json - "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { - "derivation_method": { - "type": "Iguana" - }, - "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", - "tickers": ["ASLP-SLP"] - } - ``` - - -### BalanceInfos - -The `balanceInfos` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | -| spendable | string (numeric) | The available amount of a coin or token which is ready to be traded or withdrawn. | -| unspendable | string (numeric) | The amount of a coin or token which is awaiting confirmation on the block chain for an incoming or outgoing transaction. | - - - ```json - { - "spendable": "12.11398301", - "unspendable": "0.53" - } - ``` - - -### DerivationMethod - -The `DerivationMethod` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------------------- | -| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | - - - Using the same seed or private key to generate keypairs using different derivation methods will result in a different address and private key for each method. - - -Where the value indicates: - -* `Iguana`: The coin or token is was activated using Iguana derivation (default). -* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. - - - ```json - { - "type": "Iguana" - } - ``` - - -### EvmNode - -The `EvmNode` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| --------- | ------- | ------------------------------------------------------------------------------------------------------------------- | -| url | string | URL of an RPC node | -| gui\_auth | boolean | Optional, defaults to `false`. Must be set to `true` to access RPC nodes run officially by the Komodo Platform team | - - - ```json - { - "url": "http://eth1.cipig.net:8555", - "gui_auth": false - } - ``` - - ### CoinProtocol -| Parameter | Type | Description | -| -------------- | ------- | ----------------------------------------------------------------------------- | -| type | integer | One of the supported \[coin types]\(link TBA) | -| protocol\_data | object | A standard [CoinProtocolData](/atomicdex/api/v20/#coin-protocol-data) object. | +| Parameter | Type | Description | +| -------------- | ------- | ------------------------------------------------------------------------------------------------------ | +| type | integer | One of the supported \[coin types]\(link TBA) | +| protocol\_data | object | A standard [CoinProtocolData](/atomicdex/api/common_structures/activation/#coin-protocol-data) object. | ### CoinProtocolData -| Parameter | Type | Description | -| --------------------- | ------ | ------------------------------------------------------------------------------------------------ | -| platform | string | Indicates the platform parent coin for EMV-like protocols, or the coin used for lightning nodes. | -| network | string | Either `mainnet` or \`testnet | -| confirmation\_targets | object | A standard [ConfirmationTargets](/atomicdex/api/v20/#confirmation-targets) object. | - +| Parameter | Type | Description | +| --------------------- | ------ | ---------------------------------------------------------------------------------------------------------- | +| platform | string | Indicates the platform parent coin for EMV-like protocols, or the coin used for lightning nodes. | +| network | string | Either `mainnet` or \`testnet | +| confirmation\_targets | object | A standard [ConfirmationTargets](/atomicdex/api/common_structures/lightning/#confirmation-targets) object. | ### EvmNode @@ -272,29 +169,3 @@ The `EvmNode` object includes the following items for a given coin or token: } ``` - - -### DerivationMethod - -The `DerivationMethod` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------------------- | -| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | - - - Using the same seed or private key to generate keypairs using different derivation methods will result in a different address and private key for each method. - - -Where the value indicates: - -* `Iguana`: The coin or token is was activated using Iguana derivation (default). -* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. - - - ```json - { - "type": "Iguana" - } - ``` - diff --git a/src/pages/atomicdex/api/common_structures/index.mdx b/src/pages/atomicdex/api/common_structures/index.mdx index 0f7d385a..c839b221 100644 --- a/src/pages/atomicdex/api/common_structures/index.mdx +++ b/src/pages/atomicdex/api/common_structures/index.mdx @@ -1,128 +1,27 @@ export const title = "Komodo DeFi SDK RPC Protocol v2.0"; export const description = "Starting with version beta-2.1.3434, the Komodo DeFi SDK supports the standardized protocol format called mmrpc 2.0."; -# Komodo DeFi SDK RPC Protocol v2.0 - -Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the Komodo DeFi SDK supports the standardized protocol format called `mmrpc 2.0`. - -It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. - -## Request - -| Structure | Type | Description | -| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the Komodo DeFi SDK RPC protocol. Must be exactly "2.0" | -| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | -| method | string | the name of the method to be invoked | -| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | -| id | number (optional) | the identifier is established by the client. Komodo DeFi SDK will reply with the same value in the Response object if the `id` field is included and not `NULL` | - -### Response (Success) - -| Structure | Type | Description | -| --------- | ----------------- | ------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the Komodo DeFi SDK RPC protocol | -| result | object | the value of this field is determined by the method invoked on Komodo DeFi SDK | -| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | - -### Response (Error) - -| Structure | Type | Description | -| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | -| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | -| error | string | the common error description | -| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | -| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | -| error\_type | string | the string error identifier used to determine the cause of the error | -| error\_data | object | an object containing the error data of the corresponding `error_type` | -| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | - -### 📌 Examples - - - ```json - { - "mmrpc": "2.0", - "userpass": "testpsw", - "method": "withdraw", - "params": { - "coin": "KMD", - "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", - "amount": "10" - }, - "id": 0 - } - ``` - - - - #### Response (success) - - ```json - { - "mmrpc": "2.0", - "result": { - "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", - "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", - "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], - "total_amount": "60.10253836", - "spent_by_me": "60.10253836", - "received_by_me": "60.00253836", - "my_balance_change": "-0.1", - "block_height": 0, - "timestamp": 1566472936, - "fee_details": { - "type": "Utxo", - "amount": "0.1" - }, - "coin": "DOC", - "internal_id": "" - }, - "id": 0 - } - ``` - - - - #### Response (error) - - ```json - { - "mmrpc": "2.0", - "error": "The amount 0.000005 is too small", - "error_path": "utxo_common", - "error_trace": "utxo_common:1379] utxo_common:301]", - "error_type": "AmountIsTooSmall", - "error_data": { - "amount": "0.000005" - }, - "id": 0 - } - ``` - - -## Common Komodo DeFi SDK Request / Response Objects +# Komodo DeFi SDK Common Structures The objects are in the request or response of multiple Komodo DeFi SDK methods have been grouped into the following sections: -- [Activation](/atomicdex/api/common_structures/activation) -- [Swaps](/atomicdex/api/common_structures/swaps) -- [Lightning Network](/atomicdex/api/common_structures/lightning) -- [Non-fungible Tokens](/atomicdex/api/common_structures/nfts) -Structures which are used in more than one section are listed below: +* [Activation](/atomicdex/api/common_structures/activation) +* [Swaps](/atomicdex/api/common_structures/swaps/) +* [Lightning Network](/atomicdex/api/common_structures/lightning/) +* [Non-fungible Tokens](/atomicdex/api/common_structures/nfts/) +Structures which are used in more than one section are listed below: ### AddressInfos The `addressInfos` object includes the following items for a given address: -| Parameter | Type | Description | -| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------ | -| balances | object | A standard [balanceInfos](/atomicdex/api/v20/#balance-infos) object. Not included in responses where `get_balances` is `false` | -| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/v20/#derivation-method) object | -| pubkey | string | The public key associated with the seed used to launch AtomicDEX | -| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | +| Parameter | Type | Description | +| ------------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- | +| balances | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. Not included in responses where `get_balances` is `false` | +| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/common_structures/#derivation-method) object | +| pubkey | string | The public key associated with the seed used to launch AtomicDEX | +| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | #### Example with balances @@ -171,6 +70,30 @@ The `balanceInfos` object includes the following items for a given coin or token ``` +### DerivationMethod + +The `DerivationMethod` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------------------- | +| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | + + + Using the same seed or private key to generate keypairs using different derivation methods will result in a different address and private key for each method. + + +Where the value indicates: + +* `Iguana`: The coin or token is was activated using Iguana derivation (default). +* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. + + + ```json + { + "type": "Iguana" + } + ``` + ### FeeInfo @@ -183,7 +106,6 @@ The `FeeInfo` response object includes the following items for [withdraw (v2)](/ | gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | | gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | - ### Pagination For requests which return many results, pagination offsets may be applied. \*\* Use either value, not both. \*\* diff --git a/src/pages/atomicdex/api/common_structures/lightning/index.mdx b/src/pages/atomicdex/api/common_structures/lightning/index.mdx index 69c31818..38ceb1b2 100644 --- a/src/pages/atomicdex/api/common_structures/lightning/index.mdx +++ b/src/pages/atomicdex/api/common_structures/lightning/index.mdx @@ -3,7 +3,6 @@ export const description = "Lightning network functionality is now available in # Lightning Network Structures - ### ConfirmationTargets This object represents the number of blocks required for an on-chain lightning-related transaction to be confirmed. @@ -38,7 +37,6 @@ It is used for estimating the transaction fee rate (`feerate`) for different tra | max\_channel\_reserve\_sats | boolean | Optional, defaults to `18446744073709551615`. The remote node will require us to keep a certain amount in direct payment to ourselves at all time, ensuring that we are able to be punished if we broadcast an old state. This allows us to limit the amount which we will have to keep to ourselves (and cannot use for [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract)). | | min\_max\_accepted\_htlcs | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum number of pending HTLCs to them at any given time. This allows us to set a minimum such value. | - ### LightningActivationParams | Parameter | Type | Description | diff --git a/src/pages/atomicdex/api/common_structures/nfts/index.mdx b/src/pages/atomicdex/api/common_structures/nfts/index.mdx index c3746890..2cdde778 100644 --- a/src/pages/atomicdex/api/common_structures/nfts/index.mdx +++ b/src/pages/atomicdex/api/common_structures/nfts/index.mdx @@ -3,7 +3,6 @@ export const description = "Starting with version beta-2.1.3434, the Komodo DeFi # Non-Fungible Token Structures - ### TokensRequest The `TokensRequest` object includes the following items for a given coin or token: diff --git a/src/pages/atomicdex/api/common_structures/swaps/index.mdx b/src/pages/atomicdex/api/common_structures/swaps/index.mdx index 3e4dfb77..5b889c59 100644 --- a/src/pages/atomicdex/api/common_structures/swaps/index.mdx +++ b/src/pages/atomicdex/api/common_structures/swaps/index.mdx @@ -11,20 +11,19 @@ Each swap status will be nested under its associated UUID. We should add a "maker" resonse example also. Unsure if `uuid` on maker side is swap or order uuid in response. -| Parameter | Type | Description | -| -------------- | ------- | ------------------------------------------------------- | -| type | string | `Maker` or `Taker`. Indicates if the user created the order (maker), or matched with an existing order (taker). | -| uuid | string | A unique identifier for the swap. | -| events | list | A list of swap events. The structure of each event varies depending on its type, as detailed in the [SwapEvents](/atomicdex/api/v20/#swap-events) section. | -| maker_coin | string | The coin being sent by the maker and received by the taker. | -| taker_coin | string | The coin being sent by the taker and received by the maker. | -| maker_amount | numeric string | The amount of `maker_coin` being traded. | -| taker_amount | numeric string | The amount of `taker_coin` being traded. | -| gui | string | An identifier for the GUI used to initiate the swap, as defined in a user's MM2.json file. May be `null` if not defined. | -| mm_version | string | The release version and/or commit hash of the Komodo DeFi SDK used to initiate the swap. | -| success_events | list | A list of possible [swap event types for a successful swap](/atomicdex/api/v20/#success-events). | -| error_events | list | A list of possible [swap event types which may appear in a failed swap](/atomicdex/api/v20/#error-events). | - +| Parameter | Type | Description | +| --------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | `Maker` or `Taker`. Indicates if the user created the order (maker), or matched with an existing order (taker). | +| uuid | string | A unique identifier for the swap. | +| events | list | A list of swap events. The structure of each event varies depending on its type, as detailed in the [SwapEvents](/atomicdex/api/common_structures/swaps) section. | +| maker\_coin | string | The coin being sent by the maker and received by the taker. | +| taker\_coin | string | The coin being sent by the taker and received by the maker. | +| maker\_amount | numeric string | The amount of `maker_coin` being traded. | +| taker\_amount | numeric string | The amount of `taker_coin` being traded. | +| gui | string | An identifier for the GUI used to initiate the swap, as defined in a user's MM2.json file. May be `null` if not defined. | +| mm\_version | string | The release version and/or commit hash of the Komodo DeFi SDK used to initiate the swap. | +| success\_events | list | A list of possible [swap event types for a successful swap](/atomicdex/api/common_structures/swaps/#success-events). | +| error\_events | list | A list of possible [swap event types which may appear in a failed swap](/atomicdex/api/common_structures/swaps/#error-events). | #### Example @@ -58,3 +57,6 @@ Each swap status will be nested under its associated UUID. ``` +## success events + +## error events diff --git a/src/pages/atomicdex/api/index.mdx b/src/pages/atomicdex/api/index.mdx index a7090c5a..25483716 100644 --- a/src/pages/atomicdex/api/index.mdx +++ b/src/pages/atomicdex/api/index.mdx @@ -6,7 +6,7 @@ export const description = "This document lists all available RPC methods of the Legacy methods are in the process of a migration to AtomicDEX API v2.0 (and will also remain backwards compatible). During development, some newer AtomicDEX API methods are not available in the latest release. -To test the methods in v2.0 (Dev), you will need to [build the AtomicDEX API](/atomicdex/setup/) from the `dev` branch. +To test the methods in v2.0 (Dev), you will need to [build the AtomicDEX API](../atomicdex/setup/) from the `dev` branch. Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: diff --git a/src/pages/atomicdex/api/legacy/active_swaps/index.mdx b/src/pages/atomicdex/api/legacy/active_swaps/index.mdx index 184a5024..5e50e86b 100644 --- a/src/pages/atomicdex/api/legacy/active_swaps/index.mdx +++ b/src/pages/atomicdex/api/legacy/active_swaps/index.mdx @@ -10,16 +10,16 @@ The `active_swaps` method returns all the swaps that are currently running on th ## Arguments -| Structure | Type | Description | -| --------------- | ---- | ----------------------------------------------------------------------------- | -| include\_status | bool | Optional, defaults to `false`. Whether to include swap statuses in response; | +| Structure | Type | Description | +| --------------- | ---- | ---------------------------------------------------------------------------- | +| include\_status | bool | Optional, defaults to `false`. Whether to include swap statuses in response; | ## Response -| Structure | Type | Description | -| ----------- | ---------------- | ----------------------------------------------------------------------------------------------------------- | -| uuids | array of strings | A list of currently active swap UUIDs. | -| statuses | object (map) | Only visible if `include_status` request parameter is `true`. A map of standard [SwapStatus](/atomicdex/api/v20/#swap-status) objects, delineated by the related UUID. | +| Structure | Type | Description | +| --------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| uuids | array of strings | A list of currently active swap UUIDs. | +| statuses | object (map) | Only visible if `include_status` request parameter is `true`. A map of standard SwapStatus objects, delineated by the related UUID. | #### 📌 Examples @@ -63,7 +63,6 @@ The `active_swaps` method returns all the swaps that are currently running on th ``` - #### Response (statuses included) diff --git a/src/pages/atomicdex/api/v20-dev/lightning/activation/index.mdx b/src/pages/atomicdex/api/v20-dev/lightning/activation/index.mdx index cfad21c0..28b20347 100644 --- a/src/pages/atomicdex/api/v20-dev/lightning/activation/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/lightning/activation/index.mdx @@ -17,10 +17,10 @@ The `task::enable_lightning::init` request a task to run a lightning node. Use t ### Request Parameters -| Parameter | Type | Description | -| ------------------ | ------ | ----------------------------------------------------------------------------------------------- | -| ticker | string | Ticker of coin to activate | -| activation\_params | object | A standard [LightningActivationParams](/atomicdex/api/v20/#lightning-activation-params) object. | +| Parameter | Type | Description | +| ------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of coin to activate | +| activation\_params | object | A standard [LightningActivationParams](/atomicdex/api/common_structures/lightning/#lightning-activation-params) object. | #### 📌 Example @@ -211,11 +211,11 @@ The `task::enable_lightning::status` request checks the status of lightning node ### Response Parameters - | Parameter | Type | Description | - | -------------- | ------ | -------------------------------------------------------------------- | - | platform\_coin | string | The coin ticker for which the lightning node is being intitialized. | - | address | string | This node's address for the activated coin. | - | balance | object | A standard [balanceInfos](/atomicdex/api/v20/#balance-infos) object. | + | Parameter | Type | Description | + | -------------- | ------ | ---------------------------------------------------------------------------------- | + | platform\_coin | string | The coin ticker for which the lightning node is being intitialized. | + | address | string | This node's address for the activated coin. | + | balance | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | The unspendable balance for lightning is different to a layer-1 unspendable balance. The channel reserve is part of the unspendable balance in lightning - the user will get this part of the balance on chain when closing the channel, but it can't be spent on layer 2 (lightning) because it's part of the security mechanism to prevent channel breaches and ensure that both parties fulfill their obligations within the channel. diff --git a/src/pages/atomicdex/api/v20-dev/lightning/channels/index.mdx b/src/pages/atomicdex/api/v20-dev/lightning/channels/index.mdx index aa69cbe1..d8e8f84d 100644 --- a/src/pages/atomicdex/api/v20-dev/lightning/channels/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/lightning/channels/index.mdx @@ -17,10 +17,10 @@ The `lightning::channels::open_channel` method opens a new channel with a remote | ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | coin | string | The ticker of the coin you would like to open a channel for. | | node\_address | string | Lightning node addresses always have a format of `node_pubkey`@`ip_address`:`port`. | -| amount | object | A standard [LightningChannelAmount](/atomicdex/api/v20/#lightning-channel-amount) object. | +| amount | object | A standard [LightningChannelAmount](/atomicdex/api/common_structures/lightning/#lightning-channel-amount) object. | | push\_msat | integer | Optional. The amount in millisatoshi to push to the counterparty while openning, to create inbound liquidity for the channel. Using the `push_msat` parameter avoids having to send funds in a separate request later. Please note that the funds given using push\_msat is given unconditionally, meaning that there is no proof of payment in a preimage as with paying an invoice. | -| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/v20/#lightning-channel-options) object. | -| channel\_configs | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/v20/#lightning-channel-config) object. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| channel\_configs | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | #### 📌 Example using an exact amount @@ -202,11 +202,11 @@ The `lightning::channels::update_channel` method updates channel options. ### Request Parameters -| Parameter | Type | Description | -| ---------------- | ------ | ------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to update channel configuration options for. | -| uuid | string | Unique channel identifier. | -| channel\_options | object | A standard [LightningChannelOptions](/atomicdex/api/v20/#lightning-channel-options) object. | +| Parameter | Type | Description | +| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to update channel configuration options for. | +| uuid | string | Unique channel identifier. | +| channel\_options | object | A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | #### 📌 Example to update all available channel options @@ -452,12 +452,12 @@ The `lightning::channels::list_open_channels_by_filter` method returns a list of ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | ---------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view open channels for. | -| filter | object | A standard [LightningOpenChannelsFilter](/atomicdex/api/v20/#lightning-open-channels-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/v20/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | +| Parameter | Type | Description | +| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view open channels for. | +| filter | object | A standard [LightningOpenChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-open-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | #### 📌 Example without using `filter` parameter @@ -711,12 +711,12 @@ The `lightning::channels::list_closed_channels_by_filter` method returns a list ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | -------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin you would like to view closed channels for. | -| filter | object | A standard [LightningClosedChannelsFilter](/atomicdex/api/v20/#lightning-closed-channels-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/v20/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | +| Parameter | Type | Description | +| --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view closed channels for. | +| filter | object | A standard [LightningClosedChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-closed-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | #### 📌 Example without using `filter` parameter diff --git a/src/pages/atomicdex/api/v20-dev/lightning/index.mdx b/src/pages/atomicdex/api/v20-dev/lightning/index.mdx index 75ee9c23..2ce8bafb 100644 --- a/src/pages/atomicdex/api/v20-dev/lightning/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/lightning/index.mdx @@ -66,7 +66,7 @@ Follow the flowchart below to visualize the process: ## Lightning Network Coins File Configuration - Some configurations are set per coin, and some are set per channel. The [counterparty\_channel\_config\_limits](/atomicdex/api/v20/#counterparty-channel-config) param must be set in the `coins` configuration file, and aplies to all channels opened by counterparty nodes. The [our\_channels\_config](/atomicdex/api/v20/#lightning-channel-config) and [channel\_options](/atomicdex/api/v20/#lightning-channel-options) parameters are set per channel. These can be defined in the `coins` configuration file to act as the default for all opened channels, and optionally overwritten or updated using the [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) methods. + Some configurations are set per coin, and some are set per channel. The [counterparty\_channel\_config\_limits](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) param must be set in the `coins` configuration file, and aplies to all channels opened by counterparty nodes. The [our\_channels\_config](/atomicdex/api/common_structures/lightning/#lightning-channel-config) and [channel\_options](/atomicdex/api/common_structures/lightning/#lightning-channel-options) parameters are set per channel. These can be defined in the `coins` configuration file to act as the default for all opened channels, and optionally overwritten or updated using the [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) methods. ### Lightning Coin Config Parameters @@ -76,15 +76,15 @@ Follow the flowchart below to visualize the process: | coin | object | The ticker of the coin you will use lightning network with, suffixed with `-lightning` | | mm2 | integer | Defaults to `0`. A value of `1`, indicates the coin is atomic swap compatible. | | decimals | integer | The decimal precision of the coin you will use the lightning network with. | -| protocol | object | A standard [CoinProtocol](/atomicdex/api/v20/#coin-protocol) object. | +| protocol | object | A standard [CoinProtocol](/atomicdex/api/common_structures/activation/#coin-protocol) object. | | accept\_inbound\_channels | boolean | Optional, defaults to `true`. If this is set to false, we do not accept inbound requests to open a new channel. | | accept\_forwards\_to\_priv\_channels | boolean | Optional, defaults to `false`. When set to `false`, any HTLCs which were to be forwarded over private channels will be rejected. This prevents us from taking on HTLC-forwarding risk when we intend to run as a node which is not online reliably (e.g. GUI wallet apps). Generally, private channels are used for non-routing purposes only. | -| counterparty\_channel\_config\_limits | object | Optional. A standard [CounterpartyChannelConfig](/atomicdex/api/v20/#counterparty-channel-config) object. | -| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/v20/#lightning-channel-options) object. | -| our\_channels\_config | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/v20/#lightning-channel-config) object. | +| counterparty\_channel\_config\_limits | object | Optional. A standard [CounterpartyChannelConfig](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) object. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| our\_channels\_config | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | - For GUIs and wallet apps, it is recommended to set `accept_forwards_to_priv_channels` to `false`. This prevents users from taking on HTLC-forwarding risk when a node is expected to not be reliably online. [our\_channels\_config::announced\_channel](/atomicdex/api/v20/#lightning-channel-options) should also be set to `false` for GUIs and wallet apps. + For GUIs and wallet apps, it is recommended to set `accept_forwards_to_priv_channels` to `false`. This prevents users from taking on HTLC-forwarding risk when a node is expected to not be reliably online. [our\_channels\_config::announced\_channel](/atomicdex/api/common_structures/lightning/#lightning-channel-options) should also be set to `false` for GUIs and wallet apps. diff --git a/src/pages/atomicdex/api/v20-dev/lightning/payments/index.mdx b/src/pages/atomicdex/api/v20-dev/lightning/payments/index.mdx index 01a9c387..eafc49ba 100644 --- a/src/pages/atomicdex/api/v20-dev/lightning/payments/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/lightning/payments/index.mdx @@ -78,10 +78,10 @@ Used to pay an invoice or send a payment via pubkey/address. ### Request Parameters -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------------------------------------------- | -| type | string | Ticker of the coin to query. | -| payment | object | A standard [LightningPayment](/atomicdex/api/v20/#lightning-payment) object. | +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------- | +| type | string | Ticker of the coin to query. | +| payment | object | A standard [LightningPayment](/atomicdex/api/common_structures/lightning/#lightning-payment) object. | #### 📌 Example using `invoice` @@ -327,12 +327,12 @@ The `lightning::payments::list_payments_by_filter` method returns a list of paym ### Request Parameters -| Parameter | Type | Description | -| --------------- | ------- | --------------------------------------------------------------------------------------------------- | -| coin | string | Ticker of the coin to query. | -| filter | object | Optional. A standard [LightningPaymentFilter](/atomicdex/api/v20/#lightning-payment-filter) object. | -| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/v20/#pagination) object. | -| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | +| Parameter | Type | Description | +| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of the coin to query. | +| filter | object | Optional. A standard [LightningPaymentFilter](/atomicdex/api/common_structures/lightning/#lightning-payment-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | #### 📌 Example without filter diff --git a/src/pages/atomicdex/api/v20-dev/task_enable_z_coin/index.mdx b/src/pages/atomicdex/api/v20-dev/task_enable_z_coin/index.mdx index 44e8a7e4..f450efa5 100644 --- a/src/pages/atomicdex/api/v20-dev/task_enable_z_coin/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/task_enable_z_coin/index.mdx @@ -21,10 +21,10 @@ To withdraw ZHTLC coins, you need to use the [task::withdraw](/atomicdex/api/v20 #### Arguments -| Structure | Type | Description | -| ------------------ | ------ | ------------------------------------------------------------------------------- | -| ticker | string | Ticker of coin to activate | -| activation\_params | object | A standard [ActivationRpcData](/atomicdex/api/v20/#activation-rpc-data) object. | +| Structure | Type | Description | +| ------------------ | ------ | -------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of coin to activate | +| activation\_params | object | A standard [ActivationRpcData](/atomicdex/api/common_structures/activation/#activation-rpc-data) object. | #### Response diff --git a/src/pages/atomicdex/api/v20/enable_bch_with_tokens/index.mdx b/src/pages/atomicdex/api/v20/enable_bch_with_tokens/index.mdx index 9a820d7d..55c61eab 100644 --- a/src/pages/atomicdex/api/v20/enable_bch_with_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20/enable_bch_with_tokens/index.mdx @@ -13,7 +13,7 @@ The AtomicDEX-API supports Bitcoin Cash SLP tokens. Using this method, you can e | bchd\_urls | array of strings | A list of BCHD gRPC API server URLs, used for validation of SLP token transactions. It's recommended to add as many servers as possible. The URLs list can be found at [https://bchd.fountainhead.cash/](https://bchd.fountainhead.cash/). | | mode | string | Utxo RPC mode. Options: `{ "rpc":"Native" }` if running a native blockchain node, or `"rpc":"Electrum"` to use electrum RPCs. If using electrum, a list of electrum servers is required under `rpc_data.servers` | | tx\_history | boolean | If `true`, spawns a background loop to store the local cache of address(es) transactions. Defaults to `false`. | -| slp\_tokens\_requests | array of objects | A list of standard [TokensRequest](/atomicdex/api/v20/#tokens-request) objects. | +| slp\_tokens\_requests | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/nfts/#tokens-request) objects. | | address\_format.format | string | Optional. Overwrites the address format from coins file, if set. Options: `{"format":"standard"}` for legacy/standard address format, `{"format":"cashaddress"}` for cash address format | | address\_format.network | string | Optional. Overwrites the address network from coins file, if set. Options: `{"network":"bitcoincash"}` for mainnet, `{"network":"bchreg"}` for regtest, or `{"network":"bchtest"}` for testnet | | allow\_slp\_unsafe\_conf | boolean | Optional, defaults to `false`. If `true`, allows bchd\_urls to be empty. **Warning:** it is highly unsafe to do so as it may lead to invalid SLP transactions generation and tokens burning. | @@ -25,11 +25,15 @@ The AtomicDEX-API supports Bitcoin Cash SLP tokens. Using this method, you can e ### Response Parameters -| Parameter | Type | Description | -| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| current\_block | integer | Block height of the coin being activated | -| bch\_addresses\_infos | object | A standard [addressInfos](/atomicdex/api/v20/#address-infos) object. Note: the structure may vary based on the value of the `get_balances` parameter. | -| slp\_addresses\_infos | object | A standard [addressInfos](/atomicdex/api/v20/#address-infos) object. Note: the structure may vary based on the value of the `get_balances` parameter. | +| Parameter | Type | Description | +| --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| current\_block | integer | Block height of the coin being activated | +| bch\_addresses\_infos | object | A standard [addressInfos](/atomicdex/api/common_structures/#address-infos) object. Note: the structure may vary based on the value of the `get_balances` parameter. | +| slp\_addresses\_infos | object | A standard [addressInfos](/atomicdex/api/common_structures/#address-infos) object. Note: the structure may vary based on the value of the `get_balances` parameter. | + + + bch\_addresses\_infos and slp\_addresses\_infos are the same. This should be consolidated in the api. + ### 📌 Examples diff --git a/src/pages/atomicdex/api/v20/enable_eth_with_tokens/index.mdx b/src/pages/atomicdex/api/v20/enable_eth_with_tokens/index.mdx index cfb8a4f2..1a32572b 100644 --- a/src/pages/atomicdex/api/v20/enable_eth_with_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20/enable_eth_with_tokens/index.mdx @@ -14,8 +14,8 @@ Additionally, it supports ERC20 tokens on the ETH chain and associated ERC20 lik | mm2 | integer | Required if not set in `coins` file. Informs the AtomicDEX API whether or not the coin is expected to function. Accepted values are `0` or `1` | | swap\_contract\_address | string | Address of etomic swap smart contract | | fallback\_swap\_contract | string | Address of backup etomic swap smart contract | -| nodes | array of objects | A list of standard [EvmNode](/atomicdex/api/v20/#evm-node) objects. | -| erc20\_tokens\_requests | array of objects | A list of standard [TokensRequest](/atomicdex/api/v20/#tokens-request) objects. | +| nodes | array of objects | A list of standard [EvmNode](/atomicdex/api/common_structures/activation/#evm-node) objects. | +| erc20\_tokens\_requests | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/nfts/#tokens-request) objects. | | gas\_station\_decimals | integer | Optional, for ETH/ERC20 and other gas model chains. Defaults to `8`. Defines the decimals used to denominate the gas station response to gwei units. For example, the ETH gas station uses 8 decimals, which means that "average": 860 is equal to 86 gwei. While the Matic gas station uses 9 decimals, so 860 would mean 860 gwei exactly. | | gas\_station\_policy.policy | string | Optional, for ETH/ERC20 and other gas model chains. Defaults to `"MeanAverageFast"`. Defines the method of gas price calculation from the station response. `"MeanAverageFast"` will use the mean between average and fast fields. `"Average"` will return a simple average value. | | get\_balances | boolean | Optional, defaults to `true`. If `false`, coin and token balances will not be returned in the response, and the response will be returned more quickly. | @@ -27,11 +27,11 @@ Additionally, it supports ERC20 tokens on the ETH chain and associated ERC20 lik ### Response Parameters -| Parameter | Type | Description | -| ----------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| current\_block | integer | Block height of the coin being activated | -| eth\_addresses\_infos | object | A standard [addressInfos](/atomicdex/api/v20/#address-infos) object. Note: the structure may vary based on the value of the `get_balances` parameter. | -| erc20\_addresses\_infos | object | A standard [addressInfos](/atomicdex/api/v20/#address-infos) object. Note: the structure may vary based on the value of the `get_balances` parameter. | +| Parameter | Type | Description | +| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| current\_block | integer | Block height of the coin being activated | +| eth\_addresses\_infos | object | A standard [addressInfos](/atomicdex/api/common_structures/#address-infos) object. Note: the structure may vary based on the value of the `get_balances` parameter. | +| erc20\_addresses\_infos | object | A standard [addressInfos](/atomicdex/api/common_structures/#address-infos) object. Note: the structure may vary based on the value of the `get_balances` parameter. | ### 📌 Examples diff --git a/src/pages/atomicdex/api/v20/enable_tendermint_with_assets/index.mdx b/src/pages/atomicdex/api/v20/enable_tendermint_with_assets/index.mdx index 836e803b..581a003b 100644 --- a/src/pages/atomicdex/api/v20/enable_tendermint_with_assets/index.mdx +++ b/src/pages/atomicdex/api/v20/enable_tendermint_with_assets/index.mdx @@ -11,7 +11,7 @@ Use this method to activate Tendermint coins (COSMOS/IRIS/OSMOSIS) and IBC asset | ----------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ticker | string | Ticker of the platform protocol coin. Options: `ATOM`, `IRIS`, `OSMOSIS` | | mm2 | integer | Required if not set in `coins` file. Informs the AtomicDEX API whether or not the coin is expected to function. Accepted values are `0` or `1` | -| tokens\_params | array of objects | A list of standard [TokensRequest](/atomicdex/api/v20/#tokens-request) objects. | +| tokens\_params | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/nfts/#tokens-request) objects. | | priv\_key\_policy | string | Optional, defaults to `ContextPrivKey`. value can be `ContextPrivKey`,`Trezor` when AtomicDEX-API is built for native platforms. value can be `ContextPrivKey`, `Trezor`, `Metamask` when the AtomicDEX-API is built targeting `wasm` | | tx\_history | boolean | Optional, defaults to `false`. If `true` the AtomicDEX API will preload transaction history as a background process. Must be set to `true` to use the [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method | | required\_confirmations | integer | Optional, defaults to `3`. When the platform coin is involved, the number of confirmations for the AtomicDEX API to wait during the transaction steps of an atomic swap | @@ -20,14 +20,14 @@ Use this method to activate Tendermint coins (COSMOS/IRIS/OSMOSIS) and IBC asset ### Response Parameters -| Parameter | Type | Description | -| ---------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| current\_block | integer | Block height of the coin being activated | -| ticker | string | Ticker of the platform protocol coin, as input in the request. | -| address | string | An address for the activated coin | -| balance | object | Only returned when `get_balances` is `true`. A standard [BalanceInfos](/atomicdex/api/v20/#balance-infos) object. | -| tokens\_balances | array of objects | Only returned when `get_balances` is `true`. A list of standard [addressInfos](/atomicdex/api/v20/#address-infos) objects, one for each token. | -| tokens\_tickers | array | Only returned when `get_balances` is `false`. A list of each token which was activated. | +| Parameter | Type | Description | +| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| current\_block | integer | Block height of the coin being activated | +| ticker | string | Ticker of the platform protocol coin, as input in the request. | +| address | string | An address for the activated coin | +| balance | object | Only returned when `get_balances` is `true`. A standard [BalanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | +| tokens\_balances | array of objects | Only returned when `get_balances` is `true`. A list of standard [addressInfos](/atomicdex/api/common_structures/#address-infos) objects, one for each token. | +| tokens\_tickers | array | Only returned when `get_balances` is `false`. A list of each token which was activated. | ### 📌 Examples diff --git a/src/pages/atomicdex/api/v20/index.mdx b/src/pages/atomicdex/api/v20/index.mdx index 1ec28214..6771cdb2 100644 --- a/src/pages/atomicdex/api/v20/index.mdx +++ b/src/pages/atomicdex/api/v20/index.mdx @@ -101,456 +101,3 @@ It includes a uniform request, successful and error response formats. At the mom } ``` - -## Common Komodo DeFi SDK Request / Response Objects - -The folowing objects are used in the request or response of multiple Komodo DeFi SDK methods. - -### ActivationParams - -The `ActivationParams` object defines additional parameters used for activation. These params may vary depending on the coin type. - -| Parameter | Type | Description | -| ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | -| requires\_notarization | boolean | Optional, defaults to `false`. For [dPoW](https://komodoplatform.com/en/blog/dpow-demystified/) protected coins, a `true` value will wait for transactions to be notarised when doing swaps. Overrides value if set in `coins` file. | -| priv\_key\_policy | string | Defaults to `ContextPrivkey`. Set as `Trezor` to activate in Trezor mode. | -| min\_addresses\_number | integer | HD wallets only. How many additional addreesses to generate at a minimum. | -| scan\_policy | string | HD wallets only. Whether or not to scan for new addresses. Select from `do_not_scan`, `scan_if_new_wallet` or `scan`. Note that `scan` will result in multple requests to the Komodo DeFi SDK. | -| gap\_limit | integer | HD wallets only. The max number of empty addresses in a row. If transactions were sent to an address outside the `gap_limit`, they will not be identified when scanning. | -| zcash\_params\_path | string | ZHTLC coins only. Path to folder containing Zcash parameters. Optional, defaults to standard location as defined in [this guide](https://forum.komodoplatform.com/t/installing-zcash-params/603) | -| scan\_blocks\_per\_iteration | integer | ZHTLC coins only. Sets the number of scanned blocks per iteration during `BuildingWalletDb` state. Optional, default value is 1000. | -| scan\_interval\_ms | integer | ZHTLC coins only. Sets the interval in milliseconds between iterations of `BuildingWalletDb` state. Optional, default value is 0. | -| mode | object | QTUM, UTXO & ZHTLC coins only. A standard [ActivationMode](/atomicdex/api/v20/#activation-mode) object. | - - - For ZHTLC coins, older wallets need to set the `sync_params` field to a date before its - first transaction to see all balance and history. This may take a long time on the first - activation, but subsequent activations will be much faster. - Using a smaller `scan_blocks_per_iteration` and larger `scan_interval_ms`, - will reduce the average CPU load during ZHTLC coin activation (at the cost of a - longer activation time). These optional fields are recommended when developing - for iOS, where a high CPU load may kill the activation process. Android & - desktop operating systems do not appear to have any problems with high CPU - load during ZHTLC coin activation. - - -### ActivationMode - -Defines the activation mode for QTUM, BCH, UTXO & ZHTLC coins. - -| Parameter | Type | Description | -| --------- | ------ | ---------------------------------------------------------------------------------------------------------------- | -| rpc | string | `Native` if running a native blockchain node, `Electrum` if using electrum servers or `Light` for ZHTLC coins. | -| rpc\_data | object | `Electrum` or `Light` mode only. A standard [ActivationRpcData](/atomicdex/api/v20/#activation-rpc-data) object. | - -### ActivationRpcData - -Contains information about electrum & lightwallet\_d servers for coins being used in `Electrum` or `Light` mode. - -| Parameter | Type | Description | -| ------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | -| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | -| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/v20/#activation-servers) objects. | -| sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a unix timestamp). | - -### ActivationServers - -Contains information electrum servers for coins being used in `Electrum` or `Light` mode. - -| Parameter | Type | Description | -| --------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| url | string | The URL and port for an electrum server. | -| ws\_url | string | Optional, for WSS only. The URL and port for an electrum server's WSS port. | -| protocol | string | Optional, defaults to `TCP`. Transport protocol used to connect to the server. Options: `TCP` or `SSL` | -| disable\_cert\_verification | boolean | Optional, defaults to `false`. If `true`, this disables server SSL/TLS certificate verification (e.g. for self-signed certificates). Use at your own risk! | - - - #### ZHTLC Example - - ```json - { - "activation_params": { - "mode": { - "rpc": "Light", - "rpc_data": { - "electrum_servers": [ - { - "url":"zombie.dragonhound.info:10033" - } - ], - "light_wallet_d_servers": [ - "http://zombie.dragonhound.info:443" - ] - }, - "sync_params": { - "height": 2528700 - } - }, - "zcash_params_path": "/home/username/path_to/.zcash-params", - "scan_blocks_per_iteration": 100, - "scan_interval_ms": 200 - } - } - ``` - - #### HD UTXO Activation (v2) - - ```json - { - "activation_params": { - "mode": { - "rpc": "Electrum", - "rpc_data": { - "servers": [ - { - "url": "electrum2.cipig.net:10001" - }, - { - "url": "electrum3.cipig.net:20001", - "ws_url": "electrum3.cipig.net:30001", - "protocol": "SSL" - } - ] - } - }, - "scan_policy": "scan_if_new_wallet", - "priv_key_policy": "Trezor", - "min_addresses_number": 3, - "gap_limit": 20 - } - } - ``` - - -### AddressInfos - -The `addressInfos` object includes the following items for a given address: - -| Parameter | Type | Description | -| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------ | -| balances | object | A standard [balanceInfos](/atomicdex/api/v20/#balance-infos) object. Not included in responses where `get_balances` is `false` | -| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/v20/#derivation-method) object | -| pubkey | string | The public key associated with the seed used to launch AtomicDEX | -| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | - - - #### Example with balances - - ```json - "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { - "derivation_method": { - "type": "Iguana" - }, - "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", - "balances": { - "spendable": "0.11398301", - "unspendable": "0.00001" - } - } - ``` - - #### Example without balances - - ```json - "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { - "derivation_method": { - "type": "Iguana" - }, - "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", - "tickers": ["ASLP-SLP"] - } - ``` - - -### BalanceInfos - -The `balanceInfos` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | -| spendable | string (numeric) | The available amount of a coin or token which is ready to be traded or withdrawn. | -| unspendable | string (numeric) | The amount of a coin or token which is awaiting confirmation on the block chain for an incoming or outgoing transaction. | - - - ```json - { - "spendable": "12.11398301", - "unspendable": "0.53" - } - ``` - - -### DerivationMethod - -The `DerivationMethod` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| --------- | ------ | ------------------------------------------------------------------------------- | -| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | - - - Using the same seed or private key to generate keypairs using different derivation methods will result in a different address and private key for each method. - - -Where the value indicates: - -* `Iguana`: The coin or token is was activated using Iguana derivation (default). -* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. - - - ```json - { - "type": "Iguana" - } - ``` - - -### EvmNode - -The `EvmNode` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| --------- | ------- | ------------------------------------------------------------------------------------------------------------------- | -| url | string | URL of an RPC node | -| gui\_auth | boolean | Optional, defaults to `false`. Must be set to `true` to access RPC nodes run officially by the Komodo Platform team | - - - ```json - { - "url": "http://eth1.cipig.net:8555", - "gui_auth": false - } - ``` - - -### CoinProtocol - -| Parameter | Type | Description | -| -------------- | ------- | ----------------------------------------------------------------------------- | -| type | integer | One of the supported \[coin types]\(link TBA) | -| protocol\_data | object | A standard [CoinProtocolData](/atomicdex/api/v20/#coin-protocol-data) object. | - -### CoinProtocolData - -| Parameter | Type | Description | -| --------------------- | ------ | ------------------------------------------------------------------------------------------------ | -| platform | string | Indicates the platform parent coin for EMV-like protocols, or the coin used for lightning nodes. | -| network | string | Either `mainnet` or \`testnet | -| confirmation\_targets | object | A standard [ConfirmationTargets](/atomicdex/api/v20/#confirmation-targets) object. | - -### ConfirmationTargets - -This object represents the number of blocks required for an on-chain lightning-related transaction to be confirmed. -It is used for estimating the transaction fee rate (`feerate`) for different transaction types in the context of permissionless transactions performed by the node. Different target types are `background`, `normal`, and `high_priority`. - -| Parameter | Type | Description | -| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| background | integer | Used for transactions that can tolerate slower confirmation times when the transaction fee rate decreases. These transactions are not time-sensitive and can afford to wait longer for confirmation. The recommended range is `12` to `144` blocks to ensure a low `feerate`. | -| normal | integer | Used for transactions that we want to confirm promptly, without significant delay (e.g, transactions for opening payment channels). These transactions are important but not critical. Suggested value is `6` blocks to ensure a moderate `feerate`. | -| high\_priority | integer | Used for transactions that require quick confirmation to prevent potential loss of funds (e.g. redeeming a Hashed Time Lock Contract (HTLC) on the blockchain before it times out). These transactions are time-critical and must be confirmed promptly to ensure the security of funds. Recommended value for `high_priority` is 1-2 blocks to ensure a high `feerate`. | - - - Using the recommended values in the above table with a coin that has a block time of 10 minutes, the equivalent time in minutes is: - - * `background`: 120 minutes to 1440 minutes (2 hours to 1 day). - * `normal`: 60 minutes (one hour). - * `high_priority`: 10 to 20 minutes. - - -### CounterpartyChannelConfig - -| Parameter | Type | Description | -| --------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| allow\_outbound\_0conf | boolean | Optional, defaults to `true`. When setting an outbound channel, it can be used straight away [without waiting](https://docs.rs/lightning/latest/lightning/util/config/struct.ChannelHandshakeLimits.html#structfield.trust_own_funding_0conf) for any on-chain confirmations. | -| force\_announced\_channel\_preference | boolean | Optional, defaults to `true`. Set to force an incoming channel to match our announced channel preference in ChannelOptions announced\_channel. | -| outbound\_channels\_confirmations | integer | Optional, defaults to `144`. Confirmations we will wait for before considering an inbound channel locked in. | -| our\_locktime\_limit | boolean | Optional, defaults to `2016`. Set to the amount of blocks we're willing to wait to claim money back to us. | -| min\_funding\_sats | boolean | Optional, defaults to `0`. Minimum allowed satoshis when an inbound channel is funded. | -| max\_funding\_sats | boolean | Optional, defaults to `16777215`. Maximum allowed satoshis when an inbound channel is funded. | -| max\_htlc\_minimum\_msat | boolean | Optional, defaults to `18446744073709551615`. The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows us to limit the maximum minimum-size they can require. | -| min\_max\_htlc\_value\_in\_flight\_msat | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum value of pending HTLCs to them at any given time to limit their funds exposure to [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract). This allows us to set a minimum such value. | -| max\_channel\_reserve\_sats | boolean | Optional, defaults to `18446744073709551615`. The remote node will require us to keep a certain amount in direct payment to ourselves at all time, ensuring that we are able to be punished if we broadcast an old state. This allows us to limit the amount which we will have to keep to ourselves (and cannot use for [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract)). | -| min\_max\_accepted\_htlcs | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum number of pending HTLCs to them at any given time. This allows us to set a minimum such value. | - -### FeeInfo - -The `FeeInfo` response object includes the following items for [withdraw (v2)](/atomicdex/api/v20/withdraw/) requests: - -| Parameter | Type | Description | -| ---------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | Type of transaction fee; possible values: `UtxoFixed`, `UtxoPerKbyte`, `EthGas` | -| amount | string (numeric) | Fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) | -| gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | -| gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | - -### LightningActivationParams - -| Parameter | Type | Description | -| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| name | string | The name of the node that will be used in [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | -| listening port | integer | Optional, defaults to `9735`. The port that this node listens for incoming connections on. | -| color | string | Optional, defaults to `2b6680`. A hexidecimal color string which will be used in network graphs on [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | -| payment\_retries | integer | Optional, defaults to `5`. Number of times a payment will be retried if it fails. | -| backup\_path | string | Optional. The backup path for channel backups, preferably on an external drive. | - -### LightningChannelAmount - -| Parameter | Type | Description | -| --------- | ------ | -------------------------------------------------------------------------------------- | -| type | string | `Exact` for a specific amount or `Max` for whole balance. | -| value | object | Only required if type is `Exact`. The amount in BTC you want to open the channel with. | - -### LightningChannelConfig - - - The values in this object are only used if the channel is being opened by the user. If the channel is being opened by the counterparty, the values in this object are ignored. - If not specified when using the [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) methods, the values in this object will default to the values set in the `coins` configuration file. - - -| Parameter | Type | Description | -| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| inbound\_channels\_confirmations | string | Optional, defaults to `6`. Should be set in coins file, and applies to all channels. Confirmations we will wait for before considering an inbound channel locked in. | -| max\_inbound\_in\_flight\_htlc\_percent | integer | Optional, defaults to `10`. Should be set in coins file, and applies to all channels. Sets the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. | -| our\_htlc\_minimum\_msat | integer | Optional, defaults to `1`. The smallest value HTLC we will accept to process. The channel gets closed any time our counterparty misbehaves by sending us an HTLC with a value smaller than this. | -| announced\_channel | boolean | Optional, defaults to `false`. Set to announce the channel publicly and notify all nodes that they can route via this channel. GUIs and wallet apps should be set to `false`. | -| commit\_upfront\_shutdown\_pubkey | boolean | Optional, defaults to `true`. When `true` (and the counterparty agrees), the user must use the same key for cooperative closing. This prevents a user from changing the destination address in a cooperative close, which slightly increases security (however, this option is not required if the counterparty does not support it and a channel can be accepted regardless). **Note that the key for forced closing is always fixed when opening a channel and is different from shutdown\_pubkey.** | -| counterparty\_locktime | integer | Optional, defaults to `144`. The number of blocks we require our counterparty to wait to claim their money on chainif they broadcast a revoked transaction. We have to be online at least once during this time to punish our counterparty for broadcasting a revoked transaction. We have to account also for the time to broadcast and confirm our transaction, possibly with time in between to [RBF (Replace-By-Fee)](https://bitcoinops.org/en/topics/replace-by-fee/) the spending transaction. | -| negotiate\_scid\_privacy | integer | Optional, defaults to `false`. If `true`, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the [BOLTs](https://github.com/lightning/bolts)) option for outbound private channels. This provides better privacy by not including our real on-chain channel UTXO in each invoice and requiring that our counterparty only relay HTLCs to us using the channel's SCID alias. | -| their\_channel\_reserve\_sats | boolean | Optional, defaults to `10000` or 1% of channel value. The minimum balance that the other node has to maintain on their side, at all times. This ensures that if our counterparty broadcasts a revoked state, we can punish them by claiming at least this value on chain. | - - - For GUIs and wallet apps, it is recommended to set `announced_channel` to `false` (the default value), as the node is not expected to be reliably online. - - -### LightningChannelOptions - -| Parameter | Type | Description | -| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| proportional\_fee\_in\_millionths\_sats | integer | Optional, defaults to `0`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | -| base\_fee\_msat | integer | Optional, defaults to `1000`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | -| cltv\_expiry\_delta | integer | Optional, defaults to `72`. Blocks until [CheckLockTimeVerify (CLTV)](https://academy.bit2me.com/en/que-es-cltv-bitcoin/) expiry. | -| max\_dust\_htlc\_exposure\_msat | integer | Optional, defaults to `5000000`. Limit our total exposure to in-flight [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract) which are burned to fees as they are too small to claim on-chain. | -| force\_close\_avoidance\_max\_fee\_sats | integer | Optional, defaults to `1000`. The additional fee we're willing to pay to avoid waiting for the counterparty's locktime to reclaim funds. | - -### LightningClosedChannelsFilter - -| Parameter | Type | Description | -| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| channel\_id | string | Optional. Unique string identifying a channel by its ID. | -| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | -| funding\_tx | string | Optional. A transaction ID which added funds. | -| from\_funding\_value | integer | Optional. The minimum value of channel funding in satoshis. | -| to\_funding\_value | integer | Optional. The maximum value of channel funding in satoshis. | -| channel\_type | string | Optional. `Inbound` or `Outbound`. | -| closing\_tx | integer | Optional. A transaction ID which closed the channel. | -| closure\_reason | integer | Optional. The reason a channel was closed. | -| claiming\_tx | integer | Optional. The ID of the transaction that returned the remaining outbound funds when the channel was closed to our on-chain address. | -| from\_claimed\_balance | integer | Optional. The minimum balance of channel funds claimed in satoshis. | -| to\_claimed\_balance | integer | Optional. The maximum balance of channel funds claimed in satoshis. | -| channel\_visibility | integer | Optional. `Public` or `Private`. | - - - Response may change to be more consistent in future. - [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206446309](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206446309) - - -### LightningOpenChannelsFilter - -| Parameter | Type | Description | -| ------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| channel\_id | string | Optional. Unique string identifying a channel by its ID. | -| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | -| funding\_tx | string | Optional. A transaction ID which added funds. | -| from\_funding\_value\_sats | integer | Optional. The minimum value of channel funding in satoshis. | -| to\_funding\_value\_sats | integer | Optional. The maximum value of channel funding in satoshis. | -| is\_outbound | boolean | Optional. If `true`, limits the response to outbound channels only. | -| from\_balance\_msat | integer | Optional. The minimum channel balance in millisatoshis. | -| to\_balance\_msat | integer | Optional. The maximum channel balance in millisatoshis. | -| from\_outbound\_capacity\_msat | integer | Optional. The minimum outbound capacity of the channel balance in millisatoshis. | -| to\_outbound\_capacity\_msat | integer | Optional. The maximum outbound capacity of the channel balance in millisatoshis. | -| from\_inbound\_capacity\_msat | integer | Optional. The minimum inbound capacity of the channel balance in millisatoshis. | -| to\_inbound\_capacity\_msat | integer | Optional. The maximum inbound capacity of the channel balance in millisatoshis. | -| confirmed | boolean | Optional. If `true`, only channels with channel opening transactions that passed the number of confirmations required for the channel to be usable will be returned. | -| is\_usable | boolean | Optional. If `true`, only channels that are confirmed and the counterparty is online, meaning that these channels can be used for payments will be returned. | -| is\_public | boolean | Optional. If `true`, only channels that our node announces to the lightning network, these channels are visible on lightning explorers will be returned. | - -### LightningPayment - -| Parameter | Type | Description | -| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | The payment type. Accepted values are `invoice` or [`keysend`](https://cdecker-lightning.readthedocs.io/lightning-keysend.7.html). | -| invoice | string | Only used if `type` is `invoice`. An identifying string which represents the invoice. | -| destination | string | Only used if `type` is `keysend`. A `node_pubkey` (which is also the node address in lightning context). Not to be confused with an onchain address. | -| amount\_in\_msat | string | Only used if `type` is `keysend`. Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin). | -| expiry | string | Only used if `type` is `keysend`. Optional, defaults to `3600`. Seconds until the payment expires. | - -### LightningPaymentFilter - -| Parameter | Type | Description | -| --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------- | -| payment\_type | object | A standard `LightningPaymentType` object. | -| description | string | Optional. A note to indicate the purpose of the invoice. | -| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | -| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | -| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | -| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | -| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | -| from\_timestamp | string | Optional. Minimum timestamp (in milliseconds) of payment results to return. | -| to\_timestamp | string | Optional. Maximum timestamp (in milliseconds) of payment results to return. | - -### LightningPaymentType - -| Parameter | Type | Description | -| ----------- | ------ | ----------------------------------------------------------------------------------- | -| type | object | Accepted values are `Outbound Payment` or `Inbound Payment`. | -| destination | string | Only used if `type` is `Outbound Payment`. A pubkey which will receive the payment. | - - - Response may change in future. - See [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206176530](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206176530) - - -### Pagination - -For requests which return many results, pagination offsets may be applied. \*\* Use either value, not both. \*\* - -| Parameter | Type | Description | -| ---------- | ------- | ------------------------------------------------------- | -| PageNumber | integer | Optional, defaults to `1`. Offset for paginated results | -| FromId | integer | Optional. Ignores any results prior to this UUID | - - - #### Example - - ```json - { - "PageNumber": 1 - } - ``` - - ```json - { - "FromId": 4 - } - ``` - - -### TokensRequest - -The `TokensRequest` object includes the following items for a given coin or token: - -| Parameter | Type | Description | -| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | -| ticker | string | Ticker of the token to be enabled | -| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | - - - ```json - { - "ticker": "MINDS-ERC20", - "required_confirmations": 4 - } - ``` - diff --git a/utils/_fileData.json b/utils/_fileData.json index 71e805d9..60d44e17 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -214,8 +214,12 @@ } }, "/antara/api/musig": { - "dateModified": "2023-09-27T13:42:56.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -224,18 +228,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/api/oracles": { @@ -264,8 +264,12 @@ } }, "/antara/api/payments": { - "dateModified": "2023-09-28T07:39:39.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -277,15 +281,11 @@ { "name": "\"smk762\"", "email": "smk762@iinet.net.au" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/api/pegs": { @@ -364,8 +364,12 @@ } }, "/antara/api/rogue": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -374,18 +378,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/api/sudoku": { @@ -464,8 +464,12 @@ } }, "/antara/setup/antara-customizations": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-09-29T14:54:33.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -477,15 +481,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/setup": { @@ -506,8 +506,12 @@ } }, "/antara/tutorials/advanced-series-0": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-09-29T15:15:08.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -519,20 +523,20 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/advanced-series-1": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-09-29T14:54:33.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -544,20 +548,20 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/advanced-series-2": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -566,18 +570,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/advanced-series-3": { @@ -631,8 +631,12 @@ } }, "/antara/tutorials/advanced-series-5": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-09-29T15:15:08.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -644,15 +648,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/advanced-series-6": { @@ -915,8 +915,12 @@ } }, "/antara/tutorials/overview-of-antara-modules-part-i": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-09-29T09:18:12.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -925,23 +929,23 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/overview-of-antara-modules-part-ii": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-09-29T15:15:08.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -950,18 +954,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/pegs-module-creator-tutorial": { @@ -1015,8 +1015,12 @@ } }, "/antara/tutorials/rogue-module-tutorial": { - "dateModified": "2023-09-27T17:48:31.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -1028,15 +1032,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/antara/tutorials/understanding-antara-addresses": { @@ -1064,6 +1064,71 @@ "email": "smk762@iinet.net.au" } }, + "/atomicdex/api/common_structures/activation": { + "dateModified": "2023-10-04T05:02:02.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, + "/atomicdex/api/common_structures": { + "dateModified": "2023-10-04T05:02:02.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, + "/atomicdex/api/common_structures/lightning": { + "dateModified": "2023-10-04T05:02:02.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, + "/atomicdex/api/common_structures/nfts": { + "dateModified": "2023-10-04T05:02:02.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, + "/atomicdex/api/common_structures/swaps": { + "dateModified": "2023-10-04T05:02:02.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, "/atomicdex/api": { "dateModified": "2023-09-28T13:40:06.000Z", "contributors": [ @@ -1090,8 +1155,12 @@ } }, "/atomicdex/api/legacy/active_swaps": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T04:58:50.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1103,15 +1172,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/all_swaps_uuids_by_filter": { @@ -1290,8 +1355,12 @@ } }, "/atomicdex/api/legacy/coin_activation": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-29T09:18:12.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -1307,15 +1376,11 @@ { "name": "\"Samuel Onoja\"", "email": "samiodev@icloud.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/legacy/coins_needed_for_kick_start": { @@ -1594,7 +1659,7 @@ } }, "/atomicdex/api/legacy/get_trade_fee": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2237,7 +2302,7 @@ } }, "/atomicdex/api/legacy/trade_preimage": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2387,8 +2452,12 @@ } }, "/atomicdex/api/v20/add_delegation": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-09-29T09:42:14.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -2400,15 +2469,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20/add_node_to_version_stat": { @@ -2512,8 +2577,12 @@ } }, "/atomicdex/api/v20/enable_eth_with_tokens": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-09-29T09:18:12.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -2525,15 +2594,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20/enable_slp": { @@ -2687,11 +2752,15 @@ } }, "/atomicdex/api/v20/get_staking_infos": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-09-29T09:42:14.000Z", "contributors": [ { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" }, { "name": "\"gcharang\"", @@ -2700,28 +2769,24 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20": { - "dateModified": "2023-09-28T13:40:06.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2732,13 +2797,17 @@ } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20/message_signing": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -2750,15 +2819,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20/my_tx_history": { @@ -2800,8 +2865,12 @@ } }, "/atomicdex/api/v20/recreate_swap_data": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-09-29T14:54:33.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2810,23 +2879,23 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20/remove_delegation": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-09-29T09:42:14.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -2838,15 +2907,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20/remove_node_from_version_stat": { @@ -2875,8 +2940,12 @@ } }, "/atomicdex/api/v20/start_simple_market_maker_bot": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-09-29T09:42:14.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2888,15 +2957,11 @@ { "name": "\"smk762\"", "email": "smk762@iinet.net.au" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20/start_version_stat_collection": { @@ -3175,8 +3240,12 @@ } }, "/atomicdex/api/v20-dev": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -3188,28 +3257,24 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/api/v20-dev/lightning/activation": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-29T04:59:01.000Z", "contributors": [ - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" }, + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -3220,12 +3285,12 @@ } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" } }, "/atomicdex/api/v20-dev/lightning/channels": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3346,7 +3411,7 @@ } }, "/atomicdex/api/v20-dev/task_account_balance": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3359,7 +3424,7 @@ } }, "/atomicdex/api/v20-dev/task_enable_qtum": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3372,7 +3437,7 @@ } }, "/atomicdex/api/v20-dev/task_enable_utxo": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3398,7 +3463,7 @@ } }, "/atomicdex/api/v20-dev/task_init_trezor": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3411,7 +3476,7 @@ } }, "/atomicdex/api/v20-dev/task_withdraw": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-09-27T20:43:30.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3655,8 +3720,12 @@ } }, "/atomicdex/setup/configure-mm2-json": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -3668,36 +3737,32 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/setup": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/tutorials/additional-information-about-atomicdex": { @@ -3747,8 +3812,12 @@ } }, "/atomicdex/tutorials/atomicdex-walkthrough": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -3760,15 +3829,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/tutorials/coins-file-update": { @@ -3793,8 +3858,12 @@ } }, "/atomicdex/tutorials/how-to-become-a-liquidity-provider": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -3806,40 +3875,36 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/tutorials/how-to-compile-mm2-from-source": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/tutorials": { - "dateModified": "2023-05-31T18:19:46.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ { "name": "\"gaeacodes\"", @@ -3856,8 +3921,12 @@ } }, "/atomicdex/tutorials/listing-a-coin-on-atomicdex": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -3865,15 +3934,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/atomicdex/tutorials/query-the-mm2-database": { @@ -3902,8 +3967,12 @@ } }, "/atomicdex/tutorials/setup-atomicdex-aws": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -3912,18 +3981,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/cc-jl/chapter00": { @@ -3944,45 +4009,45 @@ } }, "/historical/cc-jl/chapter01": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-09-29T14:54:33.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/cc-jl/chapter02": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/cc-jl/chapter03": { @@ -4003,24 +4068,24 @@ } }, "/historical/cc-jl/chapter04": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/cc-jl/chapter05": { @@ -4041,8 +4106,12 @@ } }, "/historical/cc-jl/chapter06": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -4050,19 +4119,15 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/cc-jl/chapter07": { - "dateModified": "2023-05-24T13:18:47.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ { "name": "\"gaeacodes\"", @@ -4223,37 +4288,41 @@ } }, "/historical/cc-jl/faq": { - "dateModified": "2023-09-01T12:11:07.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/cc-jl": { - "dateModified": "2023-06-14T19:22:24.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical": { @@ -4295,29 +4364,33 @@ } }, "/historical/whitepaper/chapter2": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/whitepaper/chapter3": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -4326,18 +4399,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/historical/whitepaper/chapter4": { @@ -4471,24 +4540,24 @@ } }, "/historical/whitepaper/references": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/": { @@ -4609,8 +4678,12 @@ } }, "/smart-chains/api/crosschain": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -4622,15 +4695,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/smart-chains/api/disclosure": { @@ -4747,8 +4816,12 @@ } }, "/smart-chains/api/network": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -4757,18 +4830,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/smart-chains/api/rawtransactions": { @@ -4893,8 +4962,12 @@ } }, "/smart-chains/setup/common-runtime-parameters": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -4906,15 +4979,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/smart-chains/setup/ecosystem-launch-parameters": { @@ -4952,8 +5021,12 @@ } }, "/smart-chains/setup/installing-from-source": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -4962,18 +5035,14 @@ "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/smart-chains/setup/interacting-with-smart-chains": { @@ -5061,24 +5130,24 @@ } }, "/smart-chains/tutorials/basic-environment-setup-for-linux-vps": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/smart-chains/tutorials/create-a-default-smart-chain": { @@ -5304,8 +5373,12 @@ } }, "/start-here/about-komodo-platform/simple-installations": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -5313,15 +5386,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/start-here/core-technology-discussions/antara": { @@ -5367,8 +5436,12 @@ } }, "/start-here/core-technology-discussions/delayed-proof-of-work": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -5376,15 +5449,11 @@ { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/start-here/core-technology-discussions": { @@ -5405,8 +5474,12 @@ } }, "/start-here/core-technology-discussions/initial-dex-offering": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -5418,15 +5491,11 @@ { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" - }, - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/start-here/core-technology-discussions/miscellaneous": { @@ -5455,24 +5524,24 @@ } }, "/start-here/core-technology-discussions/references": { - "dateModified": "2023-09-05T12:43:04.000Z", + "dateModified": "2023-10-03T07:36:45.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } }, "/start-here": { @@ -5518,8 +5587,12 @@ } }, "/start-here/learning-launchpad": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-09-29T09:42:14.000Z", "contributors": [ + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -5534,8 +5607,8 @@ } ], "lastContributor": { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" } } } \ No newline at end of file diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index 737ad64f..e84f4994 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -14,6 +14,7 @@ import remarkGfm from "remark-gfm"; import remarkMdx from "remark-mdx"; import { slugifyWithCounter } from "@sindresorhus/slugify"; import { toString } from "mdast-util-to-string"; +import { type } from "os"; const manualLinkFile = "links-to-manually-check"; if (fs.existsSync(manualLinkFile)) { @@ -24,7 +25,7 @@ if (fs.existsSync(manualLinkFile)) { try { let filepaths = []; walkDir("./src/pages", (filepath) => filepaths.push(filepath)); - //await createFileSlugs(filepaths); + await createFileSlugs(filepaths); let filepathSlugs = JSON.parse(fs.readFileSync("filepathSlugs.json")); for (let index = 0; index < filepaths.length; index++) { @@ -216,12 +217,29 @@ async function processLink(link, currFilePath, filepathSlugs) { slug = slugify(correctUrlSplit[1]); correctUrl = correctUrlSplit[0] + "#" + slug; } - + if ( + !Object.hasOwn(filepathSlugs, internalLinkFile) + ) { + console.log("#----------------------------------------------#"); + console.log("currNormalisedDir: " + currNormalisedDir); + console.log("currFilePath: " + currFilePath); + console.log("hash: " + hash); + console.log("strippedPath: " + strippedPath); + console.log("link: " + link); + console.log("correctUrl: " + correctUrl); + console.log("internalLinkFile: " + internalLinkFile); + console.log("slug: " + slug); + console.log("#----------------------------------------------#"); + throw new Error( + `Processing file: ${currFilePath}, slug: ${slug} (original slug: ${correctUrlSplit[1]} ) not present in file: ${internalLinkFile} with url ${correctUrl} (original url: ${link})` + ); + } + else if ( slug && !filepathSlugs[internalLinkFile].some((slugO) => slug === slugO) ) { - console.log("------------------------------------------------"); + console.log("##------------------------------------------------##"); console.log("currNormalisedDir: " + currNormalisedDir); console.log("currFilePath: " + currFilePath); console.log("hash: " + hash); @@ -230,7 +248,7 @@ async function processLink(link, currFilePath, filepathSlugs) { console.log("correctUrl: " + correctUrl); console.log("internalLinkFile: " + internalLinkFile); console.log("slug: " + slug); - console.log("------------------------------------------------"); + console.log("##------------------------------------------------##"); throw new Error( `Processing file: ${currFilePath}, slug: ${slug} (original slug: ${correctUrlSplit[1]} ) not present in file: ${internalLinkFile}` ); From 7feab0ac5b120f78a4d8cbccc479ae6c791e68d4 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 4 Oct 2023 20:56:06 +0800 Subject: [PATCH 04/27] add orders section for common_structures --- filepathSlugs.json | 5 ++ src/data/sidebar.json | 7 +- .../atomicdex/api/common_structures/index.mdx | 18 +++++ .../api/common_structures/orders/index.mdx | 43 ++++++++++++ .../api/legacy/active_swaps/index.mdx | 8 +-- .../all_swaps_uuids_by_filter/index.mdx | 17 +++-- .../api/legacy/best_orders/index.mdx | 43 +----------- utils/_fileData.json | 68 +++++++++---------- 8 files changed, 121 insertions(+), 88 deletions(-) create mode 100644 src/pages/atomicdex/api/common_structures/orders/index.mdx diff --git a/filepathSlugs.json b/filepathSlugs.json index df0fccd5..836c0642 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -1587,6 +1587,7 @@ "balance-infos", "derivation-method", "fee-info", + "fractional-value", "pagination", "example" ], @@ -1608,6 +1609,10 @@ "non-fungible-token-structures", "tokens-request" ], + "src/pages/atomicdex/api/common_structures/orders/index.mdx": [ + "order-structures", + "ticker-best-order-v1" + ], "src/pages/atomicdex/api/common_structures/swaps/index.mdx": [ "swap-structures", "swap-status", diff --git a/src/data/sidebar.json b/src/data/sidebar.json index 5e82eaa3..b6b51b52 100644 --- a/src/data/sidebar.json +++ b/src/data/sidebar.json @@ -729,7 +729,12 @@ "links": [] }, { - "title": "Swap Structures", + "title": "Orders Structures", + "titleLink": "/atomicdex/api/common_structures/orders/", + "links": [] + }, + { + "title": "Swaps Structures", "titleLink": "/atomicdex/api/common_structures/swaps/", "links": [] } diff --git a/src/pages/atomicdex/api/common_structures/index.mdx b/src/pages/atomicdex/api/common_structures/index.mdx index c839b221..43ad6f80 100644 --- a/src/pages/atomicdex/api/common_structures/index.mdx +++ b/src/pages/atomicdex/api/common_structures/index.mdx @@ -106,6 +106,24 @@ The `FeeInfo` response object includes the following items for [withdraw (v2)](/ | gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | | gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | +### FractionalValue + +The `FractionalValue` object includes a [numerator and denominator](https://www.freemathhelp.com/numerator-denominator/) values for a given price or amount: + +| Parameter | Type | Description | +| --------- | ---------------- | ---------------------------------------- | +| numer | string (numeric) | The numerator of the fractional value. | +| denom | string (numeric) | The denominator of the fractional value. | + + + ```json + { + "numer": "4561782244811", + "denom": "4000000" + } + ``` + + ### Pagination For requests which return many results, pagination offsets may be applied. \*\* Use either value, not both. \*\* diff --git a/src/pages/atomicdex/api/common_structures/orders/index.mdx b/src/pages/atomicdex/api/common_structures/orders/index.mdx new file mode 100644 index 00000000..e5fbd77c --- /dev/null +++ b/src/pages/atomicdex/api/common_structures/orders/index.mdx @@ -0,0 +1,43 @@ +export const title = "Komodo DeFi SDK Common Structures: Orders"; +export const description = "Each order on the Komodo Defi oderbook can be queried to view full details of each order for a pair, or the best orders for a ticker."; + +# Order Structures + +### TickerBestOrderV1 + +| Structure | Type | Description | | +| --------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------- | - | +| coin | string | the ticker of the coin | | +| address | string | the address offering the trade | | +| price | string (decimal) | the price the user is willing to buy or sell per one unit of the coin from request | | +| price\_rat | rational | the price in num-rational crate format | | +| price\_fraction | object (fraction) | the price represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | +| maxvolume | string (decimal) | the maximum amount of `base` the offer provider is willing to sell | | +| max\_volume\_rat | rational | the max volume in num-rational crate format | | +| max\_volume\_fraction | object (rational) | the max volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | +| min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to sell | | +| min\_volume\_rat | rational | the min volume in num-rational crate format | | +| min\_volume\_fraction | object (rational) | the min volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | +| pubkey | string | the pubkey of the offer provider | | +| age | number | the age of the offer (in seconds) | | +| zcredits | number | the zeroconf deposit amount (deprecated) | | +| netid | number | the id of the network on which the request is made (default is `0`) | | +| uuid | string | the uuid of order | | +| is\_mine | bool | whether the order is placed by me | | +| base\_max\_volume | string (decimal) | the maximum amount of `base` coin the offer provider is willing to buy or sell | | +| base\_max\_volume\_rat | rational | the `base_max_volume` in num-rational crate format | | +| base\_max\_volume\_fraction | object (rational) | the `base_max_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | +| base\_min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to buy or sell | | +| base\_min\_volume\_rat | rational | the `base_min_volume` in num-rational crate format | | +| base\_min\_volume\_fraction | object (rational) | the `base_min_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | +| base\_confs | number | the confirmations settings of `base` coin set by the offer provider | | +| base\_nota | bool | the notarisation settings of `base` coin set by the offer provider | | +| rel\_max\_volume | string (decimal) | the maximum amount of `rel` coin the offer provider is willing to buy or sell | | +| rel\_max\_volume\_rat | rational | the `rel_max_volume` max volume in num-rational crate format | | +| rel\_max\_volume\_fraction | object (rational) | the `rel_max_volume` max volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | +| rel\_min\_volume | string (decimal) | the minimum amount of `rel` coin the offer provider is willing to buy or sell | | +| rel\_min\_volume\_rat | rational | the `rel_min_volume` in num-rational crate format | | +| rel\_min\_volume\_fraction | object (rational) | the `rel_min_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | +| rel\_confs | number | the confirmations settings of `rel` coin set by the offer provider | | +| rel\_nota | bool | the notarisation settings of `rel` coin set by the offer provider | | +| original\_tickers | list (string) | Tickers included in response when `orderbook_ticker` is configured for the queried coin in `coins` file | | diff --git a/src/pages/atomicdex/api/legacy/active_swaps/index.mdx b/src/pages/atomicdex/api/legacy/active_swaps/index.mdx index 5e50e86b..8293e132 100644 --- a/src/pages/atomicdex/api/legacy/active_swaps/index.mdx +++ b/src/pages/atomicdex/api/legacy/active_swaps/index.mdx @@ -16,10 +16,10 @@ The `active_swaps` method returns all the swaps that are currently running on th ## Response -| Structure | Type | Description | -| --------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| uuids | array of strings | A list of currently active swap UUIDs. | -| statuses | object (map) | Only visible if `include_status` request parameter is `true`. A map of standard SwapStatus objects, delineated by the related UUID. | +| Structure | Type | Description | +| --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| uuids | array of strings | A list of currently active swap UUIDs. | +| statuses | object (map) | Only visible if `include_status` request parameter is `true`. A map of standard [SwapStatus](/atomicdex/api/common_structures/swaps/#swap-status) objects, delineated by the related UUID. | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/all_swaps_uuids_by_filter/index.mdx b/src/pages/atomicdex/api/legacy/all_swaps_uuids_by_filter/index.mdx index ab6d5bfb..b4d40cda 100644 --- a/src/pages/atomicdex/api/legacy/all_swaps_uuids_by_filter/index.mdx +++ b/src/pages/atomicdex/api/legacy/all_swaps_uuids_by_filter/index.mdx @@ -18,15 +18,14 @@ The `all_swaps_uuids_by_filter` method returns all uuids of swaps that match the ## Response -| Structure | Type | Description | -| ---------------------- | ---------------- | ---------------------------------------------- | -| result | result object | | -| result.uuids | array of strings | uuids of swaps that match the selected filters | -| result.my\_coin | string | my\_coin that was set in request | -| result.other\_coin | string | other\_coin that was set in request | -| result.from\_timestamp | number | from\_timestamp that was set in request | -| result.to\_timestamp | number | to\_timestamp that was set in request | -| result.records\_found | number | the number of found uuids | +| Structure | Type | Description | +| --------------- | ---------------- | ---------------------------------------------- | +| uuids | array of strings | uuids of swaps that match the selected filters | +| my\_coin | string | my\_coin that was set in request | +| other\_coin | string | other\_coin that was set in request | +| from\_timestamp | number | from\_timestamp that was set in request | +| to\_timestamp | number | to\_timestamp that was set in request | +| records\_found | number | the number of found uuids | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/best_orders/index.mdx b/src/pages/atomicdex/api/legacy/best_orders/index.mdx index e58bf79e..e8883cc1 100644 --- a/src/pages/atomicdex/api/legacy/best_orders/index.mdx +++ b/src/pages/atomicdex/api/legacy/best_orders/index.mdx @@ -22,49 +22,12 @@ The `best_orders` method returns the best price orders that can fill the volume ## Response -| Structure | Type | Description | -| --------- | ------------ | ------------------------------------------ | -| result | object (map) | the `ticker -> array of order entries` map | +| Structure | Type | Description | +| --------- | ------------ | -------------------------------------------------------------------------------------------------- | +| result | object (map) | A map of standard [TickerBestOrderV1](/atomicdex/api/common_structures/orders) objects (by ticker) | where order entry has the following structure -| Structure | Type | Description | -| --------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------- | -| coin | string | the ticker of the coin | -| address | string | the address offering the trade | -| price | string (decimal) | the price the user is willing to buy or sell per one unit of the coin from request | -| price\_rat | rational | the price in num-rational crate format | -| price\_fraction | object (fraction) | the price represented as an object | -| maxvolume | string (decimal) | the maximum amount of `base` the offer provider is willing to sell | -| max\_volume\_rat | rational | the max volume in num-rational crate format | -| max\_volume\_fraction | object (rational) | the max volume represented as an object | -| min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to sell | -| min\_volume\_rat | rational | the min volume in num-rational crate format | -| min\_volume\_fraction | object (rational) | the min volume represented as an object | -| pubkey | string | the pubkey of the offer provider | -| age | number | the age of the offer (in seconds) | -| zcredits | number | the zeroconf deposit amount (deprecated) | -| netid | number | the id of the network on which the request is made (default is `0`) | -| uuid | string | the uuid of order | -| is\_mine | bool | whether the order is placed by me | -| base\_max\_volume | string (decimal) | the maximum amount of `base` coin the offer provider is willing to buy or sell | -| base\_max\_volume\_rat | rational | the `base_max_volume` in num-rational crate format | -| base\_max\_volume\_fraction | object (rational) | the `base_max_volume` represented as an object | -| base\_min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to buy or sell | -| base\_min\_volume\_rat | rational | the `base_min_volume` in num-rational crate format | -| base\_min\_volume\_fraction | object (rational) | the `base_min_volume` represented as an object | -| base\_confs | number | the confirmations settings of `base` coin set by the offer provider | -| base\_nota | bool | the notarisation settings of `base` coin set by the offer provider | -| rel\_max\_volume | string (decimal) | the maximum amount of `rel` coin the offer provider is willing to buy or sell | -| rel\_max\_volume\_rat | rational | the `rel_max_volume` max volume in num-rational crate format | -| rel\_max\_volume\_fraction | object (rational) | the `rel_max_volume` max volume represented as an object | -| rel\_min\_volume | string (decimal) | the minimum amount of `rel` coin the offer provider is willing to buy or sell | -| rel\_min\_volume\_rat | rational | the `rel_min_volume` in num-rational crate format | -| rel\_min\_volume\_fraction | object (rational) | the `rel_min_volume` represented as an object | -| rel\_confs | number | the confirmations settings of `rel` coin set by the offer provider | -| rel\_nota | bool | the notarisation settings of `rel` coin set by the offer provider | -| original\_tickers | list (string) | Tickers included in response when `orderbook_ticker` is configured for the queried coin in `coins` file | - #### 📌 Examples #### Command diff --git a/utils/_fileData.json b/utils/_fileData.json index 60d44e17..ab36167e 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -1065,7 +1065,7 @@ } }, "/atomicdex/api/common_structures/activation": { - "dateModified": "2023-10-04T05:02:02.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1078,7 +1078,7 @@ } }, "/atomicdex/api/common_structures": { - "dateModified": "2023-10-04T05:02:02.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1091,7 +1091,7 @@ } }, "/atomicdex/api/common_structures/lightning": { - "dateModified": "2023-10-04T05:02:02.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1104,7 +1104,7 @@ } }, "/atomicdex/api/common_structures/nfts": { - "dateModified": "2023-10-04T05:02:02.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1117,7 +1117,7 @@ } }, "/atomicdex/api/common_structures/swaps": { - "dateModified": "2023-10-04T05:02:02.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1130,7 +1130,7 @@ } }, "/atomicdex/api": { - "dateModified": "2023-09-28T13:40:06.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1155,7 +1155,7 @@ } }, "/atomicdex/api/legacy/active_swaps": { - "dateModified": "2023-10-04T04:58:50.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2527,7 +2527,7 @@ } }, "/atomicdex/api/v20/enable_bch_with_tokens": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2577,16 +2577,16 @@ } }, "/atomicdex/api/v20/enable_eth_with_tokens": { - "dateModified": "2023-09-29T09:18:12.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2597,8 +2597,8 @@ } ], "lastContributor": { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20/enable_slp": { @@ -2652,7 +2652,7 @@ } }, "/atomicdex/api/v20/enable_tendermint_with_assets": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2777,16 +2777,16 @@ } }, "/atomicdex/api/v20": { - "dateModified": "2023-10-03T07:36:45.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ - { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, + { + "name": "\"gaeacodes\"", + "email": "gaeacodes@gmail.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2797,8 +2797,8 @@ } ], "lastContributor": { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20/message_signing": { @@ -3265,16 +3265,16 @@ } }, "/atomicdex/api/v20-dev/lightning/activation": { - "dateModified": "2023-09-29T04:59:01.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -3285,12 +3285,12 @@ } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20-dev/lightning/channels": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3315,7 +3315,7 @@ } }, "/atomicdex/api/v20-dev/lightning": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3361,7 +3361,7 @@ } }, "/atomicdex/api/v20-dev/lightning/payments": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3450,7 +3450,7 @@ } }, "/atomicdex/api/v20-dev/task_enable_z_coin": { - "dateModified": "2023-09-28T20:56:11.000Z", + "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ { "name": "\"smk762\"", From 5caa461c21409a2f176bb844232aae24bdfde78c Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 4 Oct 2023 23:08:02 +0800 Subject: [PATCH 05/27] add more legacy order structures --- filepathSlugs.json | 9 +- .../atomicdex/api/common_structures/index.mdx | 19 ++ .../api/common_structures/orders/index.mdx | 188 +++++++++--- src/pages/atomicdex/api/legacy/buy/index.mdx | 71 ++--- .../api/legacy/cancel_all_orders/index.mdx | 20 +- .../api/legacy/order_status/index.mdx | 2 +- src/pages/atomicdex/api/legacy/sell/index.mdx | 71 ++--- .../atomicdex/api/legacy/setprice/index.mdx | 41 ++- .../api/legacy/update_maker_order/index.mdx | 37 ++- .../atomicdex/api/v20-dev/lightning/index.mdx | 8 +- utils/_fileData.json | 283 ++++++++++-------- 11 files changed, 438 insertions(+), 311 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index 836c0642..20cb9b89 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -1589,7 +1589,8 @@ "fee-info", "fractional-value", "pagination", - "example" + "example", + "rational-value" ], "src/pages/atomicdex/api/common_structures/lightning/index.mdx": [ "lightning-network-structures", @@ -1611,7 +1612,11 @@ ], "src/pages/atomicdex/api/common_structures/orders/index.mdx": [ "order-structures", - "ticker-best-order-v1" + "cancel-by", + "conf-settings", + "order-type", + "ticker-best-order-v1", + "match-by" ], "src/pages/atomicdex/api/common_structures/swaps/index.mdx": [ "swap-structures", diff --git a/src/pages/atomicdex/api/common_structures/index.mdx b/src/pages/atomicdex/api/common_structures/index.mdx index 43ad6f80..13ac3685 100644 --- a/src/pages/atomicdex/api/common_structures/index.mdx +++ b/src/pages/atomicdex/api/common_structures/index.mdx @@ -148,3 +148,22 @@ For requests which return many results, pagination offsets may be applied. \*\* } ``` + +### RationalValue + +The Komodo DeFi SDK now offers the [num-rational crate](https://crates.io/crates/num-rational) feature which allows for higher precision numeric values to represent order volumes and prices in a unique format as explained below: + +```json +[ + [1, [0, 1]], + [1, [1]] +] +``` + +In the above unique format, the first item `[1,[0,1]]` is the `numerator` and the second item `[1,[1]]` is the `denominator`. + +The `numerator` and `denominator` are BigInteger numbers represented as a sign and a uint32 array (where numbers are 32-bit parts of big integer in little-endian order). + +`[1,[0,1]]` represents `+0000000000000000000000000000000010000000000000000000000000000000` = `4294967296` + +`[-1,[1,1]]` represents `-1000000000000000000000000000000010000000000000000000000000000000` = `-4294967297` diff --git a/src/pages/atomicdex/api/common_structures/orders/index.mdx b/src/pages/atomicdex/api/common_structures/orders/index.mdx index e5fbd77c..de3a5717 100644 --- a/src/pages/atomicdex/api/common_structures/orders/index.mdx +++ b/src/pages/atomicdex/api/common_structures/orders/index.mdx @@ -3,41 +3,157 @@ export const description = "Each order on the Komodo Defi oderbook can be querie # Order Structures +### CancelBy + +| Structure | Type | Description | +| ----------- | ------ | -------------------------------------------------------------------------------------------------------------------------------- | +| type | string | `All` to cancel all orders; `Pair` to cancel all orders for specific coin pairs; `Coin` to cancel all orders for a specific coin | +| data | object | additional data the cancel condition; present with `Pair` and `Coin` types | +| data.base | string | base coin of the pair; `Pair` type only | +| data.rel | string | rel coin of the pair; `Pair` type only | +| data.ticker | string | order is cancelled if it uses `ticker` as base or rel; `Coin` type only | + + + To cancel all orders for a specific coin: + + ```json + { + "type": "Coin", + "data": { + "ticker": "DOC" + } + } + ``` + + To cancel all orders for a specific pair: + + ```json + { + "type": "Pair", + "data": { + "base": "DOC", + "rel": "MARTY" + } + } + ``` + + +### ConfSettings + +| Structure | Type | Description | +| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| base\_confs | number | Number of required confirmations on the base coin's blockchain for a transaction to complete an atomic swap event. | +| base\_nota | bool | Whether [dPoW notarization](https://komodoplatform.com/en/blog/dpow-demystified/) is required on the base coin's blockchain for a transaction to complete an atomic swap event. | +| rel\_confs | number | Number of required confirmations on the rel coin's blockchain for a transaction to complete an atomic swap event. | +| rel\_nota | bool | Whether [dPoW notarization](https://komodoplatform.com/en/blog/dpow-demystified/) is required on the rel coin's blockchain for a transaction to complete an atomic swap event. | + + + ```json + { + "conf_settings": { + "base_confs": 2, + "base_nota": true, + "rel_confs": 5, + "rel_nota": false + } + } + ``` + + +### OrderType + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | There are two types from which to choose: `GoodTillCancelled` and `FillOrKill`. The `GoodTillCancelled` order is automatically converted to a `maker` order if the order is not matched in 30 seconds, and this `maker` order stays in the orderbook until explicitly cancelled. On the other hand, a `FillOrKill` order is cancelled if it is not matched within 30 seconds. The default type is `GoodTillCancelled` | + + + `GoodTillCancelled` orders will remain on the orderbook until they are exhausted or explicitly cancelled. + + ```json + { + "order_type": { + "type": "GoodTillCancelled" + } + } + ``` + + `FillOrKill` orders will be automatically cancelled if they are not matched within 60 seconds. + + ```json + { + "order_type": { + "type": "FillOrKill" + } + } + ``` + + ### TickerBestOrderV1 -| Structure | Type | Description | | -| --------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------- | - | -| coin | string | the ticker of the coin | | -| address | string | the address offering the trade | | -| price | string (decimal) | the price the user is willing to buy or sell per one unit of the coin from request | | -| price\_rat | rational | the price in num-rational crate format | | -| price\_fraction | object (fraction) | the price represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | -| maxvolume | string (decimal) | the maximum amount of `base` the offer provider is willing to sell | | -| max\_volume\_rat | rational | the max volume in num-rational crate format | | -| max\_volume\_fraction | object (rational) | the max volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | -| min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to sell | | -| min\_volume\_rat | rational | the min volume in num-rational crate format | | -| min\_volume\_fraction | object (rational) | the min volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | -| pubkey | string | the pubkey of the offer provider | | -| age | number | the age of the offer (in seconds) | | -| zcredits | number | the zeroconf deposit amount (deprecated) | | -| netid | number | the id of the network on which the request is made (default is `0`) | | -| uuid | string | the uuid of order | | -| is\_mine | bool | whether the order is placed by me | | -| base\_max\_volume | string (decimal) | the maximum amount of `base` coin the offer provider is willing to buy or sell | | -| base\_max\_volume\_rat | rational | the `base_max_volume` in num-rational crate format | | -| base\_max\_volume\_fraction | object (rational) | the `base_max_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | -| base\_min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to buy or sell | | -| base\_min\_volume\_rat | rational | the `base_min_volume` in num-rational crate format | | -| base\_min\_volume\_fraction | object (rational) | the `base_min_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | -| base\_confs | number | the confirmations settings of `base` coin set by the offer provider | | -| base\_nota | bool | the notarisation settings of `base` coin set by the offer provider | | -| rel\_max\_volume | string (decimal) | the maximum amount of `rel` coin the offer provider is willing to buy or sell | | -| rel\_max\_volume\_rat | rational | the `rel_max_volume` max volume in num-rational crate format | | -| rel\_max\_volume\_fraction | object (rational) | the `rel_max_volume` max volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | -| rel\_min\_volume | string (decimal) | the minimum amount of `rel` coin the offer provider is willing to buy or sell | | -| rel\_min\_volume\_rat | rational | the `rel_min_volume` in num-rational crate format | | -| rel\_min\_volume\_fraction | object (rational) | the `rel_min_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | -| rel\_confs | number | the confirmations settings of `rel` coin set by the offer provider | | -| rel\_nota | bool | the notarisation settings of `rel` coin set by the offer provider | | -| original\_tickers | list (string) | Tickers included in response when `orderbook_ticker` is configured for the queried coin in `coins` file | | +| Structure | Type | Description | +| --------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | the ticker of the coin | +| address | string | the address offering the trade | +| price | string (decimal) | the price the user is willing to buy or sell per one unit of the coin from request | +| price\_rat | rational | the price represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| price\_fraction | object | the price represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| maxvolume | string (decimal) | the maximum amount of `base` the offer provider is willing to sell | +| max\_volume\_rat | rational | the max volume represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| max\_volume\_fraction | object | the max volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to sell | +| min\_volume\_rat | rational | the min volume represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| min\_volume\_fraction | object | the min volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| pubkey | string | the pubkey of the offer provider | +| age | number | the age of the offer (in seconds) | +| zcredits | number | the zeroconf deposit amount (deprecated) | +| netid | number | the id of the network on which the request is made (default is `0`) | +| uuid | string | the uuid of order | +| is\_mine | bool | whether the order is placed by me | +| base\_max\_volume | string (decimal) | the maximum amount of `base` coin the offer provider is willing to buy or sell | +| base\_max\_volume\_rat | rational | the `base_max_volume` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| base\_max\_volume\_fraction | object | the `base_max_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| base\_min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to buy or sell | +| base\_min\_volume\_rat | rational | the `base_min_volume` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| base\_min\_volume\_fraction | object | the `base_min_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| base\_confs | number | the confirmations settings of `base` coin set by the offer provider | +| base\_nota | bool | the notarisation settings of `base` coin set by the offer provider | +| rel\_max\_volume | string (decimal) | the maximum amount of `rel` coin the offer provider is willing to buy or sell | +| rel\_max\_volume\_rat | rational | the `rel_max_volume` max volume represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| rel\_max\_volume\_fraction | object | the `rel_max_volume` max volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| rel\_min\_volume | string (decimal) | the minimum amount of `rel` coin the offer provider is willing to buy or sell | +| rel\_min\_volume\_rat | rational | the `rel_min_volume` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| rel\_min\_volume\_fraction | object | the `rel_min_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| rel\_confs | number | the confirmations settings of `rel` coin set by the offer provider | +| rel\_nota | bool | the notarisation settings of `rel` coin set by the offer provider | +| original\_tickers | list (string) | Tickers included in response when `orderbook_ticker` is configured for the queried coin in `coins` file | + +## MatchBy + +| Structure | Type | Description | +| --------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| type | string | `Any` to match with any other order; `Orders` to select specific uuids; `Pubkeys` to select specific nodes; default is `Any` | +| data | array of strings | A list of order uuids (to match for `Orders` type) or pubkeys of nodes (to match for `Pubkeys` type) | + + + ```json + "match_by": { + "type": "Pubkeys", + "data": [ + "0261eef15cbc141f555aff1aa40fb21de17a0a9e6897eee18c14c6032586b456b3", + "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c" + ] + } + ``` + + Match by order uuids: + + ```json + "match_by": { + "type": "Orders", + "data": [ + "6f65968f-e3c6-4978-98c5-5cec2bb5aa5b", + "07ce08bf-3db9-4dd8-a671-854affc1b7a3" + ] + } + ``` + diff --git a/src/pages/atomicdex/api/legacy/buy/index.mdx b/src/pages/atomicdex/api/legacy/buy/index.mdx index d7eda919..bb8cfd2b 100644 --- a/src/pages/atomicdex/api/legacy/buy/index.mdx +++ b/src/pages/atomicdex/api/legacy/buy/index.mdx @@ -14,49 +14,40 @@ The `buy` method issues a buy request and attempts to match an order from the or ## Arguments -| Structure | Type | Description | -| ----------------- | ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| base | string | the name of the coin the user desires to receive | -| rel | string | the name of the coin the user desires to sell | -| price | numeric string or rational | the price in `rel` the user is willing to pay per one unit of the `base` coin | -| volume | numeric string or rational | the amount of coins the user is willing to receive of the `base` coin; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin: | -| min\_volume | numeric string or rational (optional) | the amount of `base` coin that will be used as `min_volume` of `GoodTillCancelled` order after conversion to maker; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin: | -| match\_by | object | the created order is matched using this condition. *Important:* This condition is not applied after a `GoodTillCancelled` order is converted to a `maker` request | -| match\_by.type | string | `Any` to match with any other order; `Orders` to select specific uuids; `Pubkeys` to select specific nodes; default is `Any` | -| match\_by.data | array of strings | uuids of orders to match for `Orders` type; pubkeys of nodes to match for `Pubkeys` type | -| order\_type | object | the type of the order | -| order\_type.type | string | there are two types from which to choose: `GoodTillCancelled` and `FillOrKill`. The `GoodTillCancelled` order is automatically converted to a `maker` order if the order is not matched in 30 seconds, and this `maker` order stays in the orderbook until explicitly cancelled. On the other hand, a `FillOrKill` order is cancelled if it is not matched within 30 seconds. The default type is `GoodTillCancelled` | -| base\_confs | number | number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set | -| base\_nota | boolean | whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set | -| rel\_confs | number | number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set | -| rel\_nota | boolean | whether dPoW notarization is required for rel coin atomic swap transaction; default to rel coin configuration if not set | -| save\_in\_history | boolean | Defaults to `true`. If set to `false` no order history will be saved (though order status will be temporarily stored while in progress). If `true`, each order's short record history is stored in a local SQLite database table, and when the order is cancelled or fully matched, it's history will be saved as a json file | +| Structure | Type | Description | +| ----------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| base | string | The name of the coin the user desires to receive | +| rel | string | The name of the coin the user desires to sell | +| price | varies | The price in `rel` the user is willing to pay per one unit of the `base` coin. Can be a numeric string, expressed using standard [RationalValue](/atomicdex/api/common_structures/#rational-value) or [FractionalValue](/atomicdex/api/common_structures/#fractional-value) objects. | +| volume | varies | The amount of coins the user is willing to receive of the `base` coin; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin: . . Can be a numeric string, expressed using standard [RationalValue](/atomicdex/api/common_structures/#rational-value) or [FractionalValue](/atomicdex/api/common_structures/#fractional-value) objects. | +| min\_volume | varies (optional) | The amount of `base` coin that will be used as `min_volume` of `GoodTillCancelled` order after conversion to maker; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin: . . Can be a numeric string, expressed using standard [RationalValue](/atomicdex/api/common_structures/#rational-value) or [FractionalValue](/atomicdex/api/common_structures/#fractional-value) objects. | +| match\_by | object | Optional. A standard [MatchBy](/atomicdex/api/common_structures/orders/#match-by) object, to filter to include only matches by pubkey or uuid. *Important:* This condition is not applied after a `GoodTillCancelled` order is converted to a `maker` request. | +| order\_type | object | Optional. A standard [OrderType](/atomicdex/api/common_structures/orders/#order-type) object. | +| base\_confs | number | Number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set | +| base\_nota | boolean | Whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set | +| rel\_confs | number | Number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set | +| rel\_nota | boolean | Whether dPoW notarization is required for rel coin atomic swap transaction; default to rel coin configuration if not set | +| save\_in\_history | boolean | Defaults to `true`. If set to `false` no order history will be saved (though order status will be temporarily stored while in progress). If `true`, each order's short record history is stored in a local SQLite database table, and when the order is cancelled or fully matched, it's history will be saved as a json file | ## Response -| Structure | Type | Description | -| --------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| result | object | the resulting order object | -| result.action | string | the action of the request (`Buy`) | -| result.base | string | the base currency of request | -| result.base\_amount | string | the resulting amount of base currency that is received if the order matches (in decimal representation) | -| result.base\_amount\_rat | rational | the resulting amount of base currency that is received if the order matches (in rational representation) | -| result.rel | string | the rel currency of the request | -| result.rel\_amount | string | the maximum amount of `rel` coin that is spent in order to buy the `base_amount` (according to `price`, in decimal representation) | -| result.rel\_amount\_rat | rational | the maximum amount of `rel` coin that is spent in order to buy the `base_amount` (according to `price`, in rational representation) | -| result.method | string | this field is used for internal P2P interactions; the value is always equal to "request | -| result.dest\_pub\_key | string | reserved for future use. `dest_pub_key` allows the user to choose the P2P node that is eligible to match with the request. This value defaults to a "zero pubkey", which means `anyone` can be a match | -| result.sender\_pubkey | string | the public key of this node | -| result.uuid | string | the request uuid | -| result.match\_by | object | the created order is matched using this condition | -| result.match\_by.type | string | `Any` to match with any other order; `Orders` to select specific uuids; `Pubkeys` to select specific nodes; Default is `Any` | -| result.match\_by.data | array of strings | uuids of orders to match for `Orders` type; pubkeys of nodes to match for `Pubkeys` type | -| result.conf\_settings.base\_confs | number | number of required blockchain confirmations for base coin atomic swap transaction | -| result.conf\_settings.base\_nota | bool | whether dPoW notarization is required for base coin atomic swap transaction | -| result.conf\_settings.rel\_confs | number | number of required blockchain confirmations for rel coin atomic swap transaction | -| result.conf\_settings.rel\_nota | bool | whether dPoW notarization is required for rel coin atomic swap transaction | -| result.base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | -| result.rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | +| Structure | Type | Description | +| ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| action | string | The action of the request (`Buy`) | +| base | string | The base currency of request | +| base\_amount | string | The resulting amount of base currency that is received if the order matches (in decimal representation) | +| base\_amount\_rat | rational | The resulting amount of base currency that is received if the order matches, represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| rel | string | The rel currency of the request | +| rel\_amount | string | The maximum amount of `rel` coin that is spent in order to buy the `base_amount` (according to `price`, in decimal representation) | +| rel\_amount\_rat | rational | The maximum amount of `rel` coin that is spent in order to buy the `base_amount` (according to `price`, represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object). | +| method | string | This field is used for internal P2P interactions; the value is always equal to "request | +| dest\_pub\_key | string | Reserved for future use. `dest_pub_key` allows the user to choose the P2P node that is eligible to match with the request. This value defaults to a "zero pubkey", which means `anyone` can be a match | +| sender\_pubkey | string | The public key of this node | +| uuid | string | The request uuid | +| match\_by | object | A standard [MatchBy](/atomicdex/api/common_structures/orders/#match-by) object, to filter to include only matches by pubkey or uuid. | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | +| base\_orderbook\_ticker | string | The ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | +| rel\_orderbook\_ticker | string | The ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/cancel_all_orders/index.mdx b/src/pages/atomicdex/api/legacy/cancel_all_orders/index.mdx index c9021590..f501bae5 100644 --- a/src/pages/atomicdex/api/legacy/cancel_all_orders/index.mdx +++ b/src/pages/atomicdex/api/legacy/cancel_all_orders/index.mdx @@ -9,22 +9,16 @@ The `cancel_all_orders` cancels the active orders created by the AtomicDEX API n ## Arguments -| Structure | Type | Description | -| ---------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------- | -| cancel\_by | object | orders matching this condition are cancelled | -| cancel\_by.type | string | `All` to cancel all orders; `Pair` to cancel all orders for specific coin pairs; `Coin` to cancel all orders for a specific coin | -| cancel\_by.data | object | additional data the cancel condition; present with `Pair` and `Coin` types | -| cancel\_by.data.base | string | base coin of the pair; `Pair` type only | -| cancel\_by.data.rel | string | rel coin of the pair; `Pair` type only | -| cancel\_by.data.ticker | string | order is cancelled if it uses `ticker` as base or rel; `Coin` type only | +| Structure | Type | Description | +| ---------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- | +| cancel\_by | object | A standard [CancelBy](/atomicdex/api/common_structures/orders/#cancel-by) object. Orders matching this filter are cancelled. | ## Response -| Structure | Type | Description | -| -------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------- | -| result | object | | -| result.cancelled | array of strings (uuids) | uuids of cancelled orders | -| result.currently\_matching | array of strings (uuids) | uuids of the orders being matched with other orders; these are not cancelled even if they fit cancel condition | +| Structure | Type | Description | +| ------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------- | +| cancelled | array of strings (uuids) | uuids of cancelled orders | +| currently\_matching | array of strings (uuids) | uuids of the orders being matched with other orders; these are not cancelled even if they fit cancel condition | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/order_status/index.mdx b/src/pages/atomicdex/api/legacy/order_status/index.mdx index a4f60915..cc1798a8 100644 --- a/src/pages/atomicdex/api/legacy/order_status/index.mdx +++ b/src/pages/atomicdex/api/legacy/order_status/index.mdx @@ -268,7 +268,7 @@ The `order_status` method returns the data of the order with the selected `uuid` | order.request.match\_by.type | string | `Orders` to select specific uuids; `Pubkeys` to select specific nodes; Defaults to `Any` | | order.request.conf\_settings | object | base/rel confirmation/notarisation settings | | order.matches | object | Details of matching Maker Order UUIDs | -| order.order\_type | object | `FillOrKill` or `GoodTillCancelled` | +| order.order\_type | object | A standard [OrderType](/atomicdex/api/common_structures/orders/#order-type) object. | | order.matches | list | UUIDS of matching orders | | order.base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | | order.rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | diff --git a/src/pages/atomicdex/api/legacy/sell/index.mdx b/src/pages/atomicdex/api/legacy/sell/index.mdx index c8dce201..496f8b91 100644 --- a/src/pages/atomicdex/api/legacy/sell/index.mdx +++ b/src/pages/atomicdex/api/legacy/sell/index.mdx @@ -14,49 +14,40 @@ The `sell` method issues a sell request and attempts to match an order from the ## Arguments -| Structure | Type | Description | -| ----------------- | ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| base | string | the name of the coin the user desires to sell | -| rel | string | the name of the coin the user desires to receive | -| price | numeric string or rational | the price in `rel` the user is willing to receive per one unit of the `base` coin | -| volume | numeric string or rational | the amount of coins the user is willing to sell of the `base` coin; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin: | -| min\_volume | numeric string or rational (optional) | the amount of `base` coin that will be used as `min_volume` of `GoodTillCancelled` order after conversion to maker; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin: | -| match\_by | object | the created order is matched using this condition; *important:* this condition is not applied after `GoodTillCancelled` order conversion to `maker` request | -| match\_by.type | string | `Any` to match with any other order; `Orders` to select specific uuids; `Pubkeys` to select specific nodes; Default is `Any` | -| match\_by.data | array of strings | uuids of orders to match for `Orders` type; pubkeys of nodes to match for `Pubkeys` type | -| order\_type | object | the type of the order | -| order\_type.type | string | there are two types from which to choose: `GoodTillCancelled` and `FillOrKill`. The `GoodTillCancelled` order is automatically converted to a `maker` order if the order is not matched in 30 seconds, and this `maker` order stays in the orderbook until explicitly cancelled. On the other hand, a `FillOrKill` order is cancelled if it is not matched within 30 seconds. The default type is `GoodTillCancelled` | -| base\_confs | number | number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set | -| base\_nota | bool | whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set | -| rel\_confs | number | number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set | -| rel\_nota | bool | whether dPoW notarization is required for rel coin atomic swap transaction; default to rel coin configuration if not set | -| save\_in\_history | boolean | Defaults to `true`. If set to `false` no order history will be saved (though order status will be temporarily stored while in progress). If `true`, each order's short record history is stored in a local SQLite database table, and when the order is cancelled or fully matched, it's history will be saved as a json file | +| Structure | Type | Description | +| ----------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| base | string | the name of the coin the user desires to sell | +| rel | string | the name of the coin the user desires to receive | +| price | varies | The price in `rel` the user is willing to pay per one unit of the `base` coin. Can be a numeric string, expressed using standard [RationalValue](/atomicdex/api/common_structures/#rational-value) or [FractionalValue](/atomicdex/api/common_structures/#fractional-value) objects. | +| volume | varies | The amount of coins the user is willing to receive of the `base` coin; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin: . . Can be a numeric string, expressed using standard [RationalValue](/atomicdex/api/common_structures/#rational-value) or [FractionalValue](/atomicdex/api/common_structures/#fractional-value) objects. | +| min\_volume | varies (optional) | The amount of `base` coin that will be used as `min_volume` of `GoodTillCancelled` order after conversion to maker; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin: . . Can be a numeric string, expressed using standard [RationalValue](/atomicdex/api/common_structures/#rational-value) or [FractionalValue](/atomicdex/api/common_structures/#fractional-value) objects. | +| match\_by | object | Optional. A standard [MatchBy](/atomicdex/api/common_structures/orders/#match-by) object, to filter to include only matches by pubkey or uuid. *Important:* This condition is not applied after a `GoodTillCancelled` order is converted to a `maker` request. | +| order\_type | object | Optional. A standard [OrderType](/atomicdex/api/common_structures/orders/#order-type) object. | +| base\_confs | number | number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set | +| base\_nota | bool | whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set | +| rel\_confs | number | number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set | +| rel\_nota | bool | whether dPoW notarization is required for rel coin atomic swap transaction; default to rel coin configuration if not set | +| save\_in\_history | boolean | Defaults to `true`. If set to `false` no order history will be saved (though order status will be temporarily stored while in progress). If `true`, each order's short record history is stored in a local SQLite database table, and when the order is cancelled or fully matched, it's history will be saved as a json file | ## Response -| Structure | Type | Description | -| --------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| result | object | the resulting order object | -| result.action | string | the action of the request (`Sell`) | -| result.base | string | the base currency of the request | -| result.base\_amount | string | the resulting amount of base currency that is sold if the order matches (in decimal representation) | -| result.base\_amount\_rat | rational | the resulting amount of base currency that is sold if the order matches (in rational representation) | -| result.rel | string | the rel currency of the request | -| result.rel\_amount | string | the minimum amount of `rel` coin that must be received in order to sell the `base_amount` of `base` (according to `price`, in decimal representation) | -| result.rel\_amount\_rat | rational | the minimum amount of `rel` coin that must be received in order to sell the `base_amount` of `base` (according to `price`, in rational representation) | -| result.method | string | this field is used for internal P2P interactions; the value is always equal to "request | -| result.dest\_pub\_key | string | reserved for future use. The `dest_pub_key` allows the user to choose the P2P node that is eligible to match with the request. This value defaults to "zero pubkey", meaning that `anyone` can match | -| result.sender\_pubkey | string | the public key of our node | -| result.uuid | string | the request uuid | -| result.match\_by | object | the created order is matched using this condition | -| result.match\_by.type | string | `Any` to match with any other order; `Orders` to select specific uuids; `Pubkeys` to select specific nodes; Default is `Any` | -| result.match\_by.data | array of strings | uuids of orders to match for `Orders` type; pubkeys of nodes to match for `Pubkeys` type | -| result.conf\_settings.base\_confs | number | number of required blockchain confirmations for base coin atomic swap transaction | -| result.conf\_settings.base\_nota | bool | whether dPoW notarization is required for base coin atomic swap transaction | -| result.conf\_settings.rel\_confs | number | number of required blockchain confirmations for rel coin atomic swap transaction | -| result.conf\_settings.rel\_nota | bool | whether dPoW notarization is required for rel coin atomic swap transaction | -| result.base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | -| result.rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | +| Structure | Type | Description | +| ----------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| action | string | the action of the request (`Sell`) | +| base | string | the base currency of the request | +| base\_amount | numeric string | the resulting amount of base currency that is sold if the order matches, represented as a decimal value. | +| base\_amount\_rat | rational | the resulting amount of base currency that is sold if the order matches, represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| rel | string | the rel currency of the request | +| rel\_amount | string | the minimum amount of `rel` coin that must be received in order to sell the `base_amount` of `base` (according to `price`, in decimal representation) | +| rel\_amount\_rat | rational | the minimum amount of `rel` coin that must be received in order to sell the `base_amount` of `base` (according to `price`, represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object). | +| method | string | this field is used for internal P2P interactions; the value is always equal to "request | +| dest\_pub\_key | string | reserved for future use. The `dest_pub_key` allows the user to choose the P2P node that is eligible to match with the request. This value defaults to "zero pubkey", meaning that `anyone` can match | +| sender\_pubkey | string | the public key of our node | +| uuid | string | the request uuid | +| match\_by | object | A standard [MatchBy](/atomicdex/api/common_structures/orders/#match-by) object, to filter to include only matches by pubkey or uuid. *Important:* This condition is not applied after a `GoodTillCancelled` order is converted to a `maker` request. | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | +| base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | +| rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/setprice/index.mdx b/src/pages/atomicdex/api/legacy/setprice/index.mdx index 2d6f1eac..11a404fd 100644 --- a/src/pages/atomicdex/api/legacy/setprice/index.mdx +++ b/src/pages/atomicdex/api/legacy/setprice/index.mdx @@ -32,28 +32,25 @@ The `setprice` order is always considered a `sell`, for internal implementation #### Response -| Structure | Type | Description | -| --------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -| result | object | the resulting order object | -| result.base | string | the base coin of the order | -| result.rel | string | the rel coin of the order | -| result.price | string (numeric) | the expected amount of `rel` coin to be received per 1 unit of `base` coin; decimal representation | -| result.price\_rat | rational | the expected amount of `rel` coin to be received per 1 unit of `base` coin; rational representation | -| result.max\_base\_vol | string (numeric) | the maximum volume of base coin available to trade; decimal representation | -| result.max\_base\_vol\_rat | rational | the maximum volume of base coin available to trade; rational representation | -| result.min\_base\_vol | string (numeric) | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; decimal representation | -| result.min\_base\_vol\_rat | rational | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; rational representation | -| result.created\_at | number | unix timestamp in milliseconds, indicating the order creation time | -| result.updated\_at | number | unix timestamp in milliseconds, indicating the order update time | -| result.matches | object | contains the map of ongoing matches with other orders, empty as the order was recently created | -| result.started\_swaps | array of strings | uuids of swaps that were initiated by the order | -| result.uuid | string | uuid of the created order | -| result.conf\_settings.base\_confs | number | number of required blockchain confirmations for base coin atomic swap transaction | -| result.conf\_settings.base\_nota | bool | whether dPoW notarization is required for base coin atomic swap transaction | -| result.conf\_settings.rel\_confs | number | number of required blockchain confirmations for rel coin atomic swap transaction | -| result.conf\_settings.rel\_nota | bool | whether dPoW notarization is required for rel coin atomic swap transaction | -| result.base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | -| result.rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | +| Structure | Type | Description | +| ------------------------------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | object | the resulting order object | +| result.base | string | the base coin of the order | +| result.rel | string | the rel coin of the order | +| result.price | string (numeric) | the expected amount of `rel` coin to be received per 1 unit of `base` coin; decimal representation | +| result.price\_rat | rational | the expected amount of `rel` coin to be received per 1 unit of `base` coin; rational representation | +| result.max\_base\_vol | string (numeric) | the maximum volume of base coin available to trade; decimal representation | +| result.max\_base\_vol\_rat | rational | the maximum volume of base coin available to trade; rational representation | +| result.min\_base\_vol | string (numeric) | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; decimal representation | +| result.min\_base\_vol\_rat | rational | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; rational representation | +| result.created\_at | number | unix timestamp in milliseconds, indicating the order creation time | +| result.updated\_at | number | unix timestamp in milliseconds, indicating the order update time | +| result.matches | object | contains the map of ongoing matches with other orders, empty as the order was recently created | +| result.started\_swaps | array of strings | uuids of swaps that were initiated by the order | +| result.uuid | string | uuid of the created order | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | +| result.base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | +| result.rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/update_maker_order/index.mdx b/src/pages/atomicdex/api/legacy/update_maker_order/index.mdx index a6db6b98..6298e7a1 100644 --- a/src/pages/atomicdex/api/legacy/update_maker_order/index.mdx +++ b/src/pages/atomicdex/api/legacy/update_maker_order/index.mdx @@ -28,26 +28,23 @@ The `update_maker_order` method updates an active order on the orderbook created ## Response -| Structure | Type | Description | -| --------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------- | -| result | object | the resulting order object | -| result.base | string | the base coin of the order | -| result.rel | string | the rel coin of the order | -| result.price | string (numeric) | the expected amount of `rel` coin to be received per 1 unit of `base` coin; decimal representation | -| result.price\_rat | rational | the expected amount of `rel` coin to be received per 1 unit of `base` coin; rational representation | -| result.max\_base\_vol | string (numeric) | the maximum volume of base coin available to trade; decimal representation | -| result.max\_base\_vol\_rat | rational | the maximum volume of base coin available to trade; rational representation | -| result.min\_base\_vol | string (numeric) | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; decimal representation | -| result.min\_base\_vol\_rat | rational | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; rational representation | -| result.created\_at | number | unix timestamp in milliseconds, indicating the order creation time | -| result.updated\_at | number | unix timestamp in milliseconds, indicating the order update time | -| result.matches | object | contains the map of ongoing matches with other orders, empty as the order was recently created | -| result.started\_swaps | array of strings | uuids of swaps that were initiated by the order | -| result.uuid | string | uuid of the updated order | -| result.conf\_settings.base\_confs | number | number of required blockchain confirmations for base coin atomic swap transaction | -| result.conf\_settings.base\_nota | bool | whether dPoW notarization is required for base coin atomic swap transaction | -| result.conf\_settings.rel\_confs | number | number of required blockchain confirmations for rel coin atomic swap transaction | -| result.conf\_settings.rel\_nota | bool | whether dPoW notarization is required for rel coin atomic swap transaction | +| Structure | Type | Description | +| -------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------- | +| result | object | the resulting order object | +| result.base | string | the base coin of the order | +| result.rel | string | the rel coin of the order | +| result.price | string (numeric) | the expected amount of `rel` coin to be received per 1 unit of `base` coin; decimal representation | +| result.price\_rat | rational | the expected amount of `rel` coin to be received per 1 unit of `base` coin; rational representation | +| result.max\_base\_vol | string (numeric) | the maximum volume of base coin available to trade; decimal representation | +| result.max\_base\_vol\_rat | rational | the maximum volume of base coin available to trade; rational representation | +| result.min\_base\_vol | string (numeric) | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; decimal representation | +| result.min\_base\_vol\_rat | rational | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; rational representation | +| result.created\_at | number | unix timestamp in milliseconds, indicating the order creation time | +| result.updated\_at | number | unix timestamp in milliseconds, indicating the order update time | +| result.matches | object | contains the map of ongoing matches with other orders, empty as the order was recently created | +| result.started\_swaps | array of strings | uuids of swaps that were initiated by the order | +| result.uuid | string | uuid of the updated order | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | #### 📌 Examples diff --git a/src/pages/atomicdex/api/v20-dev/lightning/index.mdx b/src/pages/atomicdex/api/v20-dev/lightning/index.mdx index 8a76bcbf..d34f2ac5 100644 --- a/src/pages/atomicdex/api/v20-dev/lightning/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/lightning/index.mdx @@ -70,11 +70,11 @@ Follow the flowchart below to visualize the process: Some configurations are set per coin, and some are set per channel. The - [counterparty\_channel\_config\_limits](/atomicdex/api/v20/#counterparty-channel-config) + [counterparty\_channel\_config\_limits](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) param must be set in the `coins` configuration file, and aplies to all channels opened by counterparty nodes. The - [our\_channels\_config](/atomicdex/api/v20/#lightning-channel-config) and - [channel\_options](/atomicdex/api/v20/#lightning-channel-options) parameters + [our\_channels\_config](/atomicdex/api/common_structures/lightning/#lightning-channel-config) and + [channel\_options](/atomicdex/api/common_structures/lightning/#lightning-channel-options) parameters are set per channel. These can be defined in the `coins` configuration file to act as the default for all opened channels, and optionally overwritten or updated using the @@ -101,7 +101,7 @@ Follow the flowchart below to visualize the process: For GUIs and wallet apps, it is recommended to set `accept_forwards_to_priv_channels` to `false`. This prevents users from taking on HTLC-forwarding risk when a node is expected to not be reliably online. - [our\_channels\_config::announced\_channel](/atomicdex/api/v20/#lightning-channel-options) + [our\_channels\_config::announced\_channel](/atomicdex/api/common_structures/lightning/#lightning-channel-options) should also be set to `false` for GUIs and wallet apps. diff --git a/utils/_fileData.json b/utils/_fileData.json index e301aed9..1c681d55 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -176,8 +176,12 @@ } }, "/antara/api/heir": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -186,10 +190,6 @@ "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" @@ -197,7 +197,7 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/antara/api": { @@ -264,11 +264,11 @@ } }, "/antara/api/payments": { - "dateModified": "2023-10-04T04:57:56.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", @@ -278,10 +278,6 @@ "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" }, - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" @@ -289,7 +285,7 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/antara/api/pegs": { @@ -610,8 +606,12 @@ } }, "/antara/tutorials/advanced-series-4": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -620,10 +620,6 @@ "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" @@ -631,7 +627,7 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/antara/tutorials/advanced-series-5": { @@ -685,8 +681,12 @@ } }, "/antara/tutorials/beginner-series-part-0": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -695,10 +695,6 @@ "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" @@ -706,12 +702,16 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/antara/tutorials/beginner-series-part-1": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -720,10 +720,6 @@ "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" @@ -731,7 +727,7 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/antara/tutorials/beginner-series-part-2": { @@ -785,8 +781,12 @@ } }, "/antara/tutorials/beginner-series-part-4": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -795,10 +795,6 @@ "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" @@ -806,7 +802,7 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/antara/tutorials/dilithium-module-tutorial": { @@ -1082,7 +1078,7 @@ } }, "/atomicdex/api/common_structures": { - "dateModified": "2023-10-04T08:31:28.000Z", + "dateModified": "2023-10-04T12:56:06.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1120,6 +1116,19 @@ "email": "smk762@iinet.net.au" } }, + "/atomicdex/api/common_structures/orders": { + "dateModified": "2023-10-04T12:56:06.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, "/atomicdex/api/common_structures/swaps": { "dateModified": "2023-10-04T08:31:28.000Z", "contributors": [ @@ -1159,7 +1168,7 @@ } }, "/atomicdex/api/legacy/active_swaps": { - "dateModified": "2023-10-04T08:31:28.000Z", + "dateModified": "2023-10-04T12:56:06.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1184,8 +1193,12 @@ } }, "/atomicdex/api/legacy/all_swaps_uuids_by_filter": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T12:56:06.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1197,15 +1210,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/ban_pubkey": { @@ -1259,8 +1268,12 @@ } }, "/atomicdex/api/legacy/best_orders": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T12:56:06.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1272,15 +1285,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/buy": { @@ -3319,7 +3328,7 @@ } }, "/atomicdex/api/v20-dev/lightning": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T09:07:04.000Z", "contributors": [ { "name": "\"gcharang\"", @@ -3432,8 +3441,12 @@ } }, "/atomicdex/api/v20-dev/task_enable_qtum": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -3445,12 +3458,16 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/api/v20-dev/task_enable_utxo": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -3462,7 +3479,7 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/api/v20-dev/task_enable_z_coin": { @@ -3479,8 +3496,12 @@ } }, "/atomicdex/api/v20-dev/task_init_trezor": { - "dateModified": "2023-10-04T04:56:29.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -3492,7 +3513,7 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/api/v20-dev/task_withdraw": { @@ -3547,15 +3568,15 @@ } }, "/atomicdex/mobile/add-and-activate-coins-on-atomicdex-mobile": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { "name": "\"gaeacodes\"", @@ -3564,19 +3585,19 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/mobile/delete-seed-from-atomicdex-mobile": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { "name": "\"gaeacodes\"", @@ -3585,19 +3606,19 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/mobile": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { "name": "\"gaeacodes\"", @@ -3606,19 +3627,19 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/mobile/perform-cross-chain-atomic-swaps-using-atomicdex-mobile": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { "name": "\"gaeacodes\"", @@ -3631,19 +3652,19 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/mobile/recover-seed-on-atomicdex-mobile": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { "name": "\"gaeacodes\"", @@ -3652,19 +3673,19 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/mobile/restore-wallet-using-atomicdex-mobile": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { "name": "\"gaeacodes\"", @@ -3673,19 +3694,19 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/mobile/view-ongoing-orders-and-swap-history-on-atomicdex-mobile": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { "name": "\"gaeacodes\"", @@ -3694,19 +3715,19 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/mobile/view-your-receiving-address-to-send-funds-for-trading": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { "name": "\"gaeacodes\"", @@ -3715,19 +3736,19 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/mobile/withdraw-or-send-funds-using-atomicdex-mobile": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { "name": "\"gaeacodes\"", @@ -3736,7 +3757,7 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/setup/configure-mm2-json": { @@ -3765,8 +3786,12 @@ } }, "/atomicdex/setup": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -3774,15 +3799,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" } ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/tutorials/additional-information-about-atomicdex": { @@ -3807,8 +3828,12 @@ } }, "/atomicdex/tutorials/atomicdex-metrics": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -3817,10 +3842,6 @@ "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" @@ -3828,7 +3849,7 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/tutorials/atomicdex-walkthrough": { @@ -3941,11 +3962,11 @@ } }, "/atomicdex/tutorials/listing-a-coin-on-atomicdex": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", @@ -3954,15 +3975,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" } ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/atomicdex/tutorials/query-the-mm2-database": { @@ -4727,15 +4744,15 @@ } }, "/smart-chains/api/disclosure": { - "dateModified": "2023-10-04T04:57:56.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" }, { "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "email": "21151592+gcharang@users.noreply.github.com" }, { "name": "\"gaeacodes\"", @@ -4744,7 +4761,7 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/smart-chains/api/generate": { @@ -5326,8 +5343,12 @@ } }, "/start-here/about-komodo-platform": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -5335,15 +5356,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" } ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/start-here/about-komodo-platform/orientation": { @@ -5372,8 +5389,12 @@ } }, "/start-here/about-komodo-platform/product-introductions": { - "dateModified": "2023-10-04T04:39:48.000Z", + "dateModified": "2023-10-04T06:26:45.000Z", "contributors": [ + { + "name": "\"gcharang\"", + "email": "gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -5382,10 +5403,6 @@ "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, - { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" - }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" @@ -5393,7 +5410,7 @@ ], "lastContributor": { "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "email": "gcharang@users.noreply.github.com" } }, "/start-here/about-komodo-platform/simple-installations": { From fa51e183b22c4a7a4f0b1c923aeaf327ce6fe9de Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:00:34 +0530 Subject: [PATCH 06/27] update submodule update steps --- .github/workflows/get_data_lint_files_deploy.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/get_data_lint_files_deploy.yml b/.github/workflows/get_data_lint_files_deploy.yml index 6a2bcbbc..a45f4867 100644 --- a/.github/workflows/get_data_lint_files_deploy.yml +++ b/.github/workflows/get_data_lint_files_deploy.yml @@ -133,16 +133,18 @@ jobs: - name: Get updated content (without diff) if: needs.update_lint_get_data.outputs.NO_DIFF == 'true' run: | - cd utils - ./update_mdx_branch.sh ${{ needs.update_lint_get_data.outputs.BRANCH }} + cd komodo-docs-mdx + git fetch origin + git checkout ${{ needs.update_lint_get_data.outputs.BRANCH }} cd .. ./update-content.sh - name: Get updated content (with diff) if: needs.update_lint_get_data.outputs.NO_DIFF == 'false' run: | - cd utils - ./update_mdx_branch.sh ${{ needs.update_lint_get_data.outputs.LINT_BRANCH }} + cd komodo-docs-mdx + git fetch origin + git checkout ${{ needs.update_lint_get_data.outputs.LINT_BRANCH }} cd .. ./update-content.sh From 9d65c84b4f914a485259114ac2d21468f13a7422 Mon Sep 17 00:00:00 2001 From: smk762 Date: Wed, 4 Oct 2023 23:33:39 +0800 Subject: [PATCH 07/27] Apply common structure links for more legacy methods --- filepathSlugs.json | 4 +- .../atomicdex/api/common_structures/index.mdx | 24 +++++ .../api/legacy/convertaddress/index.mdx | 18 ++-- .../api/legacy/disable_coin/index.mdx | 14 +-- .../api/legacy/get_trade_fee/index.mdx | 13 ++- src/pages/atomicdex/api/legacy/help/index.mdx | 6 +- .../api/legacy/import_swaps/index.mdx | 6 +- .../api/legacy/kmd_rewards_info/index.mdx | 26 ++--- .../api/legacy/max_taker_vol/index.mdx | 6 +- utils/_fileData.json | 102 +++++++++--------- 10 files changed, 121 insertions(+), 98 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index 20cb9b89..3f4f7bb0 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -1581,6 +1581,8 @@ ], "src/pages/atomicdex/api/common_structures/index.mdx": [ "komodo-de-fi-sdk-common-structures", + "address-format", + "example", "address-infos", "example-with-balances", "example-without-balances", @@ -1589,7 +1591,7 @@ "fee-info", "fractional-value", "pagination", - "example", + "example-2", "rational-value" ], "src/pages/atomicdex/api/common_structures/lightning/index.mdx": [ diff --git a/src/pages/atomicdex/api/common_structures/index.mdx b/src/pages/atomicdex/api/common_structures/index.mdx index 13ac3685..8af6bd15 100644 --- a/src/pages/atomicdex/api/common_structures/index.mdx +++ b/src/pages/atomicdex/api/common_structures/index.mdx @@ -12,6 +12,30 @@ The objects are in the request or response of multiple Komodo DeFi SDK methods h Structures which are used in more than one section are listed below: +## AddressFormat + +| Structure | Type | Description | +| --------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| format | string (enum) | address format to which the input address should be converted. Possible values: `mixedcase` for ETH/ERC20 coins; `cashaddress` or `standard` for UTXO coins; `contract` or `wallet` for QTUM/QRC20 | +| network | string (enum) | Optional, only used for UTXO coins. Network prefix for `cashaddress` format. Possible values: `bitcoincash` for BCH mainnet; `bchtest` for BCH testnet; `bchreg` for BCH regtest | + + + #### Example + + ```json + { + "format": "mixedcase" + } + ``` + + ```json + { + "format": "cashaddress", + "network": "bitcoincash" + } + ``` + + ### AddressInfos The `addressInfos` object includes the following items for a given address: diff --git a/src/pages/atomicdex/api/legacy/convertaddress/index.mdx b/src/pages/atomicdex/api/legacy/convertaddress/index.mdx index 1e68c23a..d4b15e3b 100644 --- a/src/pages/atomicdex/api/legacy/convertaddress/index.mdx +++ b/src/pages/atomicdex/api/legacy/convertaddress/index.mdx @@ -13,19 +13,17 @@ Or this can be used to convert an ETH address from single to mixed case checksum ## Arguments -| Structure | Type | Description | -| --------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | the name of the coin address context | -| from | string | input address | -| to\_address\_format | object | address format to which the input address should be converted | -| to\_address\_format.format | string (enum) | address format to which the input address should be converted, possible values: `mixedcase` for ETH/ERC20 coins; `cashaddress` or `standard` for UTXO coins | -| to\_address\_format.network | string (enum) | network prefix for `cashaddress` format. Possible values: `bitcoincash` for BCH mainnet; `bchtest` for BCH testnet; `bchreg` for BCH regtest | +| Structure | Type | Description | +| ------------------- | ------ | ------------------------------------------------------------- | +| coin | string | the name of the coin address context | +| from | string | input address | +| to\_address\_format | object | address format to which the input address should be converted | ## Response -| Structure | Type | Description | -| -------------- | ------ | -------------------------------- | -| result.address | string | the result of address conversion | +| Structure | Type | Description | +| --------- | ------ | -------------------------------- | +| address | string | the result of address conversion | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/disable_coin/index.mdx b/src/pages/atomicdex/api/legacy/disable_coin/index.mdx index 35f2f853..342e4c5d 100644 --- a/src/pages/atomicdex/api/legacy/disable_coin/index.mdx +++ b/src/pages/atomicdex/api/legacy/disable_coin/index.mdx @@ -19,13 +19,13 @@ The `disable_coin` method deactivates the previously enabled coin, and also canc #### Response -| Structure | Type | Description | -| ------------------------ | ---------------- | -------------------------------------------------------------------------------- | -| result.coin | string | the ticker of deactivated coin | -| result.cancelled\_orders | array of strings | uuids of cancelled orders | -| swaps | array of strings | uuids of active swaps that use the selected coin; present only in error cases | -| orders.matching | array of strings | uuids of matching orders that use the selected coin; present only in error cases | -| orders.cancelled | array of strings | uuids of orders that were successfully cancelled despite the error | +| Structure | Type | Description | +| ----------------- | ---------------- | -------------------------------------------------------------------------------- | +| coin | string | the ticker of deactivated coin | +| cancelled\_orders | array of strings | uuids of cancelled orders | +| swaps | array of strings | uuids of active swaps that use the selected coin; present only in error cases | +| orders.matching | array of strings | uuids of matching orders that use the selected coin; present only in error cases | +| orders.cancelled | array of strings | uuids of orders that were successfully cancelled despite the error | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/get_trade_fee/index.mdx b/src/pages/atomicdex/api/legacy/get_trade_fee/index.mdx index ada63342..85b11283 100644 --- a/src/pages/atomicdex/api/legacy/get_trade_fee/index.mdx +++ b/src/pages/atomicdex/api/legacy/get_trade_fee/index.mdx @@ -31,13 +31,12 @@ This amount should be multiplied by 2 and deducted from the volume on `buy/sell` #### Response -| Structure | Type | Description | -| ----------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -| result | object | an object containing the relevant information | -| result.coin | string | the fee is paid from the user's balance of this coin. This coin name may differ from the requested coin. For example, ERC20 fees are paid by ETH (gas) | -| result.amount | string (numeric) | the approximate fee amount to be paid per swap transaction in decimal representation | -| result.amount\_rat | rational | the approximate fee amount to be paid per swap transaction in rational representation | -| result.amount\_fraction | fraction | the approximate fee amount to be paid per swap transaction in fraction representation | +| Structure | Type | Description | +| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| coin | string | the fee is paid from the user's balance of this coin. This coin name may differ from the requested coin. For example, ERC20 fees are paid by ETH (gas) | +| amount | string (numeric) | the approximate fee amount to be paid per swap transaction in decimal representation | +| amount\_rat | rational | the approximate fee amount to be paid per swap transaction, represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object | +| amount\_fraction | fraction | the approximate fee amount to be paid per swap transaction, represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/help/index.mdx b/src/pages/atomicdex/api/legacy/help/index.mdx index e6f98f3c..8623f148 100644 --- a/src/pages/atomicdex/api/legacy/help/index.mdx +++ b/src/pages/atomicdex/api/legacy/help/index.mdx @@ -15,6 +15,6 @@ The `help` method returns the full API documentation in the terminal. #### Response -| Structure | Type | Description | -| ----------------------------------- | ---- | ----------- | -| (returns the full docs in terminal) | | | +| Structure | Type | Description | +| --------------------------------------- | ---- | ----------- | +| (returns the documentation in terminal) | | | diff --git a/src/pages/atomicdex/api/legacy/import_swaps/index.mdx b/src/pages/atomicdex/api/legacy/import_swaps/index.mdx index 39344972..fccd921d 100644 --- a/src/pages/atomicdex/api/legacy/import_swaps/index.mdx +++ b/src/pages/atomicdex/api/legacy/import_swaps/index.mdx @@ -11,9 +11,9 @@ Use this method in combination with `my_swap_status` or `my_recent_swaps` to cop ## Arguments -| Structure | Type | Description | -| --------- | ---------------- | ----------------------------------------------------------------------- | -| swaps | array of objects | swaps data; each record has the format of the `my_swap_status` response | +| Structure | Type | Description | +| --------- | ---------------- | -------------------------------------------------------------------------------------------- | +| swaps | array of objects | A map of standard [SwapStatus](/atomicdex/api/common_structures/swaps/#swap-status) objects. | #### Response diff --git a/src/pages/atomicdex/api/legacy/kmd_rewards_info/index.mdx b/src/pages/atomicdex/api/legacy/kmd_rewards_info/index.mdx index 29ec8b1b..bb4c1fce 100644 --- a/src/pages/atomicdex/api/legacy/kmd_rewards_info/index.mdx +++ b/src/pages/atomicdex/api/legacy/kmd_rewards_info/index.mdx @@ -19,19 +19,19 @@ The `kmd_rewards_info` method returns information about the active user rewards #### Response -| Structure | Type | Description | -| ------------------------ | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | -| result | array of objects | the rewards info; each element corresponds to an unspent output and contains detailed information about the active user rewards corresponding to it | -| result.tx\_hash | string | the hash of the transaction | -| result.height | number (integer, optional) | the height of the block in which the transaction was included (empty if the tx is not mined yet) | -| result.output\_index | number (integer) | the zero-based index of the output in the transaction’s list of outputs | -| result.amount | string (numeric) | the transaction output’s value | -| result.locktime | number (integer) | the transaction output's locktime | -| result.accrued\_rewards | object | the amount of accrued rewards if they exist or the reason for their non existence | -| result.accrue\_start\_at | number (integer, optional) | the rewards start to accrue at this time for the given transaction (empty if the rewards will never accrue to it) | -| result.accrue\_stop\_at | number (integer, optional) | the rewards stop to accrue at this time for the given transaction (empty if the tx is not mined yet or if rewards will never accrue to it) | - -Where the `result.accrued_rewards` has either +| Structure | Type | Description | +| ----------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | array of objects | the rewards info; each element corresponds to an unspent output and contains detailed information about the active user rewards corresponding to it | +| tx\_hash | string | the hash of the transaction | +| height | number (integer, optional) | the height of the block in which the transaction was included (empty if the tx is not mined yet) | +| output\_index | number (integer) | the zero-based index of the output in the transaction’s list of outputs | +| amount | string (numeric) | the transaction output’s value | +| locktime | number (integer) | the transaction output's locktime | +| accrued\_rewards | object | the amount of accrued rewards if they exist or the reason for their non existence | +| accrue\_start\_at | number (integer, optional) | the rewards start to accrue at this time for the given transaction (empty if the rewards will never accrue to it) | +| accrue\_stop\_at | number (integer, optional) | the rewards stop to accrue at this time for the given transaction (empty if the tx is not mined yet or if rewards will never accrue to it) | + +Where the `accrued_rewards` has either | Structure | Type | Description | | --------- | ---------------- | ----------------------------- | diff --git a/src/pages/atomicdex/api/legacy/max_taker_vol/index.mdx b/src/pages/atomicdex/api/legacy/max_taker_vol/index.mdx index a96f1331..27f1fba5 100644 --- a/src/pages/atomicdex/api/legacy/max_taker_vol/index.mdx +++ b/src/pages/atomicdex/api/legacy/max_taker_vol/index.mdx @@ -16,9 +16,9 @@ This takes the dex fee and blockchain miner fees into account. The result should #### Response -| Structure | Type | Description | -| --------- | -------- | --------------------------------------------------------- | -| result | fraction | the max available taker volume in fraction representation | +| Structure | Type | Description | +| --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| result | fraction | the max available taker volume, represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | #### 📌 Examples diff --git a/utils/_fileData.json b/utils/_fileData.json index 1c681d55..343bd42f 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -1078,7 +1078,7 @@ } }, "/atomicdex/api/common_structures": { - "dateModified": "2023-10-04T12:56:06.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1117,7 +1117,7 @@ } }, "/atomicdex/api/common_structures/orders": { - "dateModified": "2023-10-04T12:56:06.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1293,8 +1293,12 @@ } }, "/atomicdex/api/legacy/buy": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1306,20 +1310,20 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/cancel_all_orders": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1331,15 +1335,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/cancel_order": { @@ -2002,8 +2002,12 @@ } }, "/atomicdex/api/legacy/order_status": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2015,15 +2019,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/orderbook": { @@ -2148,8 +2148,12 @@ } }, "/atomicdex/api/legacy/sell": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2161,15 +2165,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/send_raw_transaction": { @@ -2248,8 +2248,12 @@ } }, "/atomicdex/api/legacy/setprice": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2261,15 +2265,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/show_priv_key": { @@ -2365,8 +2365,12 @@ } }, "/atomicdex/api/legacy/update_maker_order": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2378,15 +2382,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/validateaddress": { @@ -3328,16 +3328,16 @@ } }, "/atomicdex/api/v20-dev/lightning": { - "dateModified": "2023-10-04T09:07:04.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -3348,8 +3348,8 @@ } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20-dev/lightning/nodes": { From 7cebfe7301a714d5e468241e40f64ee412ee752c Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:36:18 +0530 Subject: [PATCH 08/27] update submodule update steps in gh action --- .github/workflows/get_data_lint_files_deploy.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/get_data_lint_files_deploy.yml b/.github/workflows/get_data_lint_files_deploy.yml index a45f4867..8a6e89db 100644 --- a/.github/workflows/get_data_lint_files_deploy.yml +++ b/.github/workflows/get_data_lint_files_deploy.yml @@ -128,23 +128,22 @@ jobs: ssh-key: ${{ secrets.DOCS_UI_SSH_PRIVATE_KEY }} repository: KomodoPlatform/website-komodo-docs ref: main - submodules: true + submodules: recursive + fetch-depth: 0 - name: Get updated content (without diff) if: needs.update_lint_get_data.outputs.NO_DIFF == 'true' run: | - cd komodo-docs-mdx - git fetch origin - git checkout ${{ needs.update_lint_get_data.outputs.BRANCH }} + cd utils + ./update_mdx_branch.sh ${{ needs.update_lint_get_data.outputs.BRANCH }} cd .. ./update-content.sh - name: Get updated content (with diff) if: needs.update_lint_get_data.outputs.NO_DIFF == 'false' run: | - cd komodo-docs-mdx - git fetch origin - git checkout ${{ needs.update_lint_get_data.outputs.LINT_BRANCH }} + cd utils + ./update_mdx_branch.sh ${{ needs.update_lint_get_data.outputs.LINT_BRANCH }} cd .. ./update-content.sh From b6acaed1a8a0a57e1769ec27bd280a77541c4f62 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:41:40 +0530 Subject: [PATCH 09/27] update linter --- .../js/validate_update_internal_links_userpass.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/utils/js/validate_update_internal_links_userpass.js b/utils/js/validate_update_internal_links_userpass.js index 737ad64f..25e91a38 100644 --- a/utils/js/validate_update_internal_links_userpass.js +++ b/utils/js/validate_update_internal_links_userpass.js @@ -373,6 +373,10 @@ function checkUrlStatusCode(url) { } async function processExternalLink(link, currFilePath) { + let IgnoreURLs = [ + "https://moralis-proxy.komodo.earth", + "https://nft.antispam.dragonhound.info" + ] if ( link.startsWith("http://127.0.0.1") || link.startsWith("https://127.0.0.1") || @@ -408,9 +412,11 @@ async function processExternalLink(link, currFilePath) { `The link: ${link} has a ${statusCode} redirect to ${newLocation}` ); } else if (statusCode === 403 || statusCode === 405 || statusCode === 500) { - console.log( - `Check this link manually: ${link}.It responds with statuscode: ${statusCode} ` - ); + // console.log( + // `Check this link manually: [${link}] It responds with statuscode: ${statusCode} ` + // ); + fs.appendFileSync(manualLinkFile, link + "\n"); + } else if (IgnoreURLs.some(ignoreLink => link.includes(ignoreLink))) { fs.appendFileSync(manualLinkFile, link + "\n"); } else { throw new Error( @@ -418,8 +424,8 @@ async function processExternalLink(link, currFilePath) { ); } } catch (err) { - console.log(`Checking the URL ${link} in the file ${currFilePath}`); if (err.message.startsWith("Request timed out")) { + console.log(`Request timed out when checking the URL ${link} in the file ${currFilePath}`); return; } else { throw new Error(err); From a102585c5ded720459e627a40535732636eaa675 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:42:14 +0530 Subject: [PATCH 10/27] update workflow --- .../workflows/get_data_lint_files_deploy.yml | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/get_data_lint_files_deploy.yml b/.github/workflows/get_data_lint_files_deploy.yml index 8a6e89db..45aa967a 100644 --- a/.github/workflows/get_data_lint_files_deploy.yml +++ b/.github/workflows/get_data_lint_files_deploy.yml @@ -7,24 +7,24 @@ on: types: [opened, edited, synchronize, reopened, ready_for_review] jobs: - # pre_job: - # # continue-on-error: true # Uncomment once integration is finished - # runs-on: ubuntu-latest - # # Map a step output to a job output - # outputs: - # should_skip: ${{ steps.skip_check.outputs.should_skip }} - # steps: - # - id: skip_check - # uses: fkirc/skip-duplicate-actions@v5 - # with: - # # All of these options are optional, so you can remove them if you are happy with the defaults - # concurrent_skipping: "never" - # skip_after_successful_duplicate: "true" - # do_not_skip: '["pull_request"]' + pre_job: + # continue-on-error: true # Uncomment once integration is finished + runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + # All of these options are optional, so you can remove them if you are happy with the defaults + concurrent_skipping: "never" + skip_after_successful_duplicate: "true" + do_not_skip: '["pull_request"]' update_lint_get_data: - # needs: pre_job - # if: needs.pre_job.outputs.should_skip != 'true' && startsWith(github.head_ref, 'lint-fix-patches') == false && github.event.pull_request.head.repo.full_name == github.repository + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' && startsWith(github.head_ref, 'lint-fix-patches') == false && github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 0c7f89a8d266c3eed0f4130687f38c35580663c4 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Wed, 4 Oct 2023 22:03:39 +0530 Subject: [PATCH 11/27] update stylke guide --- STYLE_GUIDE.md | 34 ++++++++++-------- .../atomic-maniq.png | Bin .../code-group-sample.png | Bin .../collapsible-section-UI.png | Bin .../crude-tag-ui.png | Bin .../heading-tag-UI.png | Bin .../mm2MethodDecoratorUI.png | Bin style-guide-images/navbar-top-UI.png | Bin 0 -> 7357 bytes .../notes-error-UI.png | Bin .../notes-info-UI.png | Bin .../notes-warning-UI.png | Bin .../sidebar-left-UI.png | Bin .../sidebar-right-UI.png | Bin .../single-code-block.png | Bin .../tagged-section-UI.png | Bin 15 files changed, 20 insertions(+), 14 deletions(-) rename {src/images/style-guide-images => style-guide-images}/atomic-maniq.png (100%) rename {src/images/style-guide-images => style-guide-images}/code-group-sample.png (100%) rename {src/images/style-guide-images => style-guide-images}/collapsible-section-UI.png (100%) rename {src/images/style-guide-images => style-guide-images}/crude-tag-ui.png (100%) rename {src/images/style-guide-images => style-guide-images}/heading-tag-UI.png (100%) rename {src/images/style-guide-images => style-guide-images}/mm2MethodDecoratorUI.png (100%) create mode 100644 style-guide-images/navbar-top-UI.png rename {src/images/style-guide-images => style-guide-images}/notes-error-UI.png (100%) rename {src/images/style-guide-images => style-guide-images}/notes-info-UI.png (100%) rename {src/images/style-guide-images => style-guide-images}/notes-warning-UI.png (100%) rename {src/images/style-guide-images => style-guide-images}/sidebar-left-UI.png (100%) rename {src/images/style-guide-images => style-guide-images}/sidebar-right-UI.png (100%) rename {src/images/style-guide-images => style-guide-images}/single-code-block.png (100%) rename {src/images/style-guide-images => style-guide-images}/tagged-section-UI.png (100%) diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 90918d87..cd08f5bf 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -174,7 +174,7 @@ The `CodeGroup` acts as a wrapper around code blocks. It allows us to have tabbe And rendered as: -![Code group UI](src/images/style-guide-images/code-group-sample.png) +![Code group UI](style-guide-images/code-group-sample.png) +![Single code block UI](style-guide-images/single-code-block.png) --> It is important to **note that**, "**AtomicDEX methods**" should be wrapped with `CodeGroup` tags, using the **method name** as the **label value**, and the **tag value** set to **POST**, an additional **mm2MethodDecorate property** with the value **"true"**. This will generate code blocks for: @@ -223,7 +223,7 @@ A working code sample would look like this: Rendered as: -![mm2MethodDecoratorUI](src/images/style-guide-images/mm2MethodDecoratorUI.png) +![mm2MethodDecoratorUI](style-guide-images/mm2MethodDecoratorUI.png) ### Note @@ -259,11 +259,11 @@ Use `Note` tags to **highlight important information**. `Note`s can be one of th Rendered as: -![Note-info](src/images/style-guide-images/notes-info-UI.png) +![Note-info](style-guide-images/notes-info-UI.png) -![Note-warning](src/images/style-guide-images/notes-warning-UI.png) +![Note-warning](style-guide-images/notes-warning-UI.png) -![Note-error](src/images/style-guide-images/notes-error-UI.png) +![Note-error](style-guide-images/notes-error-UI.png) ### CollapsibleSection @@ -308,7 +308,7 @@ A working code would look like this: Rendered as: -![collapsible Section UI](src/images/style-guide-images/collapsible-section-UI.png) +![collapsible Section UI](style-guide-images/collapsible-section-UI.png) ### Images @@ -320,7 +320,7 @@ Now you can render the image using the `OptimizedImage` component, for example: `` -![Atomic Maniq](src/images/style-guide-images/atomic-maniq.png) +![Atomic Maniq](style-guide-images/atomic-maniq.png) @@ -348,7 +348,7 @@ Here's how: Rendered as: -![heading tag UI](src/images/style-guide-images/heading-tag-UI.png) +![heading tag UI](style-guide-images/heading-tag-UI.png) ### TaggedSection @@ -366,7 +366,7 @@ Here's how to use it: Rendered as: -![Tagged section](src/images/style-guide-images/tagged-section-UI.png) +![Tagged section](style-guide-images/tagged-section-UI.png) ### Tag @@ -389,17 +389,23 @@ A working code would look like this: Rendered as: -![Tag component](src/images/style-guide-images/crude-tag-ui.png) +![Tag component](style-guide-images/crude-tag-ui.png) + +## Navbar (Top) + +Top navbar's navigation data/dropdown list is manually populated. This file can be found at [src/data/navbar.json](src/data/navbar.json). If you're working on a very important new page, which links to a whole new category or an index, this is where to add them. + +![Navbar top](style-guide-images/navbar-top-UI.png) ## Sidebar (Left) -Sidebar navigation is manually populated. This file can be found at `src/data/sidebar.json`. If you're working on a new page, this is where to link them. +Left sidebar's navigation data is manually populated. This file can be found at [src/data/sidebar.json](src/data/sidebar.json). If you're working on a new page, this is where to link them. -![Sidebar left](src/images/style-guide-images/sidebar-left-UI.png) +![Sidebar left](style-guide-images/sidebar-left-UI.png) ## Sidebar (Right) -![Sidebar right](src/images/style-guide-images/sidebar-right-UI.png) +![Sidebar right](style-guide-images/sidebar-right-UI.png) The right sidebar is automatically populated based on the **Heading hierarchy** of the current page. diff --git a/src/images/style-guide-images/atomic-maniq.png b/style-guide-images/atomic-maniq.png similarity index 100% rename from src/images/style-guide-images/atomic-maniq.png rename to style-guide-images/atomic-maniq.png diff --git a/src/images/style-guide-images/code-group-sample.png b/style-guide-images/code-group-sample.png similarity index 100% rename from src/images/style-guide-images/code-group-sample.png rename to style-guide-images/code-group-sample.png diff --git a/src/images/style-guide-images/collapsible-section-UI.png b/style-guide-images/collapsible-section-UI.png similarity index 100% rename from src/images/style-guide-images/collapsible-section-UI.png rename to style-guide-images/collapsible-section-UI.png diff --git a/src/images/style-guide-images/crude-tag-ui.png b/style-guide-images/crude-tag-ui.png similarity index 100% rename from src/images/style-guide-images/crude-tag-ui.png rename to style-guide-images/crude-tag-ui.png diff --git a/src/images/style-guide-images/heading-tag-UI.png b/style-guide-images/heading-tag-UI.png similarity index 100% rename from src/images/style-guide-images/heading-tag-UI.png rename to style-guide-images/heading-tag-UI.png diff --git a/src/images/style-guide-images/mm2MethodDecoratorUI.png b/style-guide-images/mm2MethodDecoratorUI.png similarity index 100% rename from src/images/style-guide-images/mm2MethodDecoratorUI.png rename to style-guide-images/mm2MethodDecoratorUI.png diff --git a/style-guide-images/navbar-top-UI.png b/style-guide-images/navbar-top-UI.png new file mode 100644 index 0000000000000000000000000000000000000000..6682d18a025421575259aa417343210b22218bc1 GIT binary patch literal 7357 zcmdscXFOcdxAqZz?CdZD7A1pwHD;PpE^9Pl$8 zkw*-E-F26Hp@Rnwe?04G@Hg#yMT7U+E^ps^SwL+7TW1$1o2TwpP#YU(cRQE&d)Teg zppYO&NFHiq@&28QGmFkUCmTTD#@gA&-P*#3h3^@QhShr)OB*PQ0H1&$3qPMYAHO)i z7|ZKdj32m;0f2$zg~D?k@2s6!AA?sHOSt=Isl6>Wz2btA{9*ipo~+h=e_N8+{l-;( zQbJOjwY4m zxM|%Vb1*CXXLKb#p3t*0XJG|Lj-~G7y?g(4Sw@YGO^O*YmjCsTRg;kLKQkVF2nmVC z3sCF28QWKO|iyO~4 zZPcx*EBq*)F(QkCvuWluwf|aoYfRDj{ava*U%n6T=MJhRC9_gW^DgDMJsPIJ6qkR= zfY`?cBJEC;!8f_vzDlPr^C(X9z7b&Zt3mL(i5XTqhJf$-#Dr4p`arpIDdaM);~Y5E zhacVIMk|=F&LuFASCLC;xOeF3dZxFWr^4@$p;$lAS{5n(X~}9hKfOV&V{dMetCpC| zlGSbbm-F?dDv~UU`#kGV1_v;x_Q!{6<*iQ_hRt{{4Jxy6C_;`%f0(_!cdN*rs>@}v zV<@!n6Dqd2tH{E}Nky72&o}3<;KQpIV_0jCU)zj4*lu%bijM2v05p#GiXVumx%IRr zSU6Zk)cKJX=-2*P>hSQe+zp9HFq}C2p;a${L%fX(@cpBQObjAdE^&SQzF8`=AJf~P zmpzrYHx#$rl~J%a%xGWAv$Zxye8ql9hEG>06#k{+!5`Rh7<`K6Zd6t>z4PgH7j#KF zNdIkGnQ_!YH;%#5a&R_wRT2!AKsQ$05x8JHQ|Ci~I}`8!h4Px3Q%g_vZ?1!F7XGnP zkP};0qxXfGL3>$d?G@Jbcnf3A_GDPydH#AaJiZiBtXZ$c?l|?PM&uKP*rQsP37q`v zgoPa>1H-9kWXVJsT*{8+PJF$^ap$}9qk;+QH))+~L!?LZ59V41FIY#}xVS;5WG-y6 zm$EDH3PX}=5Q+!~pU#JfE(cbrr9WU3B)_SSllE=0l14}S?2`cHo*h(mCC2v~eJU6H zB=KrO-u~53So6h4W z%a-OIwW)JEqVhea*SZXju(oY&%f5+b-s3xOJ5%IE!_fJe>mN&Un6>i`hP? z*+F9iLoV$Ap?_||y|{&cm7^2tV@`@0HFJGE;H_`>vU^`7KQ_ zac|^H4QphPu%LEL7qfFl8LY1l3}5T%@wjEp%orOJ5cHg(g!H{H0G7$U$4m;Q@<(r9 z#U4A%l@t!&qO9}siQZX~QB6zS0SG;!AU8QK#!6;H9><#_L}Hv;>x3hB0G*;dLR(yk z&Yl^CqGQs~oA}?lxQ5SAbTJ7zeBkaDt(;jweZ{UCEv47UEWK1=!D#h;Fh_>)JHq*Z z`puE*NVquQJXN8cEAQiRP^yg1x*r@$8EeE_;ai);6TPzV`aJf;*%}+5A zt)G*8VPPYze*%#%IyX_i2bvAIq5+sw3>&T|+tUMnra4GNMaX^N*FYzU?VaX`6Z}Tk zmozQ|y%y0;zEm48G)O#dSd~7v5Th|`voU^#!Gca@O;;0kZV9OdPo-Wr-s_WNEHD@^ zSi9(NdNoScTDASuEi=_cG@@PIkLg&rU0~1whw&=>`+HN7w#3eC;6|CQyq;H^n!tlV zkm#r4{l$4})vK;9+uY#sQt}bC-I2D#`}0z%tnoUC1y&+skRv0*!UlQpqd0nkS?*$; z?iR+(MDX+{8%6j$|GCz0q}C)lPnUuW0!vX0p0?8a_JrL=SB zR>(hUy)`N%MA~TOcPdC?CkXx z`eHn7YMBx1QYzGBF?U;-aLa%BK6>)jAh$M+2Z~11JNtRbvL+46vnKsQ2FOI(pG3`S z*%C4f;>WxgB3<4IK~2|Qd*Lxb9y=&M;)aj%)xM1$LK+f>*W#w1~cerwxBy#TB$K^zAn!&qc|RXO?~mD9gR{v z><(~lb=7T|zR{B=GatT3y1cSt(O>(r=ikMp*B&l~{GBN8iBj_EHH=yNOlX`dtv% zL+zUz+Vfotuz~zB9&hv^`<>>Q1NSXvey4HjNr;=mq_U&y_>lA@?P z9$T3r4j-2FgHpwf-Il%{N^p7ob(|~V^mOtJ0Uflnn+_{CU(TocWyXf?G;a;@{p`vAjhzbM~6$F>T+#u&1&3O;+b<^WaV?|-l3tM>#lx^ z>A;oxJ)o<(L7g-=SwT_5lcp~_LHX{&Kb zBem>zVLV^O%_pez>o*2JOJa#Q&$ajBYbSk4W%pI%DPc*W*7tZK$x23*Htv1>P;Xt> z=b9$($9Ib#gL0BV2V_Pj`b(fy0IwaHgH%AL_|+}+XT5lYJlS^I{9_kk)iv60gfKJiLZ(w8B&A3Ryv%G&a4fG_A&&A16l zq+M$5)o_iiku#_vW0^fhSnpId?I9TNbA<&As1Y3qTu_cX%|L+H4wFFUM5#iU%O-&n zE@U7}9N%TGDI)$r#rmxc7NDi2rCI$lRcnG%=qaPe*1xnZ&j*tlyFt7t;B$rs1$qc{ z6cCp|s&^0ELz6%D%dZLWx!0Hl@R~kiTfSBV)!Xq}gPubjmPC)3U(~M85jgh1kuNqw zB_P`QEHYAEe@d=+QQXYwqPRrgba!$1Yo+oi5^bZX$BK2yYhu$;ZlV&C_+y`(XPP2F z1J*IY@(%ZUDHHH006fTaTVDn`=LfdV1zq0`_{(BMy)a$ui`>OHSi^3^ZxAWMg6F=&5PsVg-xo1fXhHxaW)vA1 z!MG<7RzKpNq(sd|D|D`q9Iubl@)I+0RVB#iXo+3IyUyz98L`0)EU&GxJ-L1aJ%Xwl zx0EeNDBMaB5*|Xh4*bBwUJkWqaW=(HW@5p+(alTTM1E1EpZrCS@FU|#q7}(`bW`nvgBwi`4iRD=4ypK;z>AGq^B6W*V+ZbG#n{&dmT1v%WM8SyrNy342X`4rA7zd zh#T$RO-p4*c5`uYDXtzEU3o@FH?fD`118Ho^5wR4YSo=A{HQ*Q&c57T+`Wjku15G#x)yj2c~D116%R7^&%%C8X!KRUtT{-#wx79$dO8Y_ zH8st4UC{nyuUnj>#cq?Amj{{E(i$}v){~A_My0!){XIA{8v!#1FdLE8@Z-yP=B#6H z_joVhjNe8`d^KeMOz<5mFhzccA2h05`&2Gh&vN-m{?(}Fdmo_P)o{0=P*W7|#>higZn_yUjd)M{xG#H$@FW>UVi zyE3~EsJ?m?RtRSbygi}zKXY<_zq>ENrI!*UZsHAl%(XHr=`ewaNbf6q$%tMpJ$o*; zJNxxA^ajx@jeh-N#cqNbx56Thd^gghy|8i(#E<(}&)e8}%zXCzE?q2BA6_~xkS2lW zV7i=~oy19)Ygonv%)hZ5slAj;ek7+`oo!rueeEByYT{a9(rPM2IJ_OVy?nPmq5roH z)WcXN9iCmnbcxSQtin7Oa=gH(qp8^j49>|_KUAc=4}qz&CZ!nW*Nax$k9YDq1ySt= zQ`OPY#e=qm2b1vH>pQ9a>JWi*vSk$=Lc1&D9iFO6o$4+3Y&?0aue!Q|tOf~^o&w`~ zt)wC*(-th6JeLpXX(hX<7J}obFKldrm34h-1@n2d)Ue>y!Hl%2zMmgHK#r?$u@j{N zlBJu%V%vW5>HghP==vR|z-UO^ zFZxb~JmEK;=lI;|JUjwBizyQ=*wTm+F5fIJb0;xMOxiGBj-{R@j(zmvduw*3^2DF$ zy7xHEekZ?9=t;}Hj3XQ@79fLVO*K|v_8snfdU0`qN7RT#pz5$Kv5c{G#iDOqInH0F z>jI@|MxQ=n;X!lOY|q3>;oc8OT6u~G&~47f9$%fL*BG=;lcEByS{QX-#GT66FsJLp z*X&J2q5SL?gEMgr{m&RBPxnG6VBcH+G)lJ0AEP>d$=a}9q;4Z#u~p~jGXJ9!?kv_Q z$TgiTPNC@R?#i_qLPKHqH*bb3Y;T7$JVU_Po1>rL4Ek`~^UELY`SYoH_jX7j_tE$E zoQHgG=n`O^IWBwI?Nuo$DPVa+oYe(&u^t=0s4y2Vcjf7{vg`ckix?$H=-A`ewpkn` z-<%`d-(jjKw8JEIY>_?hy1)UY)k zQ>xv$fTGakw{2Cw7p)70WXXZ~2A{^6OH&ZvWNOi*gBikDEZiIss6A#M4hX1D=t`a& zn^2YW7#V3&t&Cs2K;_T<^A}HiDSSzTfBqDxsVm{CSa6Tq99u9KAqEMbsQW@r`;j2C z#fLwPK|OMQ%HaCjyPYH~9KYr6$Kw6ALSZrM>!}{1MfcH*lby2E(&!KxD}HQ=(_P-v zu`cGnAhiV(Uz%@LgkZUX^gY*Id!m;JIXwd($DX8)kNXd~npCbTz>33yho>;qT@|6F zo#kvI4u7$v#K$DW)USu=;&*9fbt>-k_f|u{{?}}WDN7Kn4ajx4w2(G%b8@y#S&$B> z5gw=+`g(}ZkDgY1hEQ^SvpqxfUP$1oI~em%n$v(8hg`9lS%hV#J`I@5qX=67fR zvVNV%8jli@NRpq_LhWEC9Gvu7w0W5T`8PbPF}i|nFcIWsUP)8M$|CT&y|useTz(RN zKZ+5M(0R(Q2d-YTV+dlTue{s-5L>%;icRcl$IWMu(lvxpZV8)%#B#FA`Ch2}pXX+N z<=Y-{Y&`)aEFL`B}J%@4=mu&G9xc2_GqS zSDutW$o*?xCm#2BokTthQ zEDnjYtNG(#siAYDl6v{l=K@F8Hacy%W(oCr{KO;feRWb=_Wj21>d-O^HD5FtSS&Ly zkf7knta+aC84r6F{@IzIsi*1Y;P?wglvKP$b}GAoU?s`zF>Q&hS{pK}cCulszbO*> zyEs-v33a}|6VC$!rQfQ5)!8Hp%OA=sFv=JHVf3*l zx2FO_K`u{p5BA+k+P8Gakq6P~yxXg9*oONVk!RZ-W<1h_64F=53QEaZJjZ6pl8Y2r6rv{=EkgeKnS?_S~4o5}WO(M!U zZ*2opQzn1xP`>E_3J?{-ulRZ2;L%AyKu%HT(|7oyJ^&%QV?AbcxtrTtA~79xz&d(-OcdPm zhs4hQxU>0++3f7xL0eJrUKoyjyUf0I62V6>O>TGaHW7B}SX|*AX?mkAI*pXeIA+L} zMwgdYb%WZm5V8`mA1??grxzJ9L$1f(1a{0}JA>LR&*rDhjm%^b=3&a^P$xHi1oRdq zI~uj(fWgfBK!7&AEYdRKqLWoa3^Uy%b0uhhZ~SZHKCxs>7s2W`Fe{ zNkYEHcLVcQ23)Tg5o4U-rxIt2$kjn}7YXXADVK7qy}*ABI!DFmlMRqY4BI9$rSX~q zv2LpcrloY2ON$leeTQ0Rtxp~udQv3g2xgV#>oT+}s3_Y~7IAOZx(=zV>=M6oTll zpuqf&7lY^hKkdBi4yU^@vb*0n$Nr}ijED!6rU@O60ptkrisCJ$;hqpe|J*ivSToflK*XelK*+zhqB)fD|&rP z#M0f^hxZO?YMA_JM*0~m$%uZi#{cgXr6| Date: Wed, 4 Oct 2023 22:06:42 +0530 Subject: [PATCH 12/27] update workflow --- .github/workflows/get_data_lint_files_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get_data_lint_files_deploy.yml b/.github/workflows/get_data_lint_files_deploy.yml index 45aa967a..3be24885 100644 --- a/.github/workflows/get_data_lint_files_deploy.yml +++ b/.github/workflows/get_data_lint_files_deploy.yml @@ -181,7 +181,7 @@ jobs: accountId: ${{ secrets.CF_ACCOUNT_ID }} projectName: komodo-docs directory: ./out - #gitHubToken: ${{ secrets.GITHUB_TOKEN }} + gitHubToken: ${{ secrets.GITHUB_TOKEN }} wranglerVersion: "3" branch: ${{ steps.get_branch.outputs.BRANCH_NAME }} From dce5035ed67c0eb65ccf86418d9518b275ccf586 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 5 Oct 2023 07:08:10 +0800 Subject: [PATCH 13/27] add swap events structures --- filepathSlugs.json | 117 ++-- src/data/sidebar.json | 11 +- .../api/common_structures/swaps/index.mdx | 75 ++- .../swaps/maker_events/index.mdx | 472 +++++++++++++++ .../swaps/taker_events/index.mdx | 538 ++++++++++++++++++ .../api/legacy/convertaddress/index.mdx | 10 +- .../api/legacy/min_trading_vol/index.mdx | 14 +- .../api/legacy/my_recent_swaps/index.mdx | 2 +- .../api/legacy/my_swap_status/index.mdx | 499 +--------------- 9 files changed, 1157 insertions(+), 581 deletions(-) create mode 100644 src/pages/atomicdex/api/common_structures/swaps/maker_events/index.mdx create mode 100644 src/pages/atomicdex/api/common_structures/swaps/taker_events/index.mdx diff --git a/filepathSlugs.json b/filepathSlugs.json index 3f4f7bb0..d62b3a83 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -1622,10 +1622,72 @@ ], "src/pages/atomicdex/api/common_structures/swaps/index.mdx": [ "swap-structures", - "swap-status", + "swap-event", "example", - "success-events", - "error-events" + "swap-events", + "example-2", + "swap-status", + "example-3" + ], + "src/pages/atomicdex/api/common_structures/swaps/maker_events/index.mdx": [ + "maker-swap-events", + "maker-success-events", + "maker-error-events", + "started", + "start-failed", + "negotiated", + "negotiate-failed", + "taker-fee-validated", + "taker-fee-validate-failed", + "maker-payment-transaction-failed", + "maker-payment-sent", + "maker-payment-data-send-failed", + "maker-payment-wait-confirm-failed", + "taker-payment-received", + "taker-payment-wait-confirm-started", + "taker-payment-validate-failed", + "taker-payment-wait-confirm-failed", + "taker-payment-validated-and-confirmed", + "taker-payment-spend-failed", + "taker-payment-spent", + "taker-payment-spend-confirm-started", + "taker-payment-spend-confirm-failed", + "taker-payment-spend-confirmed", + "maker-payment-wait-refund-started", + "maker-payment-refund-failed", + "maker-payment-refunded", + "finished" + ], + "src/pages/atomicdex/api/common_structures/swaps/taker_events/index.mdx": [ + "taker-swap-events", + "taker-success-events", + "taker-error-events", + "started", + "start-failed", + "negotiated", + "negotiate-failed", + "taker-fee-sent", + "taker-fee-send-failed", + "taker-payment-instructions-received", + "maker-payment-validate-failed", + "maker-payment-received", + "maker-payment-wait-confirm-started", + "maker-payment-wait-confirm-failed", + "maker-payment-validated-and-confirmed", + "taker-payment-sent", + "taker-payment-transaction-failed", + "taker-payment-wait-confirm-failed", + "taker-payment-data-send-failed", + "taker-payment-spent", + "taker-payment-wait-for-spend-failed", + "maker-payment-spend-failed", + "maker-payment-spent", + "taker-payment-wait-refund-started", + "taker-payment-refund-started", + "taker-payment-refund-failed", + "taker-payment-refunded", + "taker-payment-refund-finished", + "finished" ], "src/pages/atomicdex/api/index.mdx": [ "atomic-dex-rpc-methods" @@ -1949,55 +2011,6 @@ "my-swap-status", "arguments", "response", - "maker-swap-events", - "started", - "start-failed", - "negotiated", - "negotiate-failed", - "taker-fee-validated", - "taker-fee-validate-failed", - "maker-payment-transaction-failed", - "maker-payment-sent", - "maker-payment-data-send-failed", - "maker-payment-wait-confirm-failed", - "taker-payment-received", - "taker-payment-wait-confirm-started", - "taker-payment-validate-failed", - "taker-payment-wait-confirm-failed", - "taker-payment-validated-and-confirmed", - "taker-payment-spend-failed", - "taker-payment-spent", - "taker-payment-spend-confirm-started", - "taker-payment-spend-confirm-failed", - "taker-payment-spend-confirmed", - "maker-payment-wait-refund-started", - "maker-payment-refund-failed", - "maker-payment-refunded", - "finished", - "taker-swap-events", - "started-2", - "start-failed-2", - "negotiated-2", - "negotiate-failed-2", - "taker-fee-sent", - "taker-fee-send-failed", - "maker-payment-validate-failed", - "maker-payment-received", - "maker-payment-wait-confirm-started", - "maker-payment-wait-confirm-failed-2", - "maker-payment-validated-and-confirmed", - "taker-payment-sent", - "taker-payment-transaction-failed", - "taker-payment-wait-confirm-failed-2", - "taker-payment-data-send-failed", - "taker-payment-spent-2", - "taker-payment-wait-for-spend-failed", - "maker-payment-spend-failed", - "maker-payment-spent", - "taker-payment-wait-refund-started", - "taker-payment-refund-failed", - "taker-payment-refunded", - "finished-2", "examples", "command", "successful-taker-swap", diff --git a/src/data/sidebar.json b/src/data/sidebar.json index b6b51b52..956ed8ff 100644 --- a/src/data/sidebar.json +++ b/src/data/sidebar.json @@ -736,7 +736,16 @@ { "title": "Swaps Structures", "titleLink": "/atomicdex/api/common_structures/swaps/", - "links": [] + "links": [ + { + "title": "Maker Swap Events", + "href": "/atomicdex/api/common_structures/swaps/maker_events/" + }, + { + "title": "Maker Swap Events", + "href": "/atomicdex/api/common_structures/swaps/taker_events/" + } + ] } ] }, diff --git a/src/pages/atomicdex/api/common_structures/swaps/index.mdx b/src/pages/atomicdex/api/common_structures/swaps/index.mdx index 5b889c59..27032915 100644 --- a/src/pages/atomicdex/api/common_structures/swaps/index.mdx +++ b/src/pages/atomicdex/api/common_structures/swaps/index.mdx @@ -3,6 +3,51 @@ export const description = "Each active or completed trade from the Komodo DeFi # Swap Structures +### SwapEvent + +There are a variety if swap events which may occur during a trade. See [Maker Events](/atomicdex/api/common_structures/swaps/maker_events/) and [Taker Events](/atomicdex/api/common_structures/swaps/maker_events/) for more info. + +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | See [Maker Events](/atomicdex/api/common_structures/swaps/maker_events/) and [Taker Events](/atomicdex/api/common_structures/swaps/maker_events/) for more info. | +| data | varies | The data field may contain contextual information (e.g. txids) releated to a swap event. In some cases, it will be `null`. | + + + #### Example + + ```json + { + "type": "TakerFeeSent", + "data": { + "tx_hex": "0400008085202f89014b9e44ba75ed80361776ac385feee7bba13b6c2d3147a3d9b5d71362a4624219000000006b483045022100a45de07b5d211c62e8ecf90cd5bee5076f6b6f20715f5618d7d0d93a6209ad870220596ca01682d2dbd4efeba3a0e90a373fd61b619471747df26afc2e2bb167de4c012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88acf4979600000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88acaf73d363000000000000000000000000000000", + "tx_hash": "b2ee0e692523c5ca081f62e36325d09a629004850be8b86df149fc979e9e3e87" + } + } + ``` + + +### SwapEvents + +For each step of a trade, a `SwapEvent` will be created, alongside the timestamp of the event. See [Maker Events](/atomicdex/api/common_structures/swaps/maker_events/) and [Taker Events](/atomicdex/api/common_structures/swaps/maker_events/) for more info. + +| Parameter | Type | Description | +| --------- | ------- | ---------------------------------------------------------------------------------- | +| timestamp | integer | Timestamp for the `SwapEvent` in UNIX format. | +| event | object | A standard [SwapEvent](/atomicdex/api/common_structures/swaps/#swap-event) object. | + + + #### Example + + ```json + { + "event": { + "type": "MakerPaymentWaitConfirmStarted" + }, + "timestamp": 1564050588178 + } + ``` + + ### SwapStatus Each swap status will be nested under its associated UUID. @@ -11,19 +56,19 @@ Each swap status will be nested under its associated UUID. We should add a "maker" resonse example also. Unsure if `uuid` on maker side is swap or order uuid in response. -| Parameter | Type | Description | -| --------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | `Maker` or `Taker`. Indicates if the user created the order (maker), or matched with an existing order (taker). | -| uuid | string | A unique identifier for the swap. | -| events | list | A list of swap events. The structure of each event varies depending on its type, as detailed in the [SwapEvents](/atomicdex/api/common_structures/swaps) section. | -| maker\_coin | string | The coin being sent by the maker and received by the taker. | -| taker\_coin | string | The coin being sent by the taker and received by the maker. | -| maker\_amount | numeric string | The amount of `maker_coin` being traded. | -| taker\_amount | numeric string | The amount of `taker_coin` being traded. | -| gui | string | An identifier for the GUI used to initiate the swap, as defined in a user's MM2.json file. May be `null` if not defined. | -| mm\_version | string | The release version and/or commit hash of the Komodo DeFi SDK used to initiate the swap. | -| success\_events | list | A list of possible [swap event types for a successful swap](/atomicdex/api/common_structures/swaps/#success-events). | -| error\_events | list | A list of possible [swap event types which may appear in a failed swap](/atomicdex/api/common_structures/swaps/#error-events). | +| Parameter | Type | Description | +| --------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | `Maker` or `Taker`. Indicates if the user created the order (maker), or matched with an existing order (taker). | +| uuid | string | A unique identifier for the swap. | +| events | list | A list of swap events. The structure of each event varies depending on its type, as detailed in the [SwapEvents](/atomicdex/api/common_structures/swaps) section. | +| maker\_coin | string | The coin being sent by the maker and received by the taker. | +| taker\_coin | string | The coin being sent by the taker and received by the maker. | +| maker\_amount | numeric string | The amount of `maker_coin` being traded. | +| taker\_amount | numeric string | The amount of `taker_coin` being traded. | +| gui | string | An identifier for the GUI used to initiate the swap, as defined in a user's MM2.json file. May be `null` if not defined. | +| mm\_version | string | The release version and/or commit hash of the Komodo DeFi SDK used to initiate the swap. | +| success\_events | list | A list of possible swap event types for a successful swap, for [makers](/atomicdex/api/common_structures/swaps/maker_events/#maker-success-events) and [takers](/atomicdex/api/common_structures/swaps/taker_events#taker-success-events). | +| error\_events | list | A list of possible swap event types which may appear in a failed swap, for [makers](/atomicdex/api/common_structures/swaps/maker_events/#maker-error-events) and [takers](/atomicdex/api/common_structures/swaps/taker_events#taker-error-events). | #### Example @@ -56,7 +101,3 @@ Each swap status will be nested under its associated UUID. } ``` - -## success events - -## error events diff --git a/src/pages/atomicdex/api/common_structures/swaps/maker_events/index.mdx b/src/pages/atomicdex/api/common_structures/swaps/maker_events/index.mdx new file mode 100644 index 00000000..b2a6a574 --- /dev/null +++ b/src/pages/atomicdex/api/common_structures/swaps/maker_events/index.mdx @@ -0,0 +1,472 @@ +export const title = "Komodo Defi SDK Swaps: Maker Events"; +export const description = "A description of events and outcomes for each step of an atomic swap from the maker's perspective."; + +# Maker Swap Events + + + Needs update for watchtower events + + +## Maker Success Events + +Click on the Events below to view thier structure: + +* [Started](/atomicdex/api/common_structures/swaps/maker_events/#started) +* [Negotiated](/atomicdex/api/common_structures/swaps/maker_events/#negotiated) +* [TakerFeeValidated](/atomicdex/api/common_structures/swaps/maker_events/#taker-fee-validated) +* [MakerPaymentSent](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-sent) +* [TakerPaymentReceived](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-received) +* [TakerPaymentWaitConfirmStarted](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-wait-confirm-started) +* [TakerPaymentValidatedAndConfirmed](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-validated-and-confirmed) +* [TakerPaymentSpent](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-spent) +* [TakerPaymentSpendConfirmStarted](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-spend-confirm-started) +* [TakerPaymentSpendConfirmed](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-spend-confirmed) +* [Finished](/atomicdex/api/common_structures/swaps/maker_events/#finished) + +## Maker Error Events + +Click on the Events below to view thier structure: + +* [StartFailed](/atomicdex/api/common_structures/swaps/maker_events/#start-failed) +* [NegotiateFailed](/atomicdex/api/common_structures/swaps/maker_events/#negotiate-failed) +* [TakerFeeValidateFailed](/atomicdex/api/common_structures/swaps/maker_events/#taker-fee-validate-failed) +* [MakerPaymentTransactionFailed](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-transaction-failed) +* [MakerPaymentDataSendFailed](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-data-send-failed) +* [MakerPaymentWaitConfirmFailed](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-wait-confirm-failed) +* [TakerPaymentValidateFailed](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-validate-failed) +* [TakerPaymentWaitConfirmFailed](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-wait-confirm-failed) +* [TakerPaymentSpendFailed](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-spend-failed) +* [TakerPaymentSpendConfirmFailed](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-spend-confirm-failed) +* [MakerPaymentWaitRefundStarted](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-wait-refund-started) +* [MakerPaymentRefunded](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-refunded) +* [MakerPaymentRefundFailed](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-refund-failed) + + + #### Started + + The `Started` event indicates that mandatory pre-checks passed, such as "available balance," and that the swap started successfully. + + The swap goes to the negotiation stage after this event occurs. + + | Structure | Type | Description | + | ------------------------------ | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | + | taker\_coin | string | the ticker of the taker coin | + | maker\_coin | string | the ticker of the maker coin | + | taker | string (hexadecimal) | the p2p ID of taker node | + | secret | string (hexadecimal) | a random secret, the hash of which is used to lock atomic-swap payments | + | secret\_hash | string (hexadecimal) | the hash of the swap secret | + | my\_persistent\_pub | string (hexadecimal) | a persistent secp256k1 public key of maker node | + | lock\_duration | number (integer) | the lock duration of swap payments in seconds. The sender can refund the transaction when the lock duration is passed. The taker payment is locked for the lock duration. The maker payment is locked for lock duration \* 2 | + | maker\_amount | string (numeric) | the amount of coins to be swapped by maker | + | taker\_amount | string (numeric) | the amount of coins to be swapped by taker | + | maker\_payment\_confirmations | number (integer) | the required number of blockchain confirmations for maker payment | + | maker\_payment\_requires\_nota | bool | whether dPoW notarization is required for maker payment; can be null; available since `beta-2.0.1738` | + | taker\_payment\_confirmations | number (integer) | the required number of blockchain confirmations for taker payment | + | taker\_payment\_requires\_nota | bool | whether dPoW notarization is required for taker payment; can be null; available since `beta-2.0.1738` | + | maker\_payment\_lock | number (UTC timestamp in seconds) | the maker payment is locked until this timestamp | + | uuid | string | the swap uuid | + | started\_at | number (UTC timestamp in seconds) | the timestamp at the start of the swap | + | maker\_coin\_start\_block | number (integer) | the maker coin block number at the start of the swap | + | taker\_coin\_start\_block | number (integer) | the taker coin block number at the start of the swap | + + + ```json + TODO: Example TBA + ``` + + + #### StartFailed + + The `StartFailed` event indicates that some of the pre-checks did not pass, and therefore the swap did not start. + + The swap finishes immediately when this event occurs. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + + #### Negotiated + + The `Negotiated` event indicates that maker has received and validated swap negotiation data from taker. + + Maker starts waiting for taker to send the dex fee after this event occurs. + + | Structure | Type | Description | + | ------------------------ | --------------------------------- | ------------------------------------------------ | + | taker\_payment\_locktime | number (UTC timestamp in seconds) | the taker payment is locked until this timestamp | + | taker\_pubkey | string (hexadecimal) | a persistent secp256k1 public key of taker node | + + + ```json + { + "data": { + "lock_duration": 7800, + "maker_amount": "1", + "maker_coin": "BEER", + "maker_coin_start_block": 154221, + "maker_payment_confirmations": 1, + "maker_payment_lock": 1561545442, + "my_persistent_pub": "02031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3", + "secret": "ea774bc94dce44c138920c6e9255e31d5645e60c0b64e9a059ab025f1dd2fdc6", + "started_at": 1561529842, + "taker": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "taker_amount": "1", + "taker_coin": "PIZZA", + "taker_coin_start_block": 141363, + "taker_payment_confirmations": 1, + "uuid": "6bf6e313-e610-4a9a-ba8c-57fc34a124aa" + }, + "type": "Started" + } + ``` + + + #### NegotiateFailed + + The `NegotiateFailed` event indicates that taker negotiation data was not received or did not pass validation. + + The swap finishes immediately when this event occurs. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + { + "data": { + "error": "taker_swap:547] \"taker_swap:543] timeout (180.0 > 180.0)\"" + }, + "type": "NegotiateFailed" + } + ``` + + + #### TakerFeeValidated + + The `TakerFeeValidated` event indicates that maker received and validated dex fee data from taker. + + Maker sends their payment after this event occurs. + + | Structure | Type | Description | + | --------- | ------ | --------------------------------------- | + | tx\_hash | string | the hash of the transaction | + | tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "data": { + "tx_hash": "a59203eb2328827de00bed699a29389792906e4f39fdea145eb40dc6b3821bd6", + "tx_hex": "f8690284ee6b280082520894d8997941dd1346e9231118d5685d866294f59e5b865af3107a4000801ca0743d2b7c9fad65805d882179062012261be328d7628ae12ee08eff8d7657d993a07eecbd051f49d35279416778faa4664962726d516ce65e18755c9b9406a9c2fd" + }, + "type": "TakerFeeValidated" + } + ``` + + + #### TakerFeeValidateFailed + + The `TakerFeeValidateFailed` event indicates that taker dex fee data was not received or did not pass validation. + + The swap finishes immediately when this event occurs. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + + #### MakerPaymentTransactionFailed + + The `MakerPaymentTransactionFailed` event indicates that maker was not able to broadcast his payment transaction to maker coin blockchain. + + The swap finishes immediately when this event occurs. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + { + "data": { + "error": "lp_swap:1888] eth:654] RPC error: Error { code: ServerError(-32010), message: \"Transaction with the same hash was already imported.\", data: None }" + }, + "type": "MakerPaymentTransactionFailed" + } + ``` + + + #### MakerPaymentSent + + The `MakerPaymentSent` event indicates that maker has broadcast the maker payment transaction. + + Maker starts waiting for taker to send his payment after this event occurs. + + | Structure | Type | Description | + | --------- | ------ | --------------------------------------- | + | tx\_hash | string | the hash of the transaction | + | tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "data": { + "tx_hash": "efa90a2918e6793c8a2725c06ee34d0fa76c43bc85e680be195414e7aee36154", + "tx_hex": "0400008085202f890cdcd071edda0d5f489b0be9c8b521ad608bb6d7f43f6e7a491843e7a4d0078f85000000006b483045022100fbc3bd09f8e1821ed671d1b1d2ed355833fb42c0bc435fef2da5c5b0a980b9a002204ef92b35576069d640ca0ac08f46645e5ade36afd5f19fb6aad19cfc9fb221fb012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffe6ae2a3ce221a6612d9e640bdbe10a2e477b3bc68a1aeee4a6784cb18648a785010000006a47304402202000a7e60ae2ce1529247875623ef2c5b42448dcaeac8de0f8f0e2f8e5bd8a6b0220426321a004b793172014f522efbca77a3dc92e86ce0a75330d8ceb83072ad4e7012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff9335553edcbac9559cae517a3e25b880a48fabf661c4ac338394972eef4572da000000006b4830450221008ded7230f2fb37a42b94f96174ec192baf4cd9e9e68fb9b6cf0463a36a6093e00220538de51ceda1617f3964a2350802377940fdfa018cc1043d77c66081b1cab0c4012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3fffffffff91b5d3733877f84108de77fec46bee156766e1a6837fa7b580ccbc3905acb14000000006b483045022100d07cf1fd20e07aafdc942ba56f6b45baee61b93145a2bdba391e2cdb8024bf15022056ea8183990703ef05018df2fe8bd5ec678ec0f9207b0283292b2cdafc5e1e0c012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff147870387ca938b2b6e7daa96ba2496014f125c0e4e576273ef36ee8186c415a000000006a47304402204c5b15b641d7e34444456d2ea6663bdc8bd8216e309a7220814474f346b8425e0220634d1dd943b416b7a807704d7f7a3d46a60d88ef4e20734588a0b302c55fa82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffd2b954ae9b4a61fad9f7bc956d24e38d7b6fe313da824bd3bd91287d5a6b49d9000000006b483045022100a7387d9ab7b2c92d3cbce525e96ffac5ae3ef14f848661741ada0db17715c4a002202c1417d5e3e04b1a2d1774a83bb8d5aa1c0536c100138123089fa69921b5d976012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff28792a2e26d9d7be0467fac52b12ece67410b23eea845008257979bd87d083e3000000006a473044022027c40517c33cd3202d4310cfd2c75f38e6d7804b255fc3838a32ea26e5a3cb0002202b4399e1d7e655b64f699318f2bfbdced49f064ee54e9d6a678668fce51caf96012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffa8bf797bacd213b74a9977ae1b956afe3af33a1ee94324e010a16db891a07441000000006a473044022004cbb1d970b9f02c578b5c1d7de33361581eebc19c3cd8d2e50b0211ca4ef13702200c93b9fe5428055b6274dc8e52073c3e87f5b5e4206134d745928ccfc9393919012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff2b6fd82c9a68111b67ad85a614a6ecb50f7b6eac3d21d8ebefd9a6065cdf5729000000006b483045022100fdff16c595c7b4a9b4fc1e445b565f7b29fe5b7a08f79291b0ff585c7b72ac2902200c694aa124013bd419ce2349f15d10435827868d35db939b9d3c344d16e78420012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff6a5468dd8c83553dc51022f2a2fb772cf91c8607dc2ca1b8f203ac534612ab29000000006b483045022100ba7cc79e7ae3720238bfc5caa225dc8017d6a0d1cb1ec66abaf724fd20b3b7ab02206e8c942756604af0f63b74af495a9b3b7f4a44c489267f69a14cf2b1b953f46e012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff5f9f48a91d343fd5aef1d85f00850070931459ab256697afb728d1c81c1fa1d2000000006a47304402200ec85fc66f963e7504eb27361a4b4bb17de60e459da414fdc3962476de636134022056b62c15cf7f9b4e7d4e11c03e4e541dd348919b8c55efa4f1927e2fdd5ae8ea012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffee1f455924d3167e7f7abf452c1856e9abdcfe27dc889942dd249cb376169d38000000006b48304502210089274eed807c5d23d819f6dfa8a358a9748e56f2080be4396ef77bb19d91b17402207fc7b22c879534fffe0eeaaec8fc284e22c2756f380c05ea57b881a96b09f3af012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f5050000000017a9144eb3a361d8a15d7f6a8ef9d1cf44962a90c44d548702912b00000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac490e135d000000000000000000000000000000" + }, + "type": "MakerPaymentSent" + } + ``` + + + #### MakerPaymentDataSendFailed + + The `MakerPaymentDataSendFailed` event indicates that maker was not able to send his payment data to taker due to a network error. + When this event occurs, maker starts waiting for **maker payment lock time expiration** to issue a refund. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + + #### MakerPaymentWaitConfirmFailed + + The `MakerPaymentWaitConfirmFailed` event indicates that maker payment transaction did not reach the required number of confirmations before the internal timeout expiration. + + When this event occurs maker starts waiting for **maker payment lock time expiration** to issue a refund. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + { + "type": "MakerPaymentWaitConfirmFailed", + "data": { + "error": "An error" + } + } + ``` + + + #### TakerPaymentReceived + + The `TakerPaymentReceived` event indicates that maker received the taker payment transaction data. + + Maker starts waiting for taker payment confirmation after this event occurs. + + | Structure | Type | Description | + | --------- | ------ | --------------------------------------- | + | tx\_hash | string | the hash of the transaction | + | tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "data": { + "tx_hash": "7e0e38e31dbe80792ef320b8c0a7cb9259127427ef8c2fca1d796f24484046a5", + "tx_hex": "0400008085202f892082f6916932f9bf674a3fb00c3d5d765303ab68461f4abe0f91cc1162546914a9010000006b483045022100999b8bb0224476b5c344a466d0051ec7a8c312574ad8956a4177a42625cb86e302205a6664396bff3f2e6fe57adb7e082a26d1b8da9ee77b3fc24aa4148fdd5c84db012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffcad29a146b81bcaa44744efbec5149b6e3ca32bace140f75ad5794288d5bff6c000000006b483045022100b4dbfe88561c201fb8fbaf5bbf5bc0985893c909429c579425da84b02d23cc12022075f1e1e3eba38d167a6e84aac23faee5a2eb0799511e647213cee168529d4e5d012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffa13eeacd04b3e26ae3f41530b560c615dafa0fd4235cc5b22d48ab97e7c3399c000000006a47304402201158306fe668cbf56ad3f586dc83c1cda9efab44cef46da6bc0fe242292c85ed02201d622fe283410320e760233ae81dc53df65406b09fd07f8649f1775689219c35012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff4352b9f1f01dde4209b9e91076a3cfcabdaa23d9d5a313abfe7edb67ee4273e3000000006b483045022100825242fb3c6d460580016e93718ae1f43917e53abcc1558a64a6ab6f406763dd0220543936ce4c725e5e9f03831274a8475b535171bb29e1919fcf52ba2a9c85a553012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffcc0fa94b5973c893e61d470ae3982b0bedfd29cb0da2c60a362de438598f108c000000006b4830450221008c70a8e10ca37819e5a4d9783366e729e690d78f2fdd8a1f4812ddc14ec7d6ad022035ba8cb4d4e50684107f8af5c184582687b5d7dfda5d9be1bd45e45749c77f08012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffb0bd3bb9fedb7bbf49ca1612c955ba6095202186cef5be6952aed3dd32da4268000000006a4730440220592216d63c199faa587a4a6cbe11ca26027368a116b50818ce30eced59ca887202201bcafcf88f9f2632151596732f839d77cbe2f2243822c8551faffecc90b5dc19012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff65cf2831fc200e55aaacbe0881ad0edfb298ee6d4421b08b048aecc151716bd1000000006a47304402202032eb1ccebc3be4b94bae343d1d168e87040d2d20977c47d073d6bf490ef6c00220067656e00c4b8930167c54078609925cec7b893a52bcb9304e6b2602f564413e012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffeaf67880bee214acecc74b12f648c1014d6394c4abf99832d408981bb460e999000000006b483045022100b9ae1cc824149220ac517298e6f21c26939485b31d0ae19d97d986c5f8f34e4502200a90578cf2c1835dbea00484af1f225711c255f1d0a3208f2e4f1154f0db2c9a012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffad089c3fe7987a44f150f34b7ac66972de76dd84c739bdeddf360ab029dfd4d6000000006a473044022015f0386ed67a61626fbe5ae79e0d39d38e7b4072b648e8a26e23adadc0a8e5bc02202398188fa2feb26994e5c1e7e758788de3d5f0f0096f956a0cd58804710bea6a012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffd6c66730546c62dd003b5af1f1e5ecfd339c62db0169c1d499584e09a8a9b288000000006b4830450221008d4c73f0e3c9d913ba32fd864167649242e3e891412ab80bdd3f7ff43a238ee20220602738e98008b146256b51d0df99e222aa165f2ce351241ebc23d8a098e2b0db012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff12d9eff354f46cbd4446a0bff27a6a635ff5b1dc8a5dd8b0178bb5f89c9ec080000000006b48304502210098d3349ba9b13560748949933d2704663a5ab52cdc804afa1ac4da3e5992e0a002201525d7ad8466ad260219f3873fb7781addbd363f91e8063bfa86c7ed4e385b84012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff69e16767806ea5f069b7d46674f7aa747fcc6e541189ce7fcf92edcfd7642ff4000000006b4830450221008a5ebfe904c87f21947a44d8418190be5893993a683fde0f96df8a9487923da002205be1bbd8b518ba2f303cae23bc20806e84ffbba6a03f032385b15edb8df107f4012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640fffffffff4fbabd508178f553e676d67ce325796b03aa249b41a23c681c1ad9dedb45ae7000000006a47304402207cea6824abe1ce35e18954b858d45243e2cb57d27d782adc5b6b07ebd21a02d7022007ba0469b298c4b1a7c4a148fa16bae93d28593b34e197c10ac0d1faf9cc1bfa012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff14867aa59932d895be607fb7398f5594e39d9fa2e1c7daaed7b1390dbfdddcab000000006b4830450221009fb6e1885a3658c593809f95ecd2049f8ef9e00379686ac236b17312c9613d4c0220709fc50c9a920a19254389944db366c354708c19885d2479d9968fda0848f9f7012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff75777c692daaa21d216a1a2a7059203becfcdcf6793aa1259cdd7aadec957ab6000000006a47304402202945019860abf9b80e71f340320d114846efa4d2780ce12513e3983fb4d3f15b022019be008fb7368e3f1f022924dc7af1138b94041f46084dd27768bc8cacd1529f012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffca037b85742e93df4eef8e8ac3b8531321c8a8e21a4a941360866ea57a973665000000006a4730440220760283a7828edcc53671fc73e29c30cdc64d60d300292761d39730f0d09f94c202201e026293e3891a6fe46e40cd21778a41e21641a261a7fbf3bf75b034d9c788d9012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffa68edd030b4307ad87bfeff96a6db5b3ddd1a0901c488a4fe4d2093531896d75000000006b48304502210091a41e16b2c27d7ef6077e8de9df692b6013e61d72798ff9f7eba7fc983cdb65022034de29a0fb22a339e8044349913915444ab420772ab0ab423e44cfe073cb4e70012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff8c952791181993a7512e48d098a06e6197c993b83241a4bf1330c0e95f2c304d000000006b483045022100fa14b9301feb056f6e6b10446a660525cc1ff3e191b0c45f9e12dcd4f142422c02203f4a94f2a9d3ec0b74fac2156dd9b1addb8fa5b9a1cfc9e34b0802e88b1cbfa3012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff32bc4d014542abf328fecff29b9f4c243c3dd295fe42524b20bf591a3ddc26a1000000006a47304402206f92c4da6651c8959f7aed61608d26b9e46f5c1d69f4fc6e592b1f552b6067f102201c8cc221eac731867d15d483cc83322dba2f14f31d3efb26be937a68ad772394012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffbb3877248c26b23023d7dbb83a5f8293c65c5bff4ac47935a4a31248cefffd91000000006a47304402205bab19ad082a1918e18ccb6462edc263196fb88c8fdfd6bd07a0cf031a4637810220371a621c1bdc6b957db2447a92dcf87b0309653a2db480c9ed623f34a6e6d8a9012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff6415b7356c94609b9a7a7eb06e4c306896767abbc11399779f952fb9ae197059000000006b483045022100e2d038dbb9a873f5a58ec7901d6a7e79f1b404afea3d852056f4d0746cfb821102207fb274947b10d467cd71aa948e9a50f5f4430b661b27afc347efd9d6cc409d9c012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff1aeefdf80ec8a07d657ca64a2c0aa465f58e6284755c9a263c5a807be43b4b81000000006a47304402206e7ff765ba47a8785008f64f49c8e73232d582b2b2d0a49be0880c2557de8f8602206448423a6a37ad9740eb316513b31f73599ae14f65623709fb5443ae609f3e2e012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff3c091681df17b46f280bc9d8011c1bb31397637ce945b393f70380f8cd0a8b0d010000006a47304402206ca8717000f3086d364318f56d52e2369c40b88a1cb86455a8db262b4816698a02206711caf453bfda6b1b3542e27e68c3180f92f0548326d74e30b3ed18cd2c2353012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff91f32d98b581def165495aff6b69530e1f3de7f68fabfeb93730cf9793bbcd2a000000006a47304402200a8cd5e29ee7ff136772ea1789a39a027eaa1cd92f90f9d57fd8cf77202251f402203dd2bc282a838a5730e840a0d22b4f0edbe3cb2da00466c66bc2b5c66fc8b032012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff854d9226c28a1f5fe440e08f41000f3547f304ecf9cc010d0b5bc845ef1f039a000000006b483045022100fe6cce49975cc78af1c394bc02d995710833ba08cf7f8dd5f99add2cc7db26c40220793491309c215d8314a1c142bef7ec6b9a397249bec1c00a0a5ab47dfc1208b6012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff593bc907aa71f3b0f7aa8c48bb5f650595e65a5a733a9601a8374ed978eec9a7000000006a47304402206362ae3c4cf1a19ba0e43424b03af542077b49761172c1ad26d802f54b1b6ca602206bc7edb655bb0024c0e48c1f4c18c8864f8d1ce59ae55cd81dc0bd1234430691012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff3b9da8c5ab0c0cd6b40f602ea6ed8e36a48034b182b9d1a77ffebd15fe203b94000000006b483045022100f8610eae25899663cb5fa9a4575d937da57cdfd41958794bbb4c02f8bed75da40220262d40e019ec3a57b252f4150d509cce6f8a2dbd83184a9fc2ed56aba8018b15012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff0897c8a57e15e7f3893b195d65cf6c6001b29c8c9734213d7a3131f57b9eca2e000000006b483045022100c485cbd6408cf0759bcf23c4154249882934b522a93c6b49e62412305bf7646902201cc4b668af4bb22fe57c32c4d34e822bceb12f6bd6923afdabf4894752a56ec3012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffffdc7000f7c45b62960623fa3a277e8a55348a4fe4936fef1224b6953434a249000000006b4830450221008a51a9c26f475d5c0838afe9d51524f95adfb21a9b0a02eae31cb01dc0a31fab022071c5492fbc7270731d4a4947a69398bf99dd28c65bb69d19910bf53a515274c8012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff10ec2af7e31ca28e27177215904d9a59abf80f0652b24e3f749f14fb7b2264ec000000006b483045022100fe4269f8f5ca53ebcff6fb782142a6228f0e50498a531b7a9c0d54768af9854102207cc740a9ea359569b49d69a94215ce3e23aeda5779cebc434ad3d608e1752990012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff5e3830c088dd6ea412d778b0a700ef27c183cf03e19f3d6f71bc5eaf53b2c22e000000006b4830450221009788a7e7f2407ba2f7c504091fbdf8f8498367781e8a357616d68e2a6770b4e70220518c92f5fb21e6bfd7d870a783b2a5572ce003f2dbb237ec59df419c9a148966012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff51630ccb0ad32b24cc7ae1b3602950ba518dca6aa65ef560e57f08c23eed8d80000000006a47304402201aa556153ffeb13aa674353bf88c04a7af15c7eb32e1a835464e4b613c31dc2802200395858c29a46e9108de1f90b401ee26c296388b4073143b63f849b2cce461af012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff0200e1f5050000000017a914ab802c4d644be63fd1a72834ff63b650d6b5353987bb7e1e00000000001976a91464ae8510aac9546d5e7704e31ce177451386455588ac680e135d000000000000000000000000000000" + }, + "type": "TakerPaymentReceived" + } + ``` + + + #### TakerPaymentWaitConfirmStarted + + The `TakerPaymentReceived` event indicates that maker started waiting for taker payment confirmation. + + This event does not have additional data. + + #### TakerPaymentValidateFailed + + The `TakerPaymentValidateFailed` event indicates that taker payment did not pass validation. For example, taker payment may have an invalid amount or the payment might be locked with a non-matching hash or timestamp. + + When this event occurs maker starts waiting for **maker payment lock time expiration** to issue a refund. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + { + "type": "TakerPaymentValidateFailed", + "data": { + "error": "Origin Taker error event: MakerPaymentWaitConfirmFailed(SwapError { error: \"An error\" })" + } + } + ``` + + + #### TakerPaymentWaitConfirmFailed + + The `MakerPaymentWaitConfirmFailed` event indicates that the taker payment transaction did not reach the required number of confirmations before the internal timeout expiration. + + When this event occurs maker starts waiting for **maker payment lock time expiration** to issue a refund. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + + #### TakerPaymentValidatedAndConfirmed + + The `TakerPaymentValidatedAndConfirmed` event indicates that maker validated taker payment and payment was confirmed the required number of times. + + Maker attempts to spend the taker payment after this event occurs. + + This event does not have additional data. + + #### TakerPaymentSpendFailed + + The `TakerPaymentSpendFailed` event indicates that maker payment was not able to spend taker payment. + + When this event occurs maker starts waiting for **maker payment lock time expiration** to issue a refund. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + { + "type": "TakerPaymentValidatedAndConfirmed" + } + ``` + + + #### TakerPaymentSpent + + The `TakerPaymentSpent` event indicates that maker has broadcast the **taker payment spend** transaction. + + Maker starts waiting for **taker payment spend** confirmation after this event occurs. + + | Structure | Type | Description | + | --------- | ------ | --------------------------------------- | + | tx\_hash | string | the hash of the transaction | + | tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "data": { + "secret": "fb968d5460399f20ffd09906dc8f65c21fbb5cb8077a8e6d7126d0526586ca96", + "transaction": { + "tx_hash": "68f5ec617bd9a4a24d7af0ce9762d87f7baadc13a66739fd4a2575630ecc1827", + "tx_hex": "0400008085202f890161394fc7f1ddcf732f838d7d74e59ed7d968117ac170b3adde9e0404b26a929500000000d8483045022100a33d976cf509d6f9e66c297db30c0f44cced2241ee9c01c5ec8d3cbbf3d41172022039a6e02c3a3c85e3861ab1d2f13ba52677a3b1344483b2ae443723ba5bb1353f0120fb968d5460399f20ffd09906dc8f65c21fbb5cb8077a8e6d7126d0526586ca96004c6b63049858835db1752102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ac6782012088a914eba736c5cc9bb33dee15b4a9c855a7831a484d84882102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ac68ffffffff011880d717000000001976a91464ae8510aac9546d5e7704e31ce177451386455588ac942c835d000000000000000000000000000000" + } + }, + "type": "TakerPaymentSpent" + } + ``` + + + #### TakerPaymentSpendConfirmStarted + + The `TakerPaymentSpendConfirmStarted` event indicates that maker started waiting for **taker payment spend** transaction confirmation. + + This event does not have additional data. + + #### TakerPaymentSpendConfirmFailed + + The `TakerPaymentSpendConfirmFailed` event indicates that the **taker payment spend** transaction did not reach the required number of confirmations before the **maker payment lock time expiration** or the **taker payment spend** transaction rejected for some reason. + + Maker attempts to refund the maker payment. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + + #### TakerPaymentSpendConfirmed + + The `TakerPaymentSpendConfirmed` event indicates that the taker payment spend transaction was confirmed the required number of times. + + The swap finishes immediately when this event occurs. + + This event does not have additional data. + + #### MakerPaymentWaitRefundStarted + + The `MakerPaymentWaitRefundStarted` event indicates that maker started waiting for lock time expiration to refund the payment. + + | Structure | Type | Description | + | ----------- | ---------------------- | ------------------------------------------ | + | wait\_until | number (UTC timestamp) | the timestamp at which a refund will occur | + + + ```json + { + "type": "TakerPaymentSpendConfirmed" + } + ``` + + + #### MakerPaymentRefundFailed + + The `MakerPaymentRefundFailed` event indicates that maker was not able to broadcast a refund transaction to the maker coin blockchain. + + The swap finishes immediately when this event occurs. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + + #### MakerPaymentRefunded + + The `MakerPaymentRefunded` event indicates that maker has broadcast the maker payment refund transaction. + + The swap finishes immediately when this event occurs. + + | Structure | Type | Description | + | --------- | ------ | --------------------------------------- | + | tx\_hash | string | the hash of the transaction | + | tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + TODO: Example TBA + ``` + + + #### Finished + + The `Finished` event indicates that the swap finished. + + This event does not have additional data. + diff --git a/src/pages/atomicdex/api/common_structures/swaps/taker_events/index.mdx b/src/pages/atomicdex/api/common_structures/swaps/taker_events/index.mdx new file mode 100644 index 00000000..4a515d15 --- /dev/null +++ b/src/pages/atomicdex/api/common_structures/swaps/taker_events/index.mdx @@ -0,0 +1,538 @@ +export const title = "Komodo Defi SDK Swaps: Taker Events"; +export const description = "A description of events and outcomes for each step of an atomic swap from the taker's perspective."; + +# Taker Swap Events + + + Needs update for watchtower events + + +## Taker Success Events + +Click on an Event below to view its structure: + +* [Started](/atomicdex/api/common_structures/swaps/taker_events/#started) +* [Negotiated](/atomicdex/api/common_structures/swaps/taker_events/#negotiated) +* [TakerFeeSent](/atomicdex/api/common_structures/swaps/taker_events/#taker-fee-sent) +* [TakerPaymentInstructionsReceived](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-instructions-received) +* [MakerPaymentReceived](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-received) +* [MakerPaymentWaitConfirmStarted](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-wait-confirm-started) +* [MakerPaymentValidatedAndConfirmed](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-validated-and-confirmed) +* [TakerPaymentSent](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-sent) +* [TakerPaymentSpent](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-spent) +* [MakerPaymentSpent](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-spent) +* [Finished](/atomicdex/api/common_structures/swaps/taker_events/#finished) + +## Taker Error Events + +Click on an Event below to view its structure: + +* [StartFailed](/atomicdex/api/common_structures/swaps/taker_events/#start-failed) +* [NegotiateFailed](/atomicdex/api/common_structures/swaps/taker_events/#negotiate-failed) +* [TakerFeeSendFailed](/atomicdex/api/common_structures/swaps/taker_events/#taker-fee-send-failed) +* [MakerPaymentValidateFailed](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-validate-failed) +* [MakerPaymentWaitConfirmFailed](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-wait-confirm-failed) +* [TakerPaymentTransactionFailed](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-transaction-failed) +* [TakerPaymentWaitConfirmFailed](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-wait-confirm-failed) +* [TakerPaymentDataSendFailed](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-data-send-failed) +* [TakerPaymentWaitForSpendFailed](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-wait-for-spend-failed) +* [MakerPaymentSpendFailed](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-spend-failed) +* [TakerPaymentWaitRefundStarted](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-wait-refund-started) +* [TakerPaymentRefundStarted](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-refund-started) +* [TakerPaymentRefunded](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-refunded) +* [TakerPaymentRefundFailed](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-refund-failed) +* [TakerPaymentRefundFinished](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-refund-finished) + + #### Started + + The `Started` event indicates that mandatory pre-checks, such as "available balance," passed and the swap started successfully. + + The swap goes to negotiation stage after this event occurs. + + | Structure | Type | Description | + | ------------------------------ | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | + | taker\_coin | string | the ticker of taker coin | + | maker\_coin | string | the ticker of maker coin | + | maker | string (hexadecimal) | the p2p ID of maker node | + | my\_persistent\_pub | string (hexadecimal) | a persistent secp256k1 public key of taker node | + | lock\_duration | number (integer) | the lock duration of swap payments in seconds. The sender can refund the transaction when the lock duration is passed. The taker payment is locked for the lock duration. The maker payment is locked for lock duration \* 2 | + | maker\_amount | string (numeric) | the amount of coins to be swapped by maker | + | taker\_amount | string (numeric) | the amount of coins to be swapped by taker | + | maker\_payment\_confirmations | number (integer) | the required number of blockchain confirmations for maker payment | + | maker\_payment\_requires\_nota | bool | whether dPoW notarization is required for maker payment; can be null; available since `beta-2.0.1738` | + | taker\_payment\_confirmations | number (integer) | the required number of blockchain confirmations for taker payment | + | taker\_payment\_requires\_nota | bool | whether dPoW notarization is required for taker payment; can be null; available since `beta-2.0.1738` | + | taker\_payment\_lock | number (UTC timestamp in seconds) | the taker payment is locked until this timestamp | + | uuid | string | the swap uuid | + | started\_at | number (UTC timestamp in seconds) | the timestamp at the start of the swap | + | maker\_payment\_wait | number (UTC timestamp in seconds) | taker will wait for maker payment confirmation until this timestamp | + | maker\_coin\_start\_block | number (integer) | the maker coin block number at the start of the swap | + | taker\_coin\_start\_block | number (integer) | the taker coin block number at the start of the swap | + + + ```json + { + "type": "Started", + "data": { + "taker_coin": "MARTY", + "maker_coin": "DOC", + "maker": "7310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5", + "my_persistent_pub": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2", + "lock_duration": 7800, + "maker_amount": "1", + "taker_amount": "1", + "maker_payment_confirmations": 1, + "maker_payment_requires_nota": false, + "taker_payment_confirmations": 0, + "taker_payment_requires_nota": false, + "taker_payment_lock": 1674809878, + "uuid": "0d72c435-821e-4278-b2a7-e36ab1ba8cb7", + "started_at": 1674802078, + "maker_payment_wait": 1674805198, + "maker_coin_start_block": 1800637, + "taker_coin_start_block": 1813161, + "fee_to_send_taker_fee": { + "coin": "MARTY", + "amount": "0.00001", + "paid_from_trading_vol": false + }, + "taker_payment_trade_fee": { + "coin": "MARTY", + "amount": "0.00002", + "paid_from_trading_vol": false + }, + "maker_payment_spend_trade_fee": { + "coin": "DOC", + "amount": "0.00001", + "paid_from_trading_vol": true + }, + "maker_coin_htlc_pubkey": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2", + "taker_coin_htlc_pubkey": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2", + "p2p_privkey": null + } + } + ``` + + +#### StartFailed + +The `StartFailed` event indicates that some of the pre-checks did not pass, and therefore the swap did not start. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### Negotiated + +The `Negotiated` event indicates that taker has received and validated swap negotiation data from maker. + +Taker sends dex fee after this event occurs. + +| Structure | Type | Description | +| ------------------------ | --------------------------------- | ----------------------------------------------------------------- | +| maker\_payment\_locktime | number (UTC timestamp in seconds) | the maker payment is locked until this timestamp | +| maker\_pubkey | string (hexadecimal) | a persistent secp256k1 public key of maker node | +| secret\_hash | string (hexadecimal) | the swap payments are expected to be locked with this secret hash | + + + ```json + { + "type": "Negotiated", + "data": { + "maker_payment_locktime": 1639000040, + "maker_pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "secret_hash": "4da9e7080175e8e10842e0e161b33cd298cab30b", + "maker_coin_swap_contract_addr": null, + "taker_coin_swap_contract_addr": null + } + } + ``` + + +#### NegotiateFailed + +The `NegotiateFailed` event indicates that maker negotiation data was not received or did not pass validation. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + { + "data": { + "error": "taker_swap:547] \"taker_swap:543] timeout (180.0 > 180.0)\"" + }, + "type": "NegotiateFailed" + } + ``` + + +#### TakerFeeSent + +The `TakerFeeSent` event indicates that taker broadcast the dex fee transaction. + +Taker starts waiting for maker payment after this event occurs. + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| tx\_hash | string | the hash of the transaction | +| tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "type": "TakerFeeSent", + "data": { + "tx_hex": "0400008085202f8901f425fbefe21f33ccb7b487df251191b27dfa7b639b04f60e5493c7ea41dbf149000000006b483045022100d5ec3e542175479bd4bd011e19b76a75e99f19cc49867e5bca9541950322c33a02207a4d1ffd674fb9760de79bb4929af44d66344b5e182de3c377186deebf6bf376012103ad6f89abc2e5beaa8a3ac28e22170659b3209fe2ddf439681b4b8f31508c36faffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac5ce6f305000000001976a914d55f0df6cb82630ad21a4e6049522a6f2b6c9d4588ac7c152160000000000000000000000000000000", + "tx_hash": "75323ab7acd64bd35242611fabaec560d9acf2e1f9ca28d3a4aba47a79fb49c4" + } + } + ``` + + +#### TakerFeeSendFailed + +The `TakerFeeSendFailed` event indicates that the taker dex fee transaction failed to broadcast to the taker coin blockchain, or that the taker failed to send the transaction data to maker. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### TakerPaymentInstructionsReceived + +The `TakerPaymentInstructionsReceived` event indicates that the taker has received payment instructions. + +This event does not have additional data. + + + ```json + { + "type": "TakerPaymentInstructionsReceived", + "data": null + } + ``` + + +#### MakerPaymentValidateFailed + +The `MakerPaymentValidateFailed` event indicates that taker was not able to receive or validate the maker payment transaction. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### MakerPaymentReceived + +The `MakerPaymentReceived` event indicates that taker received the maker payment transaction data. + +Taker starts waiting for transaction confirmation after this event occurs. + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| tx\_hash | string | the hash of the transaction | +| tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "type": "MakerPaymentReceived", + "data": { + "tx_hex": "0400008085202f89028bef955e42107c562e4e02421f25c455723a701573f86c17b4d82e35a7d8f9f7020000006b483045022100b12fc9d95acca76bf5fd8d5c6acc288b454032ba4561b1c2b1f5f33b2cf2926d022017e561bc2cd93308848674b47b2e8ebd8f074ea78e32454d5fea6f08c0b1f1e40121037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ffffffff5dfd0b24c0f7c3cf235868cf9a26ec49574764d135796fc4e7d20e95d55a8653000000006a47304402207c752d14601d1c99892f9d6c88c8ff2f93211640a65b2ee69172a16b908b21e402206f0b66684158445888271a849ab46258ad722496ee64fde055a6f44e36ed2ccc0121037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ffffffff0300e1f5050000000017a9141b85c1a277f44f7d77d52b78e2ba70a0becc2ff9870000000000000000166a14026bebc2e19c243d0940dd583c9573bf10377afda7d26301000000001976a91486f747b28c60ad1130bdd3f84f48eeaf1801ca9888ac87152160000000000000000000000000000000", + "tx_hash": "27dafe553246553d54f909fbbded80e6d490fdb95ca7b6807d73eca45f0d7a22" + } + } + ``` + + +#### MakerPaymentWaitConfirmStarted + +The `MakerPaymentWaitConfirmStarted` event indicates that taker started waiting for maker payment confirmation. + +This event does not have additional data. + +#### MakerPaymentWaitConfirmFailed + +The `MakerPaymentWaitConfirmFailed` event indicates that the maker payment transaction did not reach the required number of confirmations before the internal timeout expiration. + +Taker swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + { + "type": "MakerPaymentWaitConfirmStarted" + } + ``` + + +#### MakerPaymentValidatedAndConfirmed + +The `MakerPaymentValidatedAndConfirmed` event indicates that taker validated maker payment and the payment was confirmed the required number of times. + +Taker sends his payment after this event occurs. + +This event does not have additional data. + + + ```json + { + "type": "MakerPaymentValidatedAndConfirmed" + } + ``` + + +#### TakerPaymentSent + +The `TakerPaymentSent` event indicates that taker broadcast taker payment transaction to taker coin blockchain. + +Taker starts waiting for maker to spend this transaction. + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| tx\_hash | string | the hash of the transaction | +| tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "data": { + "tx_hash": "95926ab204049edeadb370c17a1168d9d79ee5747d8d832f73cfddf1c74f3961", + "tx_hex": "0400008085202f8902875f5e5428c8ecfeb58c558dce6353f5127ef2a06a497453d7d888da4dbe070c010000006a4730440220416059356dc6dde0ddbee206e456698d7e54c3afa92132ecbf332e8c937e5383022068a41d9c208e8812204d4b0d21749b2684d0eea513467295e359e03c5132e719012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff46b98696761d5e8667ffd665b73e13a8400baab4b22230a7ede0e4708597ee9c010000006b483045022100a990c798d0f96fd5ff7029fd5318f3c742837400d9f09a002e7f5bb1aeaf4e5a0220517dbc16713411e5c99bb0172f295a54c97aaf4d64de145eb3c5fa0fc38b67ff012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff020084d7170000000017a9144d57b4930e6c86493034f17aa05464773625de1c877bd0de03010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8c3a835d000000000000000000000000000000" + }, + "type": "TakerPaymentSent" + } + ``` + + +#### TakerPaymentTransactionFailed + +The `TakerPaymentTransactionFailed` event indicates that taker failed to broadcast transaction to taker coin blockchain. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### TakerPaymentWaitConfirmFailed + +The `TakerPaymentWaitConfirmFailed` event indicates that the taker payment transaction did not reach the required number of confirmations before the internal timeout expiration. + +When this event occurs taker starts waiting for taker payment lock time expiration to issue a refund. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### TakerPaymentDataSendFailed + +The `TakerPaymentDataSendFailed` event indicates that taker was not able to send his payment data to maker due to a network error. + +When this event occurs taker starts waiting for taker payment lock time expiration to issue a refund. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### TakerPaymentSpent + +The `TakerPaymentSpent` event indicates that maker spent taker payment and taker discovered the transaction. + +When this event occurs taker extracts the secret from the transaction and attempts to spend maker payment. + +| Structure | Type | Description | +| -------------------- | ------ | ---------------------------------------------------------- | +| secret | string | the atomic swap secret extracted from spending transaction | +| transaction | object | transaction object | +| transaction.tx\_hash | string | the hash of the transaction | +| transaction.tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "data": { + "secret": "fb968d5460399f20ffd09906dc8f65c21fbb5cb8077a8e6d7126d0526586ca96", + "transaction": { + "tx_hash": "68f5ec617bd9a4a24d7af0ce9762d87f7baadc13a66739fd4a2575630ecc1827", + "tx_hex": "0400008085202f890161394fc7f1ddcf732f838d7d74e59ed7d968117ac170b3adde9e0404b26a929500000000d8483045022100a33d976cf509d6f9e66c297db30c0f44cced2241ee9c01c5ec8d3cbbf3d41172022039a6e02c3a3c85e3861ab1d2f13ba52677a3b1344483b2ae443723ba5bb1353f0120fb968d5460399f20ffd09906dc8f65c21fbb5cb8077a8e6d7126d0526586ca96004c6b63049858835db1752102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ac6782012088a914eba736c5cc9bb33dee15b4a9c855a7831a484d84882102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ac68ffffffff011880d717000000001976a91464ae8510aac9546d5e7704e31ce177451386455588ac942c835d000000000000000000000000000000" + } + }, + "type": "TakerPaymentSpent" + } + ``` + + +#### TakerPaymentWaitForSpendFailed + +The `TakerPaymentWaitForSpendFailed` event indicates that maker did not spend taker payment before lock time expiration. + +When this event occurs taker attempts to refund the payment. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### MakerPaymentSpendFailed + +The `MakerPaymentSpendFailed` event indicates that taker failed to broadcast **maker payment spend** transaction to the maker coin blockchain. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + { + "data": { + "error": "taker_swap:798] utxo:950] utxo:950] error" + }, + "type": "MakerPaymentSpendFailed" + } + ``` + + +#### MakerPaymentSpent + +The `MakerPaymentSpent` event indicates that taker spent maker payment. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| tx\_hash | string | the hash of the transaction | +| tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "type": "MakerPaymentSpent", + "data": { + "tx_hex": "0400008085202f890180cf0d2057acf781f5854b576080842641ff56d6f0457258f2a15710fa35958700000000d74730440220159ac3c574bed4473bd6da6eb4b37a3c073dbe5311a4648795f2b0c02b68ef8d022034bc743cbe656b3d335a138f21093fcc9039f50bff40cf56e2654eb9eb225ca901201e2e0289634d42865e0f82ff0546ce2a384ae3548fb3f927c4aa1faefb0aa5d4004c6b63048cb0d363b17521037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ac6782012088a9149af6a305578518d693fca3f1e4c529224a81f654882103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ac68ffffffff0118ddf505000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88ac8cb0d363000000000000000000000000000000", + "tx_hash": "02c6bc927712478b866c3303cfdfacb868545a6730513605d4d7b5b2dbe97b09" + } + } + ``` + + +#### TakerPaymentWaitRefundStarted + +`TakerPaymentWaitRefundStarted` event indicates that taker started waiting for lock time expiration to refund the payment. + +| Structure | Type | Description | +| ----------- | ---------------------- | ------------------------------------------ | +| wait\_until | number (UTC timestamp) | the timestamp at which a refund will occur | + + + ```json + ``` + + +#### TakerPaymentRefundStarted + +`TakerPaymentRefundStarted` event indicates that taker was has initiated the refund process. + + + ```json + TODO: Table and Example TBA + ``` + + +#### TakerPaymentRefundFailed + +`TakerPaymentRefundFailed` event indicates that taker was not able to broadcast a refund transaction to taker coin blockchain. +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### TakerPaymentRefunded + +The `TakerPaymentRefunded` event indicates that taker broadcast the taker payment refund transaction. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| tx\_hash | string | the hash of the transaction | +| tx\_hex | string | transaction bytes in hexadecimal format | + +#### TakerPaymentRefundFinished + +The `TakerPaymentRefundFinished` event indicates that taker refund process is complete. + +The swap finishes immediately when this event occurs. This event does not have additional data. + + + ```json + TODO: Example TBA + ``` + + +#### Finished + +The `Finished` event indicates that the swap finished. + +This event does not have additional data. diff --git a/src/pages/atomicdex/api/legacy/convertaddress/index.mdx b/src/pages/atomicdex/api/legacy/convertaddress/index.mdx index d4b15e3b..37e4d356 100644 --- a/src/pages/atomicdex/api/legacy/convertaddress/index.mdx +++ b/src/pages/atomicdex/api/legacy/convertaddress/index.mdx @@ -13,11 +13,11 @@ Or this can be used to convert an ETH address from single to mixed case checksum ## Arguments -| Structure | Type | Description | -| ------------------- | ------ | ------------------------------------------------------------- | -| coin | string | the name of the coin address context | -| from | string | input address | -| to\_address\_format | object | address format to which the input address should be converted | +| Structure | Type | Description | +| ------------------- | ------ | ----------------------------------------------------------------------------------- | +| coin | string | the name of the coin address context | +| from | string | input address | +| to\_address\_format | object | A standard [AddressFormat](/atomicdex/api/common_structures/#address-format) object | ## Response diff --git a/src/pages/atomicdex/api/legacy/min_trading_vol/index.mdx b/src/pages/atomicdex/api/legacy/min_trading_vol/index.mdx index 340bd7fb..8b35785b 100644 --- a/src/pages/atomicdex/api/legacy/min_trading_vol/index.mdx +++ b/src/pages/atomicdex/api/legacy/min_trading_vol/index.mdx @@ -15,13 +15,13 @@ The `min_trading_vol` method returns the minimum required volume for buy/sell/se #### Response -| Structure | Type | Description | -| ---------------------------------- | ---------------- | --------------------------------------------------------------- | -| result | object | result object | -| result.coin | string | the coin ticker from the request | -| result.min\_trading\_vol | string (decimal) | the minimum trading volume threshold in decimal representation | -| result.min\_trading\_vol\_rat | rational | the minimum trading volume threshold in rational representation | -| result.min\_trading\_vol\_fraction | fraction | the minimum trading volume threshold in fraction representation | +| Structure | Type | Description | +| --------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| result | object | result object | +| coin | string | the coin ticker from the request | +| min\_trading\_vol | string (decimal) | the minimum trading volume threshold in decimal representation | +| min\_trading\_vol\_rat | rational | the minimum trading volume threshold represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object | +| min\_trading\_vol\_fraction | fraction | the minimum trading volume threshold represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/my_recent_swaps/index.mdx b/src/pages/atomicdex/api/legacy/my_recent_swaps/index.mdx index e30b552a..08e29d55 100644 --- a/src/pages/atomicdex/api/legacy/my_recent_swaps/index.mdx +++ b/src/pages/atomicdex/api/legacy/my_recent_swaps/index.mdx @@ -23,7 +23,7 @@ The `my_recent_swaps` method returns the data of the most recent atomic swaps ex | Structure | Type | Description | | -------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| swaps | array of objects | swaps data; each record has the format of the `my_swap_status` response | +| swaps | array of objects | A list of standard [SwapStatus](/atomicdex/api/common_structures/swaps/#swap-status) objects | | from\_uuid | string | the from\_uuid that was set in the request; this value is null if nothing was set | | skipped | number | the number of skipped records (i.e. the position of `from_uuid` in the list + 1 or `(page_number - 1) * limit`; the value is 0 if `from_uuid` or `page_number` were not set or `page_number` is 1) | | limit | number | the limit that was set in the request; note that the actual number of swaps can differ from the specified limit (e.g. on the last page) | diff --git a/src/pages/atomicdex/api/legacy/my_swap_status/index.mdx b/src/pages/atomicdex/api/legacy/my_swap_status/index.mdx index 8f8d3953..5a99f28e 100644 --- a/src/pages/atomicdex/api/legacy/my_swap_status/index.mdx +++ b/src/pages/atomicdex/api/legacy/my_swap_status/index.mdx @@ -17,9 +17,7 @@ The `my_swap_status` method returns the data of an atomic swap executed on an At | Structure | Type | Description | | --------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| events | array of objects | the events that occurred during the swap | -| events.type | string | an event type; the list of event types with their data structure is available below | -| events.data | object | additional data of the event; the list of events with their data structure is available below | +| events | array of objects | A standard [SwapEvent](/atomicdex/api/common_structures/swaps/#swap-event) object. Events which occurred for a swap. See [Maker Events](/atomicdex/api/common_structures/swaps/maker_events/) and [Taker Events](/atomicdex/api/common_structures/swaps/maker_events/) for more info. | | success\_events | array of strings | a list of events that gained a `success` swap state; the contents are listed in the order in which they should occur in the `events` array | | error\_events | array of strings | a list of events that fell into an `error` swap state; if at least 1 of the events happens, the swap is considered a failure | | type | string | whether the node acted as a market `Maker` or `Taker` | @@ -34,501 +32,6 @@ The `my_swap_status` method returns the data of an atomic swap executed on an At | recoverable | bool | whether the swap can be recovered using the `recover_funds_of_swap` API command. Important note: The AtomicDEX API does not record the state regarding whether the swap was recovered or not. The AtomicDEX API allows as many calls to the `recover_funds_of_swap` method as necessary, in case of errors | | my\_order\_uuid | string (uuid, optional) | the uuid of order that matched to start the swap | -#### Maker Swap Events - - - ##### Started - - The `Started` event indicates that mandatory pre-checks passed, such as "available balance," and that the swap started successfully. - - The swap goes to the negotiation stage after this event occurs. - - | Structure | Type | Description | - | ------------------------------ | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | taker\_coin | string | the ticker of the taker coin | - | maker\_coin | string | the ticker of the maker coin | - | taker | string (hexadecimal) | the p2p ID of taker node | - | secret | string (hexadecimal) | a random secret, the hash of which is used to lock atomic-swap payments | - | secret\_hash | string (hexadecimal) | the hash of the swap secret | - | my\_persistent\_pub | string (hexadecimal) | a persistent secp256k1 public key of maker node | - | lock\_duration | number (integer) | the lock duration of swap payments in seconds. The sender can refund the transaction when the lock duration is passed. The taker payment is locked for the lock duration. The maker payment is locked for lock duration \* 2 | - | maker\_amount | string (numeric) | the amount of coins to be swapped by maker | - | taker\_amount | string (numeric) | the amount of coins to be swapped by taker | - | maker\_payment\_confirmations | number (integer) | the required number of blockchain confirmations for maker payment | - | maker\_payment\_requires\_nota | bool | whether dPoW notarization is required for maker payment; can be null; available since `beta-2.0.1738` | - | taker\_payment\_confirmations | number (integer) | the required number of blockchain confirmations for taker payment | - | taker\_payment\_requires\_nota | bool | whether dPoW notarization is required for taker payment; can be null; available since `beta-2.0.1738` | - | maker\_payment\_lock | number (UTC timestamp in seconds) | the maker payment is locked until this timestamp | - | uuid | string | the swap uuid | - | started\_at | number (UTC timestamp in seconds) | the timestamp at the start of the swap | - | maker\_coin\_start\_block | number (integer) | the maker coin block number at the start of the swap | - | taker\_coin\_start\_block | number (integer) | the taker coin block number at the start of the swap | - - ##### StartFailed - - The `StartFailed` event indicates that some of the pre-checks did not pass, and therefore the swap did not start. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### Negotiated - - The `Negotiated` event indicates that maker has received and validated swap negotiation data from taker. - - Maker starts waiting for taker to send the dex fee after this event occurs. - - | Structure | Type | Description | - | ------------------------ | --------------------------------- | ------------------------------------------------ | - | taker\_payment\_locktime | number (UTC timestamp in seconds) | the taker payment is locked until this timestamp | - | taker\_pubkey | string (hexadecimal) | a persistent secp256k1 public key of taker node | - - ##### NegotiateFailed - - The `NegotiateFailed` event indicates that taker negotiation data was not received or did not pass validation. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### TakerFeeValidated - - The `TakerFeeValidated` event indicates that maker received and validated dex fee data from taker. - - Maker sends their payment after this event occurs. - - | Structure | Type | Description | - | --------- | ------ | --------------------------------------- | - | tx\_hash | string | the hash of the transaction | - | tx\_hex | string | transaction bytes in hexadecimal format | - - ##### TakerFeeValidateFailed - - The `TakerFeeValidateFailed` event indicates that taker dex fee data was not received or did not pass validation. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### MakerPaymentTransactionFailed - - The `MakerPaymentTransactionFailed` event indicates that maker was not able to broadcast his payment transaction to maker coin blockchain. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### MakerPaymentSent - - The `MakerPaymentSent` event indicates that maker has broadcast the maker payment transaction. - - Maker starts waiting for taker to send his payment after this event occurs. - - | Structure | Type | Description | - | --------- | ------ | --------------------------------------- | - | tx\_hash | string | the hash of the transaction | - | tx\_hex | string | transaction bytes in hexadecimal format | - - ##### MakerPaymentDataSendFailed - - The `MakerPaymentDataSendFailed` event indicates that maker was not able to send his payment data to taker due to a network error. - When this event occurs, maker starts waiting for **maker payment lock time expiration** to issue a refund. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### MakerPaymentWaitConfirmFailed - - The `MakerPaymentWaitConfirmFailed` event indicates that maker payment transaction did not reach the required number of confirmations before the internal timeout expiration. - - When this event occurs maker starts waiting for **maker payment lock time expiration** to issue a refund. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### TakerPaymentReceived - - The `TakerPaymentReceived` event indicates that maker received the taker payment transaction data. - - Maker starts waiting for taker payment confirmation after this event occurs. - - | Structure | Type | Description | - | --------- | ------ | --------------------------------------- | - | tx\_hash | string | the hash of the transaction | - | tx\_hex | string | transaction bytes in hexadecimal format | - - ##### TakerPaymentWaitConfirmStarted - - The `TakerPaymentReceived` event indicates that maker started waiting for taker payment confirmation. - - This event does not have additional data. - - ##### TakerPaymentValidateFailed - - The `TakerPaymentValidateFailed` event indicates that taker payment did not pass validation. For example, taker payment may have an invalid amount or the payment might be locked with a non-matching hash or timestamp. - - When this event occurs maker starts waiting for **maker payment lock time expiration** to issue a refund. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### TakerPaymentWaitConfirmFailed - - The `MakerPaymentWaitConfirmFailed` event indicates that the taker payment transaction did not reach the required number of confirmations before the internal timeout expiration. - - When this event occurs maker starts waiting for **maker payment lock time expiration** to issue a refund. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### TakerPaymentValidatedAndConfirmed - - The `TakerPaymentValidatedAndConfirmed` event indicates that maker validated taker payment and payment was confirmed the required number of times. - - Maker attempts to spend the taker payment after this event occurs. - - This event does not have additional data. - - ##### TakerPaymentSpendFailed - - The `TakerPaymentSpendFailed` event indicates that maker payment was not able to spend taker payment. - - When this event occurs maker starts waiting for **maker payment lock time expiration** to issue a refund. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### TakerPaymentSpent - - The `TakerPaymentSpent` event indicates that maker has broadcast the **taker payment spend** transaction. - - Maker starts waiting for **taker payment spend** confirmation after this event occurs. - - | Structure | Type | Description | - | --------- | ------ | --------------------------------------- | - | tx\_hash | string | the hash of the transaction | - | tx\_hex | string | transaction bytes in hexadecimal format | - - ##### TakerPaymentSpendConfirmStarted - - The `TakerPaymentSpendConfirmStarted` event indicates that maker started waiting for **taker payment spend** transaction confirmation. - - This event does not have additional data. - - ##### TakerPaymentSpendConfirmFailed - - The `TakerPaymentSpendConfirmFailed` event indicates that the **taker payment spend** transaction did not reach the required number of confirmations before the **maker payment lock time expiration** or the **taker payment spend** transaction rejected for some reason. - - Maker attempts to refund the maker payment. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### TakerPaymentSpendConfirmed - - The `TakerPaymentSpendConfirmed` event indicates that the taker payment spend transaction was confirmed the required number of times. - - The swap finishes immediately when this event occurs. - - This event does not have additional data. - - ##### MakerPaymentWaitRefundStarted - - The `MakerPaymentWaitRefundStarted` event indicates that maker started waiting for lock time expiration to refund the payment. - - | Structure | Type | Description | - | ----------- | ---------------------- | ------------------------------------------ | - | wait\_until | number (UTC timestamp) | the timestamp at which a refund will occur | - - ##### MakerPaymentRefundFailed - - The `MakerPaymentRefundFailed` event indicates that maker was not able to broadcast a refund transaction to the maker coin blockchain. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### MakerPaymentRefunded - - The `MakerPaymentRefunded` event indicates that maker has broadcast the maker payment refund transaction. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | --------------------------------------- | - | tx\_hash | string | the hash of the transaction | - | tx\_hex | string | transaction bytes in hexadecimal format | - - ##### Finished - - The `Finished` event indicates that the swap finished. - - This event does not have additional data. - - -#### Taker Swap Events - - - ##### Started - - The `Started` event indicates that mandatory pre-checks, such as "available balance," passed and the swap started successfully. - - The swap goes to negotiation stage after this event occurs. - - | Structure | Type | Description | - | ------------------------------ | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - | taker\_coin | string | the ticker of taker coin | - | maker\_coin | string | the ticker of maker coin | - | maker | string (hexadecimal) | the p2p ID of maker node | - | my\_persistent\_pub | string (hexadecimal) | a persistent secp256k1 public key of taker node | - | lock\_duration | number (integer) | the lock duration of swap payments in seconds. The sender can refund the transaction when the lock duration is passed. The taker payment is locked for the lock duration. The maker payment is locked for lock duration \* 2 | - | maker\_amount | string (numeric) | the amount of coins to be swapped by maker | - | taker\_amount | string (numeric) | the amount of coins to be swapped by taker | - | maker\_payment\_confirmations | number (integer) | the required number of blockchain confirmations for maker payment | - | maker\_payment\_requires\_nota | bool | whether dPoW notarization is required for maker payment; can be null; available since `beta-2.0.1738` | - | taker\_payment\_confirmations | number (integer) | the required number of blockchain confirmations for taker payment | - | taker\_payment\_requires\_nota | bool | whether dPoW notarization is required for taker payment; can be null; available since `beta-2.0.1738` | - | taker\_payment\_lock | number (UTC timestamp in seconds) | the taker payment is locked until this timestamp | - | uuid | string | the swap uuid | - | started\_at | number (UTC timestamp in seconds) | the timestamp at the start of the swap | - | maker\_payment\_wait | number (UTC timestamp in seconds) | taker will wait for maker payment confirmation until this timestamp | - | maker\_coin\_start\_block | number (integer) | the maker coin block number at the start of the swap | - | taker\_coin\_start\_block | number (integer) | the taker coin block number at the start of the swap | - - ##### StartFailed - - The `StartFailed` event indicates that some of the pre-checks did not pass, and therefore the swap did not start. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### Negotiated - - The `Negotiated` event indicates that taker has received and validated swap negotiation data from maker. - - Taker sends dex fee after this event occurs. - - | Structure | Type | Description | - | ------------------------ | --------------------------------- | ----------------------------------------------------------------- | - | maker\_payment\_locktime | number (UTC timestamp in seconds) | the maker payment is locked until this timestamp | - | maker\_pubkey | string (hexadecimal) | a persistent secp256k1 public key of maker node | - | secret\_hash | string (hexadecimal) | the swap payments are expected to be locked with this secret hash | - - ##### NegotiateFailed - - The `NegotiateFailed` event indicates that maker negotiation data was not received or did not pass validation. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### TakerFeeSent - - The `TakerFeeSent` event indicates that taker broadcast the dex fee transaction. - - Taker starts waiting for maker payment after this event occurs. - - | Structure | Type | Description | - | --------- | ------ | --------------------------------------- | - | tx\_hash | string | the hash of the transaction | - | tx\_hex | string | transaction bytes in hexadecimal format | - - ##### TakerFeeSendFailed - - The `TakerFeeSendFailed` event indicates that the taker dex fee transaction failed to broadcast to the taker coin blockchain, or that the taker failed to send the transaction data to maker. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### MakerPaymentValidateFailed - - The `MakerPaymentValidateFailed` event indicates that taker was not able to receive or validate the maker payment transaction. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### MakerPaymentReceived - - The `MakerPaymentReceived` event indicates that taker received the maker payment transaction data. - - Taker starts waiting for transaction confirmation after this event occurs. - - | Structure | Type | Description | - | --------- | ------ | --------------------------------------- | - | tx\_hash | string | the hash of the transaction | - | tx\_hex | string | transaction bytes in hexadecimal format | - - ##### MakerPaymentWaitConfirmStarted - - The `MakerPaymentWaitConfirmStarted` event indicates that taker started waiting for maker payment confirmation. - - This event does not have additional data. - - ##### MakerPaymentWaitConfirmFailed - - The `MakerPaymentWaitConfirmFailed` event indicates that the maker payment transaction did not reach the required number of confirmations before the internal timeout expiration. - - Taker swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### MakerPaymentValidatedAndConfirmed - - The `MakerPaymentValidatedAndConfirmed` event indicates that taker validated maker payment and the payment was confirmed the required number of times. - - Taker sends his payment after this event occurs. - - This event does not have additional data. - - ##### TakerPaymentSent - - The `TakerPaymentSent` event indicates that taker broadcast taker payment transaction to taker coin blockchain. - - Taker starts waiting for maker to spend this transaction. - - | Structure | Type | Description | - | --------- | ------ | --------------------------------------- | - | tx\_hash | string | the hash of the transaction | - | tx\_hex | string | transaction bytes in hexadecimal format | - - ##### TakerPaymentTransactionFailed - - The `TakerPaymentTransactionFailed` event indicates that taker failed to broadcast transaction to taker coin blockchain. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### TakerPaymentWaitConfirmFailed - - The `TakerPaymentWaitConfirmFailed` event indicates that the taker payment transaction did not reach the required number of confirmations before the internal timeout expiration. - - When this event occurs taker starts waiting for taker payment lock time expiration to issue a refund. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### TakerPaymentDataSendFailed - - The `TakerPaymentDataSendFailed` event indicates that taker was not able to send his payment data to maker due to a network error. - - When this event occurs taker starts waiting for taker payment lock time expiration to issue a refund. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### TakerPaymentSpent - - The `TakerPaymentSpent` event indicates that maker spent taker payment and taker discovered the transaction. - - When this event occurs taker extracts the secret from the transaction and attempts to spend maker payment. - - | Structure | Type | Description | - | -------------------- | ------ | ---------------------------------------------------------- | - | secret | string | the atomic swap secret extracted from spending transaction | - | transaction | object | transaction object | - | transaction.tx\_hash | string | the hash of the transaction | - | transaction.tx\_hex | string | transaction bytes in hexadecimal format | - - ##### TakerPaymentWaitForSpendFailed - - The `TakerPaymentWaitForSpendFailed` event indicates that maker did not spend taker payment before lock time expiration. - - When this event occurs taker attempts to refund the payment. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### MakerPaymentSpendFailed - - The `MakerPaymentSpendFailed` event indicates that taker failed to broadcast **maker payment spend** transaction to the maker coin blockchain. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### MakerPaymentSpent - - The `MakerPaymentSpent` event indicates that taker spent maker payment. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | --------------------------------------- | - | tx\_hash | string | the hash of the transaction | - | tx\_hex | string | transaction bytes in hexadecimal format | - - ##### TakerPaymentWaitRefundStarted - - `TakerPaymentWaitRefundStarted` event indicates that taker started waiting for lock time expiration to refund the payment. - - | Structure | Type | Description | - | ----------- | ---------------------- | ------------------------------------------ | - | wait\_until | number (UTC timestamp) | the timestamp at which a refund will occur | - - ##### TakerPaymentRefundFailed - - `TakerPaymentRefundFailed` event indicates that taker was not able to broadcast a refund transaction to taker coin blockchain. - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | ---------------------------------- | - | error | string | error description with stack trace | - - ##### TakerPaymentRefunded - - The `TakerPaymentRefunded` event indicates that taker broadcast the taker payment refund transaction. - - The swap finishes immediately when this event occurs. - - | Structure | Type | Description | - | --------- | ------ | --------------------------------------- | - | tx\_hash | string | the hash of the transaction | - | tx\_hex | string | transaction bytes in hexadecimal format | - - ##### Finished - - The `Finished` event indicates that the swap finished. - - This event does not have additional data. - - #### 📌 Examples #### Command From 84971be15ec7b99a1207da5ce2fc2da2fe03ab0c Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 5 Oct 2023 08:07:46 +0800 Subject: [PATCH 14/27] update order structures --- .../api/common_structures/orders/index.mdx | 99 ++++++++++++++++++- .../api/legacy/best_orders/index.mdx | 2 +- .../api/legacy/order_status/index.mdx | 23 +---- .../atomicdex/api/legacy/orderbook/index.mdx | 65 ++---------- 4 files changed, 112 insertions(+), 77 deletions(-) diff --git a/src/pages/atomicdex/api/common_structures/orders/index.mdx b/src/pages/atomicdex/api/common_structures/orders/index.mdx index de3a5717..27b3d971 100644 --- a/src/pages/atomicdex/api/common_structures/orders/index.mdx +++ b/src/pages/atomicdex/api/common_structures/orders/index.mdx @@ -88,7 +88,104 @@ export const description = "Each order on the Komodo Defi oderbook can be querie ``` -### TickerBestOrderV1 + +### OrderData + +| Structure | Type | Description | +| ----------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| base | string | base currency | +| rel | string | rel currency | +| price | number | order price as decimal number | +| price\_rat | rational number | order price as rational number | +| max\_base\_vol | number | Maximum trade volume | +| max\_base\_vol\_rat | rational number | Maximum trade volume as rational number | +| min\_base\_vol | number | Minimum trade volume | +| min\_base\_vol\_rat | rational number | Minimum trade volume as rational number | +| created\_at | number | timestamp of order creation | +| updated\_at | number | timestamp of last order update | +| matches | list | UUIDS of matching orders | +| started\_swaps | list | UUIDS of swaps started | +| uuid | string | UUID of this order | +| conf\_settings | object | Confirmation / Notarisation settings for order | +| base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | +| rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | +| cancellable | boolean | `true` if order is in a state which it can be cancelled. `false` if not (e.g. swap is in progress) | +| cancellation\_reason | string | `Cancelled` indicates order was withdrawn by user. `Fulfilled` indicates order was swapped successfully. `TimedOut` indicates a taker order with type `FillOrKill` expired before matching. | +| available\_amount | string | Funds available for order to be matched against, taking into account current spendable balance and `max_volume` | + + + + ```json + { + "available_amount": "1", + "base": "BEER", + "cancellable": true, + "created_at": 1568808684710, + "matches": { + "60aaacca-ed31-4633-9326-c9757ea4cf78": { + "connect": { + "dest_pub_key": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "maker_order_uuid": "fedd5261-a57e-4cbf-80ac-b3507045e140", + "method": "connect", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "taker_order_uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + }, + "connected": { + "dest_pub_key": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "maker_order_uuid": "fedd5261-a57e-4cbf-80ac-b3507045e140", + "method": "connected", + "sender_pubkey": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "taker_order_uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + }, + "last_updated": 1560529572571, + "request": { + "action": "Buy", + "base": "BEER", + "base_amount": "1", + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000", + "method": "request", + "rel": "PIZZA", + "rel_amount": "1", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + }, + "reserved": { + "base": "BEER", + "base_amount": "1", + "dest_pub_key": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "maker_order_uuid": "fedd5261-a57e-4cbf-80ac-b3507045e140", + "method": "reserved", + "rel": "PIZZA", + "rel_amount": "1", + "sender_pubkey": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "taker_order_uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + } + } + }, + "max_base_vol": "1", + "max_base_vol_rat": [ + [1, [1]], + [1, [1]] + ], + "min_base_vol": "0", + "min_base_vol_rat": [ + [0, []], + [1, [1]] + ], + "price": "1", + "price_rat": [ + [1, [1]], + [1, [1]] + ], + "rel": "ETOMIC", + "started_swaps": ["60aaacca-ed31-4633-9326-c9757ea4cf78"], + "uuid": "ea77dcc3-a711-4c3d-ac36-d45fc5e1ee0c" + } + ``` + + + +### OrderDataV1 | Structure | Type | Description | | --------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/src/pages/atomicdex/api/legacy/best_orders/index.mdx b/src/pages/atomicdex/api/legacy/best_orders/index.mdx index e8883cc1..f7b01328 100644 --- a/src/pages/atomicdex/api/legacy/best_orders/index.mdx +++ b/src/pages/atomicdex/api/legacy/best_orders/index.mdx @@ -24,7 +24,7 @@ The `best_orders` method returns the best price orders that can fill the volume | Structure | Type | Description | | --------- | ------------ | -------------------------------------------------------------------------------------------------- | -| result | object (map) | A map of standard [TickerBestOrderV1](/atomicdex/api/common_structures/orders) objects (by ticker) | +| result | object (map) | A map of standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects (by ticker) | where order entry has the following structure diff --git a/src/pages/atomicdex/api/legacy/order_status/index.mdx b/src/pages/atomicdex/api/legacy/order_status/index.mdx index cc1798a8..fafac1da 100644 --- a/src/pages/atomicdex/api/legacy/order_status/index.mdx +++ b/src/pages/atomicdex/api/legacy/order_status/index.mdx @@ -36,26 +36,9 @@ The `order_status` method returns the data of the order with the selected `uuid` | Structure | Type | Description | | ----------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | type | string | type of the order ("Maker" or "Taker") | -| order | object | order data | -| order.base | string | base currency | -| order.rel | string | rel currency | -| order.price | number | order price as decimal number | -| order.price\_rat | rational number | order price as rational number | -| order.max\_base\_vol | number | Maximum trade volume | -| order.max\_base\_vol\_rat | rational number | Maximum trade volume as rational number | -| order.min\_base\_vol | number | Minimum trade volume | -| order.min\_base\_vol\_rat | rational number | Minimum trade volume as rational number | -| order.created\_at | number | timestamp of order creation | -| order.updated\_at | number | timestamp of last order update | -| order.matches | list | UUIDS of matching orders | -| order.started\_swaps | list | UUIDS of swaps started | -| order.uuid | string | UUID of this order | -| order.conf\_settings | object | Confirmation / Notarisation settings for order | -| order.base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | -| order.rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | -| order.cancellable | boolean | `true` if order is in a state which it can be cancelled. `false` if not (e.g. swap is in progress) | -| order.cancellation\_reason | string | `Cancelled` indicates order was withdrawn by user. `Fulfilled` indicates order was swapped successfully. `TimedOut` indicates a taker order with type `FillOrKill` expired before matching. | -| order.available\_amount | string | Funds available for order to be matched against, taking into account current spendable balance and `max_volume` | +| order | object | A standard [OrderData](/atomicdex/api/common_structures/orders/#order-data) object. | +| base_orderbook_ticker | string | The orderbook ticker for base coin. This field is used to group segwit and non-segwit versions of UTXO coins. | +| rel_orderbook_ticker | string | The orderbook ticker for rel coin. This field is used to group segwit and non-segwit versions of UTXO coins. | #### 📌 Maker Order Examples diff --git a/src/pages/atomicdex/api/legacy/orderbook/index.mdx b/src/pages/atomicdex/api/legacy/orderbook/index.mdx index 29e0066d..76d01d9f 100644 --- a/src/pages/atomicdex/api/legacy/orderbook/index.mdx +++ b/src/pages/atomicdex/api/legacy/orderbook/index.mdx @@ -18,8 +18,8 @@ The `orderbook` method requests from the network the currently available orders | Structure | Type | Description | | -------------------------------- | ---------------- | ------------------------------------------------------------------- | -| asks | array of `Order` | an array of objects containing outstanding asks | -| bids | array of `Order` | an array of objects containing outstanding bids | +| asks | array of objects | An array of standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects containing outstanding asks | +| bids | array of objects | An array of standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects containing outstanding bids | | numasks | number | the number of outstanding asks | | numbids | number | the number of outstanding bids | | base | string | the name of the coin the user desires to receive | @@ -27,62 +27,17 @@ The `orderbook` method requests from the network the currently available orders | timestamp | number | the timestamp of the orderbook request | | netid | number | the id of the network on which the request is made (default is `0`) | | total\_asks\_base\_vol | string (decimal) | the base volumes sum of all asks | -| total\_asks\_base\_vol\_rat | rational | the `total_asks_base_vol` in num-rational crate format | -| total\_asks\_base\_vol\_fraction | fraction | the `total_asks_base_vol` represented as an object | +| total\_asks\_base\_vol\_rat | rational | the `total_asks_base_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| total\_asks\_base\_vol\_fraction | fraction | the `total_asks_base_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | total\_asks\_rel\_vol | string (decimal) | the rel volumes sum of all asks | -| total\_asks\_rel\_vol\_rat | rational | the `total_asks_rel_vol` in num-rational crate format | -| total\_asks\_rel\_vol\_fraction | fraction | the `total_asks_rel_vol` represented as an object | +| total\_asks\_rel\_vol\_rat | rational | the `total_asks_rel_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| total\_asks\_rel\_vol\_fraction | fraction | the `total_asks_rel_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | total\_bids\_base\_vol | string (decimal) | the base volumes sum of all bids | -| total\_bids\_base\_vol\_rat | rational | the `total_bids_base_vol` in num-rational crate format | -| total\_bids\_base\_vol\_fraction | fraction | the `total_bids_base_vol` represented as an object | +| total\_bids\_base\_vol\_rat | rational | the `total_bids_base_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| total\_bids\_base\_vol\_fraction | fraction | the `total_bids_base_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | | total\_bids\_rel\_vol | string (decimal) | the rel volumes sum of all bids | -| total\_bids\_rel\_vol\_rat | rational | the `total_bids_rel_vol` in num-rational crate format | -| total\_bids\_rel\_vol\_fraction | fraction | the `total_bids_rel_vol` represented as an object | - -Where `Order` object structure is as follows - -| Structure | Type | Description | -| --------------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | the name of the `base` coin; the user desires this | -| address | string | the address offering the trade | -| price | string (decimal) | the price in `rel` the user is willing to pay per one unit of the `base` coin | -| price\_rat | rational | the price in num-rational crate format | -| price\_fraction | object (rational) | the price represented as an object | -| maxvolume | string (decimal) | the maximum amount of `base` coin the offer provider is willing to sell | -| max\_volume\_rat | rational | the max volume in num-rational crate format | -| max\_volume\_fraction | object (rational) | the max volume represented as an object | -| min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to sell | -| min\_volume\_rat | rational | the min volume in num-rational crate format | -| min\_volume\_fraction | object (rational) | the min volume represented as an object | -| pubkey | string | the pubkey of the offer provider | -| age | number | the age of the offer (in seconds) | -| zcredits | number | the zeroconf deposit amount | -| numasks | number | the total number of asks | -| askdepth | number | the depth of the ask requests | -| uuid | string | the uuid of order | -| is\_mine | bool | whether the order is placed by me | -| base\_confs | number | the confirmations settings of `base` coin set by the offer provider | -| base\_nota | bool | the notarisation settings of `base` coin set by the offer provider | -| base\_max\_volume | string (decimal) | the maximum amount of `base` coin the offer provider is willing to buy or sell | -| base\_max\_volume\_rat | rational | the `base` max volume in num-rational crate format | -| base\_max\_volume\_fraction | object (rational) | the `base` max volume represented as an object | -| base\_min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to buy or sell | -| base\_min\_volume\_rat | rational | the `base` min volume in num-rational crate format | -| base\_min\_volume\_fraction | object (rational) | the `base` min volume represented as an object | -| rel\_confs | number | the confirmations settings of `rel` coin set by the offer provider | -| rel\_nota | bool | the notarisation settings of `rel` coin set by the offer provider | -| rel\_max\_volume | string (decimal) | the maximum amount of `rel` coin the offer provider is willing to buy or sell | -| rel\_max\_volume\_rat | rational | the `rel` max volume in num-rational crate format | -| rel\_max\_volume\_fraction | object (rational) | the `rel` max volume represented as an object | -| rel\_min\_volume | string (decimal) | the minimum amount of `rel` coin the offer provider is willing to buy or sell | -| rel\_min\_volume\_rat | rational | the `rel` min volume in num-rational crate format | -| rel\_min\_volume\_fraction | object (rational) | the `rel` min volume represented as an object | -| base\_max\_volume\_aggr | string (decimal) | the base max volume aggregated at the price level; the sum of base volumes of the current order and all orders with a worse price | -| base\_max\_volume\_aggr\_rat | rational | the `base_max_volume_aggr` in num-rational crate format | -| base\_max\_volume\_aggr\_fraction | object (rational) | the `base_max_volume_aggr` represented as an object | -| rel\_max\_volume\_aggr | string (decimal) | the rel max volume aggregated at the price level; the sum of rel volumes of the current order and all orders with a worse price | -| rel\_max\_volume\_aggr\_rat | rational | the `rel_max_volume_aggr` in num-rational crate format | -| rel\_max\_volume\_aggr\_fraction | object (rational) | the `rel_max_volume_aggr` represented as an object | +| total\_bids\_rel\_vol\_rat | rational | the `total_bids_rel_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| total\_bids\_rel\_vol\_fraction | fraction | the `total_bids_rel_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | #### 📌 Examples From ef6862ad21c0b28899d5ec04524ea815ca6462f6 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 5 Oct 2023 08:59:59 +0800 Subject: [PATCH 15/27] update remaining structs for legacy --- .../atomicdex/api/common_structures/index.mdx | 26 ++++++++ .../api/common_structures/orders/index.mdx | 19 +++++- .../api/legacy/order_status/index.mdx | 34 +++-------- .../legacy/orders_history_by_filter/index.mdx | 61 ++++++++----------- .../legacy/recover_funds_of_swap/index.mdx | 14 ++--- .../set_required_confirmations/index.mdx | 8 +-- .../set_requires_notarization/index.mdx | 8 +-- .../atomicdex/api/legacy/setprice/index.mdx | 38 ++++++------ .../api/legacy/trade_preimage/index.mdx | 43 ++++--------- .../api/legacy/unban_pubkeys/index.mdx | 11 ++-- .../api/legacy/update_maker_order/index.mdx | 33 +++++----- .../api/legacy/validateaddress/index.mdx | 8 +-- .../atomicdex/api/legacy/withdraw/index.mdx | 5 +- 13 files changed, 147 insertions(+), 161 deletions(-) diff --git a/src/pages/atomicdex/api/common_structures/index.mdx b/src/pages/atomicdex/api/common_structures/index.mdx index 8af6bd15..7968ceb5 100644 --- a/src/pages/atomicdex/api/common_structures/index.mdx +++ b/src/pages/atomicdex/api/common_structures/index.mdx @@ -130,6 +130,32 @@ The `FeeInfo` response object includes the following items for [withdraw (v2)](/ | gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | | gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | + +### ExtendedFeeInfo + +| Structure | Type | Description | +| ------------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | the fee is paid from the user's balance of this coin. This coin name may differ from the `base` or `rel` coins. For example, ERC20 fees are paid by ETH (gas) | +| amount | string (numeric) | fee amount (in decimal representation) | +| amount\_rat | rational | fee amount (in rational representation) | +| amount\_fraction | fraction | fee amount (in fraction representation) | +| amount\_fraction | fraction | fee amount (in fraction representation) | +| paid\_from\_trading\_vol | bool | whether the fee is paid from trading volume and not use actual `coin` balance | + + +### TotalFeeInfo + +| Structure | Type | Description | +| --------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | the fee is paid from the user's balance of this coin. This coin name may differ from the `base` or `rel` coins. For example, ERC20 fees are paid by ETH (gas) | +| amount | string (numeric) | fee amount (in decimal representation) | +| amount\_rat | rational | fee amount (in rational representation) | +| amount\_fraction | fraction | fee amount (in fraction representation) | +| required\_balance | string (numeric) | the required `coin` balance to pay the fee | +| required\_balance\_rat | rational | `required_balance` in rational representation | +| required\_balance\_fraction | fraction | `required_balance` in fraction representation | + + ### FractionalValue The `FractionalValue` object includes a [numerator and denominator](https://www.freemathhelp.com/numerator-denominator/) values for a given price or amount: diff --git a/src/pages/atomicdex/api/common_structures/orders/index.mdx b/src/pages/atomicdex/api/common_structures/orders/index.mdx index 27b3d971..78eb82eb 100644 --- a/src/pages/atomicdex/api/common_structures/orders/index.mdx +++ b/src/pages/atomicdex/api/common_structures/orders/index.mdx @@ -89,7 +89,7 @@ export const description = "Each order on the Komodo Defi oderbook can be querie -### OrderData +### OrderStatusData | Structure | Type | Description | | ----------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -224,6 +224,23 @@ export const description = "Each order on the Komodo Defi oderbook can be querie | rel\_nota | bool | the notarisation settings of `rel` coin set by the offer provider | | original\_tickers | list (string) | Tickers included in response when `orderbook_ticker` is configured for the queried coin in `coins` file | + +## OrderSummaryData + +| Structure | Type | Description | +| ------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| uuid | string | uuid of the order | +| order\_type | string | type of the order; "Maker" or "Taker" | +| base | string | base coin of the order | +| rel | string | rel coin of the order | +| price | number (decimal) | price of the order | +| volume | number (decimal) | volume of the order | +| created\_at | number | unix timestamp in milliseconds, indicating the order creation time | +| last\_updated | number | unix timestamp in milliseconds, indicating the time the order was last updated | +| was\_taker | number | `1` if the order was a "Taker" order that got converted to "Maker", `0` otherwise | +| status | string | status of the Order | + + ## MatchBy | Structure | Type | Description | diff --git a/src/pages/atomicdex/api/legacy/order_status/index.mdx b/src/pages/atomicdex/api/legacy/order_status/index.mdx index fafac1da..3230b268 100644 --- a/src/pages/atomicdex/api/legacy/order_status/index.mdx +++ b/src/pages/atomicdex/api/legacy/order_status/index.mdx @@ -36,7 +36,7 @@ The `order_status` method returns the data of the order with the selected `uuid` | Structure | Type | Description | | ----------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | type | string | type of the order ("Maker" or "Taker") | -| order | object | A standard [OrderData](/atomicdex/api/common_structures/orders/#order-data) object. | +| order | object | A standard [OrderStatusData](/atomicdex/api/common_structures/orders/#order-status-data) object. | | base_orderbook_ticker | string | The orderbook ticker for base coin. This field is used to group segwit and non-segwit versions of UTXO coins. | | rel_orderbook_ticker | string | The orderbook ticker for rel coin. This field is used to group segwit and non-segwit versions of UTXO coins. | @@ -231,32 +231,12 @@ The `order_status` method returns the data of the order with the selected `uuid` #### Response: Taker Orders -| Structure | Type | Description | -| ------------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | type of the order ("Maker" or "Taker") | -| order | object | order data | -| order.created\_at | number | timestamp of order creation | -| order.request | object | details of requested trade | -| order.request.base | string | base currency | -| order.request.base\_amount | number | base currency amount | -| order.request.base\_amount\_rat | rational number | base currency amount as rational number | -| order.request.rel | string | rel currency | -| order.request.rel\_amount | number | rel currency amount | -| order.request.rel\_amount\_rat | rational number | rel currency amount as rational number | -| order.request.action | string | `buy` or `sell` | -| order.request.uuid | string | Taker order UUID | -| order.request.method | string | Deprecated field, which always has the value `request`. | -| order.request.sender\_pubkey | string | Pubkey of Taker | -| order.request.dest\_pub\_key | string | reserved for future use. The `dest_pub_key` allows the user to choose the P2P node that is eligible to match with the request. This value defaults to "zero pubkey", meaning that `anyone` can match | -| order.request.match\_by.type | string | `Orders` to select specific uuids; `Pubkeys` to select specific nodes; Defaults to `Any` | -| order.request.conf\_settings | object | base/rel confirmation/notarisation settings | -| order.matches | object | Details of matching Maker Order UUIDs | -| order.order\_type | object | A standard [OrderType](/atomicdex/api/common_structures/orders/#order-type) object. | -| order.matches | list | UUIDS of matching orders | -| order.base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | -| order.rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | -| order.cancellable | boolean | `true` if order is in a state which it can be cancelled. `false` if not (e.g. swap is in progress) | -| cancellation\_reason | string | `Cancelled` indicates order was withdrawn by user. `Fulfilled` indicates order was swapped successfully. `TimedOut` indicates a taker order with type `FillOrKill` expired before matching. | +| Structure | Type | Description | +| ----------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | type of the order ("Maker" or "Taker") | +| order | object | A standard [OrderStatusData](/atomicdex/api/common_structures/orders/#order-status-data) object. | +| base_orderbook_ticker | string | The orderbook ticker for base coin. This field is used to group segwit and non-segwit versions of UTXO coins. | +| rel_orderbook_ticker | string | The orderbook ticker for rel coin. This field is used to group segwit and non-segwit versions of UTXO coins. | #### 📌 Taker Order Examples diff --git a/src/pages/atomicdex/api/legacy/orders_history_by_filter/index.mdx b/src/pages/atomicdex/api/legacy/orders_history_by_filter/index.mdx index f501e88e..451206f4 100644 --- a/src/pages/atomicdex/api/legacy/orders_history_by_filter/index.mdx +++ b/src/pages/atomicdex/api/legacy/orders_history_by_filter/index.mdx @@ -9,45 +9,34 @@ The `orders_history_by_filter` method returns all orders whether active or inact ## Arguments -| Structure | Type | Description | -| ---------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| order\_type | string | return only orders that match the `request.order_type`; `order_type` can be "Maker" or "Taker" | -| initial\_action | string | return only orders that match the `request.initial_action`; `initial_action` can be "Sell" or "Buy". Note that maker order `initial_action` is considered "Sell" | -| base | string | return only orders that match the `order.base = request.base` condition | -| rel | string | return only orders that match the `order.rel = request.rel` condition | -| from\_price | numeric string or rational | return only orders that match the `order.price >= request.from_price` condition | -| to\_price | numeric string or rational | return only orders that match the `order.price <= request.to_price` condition | -| from\_volume | numeric string or rational | return only orders that match the `order.volume >= request.from_volume` condition | -| to\_volume | numeric string or rational | return only orders that match the `order.volume <= request.to_volume` condition | -| from\_timestamp | number (timestamp in seconds) | return only orders that match the `order.created_at >= request.from_timestamp` condition | -| to\_timestamp | number (timestamp in seconds) | return only orders that match the `order.created_at <= request.to_timestamp` condition | -| was\_taker | bool | return only `GoodTillCancelled` orders that got converted from `taker` to `maker` | -| status | string | return only orders that match the `request.status`; `status` can be: | -| include\_details | bool | whether to include complete order details in response; defaults to false | +| Structure | Type | Description | +| ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| order\_type | string | return only orders that match the `order_type`; `order_type` can be "Maker" or "Taker" | +| initial\_action | string | return only orders that match the `initial_action`; `initial_action` can be "Sell" or "Buy". Note that maker order `initial_action` is considered "Sell" | +| base | string | return only orders that match the `order.base = base` condition | +| rel | string | return only orders that match the `order.rel = rel` condition | +| from\_price | varies | return only orders that match the `order.price >= from_price` condition | +| to\_price | varies | return only orders that match the `order.price <= to_price` condition | +| from\_volume | varies | return only orders that match the `order.volume >= from_volume` condition | +| to\_volume | varies | return only orders that match the `order.volume <= to_volume` condition | +| from\_timestamp | integer | Timestamp in UNIX format. Return only orders that match the `order.created_at >= from_timestamp` condition | +| to\_timestamp | number | Timestamp in UNIX format. return only orders that match the `order.created_at <= to_timestamp` condition | +| was\_taker | bool | return only `GoodTillCancelled` orders that got converted from `taker` to `maker` | +| status | string | return only orders that match the `status`; `status` can be: | +| include\_details | bool | whether to include complete order details in response; defaults to false | ## Response -| Structure | Type | Description | -| --------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| result | result object | | -| result.orders | array of order objects | array of orders that match the selected filters with minimal details | -| result.orders.uuid | string | uuid of the order | -| result.orders.order\_type | string | type of the order; "Maker" or "Taker" | -| result.orders.base | string | base coin of the order | -| result.orders.rel | string | rel coin of the order | -| result.orders.price | number (decimal) | price of the order | -| result.orders.volume | number (decimal) | volume of the order | -| result.orders.created\_at | number | unix timestamp in milliseconds, indicating the order creation time | -| result.orders.last\_updated | number | unix timestamp in milliseconds, indicating the time the order was last updated | -| result.orders.was\_taker | number | `1` if the order was a "Taker" order that got converted to "Maker", `0` otherwise | -| result.orders.status | string | status of the Order | -| result.details | array of order details objects | array of complete order details for every order that matches the selected filters; returns `[]` if `include_details` is false or not included in the request. | -| result.details.type | string | type of the order; "Maker" or "Taker" | -| result.details.order | object | the order details object | -| found\_records | number | the number of returned orders | -| warnings | array | array containing warnings objects | -| warnings.uuid | string | uuid of the order that produced this warning | -| warnings.warning | string | warning message | +| Structure | Type | Description | +| -------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| orders | array of order objects | Array of [OrderSummaryData](/atomicdex/api/common_structures/orders/#order-summary-data) that match the selected filters. | +| details | array | array of complete order details for every order that matches the selected filters; returns `[]` if `include_details` is false or not included in the | +| details.type | string | type of the order; "Maker" or "Taker" | +| details.order | object | A standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects containing outstanding asks | +| found\_records | number | the number of returned orders | +| warnings | array | array containing warnings objects | +| warnings.uuid | string | uuid of the order that produced this warning | +| warnings.warning | string | warning message | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/recover_funds_of_swap/index.mdx b/src/pages/atomicdex/api/legacy/recover_funds_of_swap/index.mdx index d2ff08fc..2407c532 100644 --- a/src/pages/atomicdex/api/legacy/recover_funds_of_swap/index.mdx +++ b/src/pages/atomicdex/api/legacy/recover_funds_of_swap/index.mdx @@ -15,16 +15,16 @@ In this scenario, the `recover_funds_of_swap` method instructs the AtomicDEX API | Structure | Type | Description | | ----------- | ------ | ------------------------------------- | -| params.uuid | string | uuid of the swap to recover the funds | +| uuid | string | uuid of the swap to recover the funds | ## Response -| Structure | Type | Description | -| --------------- | ------ | ------------------------------------------------------------------------------------------------- | -| result.action | string | the action executed to unlock the funds. Can be either `SpentOtherPayment` or `RefundedMyPayment` | -| result.coin | string | the balance of this coin will be unstuck by the recovering transaction | -| result.tx\_hash | string | the hash of the recovering transaction | -| result.tx\_hex | string | raw bytes of the recovering transaction in hexadecimal representation | +| Structure | Type | Description | +| ---------- | ------ | ------------------------------------------------------------------------------------------------- | +| action | string | the action executed to unlock the funds. Can be either `SpentOtherPayment` or `RefundedMyPayment` | +| coin | string | the balance of this coin will be unstuck by the recovering transaction | +| tx\_hash | string | the hash of the recovering transaction | +| tx\_hex | string | raw bytes of the recovering transaction in hexadecimal representation | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/set_required_confirmations/index.mdx b/src/pages/atomicdex/api/legacy/set_required_confirmations/index.mdx index 2a2f69bd..2ddc1f4a 100644 --- a/src/pages/atomicdex/api/legacy/set_required_confirmations/index.mdx +++ b/src/pages/atomicdex/api/legacy/set_required_confirmations/index.mdx @@ -20,10 +20,10 @@ The `set_required_confirmations` method sets the number of confirmations for whi #### Response -| Structure | Type | Description | -| -------------------- | ------ | ------------------------------------------ | -| result.coin | string | the coin selected in the request | -| result.confirmations | number | the number of confirmations in the request | +| Structure | Type | Description | +| ------------- | ------ | ------------------------------------------ | +| coin | string | the coin selected in the request | +| confirmations | number | the number of confirmations in the request | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/set_requires_notarization/index.mdx b/src/pages/atomicdex/api/legacy/set_requires_notarization/index.mdx index 46819e28..52bc66ce 100644 --- a/src/pages/atomicdex/api/legacy/set_requires_notarization/index.mdx +++ b/src/pages/atomicdex/api/legacy/set_requires_notarization/index.mdx @@ -20,10 +20,10 @@ The `set_requires_notarization` method indicates whether AtomicDEX API must wait #### Response -| Structure | Type | Description | -| ----------------------------- | ------ | ---------------------------------------------------------------------------------- | -| result.coin | string | the coin selected in the request | -| result.requires\_notarization | bool | whether the node must wait for a dPoW notarization of the atomic swap transactions | +| Structure | Type | Description | +| ---------------------- | ------ | ---------------------------------------------------------------------------------- | +| coin | string | the coin selected in the request | +| requires\_notarization | bool | whether the node must wait for a dPoW notarization of the atomic swap transactions | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/setprice/index.mdx b/src/pages/atomicdex/api/legacy/setprice/index.mdx index 11a404fd..3c7641ff 100644 --- a/src/pages/atomicdex/api/legacy/setprice/index.mdx +++ b/src/pages/atomicdex/api/legacy/setprice/index.mdx @@ -32,25 +32,25 @@ The `setprice` order is always considered a `sell`, for internal implementation #### Response -| Structure | Type | Description | -| ------------------------------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -| result | object | the resulting order object | -| result.base | string | the base coin of the order | -| result.rel | string | the rel coin of the order | -| result.price | string (numeric) | the expected amount of `rel` coin to be received per 1 unit of `base` coin; decimal representation | -| result.price\_rat | rational | the expected amount of `rel` coin to be received per 1 unit of `base` coin; rational representation | -| result.max\_base\_vol | string (numeric) | the maximum volume of base coin available to trade; decimal representation | -| result.max\_base\_vol\_rat | rational | the maximum volume of base coin available to trade; rational representation | -| result.min\_base\_vol | string (numeric) | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; decimal representation | -| result.min\_base\_vol\_rat | rational | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; rational representation | -| result.created\_at | number | unix timestamp in milliseconds, indicating the order creation time | -| result.updated\_at | number | unix timestamp in milliseconds, indicating the order update time | -| result.matches | object | contains the map of ongoing matches with other orders, empty as the order was recently created | -| result.started\_swaps | array of strings | uuids of swaps that were initiated by the order | -| result.uuid | string | uuid of the created order | -| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | -| result.base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | -| result.rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | +| Structure | Type | Description | +| ----------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | object | the resulting order object | +| base | string | the base coin of the order | +| rel | string | the rel coin of the order | +| price | string (numeric) | the expected amount of `rel` coin to be received per 1 unit of `base` coin; decimal representation | +| price\_rat | rational | the expected amount of `rel` coin to be received per 1 unit of `base` coin; rational representation | +| max\_base\_vol | string (numeric) | the maximum volume of base coin available to trade; decimal representation | +| max\_base\_vol\_rat | rational | the maximum volume of base coin available to trade; rational representation | +| min\_base\_vol | string (numeric) | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; decimal representation | +| min\_base\_vol\_rat | rational | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; rational representation | +| created\_at | number | unix timestamp in milliseconds, indicating the order creation time | +| updated\_at | number | unix timestamp in milliseconds, indicating the order update time | +| matches | object | contains the map of ongoing matches with other orders, empty as the order was recently created | +| started\_swaps | array of strings | uuids of swaps that were initiated by the order | +| uuid | string | uuid of the created order | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | +| base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | +| rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/trade_preimage/index.mdx b/src/pages/atomicdex/api/legacy/trade_preimage/index.mdx index 70d7c82a..ba5d3171 100644 --- a/src/pages/atomicdex/api/legacy/trade_preimage/index.mdx +++ b/src/pages/atomicdex/api/legacy/trade_preimage/index.mdx @@ -38,40 +38,19 @@ Depending on the parameters, the function returns different results: #### Response -| Structure | Type | Description | -| -------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| result | object | an object containing the relevant information | -| result.base\_coin\_fee | object (`ExtendedFeeInfo`) | the approximate miner fee is paid per the whole swap concerning the `base` coin | -| result.rel\_coin\_fee | object (`ExtendedFeeInfo`) | the approximate miner fee is paid per the whole swap concerning the `rel` coin | -| result.volume | string (numeric, optional) | the max available volume that can be traded (in decimal representation); empty if the `max` argument is missing or false | -| result.volume\_rat | rational (optional) | the max available volume that can be traded (in rational representation); empty if the `max` argument is missing or false | -| result.volume\_fraction | fraction (optional) | the max available volume that can be traded (in fraction representation); empty if the `max` argument is missing or false | -| result.taker\_fee | object (optional, `ExtendedFeeInfo`) | the dex fee to be paid by Taker; empty if `swap_method` is `setprice` | -| result.fee\_to\_send\_taker\_fee | object (optional, `ExtendedFeeInfo`) | the approximate miner fee is paid to send the dex fee; empty if `swap_method` is `setprice` | -| result.total\_fees | array of `TotalFeeInfo` objects | each element is a sum of fees required to be paid from user's balance of corresponding `ExtendedFeeInfo.coin`; the elements are unique by coin | +| Structure | Type | Description | +| ------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| result | object | an object containing the relevant information | +| base\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `base` coin | +| rel\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `rel` coin | +| volume | string (numeric) | Optional. The max available volume that can be traded (in decimal representation); empty if the `max` argument is missing or false | +| volume\_rat | rational | Optional. The max available volume that can be traded represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object.; empty if the `max` argument is missing or false | +| volume\_fraction | fraction | Optional. The max available volume that can be traded represented as a standard [fractionalValue](/atomicdex/api/common_structures/#fractional-value) object.; empty if the `max` argument is missing or false | +| taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The dex fee to be paid by Taker; empty if `swap_method` is `setprice` | +| fee\_to\_send\_taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid to send the dex fee; empty if `swap_method` is `setprice` | +| total\_fees | array of objects | A standard [TotalFeeInfo](/atomicdex/api/common_structures/#total-fees) object. Each element is a sum of fees required to be paid from user's balance of corresponding `ExtendedFeeInfo.coin`; the elements are unique by coin | -The `ExtendedFeeInfo` structure is as follows: -| Structure | Type | Description | -| ------------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | the fee is paid from the user's balance of this coin. This coin name may differ from the `base` or `rel` coins. For example, ERC20 fees are paid by ETH (gas) | -| amount | string (numeric) | fee amount (in decimal representation) | -| amount\_rat | rational | fee amount (in rational representation) | -| amount\_fraction | fraction | fee amount (in fraction representation) | -| amount\_fraction | fraction | fee amount (in fraction representation) | -| paid\_from\_trading\_vol | bool | whether the fee is paid from trading volume and not use actual `coin` balance | - -The `TotalFeeInfo` structure is as follows: - -| Structure | Type | Description | -| --------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | the fee is paid from the user's balance of this coin. This coin name may differ from the `base` or `rel` coins. For example, ERC20 fees are paid by ETH (gas) | -| amount | string (numeric) | fee amount (in decimal representation) | -| amount\_rat | rational | fee amount (in rational representation) | -| amount\_fraction | fraction | fee amount (in fraction representation) | -| required\_balance | string (numeric) | the required `coin` balance to pay the fee | -| required\_balance\_rat | rational | `required_balance` in rational representation | -| required\_balance\_fraction | fraction | `required_balance` in fraction representation | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/unban_pubkeys/index.mdx b/src/pages/atomicdex/api/legacy/unban_pubkeys/index.mdx index 144a7482..418cbc43 100644 --- a/src/pages/atomicdex/api/legacy/unban_pubkeys/index.mdx +++ b/src/pages/atomicdex/api/legacy/unban_pubkeys/index.mdx @@ -21,12 +21,11 @@ The `unban_pubkeys` method will remove all currently banned pubkeys from your ba ## Response -| Structure | Type | Description | -| ------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| result | string | Whether the ban was successful | -| result.still\_banned | list | List of pubkeys which remain banned. For each `pubkey`, the reason it was banned `pubkey.reason` and the type of of ban `pubkey.type` is also returned. | -| result.unbanned | list | List of pubkeys which were unbanned. For each `pubkey`, the reason it was banned `pubkey.reason` and the type of of ban `pubkey.type` is also returned. | -| result.were\_not\_banned | list | If using `unban_by.type: Few` this will return a list of pubkeys which were not banned, but had been requested to be unbanned. | +| Structure | Type | Description | +| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| still\_banned | list | List of pubkeys which remain banned. For each `pubkey`, the reason it was banned `pubkey.reason` and the type of of ban `pubkey.type` is also returned. | +| unbanned | list | List of pubkeys which were unbanned. For each `pubkey`, the reason it was banned `pubkey.reason` and the type of of ban `pubkey.type` is also returned. | +| were\_not\_banned | list | If using `unban_by.type: Few` this will return a list of pubkeys which were not banned, but had been requested to be unbanned. | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/update_maker_order/index.mdx b/src/pages/atomicdex/api/legacy/update_maker_order/index.mdx index 6298e7a1..c0fa782a 100644 --- a/src/pages/atomicdex/api/legacy/update_maker_order/index.mdx +++ b/src/pages/atomicdex/api/legacy/update_maker_order/index.mdx @@ -28,23 +28,22 @@ The `update_maker_order` method updates an active order on the orderbook created ## Response -| Structure | Type | Description | -| -------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------- | -| result | object | the resulting order object | -| result.base | string | the base coin of the order | -| result.rel | string | the rel coin of the order | -| result.price | string (numeric) | the expected amount of `rel` coin to be received per 1 unit of `base` coin; decimal representation | -| result.price\_rat | rational | the expected amount of `rel` coin to be received per 1 unit of `base` coin; rational representation | -| result.max\_base\_vol | string (numeric) | the maximum volume of base coin available to trade; decimal representation | -| result.max\_base\_vol\_rat | rational | the maximum volume of base coin available to trade; rational representation | -| result.min\_base\_vol | string (numeric) | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; decimal representation | -| result.min\_base\_vol\_rat | rational | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; rational representation | -| result.created\_at | number | unix timestamp in milliseconds, indicating the order creation time | -| result.updated\_at | number | unix timestamp in milliseconds, indicating the order update time | -| result.matches | object | contains the map of ongoing matches with other orders, empty as the order was recently created | -| result.started\_swaps | array of strings | uuids of swaps that were initiated by the order | -| result.uuid | string | uuid of the updated order | -| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | +| Structure | Type | Description | +| ------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------- | +| base | string | the base coin of the order | +| rel | string | the rel coin of the order | +| price | string (numeric) | the expected amount of `rel` coin to be received per 1 unit of `base` coin; decimal representation | +| price\_rat | rational | the expected amount of `rel` coin to be received per 1 unit of `base` coin; rational representation | +| max\_base\_vol | string (numeric) | the maximum volume of base coin available to trade; decimal representation | +| max\_base\_vol\_rat | rational | the maximum volume of base coin available to trade; rational representation | +| min\_base\_vol | string (numeric) | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; decimal representation | +| min\_base\_vol\_rat | rational | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; rational representation | +| created\_at | number | unix timestamp in milliseconds, indicating the order creation time | +| updated\_at | number | unix timestamp in milliseconds, indicating the order update time | +| matches | object | contains the map of ongoing matches with other orders, empty as the order was recently created | +| started\_swaps | array of strings | uuids of swaps that were initiated by the order | +| uuid | string | uuid of the updated order | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/validateaddress/index.mdx b/src/pages/atomicdex/api/legacy/validateaddress/index.mdx index 73191a75..a68181a4 100644 --- a/src/pages/atomicdex/api/legacy/validateaddress/index.mdx +++ b/src/pages/atomicdex/api/legacy/validateaddress/index.mdx @@ -16,10 +16,10 @@ The `validateaddress` method checks if an input string is a valid address of the ## Response -| Structure | Type | Description | -| ---------------- | ----------------- | -------------------------------------------------- | -| result.is\_valid | bool | whether input string is a valid coin address | -| result.reason | string (optional) | the reason why input string is not a valid address | +| Structure | Type | Description | +| ---------- | ----------------- | -------------------------------------------------- | +| is\_valid | bool | Whether input string is a valid coin address. | +| reason | string (optional) | Only present if not valid. The reason why input string is not a valid address. | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/withdraw/index.mdx b/src/pages/atomicdex/api/legacy/withdraw/index.mdx index 3167f533..3f9350e2 100644 --- a/src/pages/atomicdex/api/legacy/withdraw/index.mdx +++ b/src/pages/atomicdex/api/legacy/withdraw/index.mdx @@ -17,10 +17,7 @@ This method generates a raw transaction which should then be broadcast using [se | to | string | coins are withdrawn to this address | | amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` | | max | bool | withdraw the maximum available amount | -| fee.type | string | type of transaction fee; possible values: `UtxoFixed`, `UtxoPerKbyte`, `EthGas` | -| fee.amount | string (numeric) | fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) | -| fee.gas\_price | string (numeric) | used only when fee type is EthGas; sets the gas price in `gwei` units | -| fee.gas | number (integer) | used only when fee type is EthGas; sets the gas limit for transaction | +| fee | object | Optional. A standard [FeeInfo](/atomicdex/api/v20/#FeeInfo) object. | ## Response From 332565b0dc0822f7aef36ab27fa66459a214f31f Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 5 Oct 2023 09:14:39 +0800 Subject: [PATCH 16/27] fix lint errors --- filepathSlugs.json | 6 +- .../atomicdex/api/common_structures/index.mdx | 3 - .../api/common_structures/orders/index.mdx | 29 +- .../api/legacy/best_orders/index.mdx | 4 +- .../api/legacy/order_status/index.mdx | 24 +- .../atomicdex/api/legacy/orderbook/index.mdx | 44 +-- .../legacy/orders_history_by_filter/index.mdx | 50 +-- .../legacy/recover_funds_of_swap/index.mdx | 18 +- .../api/legacy/trade_preimage/index.mdx | 24 +- .../api/legacy/unban_pubkeys/index.mdx | 10 +- .../api/legacy/validateaddress/index.mdx | 8 +- .../atomicdex/api/legacy/withdraw/index.mdx | 14 +- utils/_fileData.json | 358 ++++++++++-------- 13 files changed, 308 insertions(+), 284 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index d62b3a83..9a977529 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -1589,6 +1589,8 @@ "balance-infos", "derivation-method", "fee-info", + "extended-fee-info", + "total-fee-info", "fractional-value", "pagination", "example-2", @@ -1617,7 +1619,9 @@ "cancel-by", "conf-settings", "order-type", - "ticker-best-order-v1", + "order-status-data", + "order-data-v1", + "order-summary-data", "match-by" ], "src/pages/atomicdex/api/common_structures/swaps/index.mdx": [ diff --git a/src/pages/atomicdex/api/common_structures/index.mdx b/src/pages/atomicdex/api/common_structures/index.mdx index 7968ceb5..4bd7e3fc 100644 --- a/src/pages/atomicdex/api/common_structures/index.mdx +++ b/src/pages/atomicdex/api/common_structures/index.mdx @@ -130,7 +130,6 @@ The `FeeInfo` response object includes the following items for [withdraw (v2)](/ | gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | | gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | - ### ExtendedFeeInfo | Structure | Type | Description | @@ -142,7 +141,6 @@ The `FeeInfo` response object includes the following items for [withdraw (v2)](/ | amount\_fraction | fraction | fee amount (in fraction representation) | | paid\_from\_trading\_vol | bool | whether the fee is paid from trading volume and not use actual `coin` balance | - ### TotalFeeInfo | Structure | Type | Description | @@ -155,7 +153,6 @@ The `FeeInfo` response object includes the following items for [withdraw (v2)](/ | required\_balance\_rat | rational | `required_balance` in rational representation | | required\_balance\_fraction | fraction | `required_balance` in fraction representation | - ### FractionalValue The `FractionalValue` object includes a [numerator and denominator](https://www.freemathhelp.com/numerator-denominator/) values for a given price or amount: diff --git a/src/pages/atomicdex/api/common_structures/orders/index.mdx b/src/pages/atomicdex/api/common_structures/orders/index.mdx index 78eb82eb..d02fe0e5 100644 --- a/src/pages/atomicdex/api/common_structures/orders/index.mdx +++ b/src/pages/atomicdex/api/common_structures/orders/index.mdx @@ -88,7 +88,6 @@ export const description = "Each order on the Komodo Defi oderbook can be querie ``` - ### OrderStatusData | Structure | Type | Description | @@ -114,7 +113,6 @@ export const description = "Each order on the Komodo Defi oderbook can be querie | available\_amount | string | Funds available for order to be matched against, taking into account current spendable balance and `max_volume` | - ```json { "available_amount": "1", @@ -182,7 +180,6 @@ export const description = "Each order on the Komodo Defi oderbook can be querie "uuid": "ea77dcc3-a711-4c3d-ac36-d45fc5e1ee0c" } ``` - ### OrderDataV1 @@ -224,22 +221,20 @@ export const description = "Each order on the Komodo Defi oderbook can be querie | rel\_nota | bool | the notarisation settings of `rel` coin set by the offer provider | | original\_tickers | list (string) | Tickers included in response when `orderbook_ticker` is configured for the queried coin in `coins` file | - ## OrderSummaryData -| Structure | Type | Description | -| ------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| uuid | string | uuid of the order | -| order\_type | string | type of the order; "Maker" or "Taker" | -| base | string | base coin of the order | -| rel | string | rel coin of the order | -| price | number (decimal) | price of the order | -| volume | number (decimal) | volume of the order | -| created\_at | number | unix timestamp in milliseconds, indicating the order creation time | -| last\_updated | number | unix timestamp in milliseconds, indicating the time the order was last updated | -| was\_taker | number | `1` if the order was a "Taker" order that got converted to "Maker", `0` otherwise | -| status | string | status of the Order | - +| Structure | Type | Description | +| ------------- | ---------------- | --------------------------------------------------------------------------------- | +| uuid | string | uuid of the order | +| order\_type | string | type of the order; "Maker" or "Taker" | +| base | string | base coin of the order | +| rel | string | rel coin of the order | +| price | number (decimal) | price of the order | +| volume | number (decimal) | volume of the order | +| created\_at | number | unix timestamp in milliseconds, indicating the order creation time | +| last\_updated | number | unix timestamp in milliseconds, indicating the time the order was last updated | +| was\_taker | number | `1` if the order was a "Taker" order that got converted to "Maker", `0` otherwise | +| status | string | status of the Order | ## MatchBy diff --git a/src/pages/atomicdex/api/legacy/best_orders/index.mdx b/src/pages/atomicdex/api/legacy/best_orders/index.mdx index f7b01328..0b4b2111 100644 --- a/src/pages/atomicdex/api/legacy/best_orders/index.mdx +++ b/src/pages/atomicdex/api/legacy/best_orders/index.mdx @@ -22,8 +22,8 @@ The `best_orders` method returns the best price orders that can fill the volume ## Response -| Structure | Type | Description | -| --------- | ------------ | -------------------------------------------------------------------------------------------------- | +| Structure | Type | Description | +| --------- | ------------ | ----------------------------------------------------------------------------------------------------------- | | result | object (map) | A map of standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects (by ticker) | where order entry has the following structure diff --git a/src/pages/atomicdex/api/legacy/order_status/index.mdx b/src/pages/atomicdex/api/legacy/order_status/index.mdx index 3230b268..2595557d 100644 --- a/src/pages/atomicdex/api/legacy/order_status/index.mdx +++ b/src/pages/atomicdex/api/legacy/order_status/index.mdx @@ -33,12 +33,12 @@ The `order_status` method returns the data of the order with the selected `uuid` #### Maker Order Response -| Structure | Type | Description | -| ----------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | type of the order ("Maker" or "Taker") | -| order | object | A standard [OrderStatusData](/atomicdex/api/common_structures/orders/#order-status-data) object. | -| base_orderbook_ticker | string | The orderbook ticker for base coin. This field is used to group segwit and non-segwit versions of UTXO coins. | -| rel_orderbook_ticker | string | The orderbook ticker for rel coin. This field is used to group segwit and non-segwit versions of UTXO coins. | +| Structure | Type | Description | +| ----------------------- | ------ | ------------------------------------------------------------------------------------------------------------- | +| type | string | type of the order ("Maker" or "Taker") | +| order | object | A standard [OrderStatusData](/atomicdex/api/common_structures/orders/#order-status-data) object. | +| base\_orderbook\_ticker | string | The orderbook ticker for base coin. This field is used to group segwit and non-segwit versions of UTXO coins. | +| rel\_orderbook\_ticker | string | The orderbook ticker for rel coin. This field is used to group segwit and non-segwit versions of UTXO coins. | #### 📌 Maker Order Examples @@ -231,12 +231,12 @@ The `order_status` method returns the data of the order with the selected `uuid` #### Response: Taker Orders -| Structure | Type | Description | -| ----------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | type of the order ("Maker" or "Taker") | -| order | object | A standard [OrderStatusData](/atomicdex/api/common_structures/orders/#order-status-data) object. | -| base_orderbook_ticker | string | The orderbook ticker for base coin. This field is used to group segwit and non-segwit versions of UTXO coins. | -| rel_orderbook_ticker | string | The orderbook ticker for rel coin. This field is used to group segwit and non-segwit versions of UTXO coins. | +| Structure | Type | Description | +| ----------------------- | ------ | ------------------------------------------------------------------------------------------------------------- | +| type | string | type of the order ("Maker" or "Taker") | +| order | object | A standard [OrderStatusData](/atomicdex/api/common_structures/orders/#order-status-data) object. | +| base\_orderbook\_ticker | string | The orderbook ticker for base coin. This field is used to group segwit and non-segwit versions of UTXO coins. | +| rel\_orderbook\_ticker | string | The orderbook ticker for rel coin. This field is used to group segwit and non-segwit versions of UTXO coins. | #### 📌 Taker Order Examples diff --git a/src/pages/atomicdex/api/legacy/orderbook/index.mdx b/src/pages/atomicdex/api/legacy/orderbook/index.mdx index 76d01d9f..0d6e7e2a 100644 --- a/src/pages/atomicdex/api/legacy/orderbook/index.mdx +++ b/src/pages/atomicdex/api/legacy/orderbook/index.mdx @@ -16,28 +16,28 @@ The `orderbook` method requests from the network the currently available orders ## Response -| Structure | Type | Description | -| -------------------------------- | ---------------- | ------------------------------------------------------------------- | -| asks | array of objects | An array of standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects containing outstanding asks | -| bids | array of objects | An array of standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects containing outstanding bids | -| numasks | number | the number of outstanding asks | -| numbids | number | the number of outstanding bids | -| base | string | the name of the coin the user desires to receive | -| rel | string | the name of the coin the user will trade | -| timestamp | number | the timestamp of the orderbook request | -| netid | number | the id of the network on which the request is made (default is `0`) | -| total\_asks\_base\_vol | string (decimal) | the base volumes sum of all asks | -| total\_asks\_base\_vol\_rat | rational | the `total_asks_base_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | -| total\_asks\_base\_vol\_fraction | fraction | the `total_asks_base_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | -| total\_asks\_rel\_vol | string (decimal) | the rel volumes sum of all asks | -| total\_asks\_rel\_vol\_rat | rational | the `total_asks_rel_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | -| total\_asks\_rel\_vol\_fraction | fraction | the `total_asks_rel_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | -| total\_bids\_base\_vol | string (decimal) | the base volumes sum of all bids | -| total\_bids\_base\_vol\_rat | rational | the `total_bids_base_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | -| total\_bids\_base\_vol\_fraction | fraction | the `total_bids_base_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | -| total\_bids\_rel\_vol | string (decimal) | the rel volumes sum of all bids | -| total\_bids\_rel\_vol\_rat | rational | the `total_bids_rel_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | -| total\_bids\_rel\_vol\_fraction | fraction | the `total_bids_rel_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| Structure | Type | Description | +| -------------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| asks | array of objects | An array of standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects containing outstanding asks | +| bids | array of objects | An array of standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects containing outstanding bids | +| numasks | number | the number of outstanding asks | +| numbids | number | the number of outstanding bids | +| base | string | the name of the coin the user desires to receive | +| rel | string | the name of the coin the user will trade | +| timestamp | number | the timestamp of the orderbook request | +| netid | number | the id of the network on which the request is made (default is `0`) | +| total\_asks\_base\_vol | string (decimal) | the base volumes sum of all asks | +| total\_asks\_base\_vol\_rat | rational | the `total_asks_base_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| total\_asks\_base\_vol\_fraction | fraction | the `total_asks_base_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| total\_asks\_rel\_vol | string (decimal) | the rel volumes sum of all asks | +| total\_asks\_rel\_vol\_rat | rational | the `total_asks_rel_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| total\_asks\_rel\_vol\_fraction | fraction | the `total_asks_rel_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| total\_bids\_base\_vol | string (decimal) | the base volumes sum of all bids | +| total\_bids\_base\_vol\_rat | rational | the `total_bids_base_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| total\_bids\_base\_vol\_fraction | fraction | the `total_bids_base_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| total\_bids\_rel\_vol | string (decimal) | the rel volumes sum of all bids | +| total\_bids\_rel\_vol\_rat | rational | the `total_bids_rel_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| total\_bids\_rel\_vol\_fraction | fraction | the `total_bids_rel_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/orders_history_by_filter/index.mdx b/src/pages/atomicdex/api/legacy/orders_history_by_filter/index.mdx index 451206f4..9b83a4ee 100644 --- a/src/pages/atomicdex/api/legacy/orders_history_by_filter/index.mdx +++ b/src/pages/atomicdex/api/legacy/orders_history_by_filter/index.mdx @@ -9,34 +9,34 @@ The `orders_history_by_filter` method returns all orders whether active or inact ## Arguments -| Structure | Type | Description | -| ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| order\_type | string | return only orders that match the `order_type`; `order_type` can be "Maker" or "Taker" | -| initial\_action | string | return only orders that match the `initial_action`; `initial_action` can be "Sell" or "Buy". Note that maker order `initial_action` is considered "Sell" | -| base | string | return only orders that match the `order.base = base` condition | -| rel | string | return only orders that match the `order.rel = rel` condition | -| from\_price | varies | return only orders that match the `order.price >= from_price` condition | -| to\_price | varies | return only orders that match the `order.price <= to_price` condition | -| from\_volume | varies | return only orders that match the `order.volume >= from_volume` condition | -| to\_volume | varies | return only orders that match the `order.volume <= to_volume` condition | -| from\_timestamp | integer | Timestamp in UNIX format. Return only orders that match the `order.created_at >= from_timestamp` condition | -| to\_timestamp | number | Timestamp in UNIX format. return only orders that match the `order.created_at <= to_timestamp` condition | -| was\_taker | bool | return only `GoodTillCancelled` orders that got converted from `taker` to `maker` | -| status | string | return only orders that match the `status`; `status` can be: | -| include\_details | bool | whether to include complete order details in response; defaults to false | +| Structure | Type | Description | +| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| order\_type | string | return only orders that match the `order_type`; `order_type` can be "Maker" or "Taker" | +| initial\_action | string | return only orders that match the `initial_action`; `initial_action` can be "Sell" or "Buy". Note that maker order `initial_action` is considered "Sell" | +| base | string | return only orders that match the `order.base = base` condition | +| rel | string | return only orders that match the `order.rel = rel` condition | +| from\_price | varies | return only orders that match the `order.price >= from_price` condition | +| to\_price | varies | return only orders that match the `order.price <= to_price` condition | +| from\_volume | varies | return only orders that match the `order.volume >= from_volume` condition | +| to\_volume | varies | return only orders that match the `order.volume <= to_volume` condition | +| from\_timestamp | integer | Timestamp in UNIX format. Return only orders that match the `order.created_at >= from_timestamp` condition | +| to\_timestamp | number | Timestamp in UNIX format. return only orders that match the `order.created_at <= to_timestamp` condition | +| was\_taker | bool | return only `GoodTillCancelled` orders that got converted from `taker` to `maker` | +| status | string | return only orders that match the `status`; `status` can be: | +| include\_details | bool | whether to include complete order details in response; defaults to false | ## Response -| Structure | Type | Description | -| -------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| orders | array of order objects | Array of [OrderSummaryData](/atomicdex/api/common_structures/orders/#order-summary-data) that match the selected filters. | -| details | array | array of complete order details for every order that matches the selected filters; returns `[]` if `include_details` is false or not included in the | -| details.type | string | type of the order; "Maker" or "Taker" | -| details.order | object | A standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects containing outstanding asks | -| found\_records | number | the number of returned orders | -| warnings | array | array containing warnings objects | -| warnings.uuid | string | uuid of the order that produced this warning | -| warnings.warning | string | warning message | +| Structure | Type | Description | +| ---------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| orders | array of order objects | Array of [OrderSummaryData](/atomicdex/api/common_structures/orders/#order-summary-data) that match the selected filters. | +| details | array | array of complete order details for every order that matches the selected filters; returns `[]` if `include_details` is false or not included in the | +| details.type | string | type of the order; "Maker" or "Taker" | +| details.order | object | A standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects containing outstanding asks | +| found\_records | number | the number of returned orders | +| warnings | array | array containing warnings objects | +| warnings.uuid | string | uuid of the order that produced this warning | +| warnings.warning | string | warning message | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/recover_funds_of_swap/index.mdx b/src/pages/atomicdex/api/legacy/recover_funds_of_swap/index.mdx index 2407c532..e0620eee 100644 --- a/src/pages/atomicdex/api/legacy/recover_funds_of_swap/index.mdx +++ b/src/pages/atomicdex/api/legacy/recover_funds_of_swap/index.mdx @@ -13,18 +13,18 @@ In this scenario, the `recover_funds_of_swap` method instructs the AtomicDEX API ## Arguments -| Structure | Type | Description | -| ----------- | ------ | ------------------------------------- | -| uuid | string | uuid of the swap to recover the funds | +| Structure | Type | Description | +| --------- | ------ | ------------------------------------- | +| uuid | string | uuid of the swap to recover the funds | ## Response -| Structure | Type | Description | -| ---------- | ------ | ------------------------------------------------------------------------------------------------- | -| action | string | the action executed to unlock the funds. Can be either `SpentOtherPayment` or `RefundedMyPayment` | -| coin | string | the balance of this coin will be unstuck by the recovering transaction | -| tx\_hash | string | the hash of the recovering transaction | -| tx\_hex | string | raw bytes of the recovering transaction in hexadecimal representation | +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------------------------------------------------------- | +| action | string | the action executed to unlock the funds. Can be either `SpentOtherPayment` or `RefundedMyPayment` | +| coin | string | the balance of this coin will be unstuck by the recovering transaction | +| tx\_hash | string | the hash of the recovering transaction | +| tx\_hex | string | raw bytes of the recovering transaction in hexadecimal representation | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/trade_preimage/index.mdx b/src/pages/atomicdex/api/legacy/trade_preimage/index.mdx index ba5d3171..28b12b1a 100644 --- a/src/pages/atomicdex/api/legacy/trade_preimage/index.mdx +++ b/src/pages/atomicdex/api/legacy/trade_preimage/index.mdx @@ -38,19 +38,17 @@ Depending on the parameters, the function returns different results: #### Response -| Structure | Type | Description | -| ------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| result | object | an object containing the relevant information | -| base\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `base` coin | -| rel\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `rel` coin | -| volume | string (numeric) | Optional. The max available volume that can be traded (in decimal representation); empty if the `max` argument is missing or false | -| volume\_rat | rational | Optional. The max available volume that can be traded represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object.; empty if the `max` argument is missing or false | -| volume\_fraction | fraction | Optional. The max available volume that can be traded represented as a standard [fractionalValue](/atomicdex/api/common_structures/#fractional-value) object.; empty if the `max` argument is missing or false | -| taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The dex fee to be paid by Taker; empty if `swap_method` is `setprice` | -| fee\_to\_send\_taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid to send the dex fee; empty if `swap_method` is `setprice` | -| total\_fees | array of objects | A standard [TotalFeeInfo](/atomicdex/api/common_structures/#total-fees) object. Each element is a sum of fees required to be paid from user's balance of corresponding `ExtendedFeeInfo.coin`; the elements are unique by coin | - - +| Structure | Type | Description | +| ------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | object | an object containing the relevant information | +| base\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `base` coin | +| rel\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `rel` coin | +| volume | string (numeric) | Optional. The max available volume that can be traded (in decimal representation); empty if the `max` argument is missing or false | +| volume\_rat | rational | Optional. The max available volume that can be traded represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object.; empty if the `max` argument is missing or false | +| volume\_fraction | fraction | Optional. The max available volume that can be traded represented as a standard [fractionalValue](/atomicdex/api/common_structures/#fractional-value) object.; empty if the `max` argument is missing or false | +| taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The dex fee to be paid by Taker; empty if `swap_method` is `setprice` | +| fee\_to\_send\_taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid to send the dex fee; empty if `swap_method` is `setprice` | +| total\_fees | array of objects | A standard [TotalFeeInfo](/atomicdex/api/common_structures/#total-fee-info) object. Each element is a sum of fees required to be paid from user's balance of corresponding `ExtendedFeeInfo.coin`; the elements are unique by coin | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/unban_pubkeys/index.mdx b/src/pages/atomicdex/api/legacy/unban_pubkeys/index.mdx index 418cbc43..252b92a9 100644 --- a/src/pages/atomicdex/api/legacy/unban_pubkeys/index.mdx +++ b/src/pages/atomicdex/api/legacy/unban_pubkeys/index.mdx @@ -21,11 +21,11 @@ The `unban_pubkeys` method will remove all currently banned pubkeys from your ba ## Response -| Structure | Type | Description | -| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -| still\_banned | list | List of pubkeys which remain banned. For each `pubkey`, the reason it was banned `pubkey.reason` and the type of of ban `pubkey.type` is also returned. | -| unbanned | list | List of pubkeys which were unbanned. For each `pubkey`, the reason it was banned `pubkey.reason` and the type of of ban `pubkey.type` is also returned. | -| were\_not\_banned | list | If using `unban_by.type: Few` this will return a list of pubkeys which were not banned, but had been requested to be unbanned. | +| Structure | Type | Description | +| ----------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| still\_banned | list | List of pubkeys which remain banned. For each `pubkey`, the reason it was banned `pubkey.reason` and the type of of ban `pubkey.type` is also returned. | +| unbanned | list | List of pubkeys which were unbanned. For each `pubkey`, the reason it was banned `pubkey.reason` and the type of of ban `pubkey.type` is also returned. | +| were\_not\_banned | list | If using `unban_by.type: Few` this will return a list of pubkeys which were not banned, but had been requested to be unbanned. | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/validateaddress/index.mdx b/src/pages/atomicdex/api/legacy/validateaddress/index.mdx index a68181a4..6819535c 100644 --- a/src/pages/atomicdex/api/legacy/validateaddress/index.mdx +++ b/src/pages/atomicdex/api/legacy/validateaddress/index.mdx @@ -16,10 +16,10 @@ The `validateaddress` method checks if an input string is a valid address of the ## Response -| Structure | Type | Description | -| ---------- | ----------------- | -------------------------------------------------- | -| is\_valid | bool | Whether input string is a valid coin address. | -| reason | string (optional) | Only present if not valid. The reason why input string is not a valid address. | +| Structure | Type | Description | +| --------- | ----------------- | ------------------------------------------------------------------------------ | +| is\_valid | bool | Whether input string is a valid coin address. | +| reason | string (optional) | Only present if not valid. The reason why input string is not a valid address. | #### 📌 Examples diff --git a/src/pages/atomicdex/api/legacy/withdraw/index.mdx b/src/pages/atomicdex/api/legacy/withdraw/index.mdx index 3f9350e2..73409a96 100644 --- a/src/pages/atomicdex/api/legacy/withdraw/index.mdx +++ b/src/pages/atomicdex/api/legacy/withdraw/index.mdx @@ -11,13 +11,13 @@ This method generates a raw transaction which should then be broadcast using [se ## Arguments -| Structure | Type | Description | -| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | the name of the coin the user desires to withdraw | -| to | string | coins are withdrawn to this address | -| amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` | -| max | bool | withdraw the maximum available amount | -| fee | object | Optional. A standard [FeeInfo](/atomicdex/api/v20/#FeeInfo) object. | +| Structure | Type | Description | +| --------- | ---------------- | ---------------------------------------------------------------------------------- | +| coin | string | the name of the coin the user desires to withdraw | +| to | string | coins are withdrawn to this address | +| amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` | +| max | bool | withdraw the maximum available amount | +| fee | object | Optional. A standard [FeeInfo](/atomicdex/api/common_structures/#fee-info) object. | ## Response diff --git a/utils/_fileData.json b/utils/_fileData.json index 1c681d55..36287397 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -1078,7 +1078,7 @@ } }, "/atomicdex/api/common_structures": { - "dateModified": "2023-10-04T12:56:06.000Z", + "dateModified": "2023-10-05T00:59:59.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1117,7 +1117,7 @@ } }, "/atomicdex/api/common_structures/orders": { - "dateModified": "2023-10-04T12:56:06.000Z", + "dateModified": "2023-10-05T00:59:59.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1130,7 +1130,33 @@ } }, "/atomicdex/api/common_structures/swaps": { - "dateModified": "2023-10-04T08:31:28.000Z", + "dateModified": "2023-10-04T23:08:10.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, + "/atomicdex/api/common_structures/swaps/maker_events": { + "dateModified": "2023-10-04T23:08:10.000Z", + "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + ], + "lastContributor": { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + } + }, + "/atomicdex/api/common_structures/swaps/taker_events": { + "dateModified": "2023-10-04T23:08:10.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1268,7 +1294,7 @@ } }, "/atomicdex/api/legacy/best_orders": { - "dateModified": "2023-10-04T12:56:06.000Z", + "dateModified": "2023-10-05T00:07:46.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1293,8 +1319,12 @@ } }, "/atomicdex/api/legacy/buy": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1306,20 +1336,20 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/cancel_all_orders": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1331,15 +1361,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/cancel_order": { @@ -1447,8 +1473,12 @@ } }, "/atomicdex/api/legacy/convertaddress": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T23:08:10.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1460,20 +1490,20 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/disable_coin": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T15:33:39.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1485,15 +1515,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/get_enabled_coins": { @@ -1672,7 +1698,7 @@ } }, "/atomicdex/api/legacy/get_trade_fee": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-04T15:33:39.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1697,8 +1723,12 @@ } }, "/atomicdex/api/legacy/help": { - "dateModified": "2023-05-31T18:19:46.000Z", + "dateModified": "2023-10-04T15:33:39.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" @@ -1709,13 +1739,17 @@ } ], "lastContributor": { - "name": "\"gaeacodes\"", - "email": "gaeacodes@gmail.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/import_swaps": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T15:33:39.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1727,15 +1761,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy": { @@ -1756,8 +1786,12 @@ } }, "/atomicdex/api/legacy/kmd_rewards_info": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T15:33:39.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1769,15 +1803,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/list_banned_pubkeys": { @@ -1806,8 +1836,12 @@ } }, "/atomicdex/api/legacy/max_taker_vol": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T15:33:39.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1819,15 +1853,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/metrics": { @@ -1852,8 +1882,12 @@ } }, "/atomicdex/api/legacy/min_trading_vol": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T23:08:10.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1865,15 +1899,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/my_balance": { @@ -1927,8 +1957,12 @@ } }, "/atomicdex/api/legacy/my_recent_swaps": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T23:08:10.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1940,20 +1974,20 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/my_swap_status": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T23:08:10.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -1965,15 +1999,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/my_tx_history": { @@ -2002,8 +2032,12 @@ } }, "/atomicdex/api/legacy/order_status": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-05T00:59:59.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2015,19 +2049,15 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/orderbook": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-05T00:07:46.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2077,8 +2107,12 @@ } }, "/atomicdex/api/legacy/orders_history_by_filter": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-05T00:59:59.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2090,15 +2124,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/rational_number_note": { @@ -2123,8 +2153,12 @@ } }, "/atomicdex/api/legacy/recover_funds_of_swap": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-05T00:59:59.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2136,20 +2170,20 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/sell": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2161,15 +2195,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/send_raw_transaction": { @@ -2198,8 +2228,12 @@ } }, "/atomicdex/api/legacy/set_required_confirmations": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-05T00:59:59.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2211,20 +2245,20 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/set_requires_notarization": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-05T00:59:59.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2236,20 +2270,20 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/setprice": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-05T00:59:59.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2261,15 +2295,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/show_priv_key": { @@ -2315,7 +2345,7 @@ } }, "/atomicdex/api/legacy/trade_preimage": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-05T00:59:59.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2340,8 +2370,12 @@ } }, "/atomicdex/api/legacy/unban_pubkeys": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-05T00:59:59.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2353,20 +2387,20 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/update_maker_order": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-05T00:59:59.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2378,20 +2412,20 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/validateaddress": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-05T00:59:59.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2403,15 +2437,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/legacy/version": { @@ -2440,16 +2470,16 @@ } }, "/atomicdex/api/legacy/withdraw": { - "dateModified": "2023-09-09T14:54:22.000Z", + "dateModified": "2023-10-05T00:59:59.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -2460,8 +2490,8 @@ } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20/add_delegation": { @@ -3328,16 +3358,16 @@ } }, "/atomicdex/api/v20-dev/lightning": { - "dateModified": "2023-10-04T09:07:04.000Z", + "dateModified": "2023-10-04T15:08:02.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -3348,8 +3378,8 @@ } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20-dev/lightning/nodes": { From 79ca2e9f2a30d81eafc852b210032fbe9a73578e Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 5 Oct 2023 15:16:36 +0800 Subject: [PATCH 17/27] update first half of v2 methods --- filepathSlugs.json | 8 +- .../common_structures/activation/index.mdx | 20 +++ .../atomicdex/api/common_structures/index.mdx | 30 +++- .../api/common_structures/orders/index.mdx | 137 ++++++++++++------ .../atomicdex/api/v20/best_orders/index.mdx | 57 ++------ .../api/v20/enable_bch_with_tokens/index.mdx | 39 +++-- .../api/v20/enable_eth_with_tokens/index.mdx | 10 +- .../enable_tendermint_with_assets/index.mdx | 16 +- .../api/v20/get_raw_transaction/index.mdx | 6 +- .../atomicdex/api/v20/orderbook/index.mdx | 2 +- .../listing-a-coin-on-atomicdex/index.mdx | 2 +- utils/_fileData.json | 22 +-- 12 files changed, 206 insertions(+), 143 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index 9a977529..435de246 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -1577,17 +1577,19 @@ "hd-utxo-activation-v2", "coin-protocol", "coin-protocol-data", - "evm-node" + "evm-node", + "utxo-merge-params" ], "src/pages/atomicdex/api/common_structures/index.mdx": [ "komodo-de-fi-sdk-common-structures", "address-format", "example", - "address-infos", + "address-info", "example-with-balances", "example-without-balances", "balance-infos", "derivation-method", + "numeric-formats-value", "fee-info", "extended-fee-info", "total-fee-info", @@ -1618,9 +1620,11 @@ "order-structures", "cancel-by", "conf-settings", + "request-by", "order-type", "order-status-data", "order-data-v1", + "order-data-v2", "order-summary-data", "match-by" ], diff --git a/src/pages/atomicdex/api/common_structures/activation/index.mdx b/src/pages/atomicdex/api/common_structures/activation/index.mdx index 29173e14..7173e9f7 100644 --- a/src/pages/atomicdex/api/common_structures/activation/index.mdx +++ b/src/pages/atomicdex/api/common_structures/activation/index.mdx @@ -169,3 +169,23 @@ The `EvmNode` object includes the following items for a given coin or token: } ``` + +### UtxoMergeParams + +The `UtxoMergeParams` object defines how often and at which thresholds to merge UTXOs. This is useful for wallets which have been used for a long time, and have many small UTXOs from mining activity. + +| Parameter | Type | Description | +| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| merge\_at | integer | Mamimum UTXO count before merge loop is initiated. | +| check\_every | integer | How frequently (in blocks) the wallet UTXO count is evaluated. | +| max\_merge\_at\_once | integer | The maximum nouber of UTXOs to inlude as inputs for a merge transaction. Note that more input UTXOs means a larger transaction and greater fees, and that each blockchain has a limit to the maximum size of a transaction. | + + + ```json + { + "merge_at": 50, + "check_every": 10, + "max_merge_at_once": 25 + } + ``` + diff --git a/src/pages/atomicdex/api/common_structures/index.mdx b/src/pages/atomicdex/api/common_structures/index.mdx index 4bd7e3fc..af07d482 100644 --- a/src/pages/atomicdex/api/common_structures/index.mdx +++ b/src/pages/atomicdex/api/common_structures/index.mdx @@ -36,9 +36,9 @@ Structures which are used in more than one section are listed below: ``` -### AddressInfos +### AddressInfo -The `addressInfos` object includes the following items for a given address: +The `AddressInfo` object includes the following items for a given address: | Parameter | Type | Description | | ------------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- | @@ -119,6 +119,32 @@ Where the value indicates: ``` +### NumericFormatsValue + +The `NumericFormatsValue` returns a price or amount in three different formats: `fraction`, `rational`, and `decimal`. + +| Parameter | Type | Description | +| --------- | -------------- | ---------------------------------------------------------------------------------------- | +| decimal | numeric string | A decimal number as a string. | +| rational | object | A standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| fraction | object | A standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | + + + ```json + { + "decimal": "0.0001", + "rational": [ + [1, [1]], + [1, [10000]] + ], + "fraction": { + "numer": "1", + "denom": "10000" + } + } + ``` + + ### FeeInfo The `FeeInfo` response object includes the following items for [withdraw (v2)](/atomicdex/api/v20/withdraw/) requests: diff --git a/src/pages/atomicdex/api/common_structures/orders/index.mdx b/src/pages/atomicdex/api/common_structures/orders/index.mdx index d02fe0e5..c5dbf003 100644 --- a/src/pages/atomicdex/api/common_structures/orders/index.mdx +++ b/src/pages/atomicdex/api/common_structures/orders/index.mdx @@ -7,7 +7,7 @@ export const description = "Each order on the Komodo Defi oderbook can be querie | Structure | Type | Description | | ----------- | ------ | -------------------------------------------------------------------------------------------------------------------------------- | -| type | string | `All` to cancel all orders; `Pair` to cancel all orders for specific coin pairs; `Coin` to cancel all orders for a specific coin | +| Type | string | `All` to cancel all orders; `Pair` to cancel all orders for specific coin pairs; `Coin` to cancel all orders for a specific coin | | data | object | additional data the cancel condition; present with `Pair` and `Coin` types | | data.base | string | base coin of the pair; `Pair` type only | | data.rel | string | rel coin of the pair; `Pair` type only | @@ -60,11 +60,40 @@ export const description = "Each order on the Komodo Defi oderbook can be querie ``` +### RequestBy + +| Structure | Type | Description | | +| --------- | ------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | integer | Defines whether requesting by `volume` or by `number`. | | +| value | numeric | string | If `type` is `volume`, the amount of `coin` (defined in the parent object) the user is willing to buy or sell. If `type` is `number`, the number of best price trades to return. | + + + Filter response to return the best trades for up to 20 of the coin defined in the parent object: + + ```json + { + "request_by": { + "type": "volume", + "value": 20 + } + } + ``` + + Filter response to return the 10 best priced trades: + + ```json + { + "type": "number", + "value": 10 + } + ``` + + ### OrderType | Structure | Type | Description | | --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | string | There are two types from which to choose: `GoodTillCancelled` and `FillOrKill`. The `GoodTillCancelled` order is automatically converted to a `maker` order if the order is not matched in 30 seconds, and this `maker` order stays in the orderbook until explicitly cancelled. On the other hand, a `FillOrKill` order is cancelled if it is not matched within 30 seconds. The default type is `GoodTillCancelled` | +| Type | string | There are two types from which to choose: `GoodTillCancelled` and `FillOrKill`. The `GoodTillCancelled` order is automatically converted to a `maker` order if the order is not matched in 30 seconds, and this `maker` order stays in the orderbook until explicitly cancelled. On the other hand, a `FillOrKill` order is cancelled if it is not matched within 30 seconds. The default type is `GoodTillCancelled` | `GoodTillCancelled` orders will remain on the orderbook until they are exhausted or explicitly cancelled. @@ -100,14 +129,14 @@ export const description = "Each order on the Komodo Defi oderbook can be querie | max\_base\_vol\_rat | rational number | Maximum trade volume as rational number | | min\_base\_vol | number | Minimum trade volume | | min\_base\_vol\_rat | rational number | Minimum trade volume as rational number | -| created\_at | number | timestamp of order creation | -| updated\_at | number | timestamp of last order update | +| created\_at | number | Timestamp of order creation | +| updated\_at | number | Timestamp of last order update | | matches | list | UUIDS of matching orders | | started\_swaps | list | UUIDS of swaps started | | uuid | string | UUID of this order | | conf\_settings | object | Confirmation / Notarisation settings for order | -| base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | -| rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | +| base\_orderbook\_ticker | string | The ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | +| rel\_orderbook\_ticker | string | The ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | | cancellable | boolean | `true` if order is in a state which it can be cancelled. `false` if not (e.g. swap is in progress) | | cancellation\_reason | string | `Cancelled` indicates order was withdrawn by user. `Fulfilled` indicates order was swapped successfully. `TimedOut` indicates a taker order with type `FillOrKill` expired before matching. | | available\_amount | string | Funds available for order to be matched against, taking into account current spendable balance and `max_volume` | @@ -184,63 +213,87 @@ export const description = "Each order on the Komodo Defi oderbook can be querie ### OrderDataV1 + + Compare and confirm the differences between this object in v1 and v2 methods. + + | Structure | Type | Description | | --------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | the ticker of the coin | -| address | string | the address offering the trade | -| price | string (decimal) | the price the user is willing to buy or sell per one unit of the coin from request | -| price\_rat | rational | the price represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | -| price\_fraction | object | the price represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | -| maxvolume | string (decimal) | the maximum amount of `base` the offer provider is willing to sell | -| max\_volume\_rat | rational | the max volume represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | -| max\_volume\_fraction | object | the max volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | -| min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to sell | -| min\_volume\_rat | rational | the min volume represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | -| min\_volume\_fraction | object | the min volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | -| pubkey | string | the pubkey of the offer provider | -| age | number | the age of the offer (in seconds) | -| zcredits | number | the zeroconf deposit amount (deprecated) | -| netid | number | the id of the network on which the request is made (default is `0`) | -| uuid | string | the uuid of order | -| is\_mine | bool | whether the order is placed by me | -| base\_max\_volume | string (decimal) | the maximum amount of `base` coin the offer provider is willing to buy or sell | -| base\_max\_volume\_rat | rational | the `base_max_volume` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | -| base\_max\_volume\_fraction | object | the `base_max_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | -| base\_min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to buy or sell | -| base\_min\_volume\_rat | rational | the `base_min_volume` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | -| base\_min\_volume\_fraction | object | the `base_min_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | -| base\_confs | number | the confirmations settings of `base` coin set by the offer provider | -| base\_nota | bool | the notarisation settings of `base` coin set by the offer provider | -| rel\_max\_volume | string (decimal) | the maximum amount of `rel` coin the offer provider is willing to buy or sell | -| rel\_max\_volume\_rat | rational | the `rel_max_volume` max volume represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | -| rel\_max\_volume\_fraction | object | the `rel_max_volume` max volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | -| rel\_min\_volume | string (decimal) | the minimum amount of `rel` coin the offer provider is willing to buy or sell | -| rel\_min\_volume\_rat | rational | the `rel_min_volume` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | -| rel\_min\_volume\_fraction | object | the `rel_min_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | -| rel\_confs | number | the confirmations settings of `rel` coin set by the offer provider | -| rel\_nota | bool | the notarisation settings of `rel` coin set by the offer provider | +| coin | string | The ticker of the coin | +| address | string | The address offering the trade | +| price | string (decimal) | The price the user is willing to buy or sell per one unit of the coin from request | +| price\_rat | rational | The price represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| price\_fraction | object | The price represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| maxvolume | string (decimal) | The maximum amount of `base` the offer provider is willing to sell | +| max\_volume\_rat | rational | The max volume represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| max\_volume\_fraction | object | The max volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| min\_volume | string (decimal) | The minimum amount of `base` coin the offer provider is willing to sell | +| min\_volume\_rat | rational | The min volume represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| min\_volume\_fraction | object | The min volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| pubkey | string | The pubkey of the offer provider | +| age | number | The age of the offer (in seconds) | +| zcredits | number | The zeroconf deposit amount (deprecated) | +| netid | number | The id of the network on which the request is made (default is `0`) | +| uuid | string | The uuid of order | +| is\_mine | bool | Whether the order is placed by me | +| base\_max\_volume | string (decimal) | The maximum amount of `base` coin the offer provider is willing to buy or sell | +| base\_max\_volume\_rat | rational | The `base_max_volume` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| base\_max\_volume\_fraction | object | The `base_max_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| base\_min\_volume | string (decimal) | The minimum amount of `base` coin the offer provider is willing to buy or sell | +| base\_min\_volume\_rat | rational | The `base_min_volume` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| base\_min\_volume\_fraction | object | The `base_min_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| base\_confs | number | The confirmations settings of `base` coin set by the offer provider | +| base\_nota | bool | The notarisation settings of `base` coin set by the offer provider | +| rel\_max\_volume | string (decimal) | The maximum amount of `rel` coin the offer provider is willing to buy or sell | +| rel\_max\_volume\_rat | rational | The `rel_max_volume` max volume represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| rel\_max\_volume\_fraction | object | The `rel_max_volume` max volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| rel\_min\_volume | string (decimal) | The minimum amount of `rel` coin the offer provider is willing to buy or sell | +| rel\_min\_volume\_rat | rational | The `rel_min_volume` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| rel\_min\_volume\_fraction | object | The `rel_min_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| rel\_confs | number | The confirmations settings of `rel` coin set by the offer provider | +| rel\_nota | bool | The notarisation settings of `rel` coin set by the offer provider | | original\_tickers | list (string) | Tickers included in response when `orderbook_ticker` is configured for the queried coin in `coins` file | +### OrderDataV2 + + + Compare and confirm the differences between this object in v1 and v2 methods. + + +| Structure | Type | Description | +| ----------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin | +| address | object | A standard [AddressInfo](/atomicdex/api/common_structures/#address-info) object. | +| price | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the coin price. | +| base\_min\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the minimum base volume. | +| base\_max\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the maximum base volume. | +| rel\_min\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the minimum rel volume. | +| rel\_max\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the maximum rel volume. | +| pubkey | string | The pubkey of the offer provider | +| uuid | string | The uuid of order | +| is\_mine | bool | Whether the order is placed by me | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | + ## OrderSummaryData | Structure | Type | Description | | ------------- | ---------------- | --------------------------------------------------------------------------------- | | uuid | string | uuid of the order | -| order\_type | string | type of the order; "Maker" or "Taker" | +| order\_type | string | Type of the order; "Maker" or "Taker" | | base | string | base coin of the order | | rel | string | rel coin of the order | | price | number (decimal) | price of the order | | volume | number (decimal) | volume of the order | | created\_at | number | unix timestamp in milliseconds, indicating the order creation time | | last\_updated | number | unix timestamp in milliseconds, indicating the time the order was last updated | -| was\_taker | number | `1` if the order was a "Taker" order that got converted to "Maker", `0` otherwise | +| Was\_taker | number | `1` if the order was a "Taker" order that got converted to "Maker", `0` otherwise | | status | string | status of the Order | ## MatchBy | Structure | Type | Description | | --------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------- | -| type | string | `Any` to match with any other order; `Orders` to select specific uuids; `Pubkeys` to select specific nodes; default is `Any` | +| Type | string | `Any` to match with any other order; `Orders` to select specific uuids; `Pubkeys` to select specific nodes; default is `Any` | | data | array of strings | A list of order uuids (to match for `Orders` type) or pubkeys of nodes (to match for `Pubkeys` type) | diff --git a/src/pages/atomicdex/api/v20/best_orders/index.mdx b/src/pages/atomicdex/api/v20/best_orders/index.mdx index 6d343ce7..bb64fb75 100644 --- a/src/pages/atomicdex/api/v20/best_orders/index.mdx +++ b/src/pages/atomicdex/api/v20/best_orders/index.mdx @@ -15,57 +15,18 @@ For coins with segwit, they may appear twice in the output (once for each addres #### Arguments -| Structure | Type | Description | -| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| coin | string | The ticker of the coin to get best orders | -| action | string | Whether to `buy` or `sell` the selected coin | -| request\_by.type | string | Defines whether requesting by `volume` or by `number` | -| request\_by.value | string | If `request_by.type` is `volume`, the amount of `coin` user is willing to buy or sell. If `request_by.type` is `number`, the number of best price trades to return | +| Structure | Type | Description | +| ----------- | ------ | ----------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin to get best orders | +| action | string | Whether to `buy` or `sell` the selected coin | +| request\_by | object | A standard [RequestBy](/atomicdex/api/common_structures/orders/#request-by) object. | #### Response -| Structure | Type | Description | -| --------- | ------------ | ------------------------------------------ | -| result | object (map) | the `ticker -> array of order entries` map | - -where order entry has the following structure - -| Structure | Type | Description | -| --------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------- | -| coin | string | the ticker of the coin | -| address | string | the address offering the trade | -| price | string (decimal) | the price the user is willing to buy or sell per one unit of the coin from request | -| price\_rat | rational | the price in num-rational crate format | -| price\_fraction | object (fraction) | the price represented as an object | -| maxvolume | string (decimal) | the maximum amount of `base` the offer provider is willing to sell | -| max\_volume\_rat | rational | the max volume in num-rational crate format | -| max\_volume\_fraction | object (rational) | the max volume represented as an object | -| min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to sell | -| min\_volume\_rat | rational | the min volume in num-rational crate format | -| min\_volume\_fraction | object (rational) | the min volume represented as an object | -| pubkey | string | the pubkey of the offer provider | -| age | number | the age of the offer (in seconds) | -| zcredits | number | the zeroconf deposit amount (deprecated) | -| netid | number | the id of the network on which the request is made (default is `0`) | -| uuid | string | the uuid of order | -| is\_mine | bool | whether the order is placed by me | -| base\_max\_volume | string (decimal) | the maximum amount of `base` coin the offer provider is willing to buy or sell | -| base\_max\_volume\_rat | rational | the `base_max_volume` in num-rational crate format | -| base\_max\_volume\_fraction | object (rational) | the `base_max_volume` represented as an object | -| base\_min\_volume | string (decimal) | the minimum amount of `base` coin the offer provider is willing to buy or sell | -| base\_min\_volume\_rat | rational | the `base_min_volume` in num-rational crate format | -| base\_min\_volume\_fraction | object (rational) | the `base_min_volume` represented as an object | -| base\_confs | number | the confirmations settings of `base` coin set by the offer provider | -| base\_nota | bool | the notarisation settings of `base` coin set by the offer provider | -| rel\_max\_volume | string (decimal) | the maximum amount of `rel` coin the offer provider is willing to buy or sell | -| rel\_max\_volume\_rat | rational | the `rel_max_volume` max volume in num-rational crate format | -| rel\_max\_volume\_fraction | object (rational) | the `rel_max_volume` max volume represented as an object | -| rel\_min\_volume | string (decimal) | the minimum amount of `rel` coin the offer provider is willing to buy or sell | -| rel\_min\_volume\_rat | rational | the `rel_min_volume` in num-rational crate format | -| rel\_min\_volume\_fraction | object (rational) | the `rel_min_volume` represented as an object | -| rel\_confs | number | the confirmations settings of `rel` coin set by the offer provider | -| rel\_nota | bool | the notarisation settings of `rel` coin set by the offer provider | -| original\_tickers | list (string) | Tickers included in response when `orderbook_ticker` is configured for the queried coin in `coins` file | +| Structure | Type | Description | +| ----------------- | ------------- | -------------------------------------------------------------------------------------------------------------- | +| orders | object (map) | the `ticker -> array of standard [OrderData](/atomicdex/api/common_structures/orders/#order-data) objects` map | +| original\_tickers | list (string) | Tickers included in response when `orderbook_ticker` is configured for the queried coin in `coins` file | #### 📌 Examples diff --git a/src/pages/atomicdex/api/v20/enable_bch_with_tokens/index.mdx b/src/pages/atomicdex/api/v20/enable_bch_with_tokens/index.mdx index 55c61eab..86614597 100644 --- a/src/pages/atomicdex/api/v20/enable_bch_with_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20/enable_bch_with_tokens/index.mdx @@ -7,29 +7,28 @@ The AtomicDEX-API supports Bitcoin Cash SLP tokens. Using this method, you can e ### Request Parameters -| Parameter | Type | Description | -| ------------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| ticker | string | Ticker of the platform protocol coin. Options: `BCH` or `tBCH` | -| bchd\_urls | array of strings | A list of BCHD gRPC API server URLs, used for validation of SLP token transactions. It's recommended to add as many servers as possible. The URLs list can be found at [https://bchd.fountainhead.cash/](https://bchd.fountainhead.cash/). | -| mode | string | Utxo RPC mode. Options: `{ "rpc":"Native" }` if running a native blockchain node, or `"rpc":"Electrum"` to use electrum RPCs. If using electrum, a list of electrum servers is required under `rpc_data.servers` | -| tx\_history | boolean | If `true`, spawns a background loop to store the local cache of address(es) transactions. Defaults to `false`. | -| slp\_tokens\_requests | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/nfts/#tokens-request) objects. | -| address\_format.format | string | Optional. Overwrites the address format from coins file, if set. Options: `{"format":"standard"}` for legacy/standard address format, `{"format":"cashaddress"}` for cash address format | -| address\_format.network | string | Optional. Overwrites the address network from coins file, if set. Options: `{"network":"bitcoincash"}` for mainnet, `{"network":"bchreg"}` for regtest, or `{"network":"bchtest"}` for testnet | -| allow\_slp\_unsafe\_conf | boolean | Optional, defaults to `false`. If `true`, allows bchd\_urls to be empty. **Warning:** it is highly unsafe to do so as it may lead to invalid SLP transactions generation and tokens burning. | -| get\_balances | boolean | Optional, defaults to `true`. If `false`, coin and token balances will not be returned in the response, and the response will be returned more quickly. | -| required\_confirmations | integer | Optional, defaults to value in the coins file, or `3` if not set. Confirmations to wait for steps in swap. | -| requires\_notarization | boolean | Optional, defaults to `true`. Has no effect on BCH. | -| tx\_history | boolean | Optional, defaults to `true`. If `true` the AtomicDEX API will preload transaction history as a background process. Must be set to `true` to use the [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method | -| utxo\_merge\_params | boolean | Optional. If defined, will spawn a background loop that checks the number of UTXOs every `check_every seconds` and merges `max_merge_at_once` utxos into a single utxo if the total exceeds `merge_at`. Recommended for addresses with high trading activity or mining which can increase the number of UTXOs in the address, leading to delays in RPC response (or in extreme cases, connection timing out). | +| Parameter | Type | Description | +| ------------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of the platform protocol coin. Options: `BCH` or `tBCH` | +| bchd\_urls | array of strings | A list of BCHD gRPC API server URLs, used for validation of SLP token transactions. It's recommended to add as many servers as possible. The URLs list can be found at [https://bchd.fountainhead.cash/](https://bchd.fountainhead.cash/). | +| mode | object | A standard [ActivationMode](/atomicdex/api/common_structures/activation/#activation-mode) object. | +| tx\_history | boolean | If `true`, spawns a background loop to store the local cache of address(es) transactions. Defaults to `false`. | +| slp\_tokens\_requests | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/nfts/#tokens-request) objects. | +| address\_format | object | Optional. Overwrites the address format from coins file, if set. A standard [AddressFormat](/atomicdex/api/common_structures/#address-format) object. | +| allow\_slp\_unsafe\_conf | boolean | Optional, defaults to `false`. If `true`, allows bchd\_urls to be empty. **Warning:** it is highly unsafe to do so as it may lead to invalid SLP transactions generation and tokens burning. | +| get\_balances | boolean | Optional, defaults to `true`. If `false`, coin and token balances will not be returned in the response, and the response will be returned more quickly. | +| required\_confirmations | integer | Optional, defaults to value in the coins file, or `3` if not set. Confirmations to wait for steps in swap. | +| requires\_notarization | boolean | Optional, defaults to `true`. Has no effect on BCH. | +| tx\_history | boolean | Optional, defaults to `true`. If `true` the AtomicDEX API will preload transaction history as a background process. Must be set to `true` to use the [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method | +| utxo\_merge\_params | object | A standard [UtxoMergeParams](/atomicdex/api/common_structures/activation/#utxo-merge-params) object. Used to reduce a wallet's UTXO count in cases where it is causing significantly slower RPC responses. | ### Response Parameters -| Parameter | Type | Description | -| --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| current\_block | integer | Block height of the coin being activated | -| bch\_addresses\_infos | object | A standard [addressInfos](/atomicdex/api/common_structures/#address-infos) object. Note: the structure may vary based on the value of the `get_balances` parameter. | -| slp\_addresses\_infos | object | A standard [addressInfos](/atomicdex/api/common_structures/#address-infos) object. Note: the structure may vary based on the value of the `get_balances` parameter. | +| Parameter | Type | Description | +| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| current\_block | integer | Block height of the coin being activated | +| bch\_addresses\_infos | object | A standard [AddressInfo](/atomicdex/api/common_structures/#address-info) object. Note: the structure may vary based on the value of the `get_balances` parameter. | +| slp\_addresses\_infos | object | A standard [AddressInfo](/atomicdex/api/common_structures/#address-info) object. Note: the structure may vary based on the value of the `get_balances` parameter. | bch\_addresses\_infos and slp\_addresses\_infos are the same. This should be consolidated in the api. diff --git a/src/pages/atomicdex/api/v20/enable_eth_with_tokens/index.mdx b/src/pages/atomicdex/api/v20/enable_eth_with_tokens/index.mdx index 1a32572b..c02f3618 100644 --- a/src/pages/atomicdex/api/v20/enable_eth_with_tokens/index.mdx +++ b/src/pages/atomicdex/api/v20/enable_eth_with_tokens/index.mdx @@ -27,11 +27,11 @@ Additionally, it supports ERC20 tokens on the ETH chain and associated ERC20 lik ### Response Parameters -| Parameter | Type | Description | -| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| current\_block | integer | Block height of the coin being activated | -| eth\_addresses\_infos | object | A standard [addressInfos](/atomicdex/api/common_structures/#address-infos) object. Note: the structure may vary based on the value of the `get_balances` parameter. | -| erc20\_addresses\_infos | object | A standard [addressInfos](/atomicdex/api/common_structures/#address-infos) object. Note: the structure may vary based on the value of the `get_balances` parameter. | +| Parameter | Type | Description | +| ----------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| current\_block | integer | Block height of the coin being activated | +| eth\_addresses\_infos | object | A standard [AddressInfo](/atomicdex/api/common_structures/#address-info) object. Note: the structure may vary based on the value of the `get_balances` parameter. | +| erc20\_addresses\_infos | object | A standard [AddressInfo](/atomicdex/api/common_structures/#address-info) object. Note: the structure may vary based on the value of the `get_balances` parameter. | ### 📌 Examples diff --git a/src/pages/atomicdex/api/v20/enable_tendermint_with_assets/index.mdx b/src/pages/atomicdex/api/v20/enable_tendermint_with_assets/index.mdx index 581a003b..f2d15de0 100644 --- a/src/pages/atomicdex/api/v20/enable_tendermint_with_assets/index.mdx +++ b/src/pages/atomicdex/api/v20/enable_tendermint_with_assets/index.mdx @@ -20,14 +20,14 @@ Use this method to activate Tendermint coins (COSMOS/IRIS/OSMOSIS) and IBC asset ### Response Parameters -| Parameter | Type | Description | -| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| current\_block | integer | Block height of the coin being activated | -| ticker | string | Ticker of the platform protocol coin, as input in the request. | -| address | string | An address for the activated coin | -| balance | object | Only returned when `get_balances` is `true`. A standard [BalanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | -| tokens\_balances | array of objects | Only returned when `get_balances` is `true`. A list of standard [addressInfos](/atomicdex/api/common_structures/#address-infos) objects, one for each token. | -| tokens\_tickers | array | Only returned when `get_balances` is `false`. A list of each token which was activated. | +| Parameter | Type | Description | +| ---------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| current\_block | integer | Block height of the coin being activated | +| ticker | string | Ticker of the platform protocol coin, as input in the request. | +| address | string | An address for the activated coin | +| balance | object | Only returned when `get_balances` is `true`. A standard [BalanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | +| tokens\_balances | array of objects | Only returned when `get_balances` is `true`. A list of standard [AddressInfo](/atomicdex/api/common_structures/#address-info) objects, one for each token. | +| tokens\_tickers | array | Only returned when `get_balances` is `false`. A list of each token which was activated. | ### 📌 Examples diff --git a/src/pages/atomicdex/api/v20/get_raw_transaction/index.mdx b/src/pages/atomicdex/api/v20/get_raw_transaction/index.mdx index 11c87dbe..77c8af82 100644 --- a/src/pages/atomicdex/api/v20/get_raw_transaction/index.mdx +++ b/src/pages/atomicdex/api/v20/get_raw_transaction/index.mdx @@ -14,9 +14,9 @@ The `get_raw_transaction` method takes `coin` and `tx_hash` as input, and return ## Response -| Structure | Type | Description | -| --------- | --------- | ------------------------------- | -| tx\_hex | BytesJson | raw bytes of signed transaction | +| Structure | Type | Description | +| --------- | ------ | -------------------------------------------- | +| tx\_hex | string | bytes of signed transaction in string format | #### Examples: diff --git a/src/pages/atomicdex/api/v20/orderbook/index.mdx b/src/pages/atomicdex/api/v20/orderbook/index.mdx index da8f308d..0a3ffc63 100644 --- a/src/pages/atomicdex/api/v20/orderbook/index.mdx +++ b/src/pages/atomicdex/api/v20/orderbook/index.mdx @@ -63,7 +63,7 @@ The v2 `orderbook` method requests from the network the currently available orde | pubkey | string | The pubkey of the offer provider | | uuid | string | The uuid of order | | is\_mine | bool | Whether the order is placed by me | -| conf\_settings | object | A standard `ConfSettings` object | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | | base\_max\_volume | object | A standard `OrderAmount` object representing the maximum base amount for this order | | base\_min\_volume | object | A standard `OrderAmount` object representing the minimum base amount for this order | | rel\_max\_volume | object | A standard `OrderAmount` object representing the maximum rel amount for this order | diff --git a/src/pages/atomicdex/tutorials/listing-a-coin-on-atomicdex/index.mdx b/src/pages/atomicdex/tutorials/listing-a-coin-on-atomicdex/index.mdx index 48f26912..d100636c 100644 --- a/src/pages/atomicdex/tutorials/listing-a-coin-on-atomicdex/index.mdx +++ b/src/pages/atomicdex/tutorials/listing-a-coin-on-atomicdex/index.mdx @@ -63,7 +63,7 @@ sendrawtransaction | force\_min\_relay\_fee | boolean | If `true` for coins with dynamic fees, when a new transaction is generated, AtomicDEX-API will check whether the total fee set (`sat * tx size`) is lower than relay fee and will use the relay fee instead. Defaults to `false` | | mtp\_block\_count | integer | Optional. Number of blocks to be used for the calculation of `median time past`. Must be greater than `0`. Default value is `11`. While this parameter is applicable only in the case of KMD reward calculation for now, it will be used for calculating locktimes to be set for the atomic swap refund transactions. | | estimate\_fee\_mode | string | Sets the fee mode for the `estimatesmartfee` call. Supported values are: `ECONOMICAL`,`CONSERVATIVE`, `UNSET`. Please note that some coins may not support some of these modes. Makes no effect for coins that do not have the `estimatesmartfee` RPC. | -| address\_format | Object | Optional. Defines whether to use the standard bitcoin address format or the cash address format for BCH. More formats may be added in the future. Possible values as of now: `"address_format":{"format":"standard"}` to set the standard BTC/UTXO address format. `"address_format":{"format":"cashaddress","network":"NETWORK_ID"}` to use BCH specific address format. `NETWORK_ID` can be: `bitcoincash` for BCH mainnet, `bchtest` for BCH testnet and `bchreg` for BCH regtest. | +| address\_format | object | Optional. Overwrites the address format from coins file, if set. A standard [AddressFormat](/atomicdex/api/common_structures/#address-format) object. | | isPoS | integer | Optional, defaults to `0`. A value of `1` indicates the coin uses proof of stake, so transactions created will have the `nTime` field. | | segwit | Boolean | If `true`, AtomicDEX-API will use to `P2SH` segwit addresses. | | version\_group\_id | integer | Optional, used by Zcash (and its forks') transactions. | diff --git a/utils/_fileData.json b/utils/_fileData.json index 36287397..86430722 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -1078,7 +1078,7 @@ } }, "/atomicdex/api/common_structures": { - "dateModified": "2023-10-05T00:59:59.000Z", + "dateModified": "2023-10-05T01:14:39.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1117,7 +1117,7 @@ } }, "/atomicdex/api/common_structures/orders": { - "dateModified": "2023-10-05T00:59:59.000Z", + "dateModified": "2023-10-05T01:14:39.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1294,7 +1294,7 @@ } }, "/atomicdex/api/legacy/best_orders": { - "dateModified": "2023-10-05T00:07:46.000Z", + "dateModified": "2023-10-05T01:14:39.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2032,7 +2032,7 @@ } }, "/atomicdex/api/legacy/order_status": { - "dateModified": "2023-10-05T00:59:59.000Z", + "dateModified": "2023-10-05T01:14:39.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2057,7 +2057,7 @@ } }, "/atomicdex/api/legacy/orderbook": { - "dateModified": "2023-10-05T00:07:46.000Z", + "dateModified": "2023-10-05T01:14:39.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2107,7 +2107,7 @@ } }, "/atomicdex/api/legacy/orders_history_by_filter": { - "dateModified": "2023-10-05T00:59:59.000Z", + "dateModified": "2023-10-05T01:14:39.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2153,7 +2153,7 @@ } }, "/atomicdex/api/legacy/recover_funds_of_swap": { - "dateModified": "2023-10-05T00:59:59.000Z", + "dateModified": "2023-10-05T01:14:39.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2345,7 +2345,7 @@ } }, "/atomicdex/api/legacy/trade_preimage": { - "dateModified": "2023-10-05T00:59:59.000Z", + "dateModified": "2023-10-05T01:14:39.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2370,7 +2370,7 @@ } }, "/atomicdex/api/legacy/unban_pubkeys": { - "dateModified": "2023-10-05T00:59:59.000Z", + "dateModified": "2023-10-05T01:14:39.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2420,7 +2420,7 @@ } }, "/atomicdex/api/legacy/validateaddress": { - "dateModified": "2023-10-05T00:59:59.000Z", + "dateModified": "2023-10-05T01:14:39.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2470,7 +2470,7 @@ } }, "/atomicdex/api/legacy/withdraw": { - "dateModified": "2023-10-05T00:59:59.000Z", + "dateModified": "2023-10-05T01:14:39.000Z", "contributors": [ { "name": "\"smk762\"", From 6ef931319724068598d398b30ee9e5d04f85bb94 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 5 Oct 2023 15:39:46 +0800 Subject: [PATCH 18/27] add sync status object --- filepathSlugs.json | 5 +- .../atomicdex/api/common_structures/index.mdx | 47 +++++++++++++++++ .../api/legacy/my_tx_history/index.mdx | 28 ++++------ .../api/v20-dev/task_enable_z_coin/index.mdx | 28 ++++------ .../atomicdex/api/v20/my_tx_history/index.mdx | 39 ++++++-------- utils/_fileData.json | 52 ++++++++++--------- 6 files changed, 117 insertions(+), 82 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index 435de246..32f039bc 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -1596,7 +1596,10 @@ "fractional-value", "pagination", "example-2", - "rational-value" + "rational-value", + "sync-status", + "sync-status-extended", + "example-3" ], "src/pages/atomicdex/api/common_structures/lightning/index.mdx": [ "lightning-network-structures", diff --git a/src/pages/atomicdex/api/common_structures/index.mdx b/src/pages/atomicdex/api/common_structures/index.mdx index af07d482..2649ee59 100644 --- a/src/pages/atomicdex/api/common_structures/index.mdx +++ b/src/pages/atomicdex/api/common_structures/index.mdx @@ -240,3 +240,50 @@ The `numerator` and `denominator` are BigInteger numbers represented as a sign a `[1,[0,1]]` represents `+0000000000000000000000000000000010000000000000000000000000000000` = `4294967296` `[-1,[1,1]]` represents `-1000000000000000000000000000000010000000000000000000000000000000` = `-4294967297` + +### SyncStatus + +| Parameter | Type | Description | +| ---------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| state | string | current state of sync; possible values: `NotEnabled`, `NotStarted`, `InProgress`, `Error`, `Finished` | +| additional\_info | object | A standard [SyncStatusExtended](/atomicdex/api/common_structures/#sync-status-extended/) object. Additional info that helps to track the progress; present for `InProgress` and `Error` states only. | + +### SyncStatusExtended + +| Parameter | Type | Description | +| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------ | +| blocks\_left | number | present for ETH/ERC20 coins only; displays the number of blocks left to be processed for `InProgress` state | +| transactions\_left | number | present for UTXO coins only; displays the number of transactions left to be processed for `InProgress` state | +| code | number | displays the error code for `Error` state | +| message | number | displays the error message for `Error` state | + + + #### Example + + ```json + { + "sync_status": { + "state": "NotStarted" + } + } + ``` + + ```json + { + "sync_status": { + "additional_info": { + "transactions_left": 126 + }, + "state": "InProgress" + } + } + ``` + + ```json + { + "sync_status": { + "state": "Finished" + } + } + ``` + diff --git a/src/pages/atomicdex/api/legacy/my_tx_history/index.mdx b/src/pages/atomicdex/api/legacy/my_tx_history/index.mdx index eb90cc52..be648791 100644 --- a/src/pages/atomicdex/api/legacy/my_tx_history/index.mdx +++ b/src/pages/atomicdex/api/legacy/my_tx_history/index.mdx @@ -22,23 +22,17 @@ The coin that is used must have `tx_history` set to true in its [enable](/atomic ## Response -| Structure | Type | Description | -| ------------------------------------------------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| transactions | array of objects | transactions data | -| from\_id | string | the from\_id specified in the request; this value is null if from\_id was not set | -| skipped | number | the number of skipped records (i.e. the position of `from_id` in the list + 1); this value is 0 if `from_id` was not set | -| limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) | -| total | number | the total number of transactions available | -| page\_number | number | the page\_number that was set in the request | -| total\_pages | number | total pages available with the selected limit | -| current\_block | number | the number of the latest block of coin blockchain | -| sync\_status | object | provides the information that helps to track the progress of transaction history preloading at background | -| sync\_status.state | string | current state of sync; possible values: `NotEnabled`, `NotStarted`, `InProgress`, `Error`, `Finished` | -| sync\_status.additional\_info | object | additional info that helps to track the progress; present for `InProgress` and `Error` states only | -| sync\_status.additional\_info.blocks\_left | number | present for ETH/ERC20 coins only; displays the number of blocks left to be processed for `InProgress` state | -| sync\_status.additional\_info.transactions\_left | number | present for UTXO coins only; displays the number of transactions left to be processed for `InProgress` state | -| sync\_status.additional\_info.code | number | displays the error code for `Error` state | -| sync\_status.additional\_info.message | number | displays the error message for `Error` state | +| Structure | Type | Description | +| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| transactions | array of objects | transactions data | +| from\_id | string | the from\_id specified in the request; this value is null if from\_id was not set | +| skipped | number | the number of skipped records (i.e. the position of `from_id` in the list + 1); this value is 0 if `from_id` was not set | +| limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) | +| total | number | the total number of transactions available | +| page\_number | number | the page\_number that was set in the request | +| total\_pages | number | total pages available with the selected limit | +| current\_block | number | the number of the latest block of coin blockchain | +| sync\_status | object | A standard [SyncStatus](/atomicdex/api/common_structures/#sync-status/) object. Provides the information that helps to track the progress of transaction history preloading at background | #### 📌 Examples diff --git a/src/pages/atomicdex/api/v20-dev/task_enable_z_coin/index.mdx b/src/pages/atomicdex/api/v20-dev/task_enable_z_coin/index.mdx index f450efa5..72d2d2e0 100644 --- a/src/pages/atomicdex/api/v20-dev/task_enable_z_coin/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/task_enable_z_coin/index.mdx @@ -475,23 +475,17 @@ To get the transaction history for ZHTLC coins, you need to use this special met #### Response -| Structure | Type | Description | -| ------------------------------------------------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| transactions | array of objects | transactions data | -| from\_id | string | the from\_id specified in the request; this value is null if from\_id was not set | -| skipped | number | the number of skipped records (i.e. the position of `from_id` in the list + 1); this value is 0 if `from_id` was not set | -| limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) | -| total | number | the total number of transactions available | -| page\_number | number | the page\_number that was set in the request | -| total\_pages | number | total pages available with the selected limit | -| current\_block | number | the number of the latest block of coin blockchain | -| sync\_status | object | provides the information that helps to track the progress of transaction history preloading at background | -| sync\_status.state | string | current state of sync; possible values: `NotEnabled`, `NotStarted`, `InProgress`, `Error`, `Finished` | -| sync\_status.additional\_info | object | additional info that helps to track the progress; present for `InProgress` and `Error` states only | -| sync\_status.additional\_info.blocks\_left | number | present for ETH/ERC20 coins only; displays the number of blocks left to be processed for `InProgress` state | -| sync\_status.additional\_info.transactions\_left | number | present for UTXO coins only; displays the number of transactions left to be processed for `InProgress` state | -| sync\_status.additional\_info.code | number | displays the error code for `Error` state | -| sync\_status.additional\_info.message | number | displays the error message for `Error` state | +| Structure | Type | Description | +| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| transactions | array of objects | transactions data | +| from\_id | string | the from\_id specified in the request; this value is null if from\_id was not set | +| skipped | number | the number of skipped records (i.e. the position of `from_id` in the list + 1); this value is 0 if `from_id` was not set | +| limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) | +| total | number | the total number of transactions available | +| page\_number | number | the page\_number that was set in the request | +| total\_pages | number | total pages available with the selected limit | +| current\_block | number | the number of the latest block of coin blockchain | +| sync\_status | object | A standard [SyncStatus](/atomicdex/api/common_structures/#sync-status/) object. Provides the information that helps to track the progress of transaction history preloading at background | #### 📌 Examples diff --git a/src/pages/atomicdex/api/v20/my_tx_history/index.mdx b/src/pages/atomicdex/api/v20/my_tx_history/index.mdx index d5923385..628998e3 100644 --- a/src/pages/atomicdex/api/v20/my_tx_history/index.mdx +++ b/src/pages/atomicdex/api/v20/my_tx_history/index.mdx @@ -10,32 +10,25 @@ For all other coins, use the legacy [my\_tx\_history](/atomicdex/api/legacy/my_t ## Arguments -| parameter | Type | Description | -| -------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | Ticker of the coin to get history for. | -| limit | integer | Optional. Limits the number of returned transactions. Defaults to `10`. Ignored if `max = true`. | -| paging\_options.FromId | string | Optional. AtomicDEX API will skip records until it reaches this ID, skipping the from\_id as well; track the internal\_id of the last displayed transaction to find the value of this field for the next page | -| paging\_options.PageNumber | integer | Optional. AtomicDEX API will return limit swaps from the selected page. Ignored if `FromId` . | +| parameter | Type | Description | +| --------------- | ------- | ------------------------------------------------------------------------------------------------ | +| coin | string | Ticker of the coin to get history for. | +| limit | integer | Optional. Limits the number of returned transactions. Defaults to `10`. Ignored if `max = true`. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | #### Response -| Structure | Type | Description | -| ------------------------------------------------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| transactions | array of objects | transactions data | -| from\_id | string | the from\_id specified in the request; this value is null if from\_id was not set | -| skipped | number | the number of skipped records (i.e. the position of `from_id` in the list + 1); this value is 0 if `from_id` was not set | -| limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) | -| total | number | the total number of transactions available | -| page\_number | number | the page\_number that was set in the request | -| total\_pages | number | total pages available with the selected limit | -| current\_block | number | the number of the latest block of coin blockchain | -| sync\_status | object | provides the information that helps to track the progress of transaction history preloading at background | -| sync\_status.state | string | current state of sync; possible values: `NotEnabled`, `NotStarted`, `InProgress`, `Error`, `Finished` | -| sync\_status.additional\_info | object | additional info that helps to track the progress; present for `InProgress` and `Error` states only | -| sync\_status.additional\_info.blocks\_left | number | present for ETH/ERC20 coins only; displays the number of blocks left to be processed for `InProgress` state | -| sync\_status.additional\_info.transactions\_left | number | present for UTXO coins only; displays the number of transactions left to be processed for `InProgress` state | -| sync\_status.additional\_info.code | number | displays the error code for `Error` state | -| sync\_status.additional\_info.message | number | displays the error message for `Error` state | +| Structure | Type | Description | +| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| transactions | array of objects | transactions data | +| from\_id | string | the from\_id specified in the request; this value is null if from\_id was not set | +| skipped | number | the number of skipped records (i.e. the position of `from_id` in the list + 1); this value is 0 if `from_id` was not set | +| limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) | +| total | number | the total number of transactions available | +| page\_number | number | the page\_number that was set in the request | +| total\_pages | number | total pages available with the selected limit | +| current\_block | number | the number of the latest block of coin blockchain | +| sync\_status | object | A standard [SyncStatus](/atomicdex/api/common_structures/#sync-status/) object. Provides the information that helps to track the progress of transaction history preloading at background | ## Request (BCH from page 2) diff --git a/utils/_fileData.json b/utils/_fileData.json index 86430722..f4a8007f 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -1065,7 +1065,7 @@ } }, "/atomicdex/api/common_structures/activation": { - "dateModified": "2023-10-04T08:31:28.000Z", + "dateModified": "2023-10-05T07:16:36.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1078,7 +1078,7 @@ } }, "/atomicdex/api/common_structures": { - "dateModified": "2023-10-05T01:14:39.000Z", + "dateModified": "2023-10-05T07:16:36.000Z", "contributors": [ { "name": "\"smk762\"", @@ -1117,7 +1117,7 @@ } }, "/atomicdex/api/common_structures/orders": { - "dateModified": "2023-10-05T01:14:39.000Z", + "dateModified": "2023-10-05T07:16:36.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2545,8 +2545,12 @@ } }, "/atomicdex/api/v20/best_orders": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-05T07:16:36.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2558,19 +2562,15 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20/enable_bch_with_tokens": { - "dateModified": "2023-10-04T08:31:28.000Z", + "dateModified": "2023-10-05T07:16:36.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2620,7 +2620,7 @@ } }, "/atomicdex/api/v20/enable_eth_with_tokens": { - "dateModified": "2023-10-04T08:31:28.000Z", + "dateModified": "2023-10-05T07:16:36.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2695,7 +2695,7 @@ } }, "/atomicdex/api/v20/enable_tendermint_with_assets": { - "dateModified": "2023-10-04T08:31:28.000Z", + "dateModified": "2023-10-05T07:16:36.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2770,8 +2770,12 @@ } }, "/atomicdex/api/v20/get_raw_transaction": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-05T07:16:36.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -2783,15 +2787,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20/get_staking_infos": { @@ -2895,7 +2895,7 @@ } }, "/atomicdex/api/v20/orderbook": { - "dateModified": "2023-09-27T20:43:30.000Z", + "dateModified": "2023-10-05T07:16:36.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3992,8 +3992,12 @@ } }, "/atomicdex/tutorials/listing-a-coin-on-atomicdex": { - "dateModified": "2023-10-04T06:26:45.000Z", + "dateModified": "2023-10-05T07:16:36.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -4008,8 +4012,8 @@ } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/tutorials/query-the-mm2-database": { From e85f307313492753b6ddaa6bc779990376eca9e0 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 5 Oct 2023 16:00:09 +0800 Subject: [PATCH 19/27] update v2 orderbook --- filepathSlugs.json | 1 + .../api/common_structures/orders/index.mdx | 44 +++++++---- .../atomicdex/api/v20/orderbook/index.mdx | 77 ++++--------------- utils/_fileData.json | 8 +- 4 files changed, 50 insertions(+), 80 deletions(-) diff --git a/filepathSlugs.json b/filepathSlugs.json index 32f039bc..b17e3e98 100644 --- a/filepathSlugs.json +++ b/filepathSlugs.json @@ -1624,6 +1624,7 @@ "cancel-by", "conf-settings", "request-by", + "order-address", "order-type", "order-status-data", "order-data-v1", diff --git a/src/pages/atomicdex/api/common_structures/orders/index.mdx b/src/pages/atomicdex/api/common_structures/orders/index.mdx index c5dbf003..ee815fec 100644 --- a/src/pages/atomicdex/api/common_structures/orders/index.mdx +++ b/src/pages/atomicdex/api/common_structures/orders/index.mdx @@ -89,6 +89,22 @@ export const description = "Each order on the Komodo Defi oderbook can be querie ``` +## OrderAddress + +| Structure | Type | Description | +| ------------- | ------ | -------------------------------------------------------------------- | +| address\_type | string | Generally `Transparent`, but may be `Shielded` for supporting coins. | +| address\_data | string | The actual address text for sending and receiving funds. | + + + ```json + { + "address_type": "Transparent", + "address_data": "DEsCggcN3WNmaTkF2WpqoMQqx4JGQrLbPS" + } + ``` + + ### OrderType | Structure | Type | Description | @@ -260,19 +276,21 @@ export const description = "Each order on the Komodo Defi oderbook can be querie Compare and confirm the differences between this object in v1 and v2 methods. -| Structure | Type | Description | -| ----------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The ticker of the coin | -| address | object | A standard [AddressInfo](/atomicdex/api/common_structures/#address-info) object. | -| price | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the coin price. | -| base\_min\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the minimum base volume. | -| base\_max\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the maximum base volume. | -| rel\_min\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the minimum rel volume. | -| rel\_max\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the maximum rel volume. | -| pubkey | string | The pubkey of the offer provider | -| uuid | string | The uuid of order | -| is\_mine | bool | Whether the order is placed by me | -| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | +| Structure | Type | Description | +| ----------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin | +| address | object | A standard [OrderAddress](/atomicdex/api/common_structures/orders/#order-address) object. | +| price | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the coin price. | +| base\_min\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the minimum base volume. | +| base\_max\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the maximum base volume. | +| base\_max\_volume\_aggr | object | Orderbook (v2) only. A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the maximum aggregated base amount at the specified price. The sum of max base volumes of the current order and all orders with a worse price. | +| rel\_min\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the minimum rel volume. | +| rel\_max\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the maximum rel volume. | +| rel\_max\_volume\_aggr | object | Orderbook (v2) only. A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the maximum aggregated rel amount at the specified price. The sum of max rel volumes of the current order and all orders with a worse price. | +| pubkey | string | The pubkey of the offer provider | +| uuid | string | The uuid of order | +| is\_mine | bool | Whether the order is placed by me | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | ## OrderSummaryData diff --git a/src/pages/atomicdex/api/v20/orderbook/index.mdx b/src/pages/atomicdex/api/v20/orderbook/index.mdx index 0a3ffc63..c3e20b8d 100644 --- a/src/pages/atomicdex/api/v20/orderbook/index.mdx +++ b/src/pages/atomicdex/api/v20/orderbook/index.mdx @@ -16,69 +16,20 @@ The v2 `orderbook` method requests from the network the currently available orde ## Response -| Structure | Type | Description | -| ---------------------- | ---------------- | ---------------------------------------------------------------------- | -| base | string | the name of the coin the user desires to receive | -| rel | string | the name of the coin the user will trade | -| numasks | integer | the number of outstanding asks | -| numbids | integer | the number of outstanding bids | -| netid | integer | the id of the network on which the request is made (default is `7777`) | -| asks | array of objects | an array of standard `Order` objects containing outstanding asks | -| bids | array of objects | an array of standard `Order` objects containing outstanding bids | -| timestamp | integer | the time the orderbook was requested | -| total\_asks\_base\_vol | object | A standard `OrderAmount` object. | -| total\_asks\_rel\_vol | object | A standard `OrderAmount` object. | -| total\_bids\_base\_vol | object | A standard `OrderAmount` object. | -| total\_bids\_rel\_vol | object | A standard `OrderAmount` object. | - -**`OrderAddress` object structure** - -| Structure | Type | Description | -| ------------- | ------ | -------------------------------------------------------------------- | -| address\_type | string | Generally `Transparent`, but may be `Shielded` for supporting coins. | -| address\_data | string | The actual address text for sending and receiving funds. | - -**`OrderAmount` object structure** - -| Structure | Type | Description | -| --------- | ---------------- | ------------------------------------------------------------------------ | -| decimal | string (decimal) | Decimal numeric representation of the volume | -| rational | object | Rational number representation of the volume (num-rational crate format) | -| fraction | object | A `FractionAmount` object, representing the volume | - -**`FractionAmount` object structure** - -| Structure | Type | Description | -| --------- | ---------------- | ------------------------------- | -| numer | string (decimal) | The numerator of the fraction | -| denom | object | The denominator of the fraction | - -**`Order` object structure** - -| Structure | Type | Description | -| ----------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | The name of the `base` coin; the user desires this | -| address | object | A standard `OrderAddress` object | -| price | object | The price in `rel` the user is willing to pay per one unit of the `base` coin | -| pubkey | string | The pubkey of the offer provider | -| uuid | string | The uuid of order | -| is\_mine | bool | Whether the order is placed by me | -| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | -| base\_max\_volume | object | A standard `OrderAmount` object representing the maximum base amount for this order | -| base\_min\_volume | object | A standard `OrderAmount` object representing the minimum base amount for this order | -| rel\_max\_volume | object | A standard `OrderAmount` object representing the maximum rel amount for this order | -| rel\_min\_volume | object | A standard `OrderAmount` object representing the minimum rel amount for this order | -| base\_max\_volume\_aggr | object | A standard `OrderAmount` object representing the maximum aggregated base amount at the specified price. The sum of max base volumes of the current order and all orders with a worse price. | -| rel\_max\_volume\_aggr | object | A standard `OrderAmount` object representing the maximum aggregated rel amount at the specified price. The sum of max rel volumes of the current order and all orders with a worse price. | - -**`ConfSettings` object structure** - -| Structure | Type | Description | -| ----------- | ------ | ------------------------------------------------------------------- | -| base\_confs | number | the confirmations settings of `base` coin set by the offer provider | -| base\_nota | bool | the notarisation settings of `base` coin set by the offer provider | -| rel\_confs | number | the confirmations settings of `rel` coin set by the offer provider | -| rel\_nota | bool | the notarisation settings of `rel` coin set by the offer provider | +| Structure | Type | Description | +| ---------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| base | string | The name of the coin the user desires to receive | +| rel | string | The name of the coin the user will trade | +| numasks | integer | The number of outstanding asks | +| numbids | integer | The number of outstanding bids | +| netid | integer | The id of the network on which the request is made (default is `8762`) | +| asks | array of objects | An array of standard [OrderDataV2](/atomicdex/api/common_structures/orders/#order-data-v2) objects containing outstanding asks | +| bids | array of objects | An array of standard [OrderDataV2](/atomicdex/api/common_structures/orders/#order-data-v2) objects containing outstanding bids | +| timestamp | integer | A UNIX timestamp representing when the orderbook was requested | +| total\_asks\_base\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | +| total\_asks\_rel\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | +| total\_bids\_base\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | +| total\_bids\_rel\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | #### 📌 Examples diff --git a/utils/_fileData.json b/utils/_fileData.json index f4a8007f..492dbdbb 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -1078,7 +1078,7 @@ } }, "/atomicdex/api/common_structures": { - "dateModified": "2023-10-05T07:16:36.000Z", + "dateModified": "2023-10-05T07:39:46.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2007,7 +2007,7 @@ } }, "/atomicdex/api/legacy/my_tx_history": { - "dateModified": "2023-09-28T13:40:06.000Z", + "dateModified": "2023-10-05T07:39:46.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2870,7 +2870,7 @@ } }, "/atomicdex/api/v20/my_tx_history": { - "dateModified": "2023-09-28T13:40:06.000Z", + "dateModified": "2023-10-05T07:39:46.000Z", "contributors": [ { "name": "\"smk762\"", @@ -3513,7 +3513,7 @@ } }, "/atomicdex/api/v20-dev/task_enable_z_coin": { - "dateModified": "2023-10-04T08:31:28.000Z", + "dateModified": "2023-10-05T07:39:46.000Z", "contributors": [ { "name": "\"smk762\"", From 88d48210ce226cd4a219237ba2366b3f5908eece Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 5 Oct 2023 16:10:18 +0800 Subject: [PATCH 20/27] complete common structure update for v2 methods --- .../api/v20/trade_preimage/index.mdx | 31 ++++++------------- .../atomicdex/api/v20/withdraw/index.mdx | 19 +++++------- utils/_fileData.json | 4 +-- 3 files changed, 20 insertions(+), 34 deletions(-) diff --git a/src/pages/atomicdex/api/v20/trade_preimage/index.mdx b/src/pages/atomicdex/api/v20/trade_preimage/index.mdx index b4f13871..562a4dba 100644 --- a/src/pages/atomicdex/api/v20/trade_preimage/index.mdx +++ b/src/pages/atomicdex/api/v20/trade_preimage/index.mdx @@ -32,27 +32,16 @@ Depending on the parameters, the function returns different results: ### Result -| Structure | Type | Description | -| -------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| result | object | an object containing the relevant information | -| result.base\_coin\_fee | object (`ExtendedFeeInfo`) | the approximate miner fee is paid per the whole swap concerning the `base` coin | -| result.rel\_coin\_fee | object (`ExtendedFeeInfo`) | the approximate miner fee is paid per the whole swap concerning the `rel` coin | -| result.volume | string (numeric, optional) | the max available volume that can be traded (in decimal representation); empty if the `max` argument is missing or false | -| result.volume\_rat | rational (optional) | the max available volume that can be traded (in rational representation); empty if the `max` argument is missing or false | -| result.volume\_fraction | fraction (optional) | the max available volume that can be traded (in fraction representation); empty if the `max` argument is missing or false | -| result.taker\_fee | object (optional, `ExtendedFeeInfo`) | the dex fee to be paid by Taker; empty if `swap_method` is `setprice` | -| result.fee\_to\_send\_taker\_fee | object (optional, `ExtendedFeeInfo`) | the approximate miner fee is paid to send the dex fee; empty if `swap_method` is `setprice` | -| result.total\_fees | array of `ExtendedFeeInfo` objects | each element is a sum of fees required to be paid from user's balance of corresponding `ExtendedFeeInfo.coin`; the elements are unique by coin | - -Where the `ExtendedFeeInfo` has - -| Structure | Type | Description | -| ------------------------ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | the fee is paid from the user's balance of this coin. This coin name may differ from the `base` or `rel` coins. For example, ERC20 fees are paid by ETH (gas) | -| amount | string (numeric) | fee amount (in decimal representation) | -| amount\_rat | rational | fee amount (in rational representation) | -| amount\_fraction | fraction | fee amount (in fraction representation) | -| paid\_from\_trading\_vol | boolean | If `true`, fees are deducted from the payment amount for the spend/refund UTXO HTLC transaction. If `false`, fees are not deducted from the traded volume. This is where an additional miner fee is needed to broadcast a swap transaction and/or where gas paid (e.g in ETH for an ERC20 trade) - in this case, user requires a sufficient current ETH balance to cover the fees before they can initiate the swap. | +| Structure | Type | Description | +| ------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| base\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `base` coin | +| rel\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `rel` coin | +| volume | string (numeric) | Optional. The max available volume that can be traded (in decimal representation); empty if the `max` argument is missing or false | +| volume\_rat | rational | Optional. The max available volume that can be traded represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object.; empty if the `max` argument is missing or false | +| volume\_fraction | fraction | Optional. The max available volume that can be traded represented as a standard [fractionalValue](/atomicdex/api/common_structures/#fractional-value) object.; empty if the `max` argument is missing or false | +| taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The dex fee to be paid by Taker; empty if `swap_method` is `setprice` | +| fee\_to\_send\_taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid to send the dex fee; empty if `swap_method` is `setprice` | +| total\_fees | array of objects | A standard [TotalFeeInfo](/atomicdex/api/common_structures/#total-fee-info) object. Each element is a sum of fees required to be paid from user's balance of corresponding `ExtendedFeeInfo.coin`; the elements are unique by coin | ### ⚠ Error types diff --git a/src/pages/atomicdex/api/v20/withdraw/index.mdx b/src/pages/atomicdex/api/v20/withdraw/index.mdx index 3cd073ea..bfedb489 100644 --- a/src/pages/atomicdex/api/v20/withdraw/index.mdx +++ b/src/pages/atomicdex/api/v20/withdraw/index.mdx @@ -9,17 +9,14 @@ This method generates a raw transaction which should then be broadcast using [se ## Arguments -| Structure | Type | Description | -| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -| coin | string | the name of the coin the user desires to withdraw | -| to | string | coins are withdrawn to this address | -| amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` | -| memo | string | Optional. Adds a transaction memo for compatible coins (e.g. Tendermint ecosystem). | -| max | bool | withdraw the maximum available amount | -| fee.type | string | type of transaction fee; possible values: `UtxoFixed`, `UtxoPerKbyte`, `EthGas` | -| fee.amount | string (numeric) | fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) | -| fee.gas\_price | string (numeric) | used only when fee type is EthGas; sets the gas price in `gwei` units | -| fee.gas | number (integer) | used only when fee type is EthGas; sets the gas limit for transaction | +| Structure | Type | Description | +| --------- | ---------------- | ----------------------------------------------------------------------------------- | +| coin | string | the name of the coin the user desires to withdraw | +| to | string | coins are withdrawn to this address | +| amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` | +| memo | string | Optional. Adds a transaction memo for compatible coins (e.g. Tendermint ecosystem). | +| max | bool | withdraw the maximum available amount | +| fee | object | Optional. A standard [FeeInfo](/atomicdex/api/common_structures/#fee-info) object. | ### Response diff --git a/utils/_fileData.json b/utils/_fileData.json index 492dbdbb..0926efe2 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -1117,7 +1117,7 @@ } }, "/atomicdex/api/common_structures/orders": { - "dateModified": "2023-10-05T07:16:36.000Z", + "dateModified": "2023-10-05T08:00:09.000Z", "contributors": [ { "name": "\"smk762\"", @@ -2895,7 +2895,7 @@ } }, "/atomicdex/api/v20/orderbook": { - "dateModified": "2023-10-05T07:16:36.000Z", + "dateModified": "2023-10-05T08:00:09.000Z", "contributors": [ { "name": "\"smk762\"", From f3bf765e071b1e49181d92c4da36fc6242b09a83 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 5 Oct 2023 16:19:23 +0800 Subject: [PATCH 21/27] use `NumericFormatsValue` for max_taker_vol v2-dev method --- .../atomicdex/api/v20-dev/max_maker_vol/index.mdx | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/max_maker_vol/index.mdx b/src/pages/atomicdex/api/v20-dev/max_maker_vol/index.mdx index cefc6a0d..0739493b 100644 --- a/src/pages/atomicdex/api/v20-dev/max_maker_vol/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/max_maker_vol/index.mdx @@ -17,18 +17,9 @@ The `max_maker_vol` method returns the maximum volume of a coin which can be use | Parameter | Type | Description | | -------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------ | | coin | string | The ticker of the coin you queried. | -| volume | object | An object cointaining the tradable maker volume in decimal, fraction and rational formats. | -| volume.decimal | numeric string | The tradable maker volume in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | -| volume.rational | rational object | The tradable maker volume in [rational format](/atomicdex/api/legacy/rational_number_note/). | -| volume.fraction | fraction object | The tradable maker volume in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | -| balance | object | An object cointaining the locked amount in decimal, fraction and rational formats. | -| balance.decimal | numeric string | The coin balance in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | -| balance.rational | rational object | The coin balance in [rational format](/atomicdex/api/legacy/rational_number_note/). | -| balance.fraction | fraction object | The coin balance in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | -| locked\_by\_swaps | object | An object cointaining the volume of a coin's balance which is locked by swaps in progress in decimal, fraction and rational formats. | -| locked\_by\_swaps.decimal | numeric string | The locked by swaps amount in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | -| locked\_by\_swaps.rational | rational object | The locked by swaps amount in [rational format](/atomicdex/api/legacy/rational_number_note/). | -| locked\_by\_swaps.fraction | fraction object | The locked by swaps amount in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | +| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | +| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | +| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | #### 📌 Examples From b2d85ee31bb3d362dd0198533c3aa1d60732990b Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 5 Oct 2023 16:40:43 +0800 Subject: [PATCH 22/27] update navbar --- src/data/navbar.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/data/navbar.json b/src/data/navbar.json index 8b421ac2..2a2db25e 100644 --- a/src/data/navbar.json +++ b/src/data/navbar.json @@ -13,6 +13,10 @@ { "title": "API 2.0 (Dev)", "link": "/atomicdex/api/v20-dev/" + }, + { + "title": "Common Structures", + "link": "/atomicdex/api/common_structures/" } ] }, From 3604fdaa5deb0c6fae2e6a61dd21588fe5e93285 Mon Sep 17 00:00:00 2001 From: smk762 Date: Thu, 5 Oct 2023 08:42:26 +0000 Subject: [PATCH 23/27] [Bot] File and author data updated, validated and updated internal links, formatted md content, checked presence of file and dirs based on sidebar, checked presence of h1 in every file, update atomicdex methods table --- .../api/v20-dev/max_maker_vol/index.mdx | 12 +++--- utils/_fileData.json | 42 +++++++++---------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/pages/atomicdex/api/v20-dev/max_maker_vol/index.mdx b/src/pages/atomicdex/api/v20-dev/max_maker_vol/index.mdx index 0739493b..c9fd626a 100644 --- a/src/pages/atomicdex/api/v20-dev/max_maker_vol/index.mdx +++ b/src/pages/atomicdex/api/v20-dev/max_maker_vol/index.mdx @@ -14,12 +14,12 @@ The `max_maker_vol` method returns the maximum volume of a coin which can be use #### Response -| Parameter | Type | Description | -| -------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------ | -| coin | string | The ticker of the coin you queried. | -| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | -| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | -| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | +| Parameter | Type | Description | +| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you queried. | +| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | +| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | +| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | #### 📌 Examples diff --git a/utils/_fileData.json b/utils/_fileData.json index 0926efe2..691610d3 100644 --- a/utils/_fileData.json +++ b/utils/_fileData.json @@ -3108,8 +3108,12 @@ } }, "/atomicdex/api/v20/trade_preimage": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-05T08:10:18.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -3121,15 +3125,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20/update_version_stat_collection": { @@ -3158,16 +3158,16 @@ } }, "/atomicdex/api/v20/withdraw": { - "dateModified": "2023-09-09T14:54:22.000Z", + "dateModified": "2023-10-05T08:10:18.000Z", "contributors": [ - { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" - }, { "name": "\"smk762\"", "email": "smk762@iinet.net.au" }, + { + "name": "\"gcharang\"", + "email": "21151592+gcharang@users.noreply.github.com" + }, { "name": "\"gcharang\"", "email": "gcharang@users.noreply.github.com" @@ -3178,8 +3178,8 @@ } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20-dev/get_current_mtp": { @@ -3433,8 +3433,12 @@ } }, "/atomicdex/api/v20-dev/max_maker_vol": { - "dateModified": "2023-09-09T13:48:49.000Z", + "dateModified": "2023-10-05T08:19:23.000Z", "contributors": [ + { + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" + }, { "name": "\"gcharang\"", "email": "21151592+gcharang@users.noreply.github.com" @@ -3446,15 +3450,11 @@ { "name": "\"gaeacodes\"", "email": "gaeacodes@gmail.com" - }, - { - "name": "\"smk762\"", - "email": "smk762@iinet.net.au" } ], "lastContributor": { - "name": "\"gcharang\"", - "email": "21151592+gcharang@users.noreply.github.com" + "name": "\"smk762\"", + "email": "smk762@iinet.net.au" } }, "/atomicdex/api/v20-dev/task_account_balance": { From 9a96ec114db0e7f3234e315f27706bc598b853f3 Mon Sep 17 00:00:00 2001 From: gcharang <21151592+gcharang@users.noreply.github.com> Date: Fri, 10 Nov 2023 12:04:49 +0530 Subject: [PATCH 24/27] add data file prep to ci for gpts --- .../workflows/get_data_lint_files_deploy.yml | 3 + data-for-gpts/all-content.txt | 76241 ++++++++++++++++ data-for-gpts/atomicdex-content.txt | 25356 +++++ data-for-gpts/historical-content.txt | 3706 + data-for-gpts/smart-chains-content.txt | 17428 ++++ data-for-gpts/start-here-content.txt | 3135 + utils/js/create_data_for_gpt.js | 30 + 7 files changed, 125899 insertions(+) create mode 100644 data-for-gpts/all-content.txt create mode 100644 data-for-gpts/atomicdex-content.txt create mode 100644 data-for-gpts/historical-content.txt create mode 100644 data-for-gpts/smart-chains-content.txt create mode 100644 data-for-gpts/start-here-content.txt create mode 100644 utils/js/create_data_for_gpt.js diff --git a/.github/workflows/get_data_lint_files_deploy.yml b/.github/workflows/get_data_lint_files_deploy.yml index 3be24885..715dbf6c 100644 --- a/.github/workflows/get_data_lint_files_deploy.yml +++ b/.github/workflows/get_data_lint_files_deploy.yml @@ -62,6 +62,9 @@ jobs: - name: Verify h1 is present in every file run: node utils/js/h1_presence_checker.js + - name: Prepare data files for GPTs + run: node utils/js/create_data_for_gpts.js + - name: Set lint-fix branch name id: vars shell: bash diff --git a/data-for-gpts/all-content.txt b/data-for-gpts/all-content.txt new file mode 100644 index 00000000..7b5642e0 --- /dev/null +++ b/data-for-gpts/all-content.txt @@ -0,0 +1,76241 @@ +export const title = "Assets: Powering DEX Token Trading"; +export const description = "The Assets Antara Module provides basic distributed exchange (DEX) functionality for trading tokens created using the Tokens module."; + +# Assets + +## Introduction + +The Assets Module provides basic distributed exchange (DEX) functionality for trading `tokens` created using the [Tokens](/antara/api/tokens/#introduction) module. + +The Asset Module allows anyone to buy or sell tokens using the Smart Chain's coins. + +#### Assets Module Flow + +##### Seller's Perspective + +* A token owner places a new "ask" request with the tokenask method specifying the amount of tokens they want to sell and the price. The assets module then creates a new token ask order and the specified amount of tokens is locked in the module's global address +* To fulfill the ask, a buyer executes the tokenfillask method. The purchased token amount moves from the global address to the buyer's token Antara Address. At the same time, the required amount of coins move from the buyer's address to the seller's address. This process can be repeated so long as tokens remain in the ask order +* At any time, the creator of an order can cancel it via the tokencancelask method. The remaining tokens will return to their token Antara Address + +##### Buyer's Perspective + +* A buyer places a new bid using the tokenbid method. The bid specifies the amount of tokens and the price. The Assets Module creates a new token bid order and the specified amount of coins is locked in the module's global address. +* A willing seller executes the tokenfillbid method. The token amount sold moves from the seller's token Antara Address to the buyer's token Antara Address. At the same time, the locked coins move from the global address to the seller's address. This process can be repeated so long as tokens remain in the bid order +* At any time, the creator of an order can cancel it via the tokencancelbid method. The remaining coins will return to their token Antara Address + +To retrieve a current list of all active orders, use the tokenorders or mytokenorders methods. + +## assetsaddress + +**assetsaddress (pubkey)** + +The `assetsaddress` method returns information about a asset address according to a specific `pubkey`. If no `pubkey` is provided, the `pubkey` used to launch the daemon is the default. + +### Arguments + +| Structure | Type | Description | +| --------- | ------------------ | --------------------------------- | +| pubkey | (string, optional) | the pubkey of the desired address | + +### Response + +| Structure | Type | Description | +| ------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| AssetsCCaddress | (string) | taking the token contract's EVAL code as a modifier, this is the public address that corresponds to the token contract's privkey | +| AssetsNormalAddress | (string) | the unmodified public address generated from the token contract's privkey | +| myCCaddress | (string) | taking the token contract's EVAL code as a modifier, this is the CC address from the pubkey of the user | +| myaddress | (string) | the public address of the pubkey used to launch the chain | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD assetsaddress 028702e30d8465d6aa85f35d2f58c06a6ee17f23f376b56044dadf7b793f2c12b9 +``` + + + Response: + + ```json + { + "result": "success", + "AssetsCCAddress": "RGKRjeTBw4LYFotSDLT6RWzMHbhXri6BG6", + "AssetsCCBalance": 0.0, + "AssetsNormalAddress": "RFYE2yL3KknWdHK6uNhvWacYsCUtwzjY3u", + "AssetsNormalBalance": 0.0, + "AssetsCCTokensAddress": "RTWtxY7GTBZ3zL8jfzyWWz1fveF3KXKBF8", + "PubkeyCCaddress(Assets)": "RG6mr23tQ9nUhmi5GEnYqjfkqZt9x2MRXz", + "PubkeyCCbalance(Assets)": 0.0, + "myCCAddress(Assets)": "RRG3LuYLg5fYcLggBW3hpFPq3U8u98XYqf", + "myCCbalance(Assets)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"assetsaddress", "params":["028702e30d8465d6aa85f35d2f58c06a6ee17f23f376b56044dadf7b793f2c12b9"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "AssetsCCAddress": "RGKRjeTBw4LYFotSDLT6RWzMHbhXri6BG6", + "AssetsCCBalance": 0.0, + "AssetsNormalAddress": "RFYE2yL3KknWdHK6uNhvWacYsCUtwzjY3u", + "AssetsNormalBalance": 0.0, + "AssetsCCTokensAddress": "RTWtxY7GTBZ3zL8jfzyWWz1fveF3KXKBF8", + "PubkeyCCaddress(Assets)": "RG6mr23tQ9nUhmi5GEnYqjfkqZt9x2MRXz", + "PubkeyCCbalance(Assets)": 0.0, + "myCCAddress(Assets)": "RRG3LuYLg5fYcLggBW3hpFPq3U8u98XYqf", + "myCCbalance(Assets)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + }, + "error": null, + "id": "curltest" + } + ``` + + +## tokenask + +**tokenask numtokens tokenid price** + +The `tokenask` method posts a public ask order. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +### Arguments + +| Structure | Type | Description | +| --------- | -------- | ------------------------------------------------------------------------------ | +| numtokens | (number) | the number of tokens to request in the order | +| tokenid | (string) | the txid that identifies the token | +| price | (number) | the price to pay for each token (units are in coins of the parent Smart Chain) | + +### Response + +| Structure | Type | Description | +| --------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: + +```bash +./komodo-cli -ac_name=HELLOWORLD tokenask 1000 c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59 1 +``` + + + ```json + { + "result": "success", + "hex": "010000000248403cd63777a2086206592c096ddfa1d4ba2647673b330610968eace2cf7b540200000049483045022100bde9eaf43a43fe252530bcf346be3e336e86f0171b817977d38d6ebd4bb0756e0220735f3292ef012fd56f7476700f5649b23aacf2387f4fa5a537e1b6c6daa6c1d101ffffffff4f2016d356282fca9d8278aa04fbdbed98ac6af0bf7a479959c5bb91f95e8ef5020000007b4c79a276a072a26ba067a5658021028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e278140fe6a2cd6fdb5a359d5d6eea9bcf34e5b7d8e2def612afe9c01af1129b006e68344d8f9905ea5f226cdb1556659df0c8741e8e3def1238761721b66718dabe92ca100af038001e3a10001ffffffff03e803000000000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc5087b00e000000002321028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e27ac00000000000000004f6a4c4ce373c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b5900e876481700000021028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e2700000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokenask", "params":["1000" ,"c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59" ,"1"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "010000000248403cd63777a2086206592c096ddfa1d4ba2647673b330610968eace2cf7b540200000049483045022100bde9eaf43a43fe252530bcf346be3e336e86f0171b817977d38d6ebd4bb0756e0220735f3292ef012fd56f7476700f5649b23aacf2387f4fa5a537e1b6c6daa6c1d101ffffffff4f2016d356282fca9d8278aa04fbdbed98ac6af0bf7a479959c5bb91f95e8ef5020000007b4c79a276a072a26ba067a5658021028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e278140fe6a2cd6fdb5a359d5d6eea9bcf34e5b7d8e2def612afe9c01af1129b006e68344d8f9905ea5f226cdb1556659df0c8741e8e3def1238761721b66718dabe92ca100af038001e3a10001ffffffff03e803000000000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc5087b00e000000002321028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e27ac00000000000000004f6a4c4ce373c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b5900e876481700000021028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e2700000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Use sendrawtransaction to broadcast the order + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000248403cd63777a2086206592c096ddfa1d4ba2647673b330610968eace2cf7b540200000049483045022100bde9eaf43a43fe252530bcf346be3e336e86f0171b817977d38d6ebd4bb0756e0220735f3292ef012fd56f7476700f5649b23aacf2387f4fa5a537e1b6c6daa6c1d101ffffffff4f2016d356282fca9d8278aa04fbdbed98ac6af0bf7a479959c5bb91f95e8ef5020000007b4c79a276a072a26ba067a5658021028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e278140fe6a2cd6fdb5a359d5d6eea9bcf34e5b7d8e2def612afe9c01af1129b006e68344d8f9905ea5f226cdb1556659df0c8741e8e3def1238761721b66718dabe92ca100af038001e3a10001ffffffff03e803000000000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc5087b00e000000002321028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e27ac00000000000000004f6a4c4ce373c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b5900e876481700000021028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e2700000000 +``` + + + ```bash + 8d5bb0ae5cc8406b8b12fff04437c748495f4f8852ae124e6a137bc130d3be64 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000248403cd63777a2086206592c096ddfa1d4ba2647673b330610968eace2cf7b540200000049483045022100bde9eaf43a43fe252530bcf346be3e336e86f0171b817977d38d6ebd4bb0756e0220735f3292ef012fd56f7476700f5649b23aacf2387f4fa5a537e1b6c6daa6c1d101ffffffff4f2016d356282fca9d8278aa04fbdbed98ac6af0bf7a479959c5bb91f95e8ef5020000007b4c79a276a072a26ba067a5658021028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e278140fe6a2cd6fdb5a359d5d6eea9bcf34e5b7d8e2def612afe9c01af1129b006e68344d8f9905ea5f226cdb1556659df0c8741e8e3def1238761721b66718dabe92ca100af038001e3a10001ffffffff03e803000000000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc5087b00e000000002321028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e27ac00000000000000004f6a4c4ce373c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b5900e876481700000021028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e2700000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "8d5bb0ae5cc8406b8b12fff04437c748495f4f8852ae124e6a137bc130d3be64", + "error": null, + "id": "curltest" + } + ``` + + +## tokenbid + +**tokenbid numtokens tokenid price** + +The `tokenbid` method posts a public bid order. + +To fill the order, the parent chain's coin must be used. + +The method returns a raw hex, which must be broadcast using [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) to complete the command. + +The `sendrawtransaction` method then returns a `txid`, which is the identification method of the bid order, and should be saved for future use. + +### Arguments + +| Structure | Type | Description | +| --------- | -------- | ------------------------------------------------------------------------------ | +| numtokens | (number) | the number of tokens to request in the order | +| tokenid | (string) | the txid that identifies the token | +| price | (number) | the price to pay for each token (units are in coins of the parent Smart Chain) | + +### Response + +| Structure | Type | Description | +| --------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD tokenbid 1000 c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59 1 +``` + + + ```bash + 0100000001484256677a6417030dd99716a47b8c9cb06fba6e57ff4617e9932a6cde2972830100000049483045022100fc1926401b27ba044bbf17c36f36030adae52a188594efc75fe42861ab0b997802205e729d6f5587e5a5296b5649a154ce1fe3c581078fac7ae4e2b4577978c05c8901ffffffff0300e8764817000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc10d262684a0300002321028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e27ac00000000000000004f6a4c4ce362c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59e80300000000000021028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e2700000000` + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokenbid", "params":["1000" ,"c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59" ,"1"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "0100000001484256677a6417030dd99716a47b8c9cb06fba6e57ff4617e9932a6cde2972830100000049483045022100fc1926401b27ba044bbf17c36f36030adae52a188594efc75fe42861ab0b997802205e729d6f5587e5a5296b5649a154ce1fe3c581078fac7ae4e2b4577978c05c8901ffffffff0300e8764817000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc10d262684a0300002321028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e27ac00000000000000004f6a4c4ce362c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59e80300000000000021028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e2700000000", + "error": null, + "id": "curltest" + } + ``` + + +Use `sendrawtransaction` to publish order + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0100000001484256677a6417030dd99716a47b8c9cb06fba6e57ff4617e9932a6cde2972830100000049483045022100fc1926401b27ba044bbf17c36f36030adae52a188594efc75fe42861ab0b997802205e729d6f5587e5a5296b5649a154ce1fe3c581078fac7ae4e2b4577978c05c8901ffffffff0300e8764817000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc10d262684a0300002321028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e27ac00000000000000004f6a4c4ce362c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59e80300000000000021028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e2700000000 +``` + + + ```bash + 5fc8c472bc0e5f994b5a9a3fda23af1a3e1cfd746b902d7216352732e6adba05 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["0100000001484256677a6417030dd99716a47b8c9cb06fba6e57ff4617e9932a6cde2972830100000049483045022100fc1926401b27ba044bbf17c36f36030adae52a188594efc75fe42861ab0b997802205e729d6f5587e5a5296b5649a154ce1fe3c581078fac7ae4e2b4577978c05c8901ffffffff0300e8764817000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc10d262684a0300002321028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e27ac00000000000000004f6a4c4ce362c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59e80300000000000021028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e2700000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "5fc8c472bc0e5f994b5a9a3fda23af1a3e1cfd746b902d7216352732e6adba05", + "error": null, + "id": "curltest" + } + ``` + + +The response is the transaction id. + +## tokencancelask + +**tokencancelask tokenid asktxid** + +The `tokencancelask` method cancels a specific `ask`/`sell` order that you created. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +### Arguments + +| Structure | Type | Description | +| --------- | -------- | ------------------------------------------------- | +| tokenid | (string) | the txid that identifies the token | +| asktxid | (string) | the txid that identifies the original ask request | + +### Response + +| Structure | Type | Description | +| --------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Issue the call and get your raw transaction HEX value + +```bash +./komodo-cli -ac_name=HELLOWORLD tokencancelask 9217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e 7194ae293330af80fdbe4b4b2c8b51194f12e334b4a0489288288c1b7336a65c +``` + + + ```json + { + "result": "success", + "hex": "010000000234c335a46dadea8e42420b0e284f5577cfbcb7764a8d5c3b61312b71c5b14d0800000000494830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001ffffffff030a00000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401ccf078724e18090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokencancelask", "params":["9217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e" ,"7194ae293330af80fdbe4b4b2c8b51194f12e334b4a0489288288c1b7336a65c"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "010000000234c335a46dadea8e42420b0e284f5577cfbcb7764a8d5c3b61312b71c5b14d0800000000494830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001ffffffff030a00000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401ccf078724e18090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000", + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Broadcast using `sendrawtransaction` + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000234c335a46dadea8e42420b0e284f5577cfbcb7764a8d5c3b61312b71c5b14d0800000000494830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001ffffffff030a00000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401ccf078724e18090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000 +``` + + + ```bash + 21d152480275568e3f82a5049d8b30308e3739ebd98171e075a75fea504364cd + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000234c335a46dadea8e42420b0e284f5577cfbcb7764a8d5c3b61312b71c5b14d0800000000494830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001ffffffff030a00000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401ccf078724e18090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "21d152480275568e3f82a5049d8b30308e3739ebd98171e075a75fea504364cd", + "error": null, + "id": "curltest" + } + ``` + + +The response is the transaction id. + +Step 3 (optional): Decode the raw transaction (check if the values are sane) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 010000000234c335a46dadea8e42420b0e284f5577cfbcb7764a8d5c3b61312b71c5b14d0800000000494830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001ffffffff030a00000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401ccf078724e18090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000 +``` + + + ```json + { + "txid": "21d152480275568e3f82a5049d8b30308e3739ebd98171e075a75fea504364cd", + "size": 434, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "084db1c5712b31613b5c8d4a76b7bccf77554f280e0b42428eeaad6da435c334", + "vout": 0, + "scriptSig": { + "asm": "30450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601", + "hex": "4830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601" + }, + "sequence": 4294967295 + }, + { + "txid": "7194ae293330af80fdbe4b4b2c8b51194f12e334b4a0489288288c1b7336a65c", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001", + "hex": "4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.0000001, + "valueSat": 10, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RRPpWbVdxcxmhx4xnWnVZFDfGc9p1177ti"] + } + }, + { + "value": 99999.9999, + "valueSat": 9999999990000, + "n": 1, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e", + "hex": "6a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e", + "type": "nulldata" + } + } + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["010000000234c335a46dadea8e42420b0e284f5577cfbcb7764a8d5c3b61312b71c5b14d0800000000494830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001ffffffff030a00000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401ccf078724e18090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "21d152480275568e3f82a5049d8b30308e3739ebd98171e075a75fea504364cd", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "084db1c5712b31613b5c8d4a76b7bccf77554f280e0b42428eeaad6da435c334", + "vout": 0, + "scriptSig": { + "asm": "30450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e4996[ALL]", + "hex": "4830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601" + }, + "sequence": 4294967295 + }, + { + "txid": "7194ae293330af80fdbe4b4b2c8b51194f12e334b4a0489288288c1b7336a65c", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001", + "hex": "4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.0000001, + "valueZat": 10, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RRPpWbVdxcxmhx4xnWnVZFDfGc9p1177ti"] + } + }, + { + "value": 99999.9999, + "valueZat": 9999999990000, + "n": 1, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e", + "hex": "6a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## tokencancelbid + +**tokencancelbid tokenid bidtxid** + +The `tokencancelbid` method cancels a specific `bid`/`buy` order that you created. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +### Arguments + +| Structure | Type | Description | +| --------- | -------- | ------------------------------------------------- | +| tokenid | (string) | the txid that identifies the token | +| bidtxid | (string) | the txid that identifies the original bid request | + +### Response + +| Structure | Type | Description | +| --------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Issue the call and get your raw transaction HEX value + +```bash +./komodo-cli -ac_name=HELLOWORLD tokencancelbid 9217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e 7194ae293330af80fdbe4b4b2c8b51194f12e334b4a0489288288c1b7336a65c +``` + + + ```json + { + "result": "success", + "hex": "010000000234c335a46dadea8e42420b0e284f5577cfbcb7764a8d5c3b61312b71c5b14d0800000000494830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001ffffffff030a00000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401ccf078724e18090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokencancelbid", "params":["9217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e" ,"7194ae293330af80fdbe4b4b2c8b51194f12e334b4a0489288288c1b7336a65c"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "010000000234c335a46dadea8e42420b0e284f5577cfbcb7764a8d5c3b61312b71c5b14d0800000000494830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001ffffffff030a00000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401ccf078724e18090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000", + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Send raw transaction / broadcast the HEX value from above + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000234c335a46dadea8e42420b0e284f5577cfbcb7764a8d5c3b61312b71c5b14d0800000000494830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001ffffffff030a00000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401ccf078724e18090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000 +``` + + + ```bash + 21d152480275568e3f82a5049d8b30308e3739ebd98171e075a75fea504364cd + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000234c335a46dadea8e42420b0e284f5577cfbcb7764a8d5c3b61312b71c5b14d0800000000494830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001ffffffff030a00000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401ccf078724e18090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "21d152480275568e3f82a5049d8b30308e3739ebd98171e075a75fea504364cd", + "error": null, + "id": "curltest" + } + ``` + + +The response is the transaction id. + +Step 3: Decode the raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 010000000234c335a46dadea8e42420b0e284f5577cfbcb7764a8d5c3b61312b71c5b14d0800000000494830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001ffffffff030a00000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401ccf078724e18090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000 +``` + + + ```json + { + "txid": "21d152480275568e3f82a5049d8b30308e3739ebd98171e075a75fea504364cd", + "size": 434, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "084db1c5712b31613b5c8d4a76b7bccf77554f280e0b42428eeaad6da435c334", + "vout": 0, + "scriptSig": { + "asm": "30450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601", + "hex": "4830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601" + }, + "sequence": 4294967295 + }, + { + "txid": "7194ae293330af80fdbe4b4b2c8b51194f12e334b4a0489288288c1b7336a65c", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001", + "hex": "4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.0000001, + "valueSat": 10, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RRPpWbVdxcxmhx4xnWnVZFDfGc9p1177ti"] + } + }, + { + "value": 99999.9999, + "valueSat": 9999999990000, + "n": 1, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e", + "hex": "6a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e", + "type": "nulldata" + } + } + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["010000000234c335a46dadea8e42420b0e284f5577cfbcb7764a8d5c3b61312b71c5b14d0800000000494830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001ffffffff030a00000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401ccf078724e18090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "21d152480275568e3f82a5049d8b30308e3739ebd98171e075a75fea504364cd", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "084db1c5712b31613b5c8d4a76b7bccf77554f280e0b42428eeaad6da435c334", + "vout": 0, + "scriptSig": { + "asm": "30450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e4996[ALL]", + "hex": "4830450221009f365d429d03df66b34cad764368092498ebd7340587c558ea19c4248202317b0220531524ef076f9e5b26ec5aa38b3078c041f8d0603b85552177ef14d00b0e499601" + }, + "sequence": 4294967295 + }, + { + "txid": "7194ae293330af80fdbe4b4b2c8b51194f12e334b4a0489288288c1b7336a65c", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001", + "hex": "4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702814066f6a9d580da0ac901ada8c61922d93da005e92c9e419a44c1bcbf9ec8ad43790dfc8ca71b5c21b79a58aa173fb71e1ab0b82c590dc883359de60f743fabda16a100af038001e3a10001" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.0000001, + "valueZat": 10, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RRPpWbVdxcxmhx4xnWnVZFDfGc9p1177ti"] + } + }, + { + "value": 99999.9999, + "valueZat": 9999999990000, + "n": 1, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e", + "hex": "6a22e3789217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## tokenfillask + +**tokenfillask tokenid asktxid fillamount** + +The `tokenfillask` method fills an existing ask. + +It returns a hex-encoded transaction which should then be broadcast using `sendrawtransaction`. + +### Arguments + +| Structure | Type | Description | +| ---------- | -------- | -------------------------------------- | +| tokenid | (string) | the txid that identifies the token | +| asktxid | (string) | the txid that identifies the ask order | +| fillamount | (number) | the amount to fill | + +### Response + +| Structure | Type | Description | +| --------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Create the raw transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD tokenfillask 9217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e d1b2676bb118d7bb8604dc5bb0a320a2ffb6f7ee118bfd20ed33be3fbd0b9b62 50 +``` + + + ```json + { + "result": "success", + "hex": "01000000031a47a2fa94f27f7e98645a6827f9382991d76fcfd2d84b96065763d1cfed78fc02000000494830450221008be941e56b10fb51459f66288bb68936c55fd17ecbebd12b142f4575b0fe4bf702205f048ad69269ba81530230496fea42983aad88882b1ef7d08304e1230040fb0001ffffffff629b0bbd3fbe33ed20fd8b11eef7b6ffa220a3b05bdc0486bbd718b16b67b2d1000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa27028140da534b773f52c77ebbd590330468ba49333acc0971da444de512b85d039f59f778c8bab7cb1be909b6473789b237966a0f137a9b24c93ebebe0d83ae34a6bd6fa100af038001e3a10001ffffffff2bf671abc3bdfb673c0103a3bd59282c1aee473c6ccc4b591cdb42dc469d68c4000000004847304402204fa686dfdc7c0b7d42e538751aee0534b54747df4f335fb4d3b0d1a86c68e96d02202083fa811dd4506ad83f6d58a420d31ff7ccbae84ea05399b616e3d6f373682401ffffffff050000000000000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc3200000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc0065cd1d00000000232103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9efacf01710252d090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000004f6a4c4ce3539217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000000000002103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9ef00000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokenfillask", "params":["9217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e" ,"d1b2676bb118d7bb8604dc5bb0a320a2ffb6f7ee118bfd20ed33be3fbd0b9b62" ,"50"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "01000000031a47a2fa94f27f7e98645a6827f9382991d76fcfd2d84b96065763d1cfed78fc02000000494830450221008be941e56b10fb51459f66288bb68936c55fd17ecbebd12b142f4575b0fe4bf702205f048ad69269ba81530230496fea42983aad88882b1ef7d08304e1230040fb0001ffffffff629b0bbd3fbe33ed20fd8b11eef7b6ffa220a3b05bdc0486bbd718b16b67b2d1000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa27028140da534b773f52c77ebbd590330468ba49333acc0971da444de512b85d039f59f778c8bab7cb1be909b6473789b237966a0f137a9b24c93ebebe0d83ae34a6bd6fa100af038001e3a10001ffffffff2bf671abc3bdfb673c0103a3bd59282c1aee473c6ccc4b591cdb42dc469d68c4000000004847304402204fa686dfdc7c0b7d42e538751aee0534b54747df4f335fb4d3b0d1a86c68e96d02202083fa811dd4506ad83f6d58a420d31ff7ccbae84ea05399b616e3d6f373682401ffffffff050000000000000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc3200000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc0065cd1d00000000232103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9efacf01710252d090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000004f6a4c4ce3539217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000000000002103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9ef00000000", + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Broadcast the hex using sendrawtransaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000031a47a2fa94f27f7e98645a6827f9382991d76fcfd2d84b96065763d1cfed78fc02000000494830450221008be941e56b10fb51459f66288bb68936c55fd17ecbebd12b142f4575b0fe4bf702205f048ad69269ba81530230496fea42983aad88882b1ef7d08304e1230040fb0001ffffffff629b0bbd3fbe33ed20fd8b11eef7b6ffa220a3b05bdc0486bbd718b16b67b2d1000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa27028140da534b773f52c77ebbd590330468ba49333acc0971da444de512b85d039f59f778c8bab7cb1be909b6473789b237966a0f137a9b24c93ebebe0d83ae34a6bd6fa100af038001e3a10001ffffffff2bf671abc3bdfb673c0103a3bd59282c1aee473c6ccc4b591cdb42dc469d68c4000000004847304402204fa686dfdc7c0b7d42e538751aee0534b54747df4f335fb4d3b0d1a86c68e96d02202083fa811dd4506ad83f6d58a420d31ff7ccbae84ea05399b616e3d6f373682401ffffffff050000000000000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc3200000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc0065cd1d00000000232103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9efacf01710252d090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000004f6a4c4ce3539217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000000000002103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9ef00000000 +``` + + + ```bash + b6ebeaafced887fd63deb9207e0484570d49abe8fe4fcbaa026666d4ea3f902e + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["01000000031a47a2fa94f27f7e98645a6827f9382991d76fcfd2d84b96065763d1cfed78fc02000000494830450221008be941e56b10fb51459f66288bb68936c55fd17ecbebd12b142f4575b0fe4bf702205f048ad69269ba81530230496fea42983aad88882b1ef7d08304e1230040fb0001ffffffff629b0bbd3fbe33ed20fd8b11eef7b6ffa220a3b05bdc0486bbd718b16b67b2d1000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa27028140da534b773f52c77ebbd590330468ba49333acc0971da444de512b85d039f59f778c8bab7cb1be909b6473789b237966a0f137a9b24c93ebebe0d83ae34a6bd6fa100af038001e3a10001ffffffff2bf671abc3bdfb673c0103a3bd59282c1aee473c6ccc4b591cdb42dc469d68c4000000004847304402204fa686dfdc7c0b7d42e538751aee0534b54747df4f335fb4d3b0d1a86c68e96d02202083fa811dd4506ad83f6d58a420d31ff7ccbae84ea05399b616e3d6f373682401ffffffff050000000000000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc3200000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc0065cd1d00000000232103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9efacf01710252d090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000004f6a4c4ce3539217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000000000002103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9ef00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "b6ebeaafced887fd63deb9207e0484570d49abe8fe4fcbaa026666d4ea3f902e", + "error": null, + "id": "curltest" + } + ``` + + +The response is the transaction id. + +Step 3: Wait for the transaction to be confirmed + +## tokenfillbid + +**tokenfillbid tokenid bidtxid fillamount** + +The `tokenfillbid` method fills an existing ask. + +It returns a hex-encoded transaction which should then be broadcast using `sendrawtransaction`. + +### Arguments + +| Structure | Type | Description | +| ---------- | -------- | -------------------------------------- | +| tokenid | (string) | the txid that identifies the token | +| bidtxid | (string) | the txid that identifies the bid order | +| fillamount | (number) | the amount to fill | + +### Response + +| Structure | Type | Description | +| --------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Create raw transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD tokenfillbid 9217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e d1b2676bb118d7bb8604dc5bb0a320a2ffb6f7ee118bfd20ed33be3fbd0b9b62 50 +``` + + + ```json + { + "result": "success", + "hex": "01000000031a47a2fa94f27f7e98645a6827f9382991d76fcfd2d84b96065763d1cfed78fc02000000494830450221008be941e56b10fb51459f66288bb68936c55fd17ecbebd12b142f4575b0fe4bf702205f048ad69269ba81530230496fea42983aad88882b1ef7d08304e1230040fb0001ffffffff629b0bbd3fbe33ed20fd8b11eef7b6ffa220a3b05bdc0486bbd718b16b67b2d1000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa27028140da534b773f52c77ebbd590330468ba49333acc0971da444de512b85d039f59f778c8bab7cb1be909b6473789b237966a0f137a9b24c93ebebe0d83ae34a6bd6fa100af038001e3a10001ffffffff2bf671abc3bdfb673c0103a3bd59282c1aee473c6ccc4b591cdb42dc469d68c4000000004847304402204fa686dfdc7c0b7d42e538751aee0534b54747df4f335fb4d3b0d1a86c68e96d02202083fa811dd4506ad83f6d58a420d31ff7ccbae84ea05399b616e3d6f373682401ffffffff050000000000000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc3200000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc0065cd1d00000000232103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9efacf01710252d090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000004f6a4c4ce3539217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000000000002103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9ef00000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokenfillbid", "params":["9217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e" ,"d1b2676bb118d7bb8604dc5bb0a320a2ffb6f7ee118bfd20ed33be3fbd0b9b62" ,"50"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "01000000031a47a2fa94f27f7e98645a6827f9382991d76fcfd2d84b96065763d1cfed78fc02000000494830450221008be941e56b10fb51459f66288bb68936c55fd17ecbebd12b142f4575b0fe4bf702205f048ad69269ba81530230496fea42983aad88882b1ef7d08304e1230040fb0001ffffffff629b0bbd3fbe33ed20fd8b11eef7b6ffa220a3b05bdc0486bbd718b16b67b2d1000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa27028140da534b773f52c77ebbd590330468ba49333acc0971da444de512b85d039f59f778c8bab7cb1be909b6473789b237966a0f137a9b24c93ebebe0d83ae34a6bd6fa100af038001e3a10001ffffffff2bf671abc3bdfb673c0103a3bd59282c1aee473c6ccc4b591cdb42dc469d68c4000000004847304402204fa686dfdc7c0b7d42e538751aee0534b54747df4f335fb4d3b0d1a86c68e96d02202083fa811dd4506ad83f6d58a420d31ff7ccbae84ea05399b616e3d6f373682401ffffffff050000000000000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc3200000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc0065cd1d00000000232103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9efacf01710252d090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000004f6a4c4ce3539217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000000000002103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9ef00000000", + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Broadcast the hex or sendrawtransaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000031a47a2fa94f27f7e98645a6827f9382991d76fcfd2d84b96065763d1cfed78fc02000000494830450221008be941e56b10fb51459f66288bb68936c55fd17ecbebd12b142f4575b0fe4bf702205f048ad69269ba81530230496fea42983aad88882b1ef7d08304e1230040fb0001ffffffff629b0bbd3fbe33ed20fd8b11eef7b6ffa220a3b05bdc0486bbd718b16b67b2d1000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa27028140da534b773f52c77ebbd590330468ba49333acc0971da444de512b85d039f59f778c8bab7cb1be909b6473789b237966a0f137a9b24c93ebebe0d83ae34a6bd6fa100af038001e3a10001ffffffff2bf671abc3bdfb673c0103a3bd59282c1aee473c6ccc4b591cdb42dc469d68c4000000004847304402204fa686dfdc7c0b7d42e538751aee0534b54747df4f335fb4d3b0d1a86c68e96d02202083fa811dd4506ad83f6d58a420d31ff7ccbae84ea05399b616e3d6f373682401ffffffff050000000000000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc3200000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc0065cd1d00000000232103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9efacf01710252d090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000004f6a4c4ce3539217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000000000002103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9ef00000000 +``` + + + ```bash + b6ebeaafced887fd63deb9207e0484570d49abe8fe4fcbaa026666d4ea3f902e + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["01000000031a47a2fa94f27f7e98645a6827f9382991d76fcfd2d84b96065763d1cfed78fc02000000494830450221008be941e56b10fb51459f66288bb68936c55fd17ecbebd12b142f4575b0fe4bf702205f048ad69269ba81530230496fea42983aad88882b1ef7d08304e1230040fb0001ffffffff629b0bbd3fbe33ed20fd8b11eef7b6ffa220a3b05bdc0486bbd718b16b67b2d1000000007b4c79a276a072a26ba067a565802102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa27028140da534b773f52c77ebbd590330468ba49333acc0971da444de512b85d039f59f778c8bab7cb1be909b6473789b237966a0f137a9b24c93ebebe0d83ae34a6bd6fa100af038001e3a10001ffffffff2bf671abc3bdfb673c0103a3bd59282c1aee473c6ccc4b591cdb42dc469d68c4000000004847304402204fa686dfdc7c0b7d42e538751aee0534b54747df4f335fb4d3b0d1a86c68e96d02202083fa811dd4506ad83f6d58a420d31ff7ccbae84ea05399b616e3d6f373682401ffffffff050000000000000000302ea22c80201ab400e039122028345520ba041ac3e6ec81ad28d8415e78d760d55f41097dd58103120c008203000401cc3200000000000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc0065cd1d00000000232103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9efacf01710252d090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000004f6a4c4ce3539217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e00000000000000002103fcc4b37ee767a67b75503832764b559d764d71c13785482b73609159aa6ae9ef00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "b6ebeaafced887fd63deb9207e0484570d49abe8fe4fcbaa026666d4ea3f902e", + "error": null, + "id": "curltest" + } + ``` + + +The response is the transaction id. + +Step 3: Wait for the transaction to be confirmed + +## tokenorders + +**tokenorders (tokenid)** + +The `tokenorders` method displays the public on-chain orderbook for a specific token. + +Information about the `funcid` property: + +* A lowercase `b` describes an bid offer. + +* An uppercase `B` describes a bid fill. + +* A lowercase `s` describes an ask offer. + +* An uppercase `S` describes the ask fill. + +### Arguments + +| Structure | Type | Description | +| --------- | ------------------ | ------------------------------------- | +| tokenid | (string, optional) | the identifying txid for the token id | + +### Response + +| Structure | Type | Description | +| ------------------- | -------------------------- | ------------------------------------------------------------------------------ | +| funcid | (string) | describes either a bid ask `b`, a bid fill `B`, an ask `s`, or an ask fill `S` | +| txid | (string) | the txid of the identifying order or fill | +| vout | (number) | the vout value | +| amount | (number) | the amount remaining in the bid/ask request | +| bidamount/askamount | (number) | the total amount of the relevant bid or ask request | +| origaddress | (string) | the address that made the original bid `b` or ask `s` | +| tokenid | (string) | the tokenid for the relevant bid/ask request/fill | +| totalrequired | (number, `b` and `s` only) | the total amount available in the original big/ask request/fill | +| price | (number, `b` and `s` only) | the price per token, units are in the parent Smart Chain's coin | + +#### 📌 Examples: + +Show all available orders + +```bash +./komodo-cli -ac_name=HELLOWORLD tokenorders +``` + + + ```json + [ + { + "funcid": "B", + "txid": "b9d305e9b6a82e715efce9b6244cc15fef131baf1893a7eb45b199c23b3fb806", + "vout": 0, + "amount": 0, + "bidamount": 0, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59" + }, + { + "funcid": "b", + "txid": "45b3f7874fc4a2699729a9792bc7679f6b5f11035a29ad9f661425b19534dd1d", + "vout": 0, + "amount": 1000, + "bidamount": 1000, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "totalrequired": 1000, + "price": 1 + }, + { + "funcid": "B", + "txid": "d4643ce47e9799681a4549468d47c85337367f0ef2733afe1d79c50175e6ae32", + "vout": 0, + "amount": 0, + "bidamount": 0, + "origaddress": "R9sDyKt2kW5uJaoZT6GF9e3WRbGioBuhoZ", + "tokenid": "e7d034fb7dbad561c9a86dcbcc64aa89e1d311891b4e7c744280b7de13b1186f" + }, + { + "funcid": "B", + "txid": "0909df82ade3193c9a630dd80947141f34489732e9a2f8346790304ebbdcc251", + "vout": 0, + "amount": 0, + "bidamount": 0, + "origaddress": "R9sDyKt2kW5uJaoZT6GF9e3WRbGioBuhoZ", + "tokenid": "e7d034fb7dbad561c9a86dcbcc64aa89e1d311891b4e7c744280b7de13b1186f" + }, + { + "funcid": "b", + "txid": "a8d60a3ce429ccb885ad445e7a4534130a35d2424d1883c6513d0f4da2fe9a92", + "vout": 0, + "amount": 150, + "bidamount": 150, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "totalrequired": 100, + "price": 1.5 + }, + { + "funcid": "B", + "txid": "03e118fc442a223df4dd87add64f142e1bfd99baee94c8be26bc77ed809d50a4", + "vout": 0, + "amount": 0, + "bidamount": 0, + "origaddress": "R9sDyKt2kW5uJaoZT6GF9e3WRbGioBuhoZ", + "tokenid": "e7d034fb7dbad561c9a86dcbcc64aa89e1d311891b4e7c744280b7de13b1186f" + } + ] + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokenorders", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": [ + { + "funcid": "B", + "txid": "b9d305e9b6a82e715efce9b6244cc15fef131baf1893a7eb45b199c23b3fb806", + "vout": 0, + "amount": 0, + "bidamount": 0, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59" + }, + { + "funcid": "b", + "txid": "45b3f7874fc4a2699729a9792bc7679f6b5f11035a29ad9f661425b19534dd1d", + "vout": 0, + "amount": 1000, + "bidamount": 1000, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "totalrequired": 1000, + "price": 1 + }, + { + "funcid": "B", + "txid": "d4643ce47e9799681a4549468d47c85337367f0ef2733afe1d79c50175e6ae32", + "vout": 0, + "amount": 0, + "bidamount": 0, + "origaddress": "R9sDyKt2kW5uJaoZT6GF9e3WRbGioBuhoZ", + "tokenid": "e7d034fb7dbad561c9a86dcbcc64aa89e1d311891b4e7c744280b7de13b1186f" + }, + { + "funcid": "B", + "txid": "0909df82ade3193c9a630dd80947141f34489732e9a2f8346790304ebbdcc251", + "vout": 0, + "amount": 0, + "bidamount": 0, + "origaddress": "R9sDyKt2kW5uJaoZT6GF9e3WRbGioBuhoZ", + "tokenid": "e7d034fb7dbad561c9a86dcbcc64aa89e1d311891b4e7c744280b7de13b1186f" + }, + { + "funcid": "b", + "txid": "a8d60a3ce429ccb885ad445e7a4534130a35d2424d1883c6513d0f4da2fe9a92", + "vout": 0, + "amount": 150, + "bidamount": 150, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "totalrequired": 100, + "price": 1.5 + }, + { + "funcid": "B", + "txid": "03e118fc442a223df4dd87add64f142e1bfd99baee94c8be26bc77ed809d50a4", + "vout": 0, + "amount": 0, + "bidamount": 0, + "origaddress": "R9sDyKt2kW5uJaoZT6GF9e3WRbGioBuhoZ", + "tokenid": "e7d034fb7dbad561c9a86dcbcc64aa89e1d311891b4e7c744280b7de13b1186f" + } + ], + "error": null, + "id": "curltest" + } + ``` + + +Show orders for specific token + +```bash +./komodo-cli -ac_name=HELLOWORLD tokenorders c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59 +``` + + + ```json + [ + { + "funcid": "B", + "txid": "b9d305e9b6a82e715efce9b6244cc15fef131baf1893a7eb45b199c23b3fb806", + "vout": 0, + "amount": 0, + "bidamount": 0, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59" + }, + { + "funcid": "b", + "txid": "9dabd8c01bb7d59455b64fe100617149c20cb4520d266183686aa4986fd3021d", + "vout": 0, + "amount": 100, + "bidamount": 100, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "totalrequired": 100, + "price": 1 + }, + { + "funcid": "b", + "txid": "45b3f7874fc4a2699729a9792bc7679f6b5f11035a29ad9f661425b19534dd1d", + "vout": 0, + "amount": 1000, + "bidamount": 1000, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "totalrequired": 1000, + "price": 1 + }, + { + "funcid": "b", + "txid": "a8d60a3ce429ccb885ad445e7a4534130a35d2424d1883c6513d0f4da2fe9a92", + "vout": 0, + "amount": 150, + "bidamount": 150, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "totalrequired": 100, + "price": 1.5 + } + ] + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokenorders", "params":["c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": [ + { + "funcid": "B", + "txid": "b9d305e9b6a82e715efce9b6244cc15fef131baf1893a7eb45b199c23b3fb806", + "vout": 0, + "amount": 0, + "bidamount": 0, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59" + }, + { + "funcid": "b", + "txid": "9dabd8c01bb7d59455b64fe100617149c20cb4520d266183686aa4986fd3021d", + "vout": 0, + "amount": 100, + "bidamount": 100, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "totalrequired": 100, + "price": 1 + }, + { + "funcid": "b", + "txid": "45b3f7874fc4a2699729a9792bc7679f6b5f11035a29ad9f661425b19534dd1d", + "vout": 0, + "amount": 1000, + "bidamount": 1000, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "totalrequired": 1000, + "price": 1 + }, + { + "funcid": "b", + "txid": "a8d60a3ce429ccb885ad445e7a4534130a35d2424d1883c6513d0f4da2fe9a92", + "vout": 0, + "amount": 150, + "bidamount": 150, + "origaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "totalrequired": 100, + "price": 1.5 + } + ], + "error": null, + "id": "curltest" + } + ``` + + +## mytokenorders + +**mytokenorders \[evalcode]** + +The `mytokenorders` method displays the public on-chain orders created by the user's pubkey, which is set in `-pubkey` parameter of komodod. + +The additional `evalcode` parameter allows the display of orders for non-fungible tokens bound to this evalcode. + +The response from this method is similar to the response from the `tokenorders` method. +export const title = "Channels: Secure,Trustless Instant Payments"; +export const description = "The Channels Antara Module facilitates instant payments in a trustless environment."; + +# Channels + +## Introduction + +The Channels Antara Module facilitates instant payments in a trustless environment. + +When a payment is executed properly with `channels`, as soon as it enters the mempool the odds that the payment can be withdrawn or attacked decrease to almost zero. Many developers and users may find the Channels Module to be an advantageous method for creating a secure instant-payment network that can be used within their business environment. + +It supports both coins and tokens. + + + For testing Channels, build the Komodo daemon in test mode. Instead of using the command: `./zcutil/build.sh -j8`, use + + ```bash + export CONFIGURE_FLAGS='CPPFLAGS=-DTESTMODE' + ./zcutil/build.sh -j8 + ``` + + This will reduce the number of confirmations needed for `channelsopen` and `channelsclose` transactions from `100` to `2` for non-notarized chains. + + DO NOT use a daemon created with the above parameter for actual use. + + +#### Channels Module Flow + +* Anyone can create a channel using [channelsopen](/antara/api/channels/#channelsopen) + * When creating the channel, the user indicates the number and size of their potential payment(s), and what their destination is +* Once the channel is notarized, at any time in the future the user can execute [channelspayment](/antara/api/channels/#channelspayment) to release a specific amount of their available payments + * As soon as the `channelspayment` result enters the mempool, the odds of withdrawing the `txid` from processing decrease to almost zero +* The creator of a channel may close the channel at any time using [channelsclose](/antara/api/channels/#channelsclose) + * This shows the receiver that this payment stream is permanently ended +* Once the channel's closure is notarized, the creator may withdraw remaining funds using [channelsrefund](/antara/api/channels/#channelsrefund) +* The [channelsinfo](/antara/api/channels/#channelsinfo) method reveals public information for any or all available channels on an Smart Chain + +## channelsaddress + +**channelsaddress pubkey** + +The `channelsaddress` method displays the various addresses and their balances for a specified pubkey. + +Under normal circumstances, for the `pubkey` the user provides the destination address of the intended channel. + +The global addresses are not used in the Channels Antara module. For more information about unique Antara addresses, see [this linked explanation.](/antara/tutorials/understanding-antara-addresses/) + +### Arguments + +| Name | Type | Description | +| ------ | ------------------ | ---------------------- | +| pubkey | (string, required) | the destination pubkey | + +### Response + +| Name | Type | Description | +| --------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | (string) | whether the method executed successfully | +| ChannelsCCAddress | (string) | taking the contract's EVAL code as a modifier, this is the public address that corresponds to the contract's privkey | +| CCbalance | (numeric) | the unspent amount in `ChannelsCCaddress` | +| ChannelsNormalAddress | (string) | the unmodified normal public address generated from the contract's privkey; this is generally used for markers | +| ChannelsCC1of2Address | (string) | the channel address that will store the funds once the channel is opened; this property is only active when the channel is using coins | +| ChannelsCC1of2TokensAddress | (string) | the channel address that will store the funds once the channel is opened; this property is only active when the channel is using tokens | +| myCCAddress(Channels) | (string) | taking the contract's EVAL code as a modifier, this is the Antara address from the `pubkey` [used to launch the daemon](/antara/tutorials/understanding-antara-addresses/#creating-and-launching-with-a-pubkey) | +| PubkeyCCaddress(Channels) | (string) | taking the contract's EVAL code as a modifier, this is the Antara address from the `pubkey` supplied as the argument | +| myCCbalance | (numeric) | the balance of `myccaddress` in coins | +| myaddress | (string) | the unmodified normal public address of the pubkey [used to launch the daemon](/antara/tutorials/understanding-antara-addresses/#creating-and-launching-with-a-pubkey) | +| mybalance | (numeric) | the balance of `myaddress` in coins | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD channelsaddress 02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567 +``` + + + ```json + { + "result": "success", + "ChannelsCCAddress": "RQy3rwX8sP9oDm3c39vGKA6H315cgtPLfr", + "ChannelsCCBalance": 0.0, + "ChannelsNormalAddress": "RQUuT8zmkvDfXqECH4m3VD3SsHZAfnoh1v", + "ChannelsNormalBalance": 0.0, + "ChannelsCC1of2Address": "RSSfafKpi6b5TFmyGDh5aTXLJuyrMxQyjs", + "ChannelsCC1of2TokensAddress": "RFgEqotRmMrhhEkEyUpxGDZD7DR1TncV8c", + "PubkeyCCaddress(Channels)": "RXWFiYQbj3HK7fCvkfGnWQHLkrywWBQ72D", + "PubkeyCCbalance(Channels)": 0.0, + "myCCAddress(Channels)": "RXWFiYQbj3HK7fCvkfGnWQHLkrywWBQ72D", + "myCCbalance(Channels)": 0.0001, + "myaddress": "RN727JeeiZ6NXic7PUKTCiHT1HvuBN4RDa", + "mybalance": 7781877.16591359 + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"channelsaddress", "params":["02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "ChannelsCCAddress": "RQy3rwX8sP9oDm3c39vGKA6H315cgtPLfr", + "ChannelsCCBalance": 0.0, + "ChannelsNormalAddress": "RQUuT8zmkvDfXqECH4m3VD3SsHZAfnoh1v", + "ChannelsNormalBalance": 0.0, + "ChannelsCC1of2Address": "RSSfafKpi6b5TFmyGDh5aTXLJuyrMxQyjs", + "ChannelsCC1of2TokensAddress": "RFgEqotRmMrhhEkEyUpxGDZD7DR1TncV8c", + "PubkeyCCaddress(Channels)": "RXWFiYQbj3HK7fCvkfGnWQHLkrywWBQ72D", + "PubkeyCCbalance(Channels)": 0.0, + "myCCAddress(Channels)": "RXWFiYQbj3HK7fCvkfGnWQHLkrywWBQ72D", + "myCCbalance(Channels)": 0.0001, + "myaddress": "RN727JeeiZ6NXic7PUKTCiHT1HvuBN4RDa", + "mybalance": 7782377.16591359 + }, + "error": null, + "id": "curltest" + } + ``` + + +## channelsclose + +**channelsclose open\_txid** + +The `channelsclose` method marks a specific channel as closed, meaning that no additional payments will be added to the channel. + +The owner of the `channel` may still execute [channelspayment](/antara/api/channels/#channelspayment) for any remaining payments in the channel, until all payments are used or withdrawn. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +The `sendrawtransaction` method then returns a `txid` which is used in the [channelsrefund](/antara/api/channels/#channelsrefund) method to reclaim funds. + +### Arguments + +| Name | Type | Description | +| ---------- | -------- | -------------------------------------------------------------------------- | +| open\_txid | (string) | the unique identifying txid that is created when a channel is first opened | + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Close a channel + +```bash +./komodo-cli -ac_name=HELLOWORLD channelsclose 04ed7f0d7c90036bad2822ea32564e38cc517f2ac86c8c53a031543e7d8235d0 +``` + +Output from Step 1 + +```json +{ + "result": "success", + "hex": "0400008085202f890301d6737a2ff4c9c63b49d9fa4526943ba402b471d9a9220fe9230198ed87c6800000000048473044022024e46c6054be26df24f794495e30b758ddd7afe6e5d0cb277342f2a2e9e5471f02201d0fa1de9c7d04602ad196bcf09fd24db70f8993fe2ecb252d0cd2f06d6e0f9f01ffffffffad2f890f95746fe3b79642b645abf1c48437d174bf44fab2e0e87dff2e376bd100000000a74ca5a281a1a0819ca28194a067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475678140ed5cd683ce4e8a6d03a064e9008a330c9a91deb2aafdfff41c8c95843fb0f05d34213c069bfe6f08e3a69c43019ca59d9c800ae45c2735c44b4b71d99fd461b5a129a52780203a76ccf53a3f5978c2102ab5151f744308a5e4071ea7d7dba6d915b05b692d8f8103020000af038001eba10001ffffffffad2f890f95746fe3b79642b645abf1c48437d174bf44fab2e0e87dff2e376bd1010000007b4c79a276a072a26ba067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756781400aeec3737f700487dd15331948fab80ea6b9c6b64af3c4be86733498f8bae83a657fbf274408d2929143ca8fe27988aa4195fb00e37a95d0e2d07a4298df309da100af038001eba10001ffffffff05808b874702000000302ea22c80205a8d5650f7e869c80fbe5b5e9b04d909f86800a579e21a26404799a98c47e0ff81031210008203000401cc1027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401cce0950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb43d035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed042102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634d303000080969800000000000000000000000000000000000000000000000000000000000000000000000000000000002f0100000000000000000000000000" +} +``` + +Step 2: Broadcast the raw transaction using sendrawtransaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f890301d6737a2ff4c9c63b49d9fa4526943ba402b471d9a9220fe9230198ed87c6800000000048473044022024e46c6054be26df24f794495e30b758ddd7afe6e5d0cb277342f2a2e9e5471f02201d0fa1de9c7d04602ad196bcf09fd24db70f8993fe2ecb252d0cd2f06d6e0f9f01ffffffffad2f890f95746fe3b79642b645abf1c48437d174bf44fab2e0e87dff2e376bd100000000a74ca5a281a1a0819ca28194a067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475678140ed5cd683ce4e8a6d03a064e9008a330c9a91deb2aafdfff41c8c95843fb0f05d34213c069bfe6f08e3a69c43019ca59d9c800ae45c2735c44b4b71d99fd461b5a129a52780203a76ccf53a3f5978c2102ab5151f744308a5e4071ea7d7dba6d915b05b692d8f8103020000af038001eba10001ffffffffad2f890f95746fe3b79642b645abf1c48437d174bf44fab2e0e87dff2e376bd1010000007b4c79a276a072a26ba067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756781400aeec3737f700487dd15331948fab80ea6b9c6b64af3c4be86733498f8bae83a657fbf274408d2929143ca8fe27988aa4195fb00e37a95d0e2d07a4298df309da100af038001eba10001ffffffff05808b874702000000302ea22c80205a8d5650f7e869c80fbe5b5e9b04d909f86800a579e21a26404799a98c47e0ff81031210008203000401cc1027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401cce0950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb43d035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed042102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634d303000080969800000000000000000000000000000000000000000000000000000000000000000000000000000000002f0100000000000000000000000000 +``` + + + ```bash + 3f22afe66f0dd0e7d45ea1f89509f60673efa026c545118b309cdc03fa3bec98 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"channelsclose", "params":["04ed7f0d7c90036bad2822ea32564e38cc517f2ac86c8c53a031543e7d8235d0"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "0400008085202f890301d6737a2ff4c9c63b49d9fa4526943ba402b471d9a9220fe9230198ed87c6800000000048473044022024e46c6054be26df24f794495e30b758ddd7afe6e5d0cb277342f2a2e9e5471f02201d0fa1de9c7d04602ad196bcf09fd24db70f8993fe2ecb252d0cd2f06d6e0f9f01ffffffffad2f890f95746fe3b79642b645abf1c48437d174bf44fab2e0e87dff2e376bd100000000a74ca5a281a1a0819ca28194a067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475678140ed5cd683ce4e8a6d03a064e9008a330c9a91deb2aafdfff41c8c95843fb0f05d34213c069bfe6f08e3a69c43019ca59d9c800ae45c2735c44b4b71d99fd461b5a129a52780203a76ccf53a3f5978c2102ab5151f744308a5e4071ea7d7dba6d915b05b692d8f8103020000af038001eba10001ffffffffad2f890f95746fe3b79642b645abf1c48437d174bf44fab2e0e87dff2e376bd1010000007b4c79a276a072a26ba067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756781400aeec3737f700487dd15331948fab80ea6b9c6b64af3c4be86733498f8bae83a657fbf274408d2929143ca8fe27988aa4195fb00e37a95d0e2d07a4298df309da100af038001eba10001ffffffff05808b874702000000302ea22c80205a8d5650f7e869c80fbe5b5e9b04d909f86800a579e21a26404799a98c47e0ff81031210008203000401cc1027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401cce0950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb43d035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed042102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634d303000080969800000000000000000000000000000000000000000000000000000000000000000000000000000000002f0100000000000000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +## channelsinfo + +**channelsinfo (open\_tx\_id)** + +The `channelsinfo` method fetches info about channels that are relevant to the user, either as sender or receiver. + +If no `open_tx_id` argument is included, the method returns a list of all channels available to this user. + +### Arguments + +| Name | Type | Description | +| ---------- | ------------------ | -------------------------------------------------------------------------- | +| open\_txid | (string, optional) | the unique identifying txid that is created when a channel is first opened | + +### Response + +| Name | Type | Description | +| ---------------------- | ---------------- | --------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| Channel CC address | (string) | the 1of2 Channels CC address for the two pubkeys involved | +| Destination address | (string) | the destination address of the Channel | +| Number of payments | (number) | the total number of payments available at the time of Channel opening | +| Denomination (satoshi) | (number) | the size of each payment (in satoshis) | +| Amount (satoshi) | (number) | the total amount available to pay (in satoshis) | +| Transactions | (array of jsons) | the transactions associated with the Channel | +| Open | (string) | the id of the Channel opening transaction | +| Payment | (string) | the id of a payment transaction | +| Number of payments | (number) | the number of payments used up in the transaction | +| Amount | (number) | the total amount paid in the transaction (in satoshis) | +| Destination | (string) | the destination address of the Channel | +| Secret | (string) | the secret revealed to pay the amount | +| Payments left | (number) | the total number of payments left after the transaction | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD channelsinfo 04ed7f0d7c90036bad2822ea32564e38cc517f2ac86c8c53a031543e7d8235d0 +``` + + + ```json + { + "result": "success", + "Channel CC address": "RVEZbEwMBQBdryswcWhtwWY5sYJTiEJ5SG", + "Destination address": "RM9n6rts1CBKX4oXziLp1WBBgEUjKKWHb3", + "Number of payments": 1000, + "Denomination (satoshi)": "10000000", + "Amount (satoshi)": "10000000000", + "Transactions": [ + { + "Open": "04ed7f0d7c90036bad2822ea32564e38cc517f2ac86c8c53a031543e7d8235d0" + } + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"channelsinfo", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "Channel CC address": "RVEZbEwMBQBdryswcWhtwWY5sYJTiEJ5SG", + "Destination address": "RM9n6rts1CBKX4oXziLp1WBBgEUjKKWHb3", + "Number of payments": 1000, + "Denomination (satoshi)": "10000000", + "Amount (satoshi)": "10000000000", + "Transactions": [ + { + "Open": "04ed7f0d7c90036bad2822ea32564e38cc517f2ac86c8c53a031543e7d8235d0" + } + ] + }, + "error": null, + "id": "curltest" + } + ``` + + +Command (after a Payment is done): + +```bash +./komodo-cli -ac_name=HELLOWORLD channelsinfo +``` + + + ```json + { + "result": "success", + "Channel CC address": "RVEZbEwMBQBdryswcWhtwWY5sYJTiEJ5SG", + "Destination address": "RM9n6rts1CBKX4oXziLp1WBBgEUjKKWHb3", + "Number of payments": 1000, + "Denomination (satoshi)": "10000000", + "Amount (satoshi)": "10000000000", + "Transactions": [ + { + "Open": "04ed7f0d7c90036bad2822ea32564e38cc517f2ac86c8c53a031543e7d8235d0" + }, + { + "Payment": "d16b372eff7de8e0b2fa44bf74d13784c4f1ab45b64296b7e36f74950f892fad", + "Number of payments": 21, + "Amount": 210000000, + "Destination": "RM9n6rts1CBKX4oXziLp1WBBgEUjKKWHb3", + "Secret": "570fd06eb542eb0dcb163c42467860194a0a998dfccee047724067f5aab7490e", + "Payments left": 979 + } + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"channelsinfo", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "success", + "Channel CC address": "RVEZbEwMBQBdryswcWhtwWY5sYJTiEJ5SG", + "Destination address": "RM9n6rts1CBKX4oXziLp1WBBgEUjKKWHb3", + "Number of payments": 1000, + "Denomination (satoshi)": "10000000", + "Amount (satoshi)": "10000000000", + "Transactions": [ + { + "Open": "04ed7f0d7c90036bad2822ea32564e38cc517f2ac86c8c53a031543e7d8235d0" + }, + { + "Payment": "d16b372eff7de8e0b2fa44bf74d13784c4f1ab45b64296b7e36f74950f892fad", + "Number of payments": 21, + "Amount": 210000000, + "Destination": "RM9n6rts1CBKX4oXziLp1WBBgEUjKKWHb3", + "Secret": "570fd06eb542eb0dcb163c42467860194a0a998dfccee047724067f5aab7490e", + "Payments left": 979 + } + ] + } + ``` + + +For the Tokens case: + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD channelsinfo 77925f6b05b1ecb299b1bb6c63b4451f73ff50ef494feda1293fb799238f2c4c +``` + + + ```json + { + "result": "success", + "Channel CC address": "RVEZbEwMBQBdryswcWhtwWY5sYJTiEJ5SG", + "Destination address": "RM9n6rts1CBKX4oXziLp1WBBgEUjKKWHb3", + "Number of payments": 99, + "Token id": "916a6907e39cec679a6c832255c71b74e4941895d2d8775a6d2a0e8a322401ed", + "Denomination (token satoshi)": "1", + "Amount (token satoshi)": "99", + "Transactions": [ + { + "Open": "77925f6b05b1ecb299b1bb6c63b4451f73ff50ef494feda1293fb799238f2c4c" + } + ] + } + ``` + + +## channelsopen + +**channelsopen destination\_pubkey total\_number\_of\_payments payment\_size \[tokenid]** + +The `channelsopen` method opens a channel between two public keys (sender and receiver). + +To open a channel that sends tokens, include the `tokenid` of the required token. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +The `sendrawtransaction` method then returns a `txid` which is the unique identifying `channels_tx_id`. + +### Arguments + +| Name | Type | Description | +| --------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------ | +| destination\_pubkey | (string) | the public key of the intended recipient of the channel | +| total\_number\_of\_payments | (number) | the total number of payments to allocate in the channel | +| payment\_size | (number) | the amount per payment, given in satoshis; when tokenid is specified, the number of tokens per payment | +| tokenid | (string, optional) | the id of the token | + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Create the raw hex + +```bash +./komodo-cli -ac_name=HELLOWORLD channelsopen 0257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634 1000 10000000 +``` + + + ```json + { + "hex": "010000000121a212c73e8a6265d2b1babfc3a9fcc74101e14742db394785f3604151b27ed80000000049483045022100bad26378f61b2cc6e482b63ca7d098b0dc0c060929794ba1ce5bb8d0cadf5b6502206021b228cf942a863591e9b897c40292b68aa55dc90d4cd66bf37db5a575cadd01ffffffff0500e40b5402000000302ea22c80205a8d5650f7e869c80fbe5b5e9b04d909f86800a579e21a26404799a98c47e0ff81031210008203000401cc1027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401ccff16772860c30200232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb4f00000000000000000000000000000000000000000000000000000000000000002102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634e803000080969800000000009704b3bd04d351e193cdc4dc500253acb9d6c6db6562edbe101699b24df725bc00000000", + "result": "success" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"channelsopen", "params":["0257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634" ,"1000" ,"10000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "hex": "010000000121a212c73e8a6265d2b1babfc3a9fcc74101e14742db394785f3604151b27ed80000000049483045022100bad26378f61b2cc6e482b63ca7d098b0dc0c060929794ba1ce5bb8d0cadf5b6502206021b228cf942a863591e9b897c40292b68aa55dc90d4cd66bf37db5a575cadd01ffffffff0500e40b5402000000302ea22c80205a8d5650f7e869c80fbe5b5e9b04d909f86800a579e21a26404799a98c47e0ff81031210008203000401cc1027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401ccff16772860c30200232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb4f00000000000000000000000000000000000000000000000000000000000000002102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634e803000080969800000000009704b3bd04d351e193cdc4dc500253acb9d6c6db6562edbe101699b24df725bc00000000", + "result": "success" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Broadcast the hex using `sendrawtransaction` + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000121a212c73e8a6265d2b1babfc3a9fcc74101e14742db394785f3604151b27ed80000000049483045022100bad26378f61b2cc6e482b63ca7d098b0dc0c060929794ba1ce5bb8d0cadf5b6502206021b228cf942a863591e9b897c40292b68aa55dc90d4cd66bf37db5a575cadd01ffffffff0500e40b5402000000302ea22c80205a8d5650f7e869c80fbe5b5e9b04d909f86800a579e21a26404799a98c47e0ff81031210008203000401cc1027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401ccff16772860c30200232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb4f00000000000000000000000000000000000000000000000000000000000000002102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634e803000080969800000000009704b3bd04d351e193cdc4dc500253acb9d6c6db6562edbe101699b24df725bc00000000 +``` + + + ```bash + 04ed7f0d7c90036bad2822ea32564e38cc517f2ac86c8c53a031543e7d8235d0 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000121a212c73e8a6265d2b1babfc3a9fcc74101e14742db394785f3604151b27ed80000000049483045022100bad26378f61b2cc6e482b63ca7d098b0dc0c060929794ba1ce5bb8d0cadf5b6502206021b228cf942a863591e9b897c40292b68aa55dc90d4cd66bf37db5a575cadd01ffffffff0500e40b5402000000302ea22c80205a8d5650f7e869c80fbe5b5e9b04d909f86800a579e21a26404799a98c47e0ff81031210008203000401cc1027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401ccff16772860c30200232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb4f00000000000000000000000000000000000000000000000000000000000000002102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634e803000080969800000000009704b3bd04d351e193cdc4dc500253acb9d6c6db6562edbe101699b24df725bc00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "04ed7f0d7c90036bad2822ea32564e38cc517f2ac86c8c53a031543e7d8235d0", + "error": null, + "id": "curltest" + } + ``` + + +For the Tokens case: + +Step 1: Create the raw hex + +```bash +./komodo-cli -ac_name=HELLOWORLD channelsopen 0257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634 99 1 916a6907e39cec679a6c832255c71b74e4941895d2d8775a6d2a0e8a322401ed +``` + + + ```json + { + "hex": "0400008085202f8902068ffd7dd7dbf230c79ef08c97cff151ae371d6d638ed47791fc2bee9f31e40d00000000484730440220594cf8de63f2096410560ff81322ecb4f3c7f8edcc2b8716031417311b4d5af4022031f02f69a7834b4e7b72dabe78b5b3f3a576d2befa507a85a7212639e00a664901ffffffffed0124328a0e2a6d5a77d8d2951894e4741bc75522836c9a67ec9ce307696a91010000007b4c79a276a072a26ba067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475678140b5333063661eb5013544e67282254a8f0abf6b7334c83bdde07eff054d53657876310286e17e81a9c8c26af8c744325a9268d3220cb9a80b1316cc0e1290aaa1a100af038001f2a10001ffffffff066300000000000000302ea22c8020f765a39dc65a1a5b9535633f65604f92d404de5ea156f3e660929f46db671ec781032214008203000401cc1027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401cc0100000000000000302ea22c80205dcc33b0b3f0573b306ab85ffa9ce8622fbcb81cb6ad8ec00f366935bbf500f78103120c008203000401ccd06e0b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000fdfe006a4cfbf274916a6907e39cec679a6c832255c71b74e4941895d2d8775a6d2a0e8a322401ed022102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb030552866341492eb4f00000000000000000000000000000000000000000000000000000000000000002102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634630000000100000000000000e613adac747c26e76f8db6ca9818032f3d678b1b7f608938516662d857b2980f000000003b0100000000000000000000000000", + "result": "success" + } + ``` + + +Step 2: Broadcast the hex using `sendrawtransaction` + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f8902068ffd7dd7dbf230c79ef08c97cff151ae371d6d638ed47791fc2bee9f31e40d00000000484730440220594cf8de63f2096410560ff81322ecb4f3c7f8edcc2b8716031417311b4d5af4022031f02f69a7834b4e7b72dabe78b5b3f3a576d2befa507a85a7212639e00a664901ffffffffed0124328a0e2a6d5a77d8d2951894e4741bc75522836c9a67ec9ce307696a91010000007b4c79a276a072a26ba067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475678140b5333063661eb5013544e67282254a8f0abf6b7334c83bdde07eff054d53657876310286e17e81a9c8c26af8c744325a9268d3220cb9a80b1316cc0e1290aaa1a100af038001f2a10001ffffffff066300000000000000302ea22c8020f765a39dc65a1a5b9535633f65604f92d404de5ea156f3e660929f46db671ec781032214008203000401cc1027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401cc0100000000000000302ea22c80205dcc33b0b3f0573b306ab85ffa9ce8622fbcb81cb6ad8ec00f366935bbf500f78103120c008203000401ccd06e0b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000fdfe006a4cfbf274916a6907e39cec679a6c832255c71b74e4941895d2d8775a6d2a0e8a322401ed022102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb030552866341492eb4f00000000000000000000000000000000000000000000000000000000000000002102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634630000000100000000000000e613adac747c26e76f8db6ca9818032f3d678b1b7f608938516662d857b2980f000000003b0100000000000000000000000000 +``` + + + ```bash + 77925f6b05b1ecb299b1bb6c63b4451f73ff50ef494feda1293fb799238f2c4c + ``` + + +## channelspayment + +**channelspayment open\_tx\_id payment\_amount (secret)** + +The `channelspayment` method sends a payment in a channel to the receiver. + +The method requires that the channel `open_tx_id` has either one notarization or 100 confirmations. + +The owner of a channel reveals the password of a unique payment `txid` as a part of the payment. This password is intentionally visible to anyone watching the chain at the time of payment, although the password does not persist in the database. + +If the receiver is monitoring the chain at the time of payment and saves the password, and there is a chain reorganization that nullifies the payment, the receiver now has the password to resend the payment. This option is available so long as the channel remains open and the payment has not been refunded. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +The `sendrawtransaction` method then returns a `txid` which is the unique identifying `channels_tx_id`. + +### Arguments + +| Name | Type | Description | +| --------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| open\_tx\_id | (string) | the transaction id of the channel open transaction | +| payment\_amount | (number) | the amount to release to the receiver pubkey in satoshis; the number of tokens to release in case of Token | +| secret | (string, optional) | to be used by the receiver when a payment was issued previously but not mined; the secret must be extracted from the initial payment that has reached the mempool | + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD channelspayment 04ed7f0d7c90036bad2822ea32564e38cc517f2ac86c8c53a031543e7d8235d0 210000000 +``` + + + ```json + { + "result": "success", + "hex": "010000000307f4bba340b8a8b45864613f0b608360a2df80a2ebc116ad0f1d8f9680bb85890000000049483045022100ffccb5b9ba7e2d2e0c3a0e8b4378d004932731c4116853df38ea3727b24bb2540220370d76eb59eb2b9de7087d96242b0c0d47598b4b8500bc586f04d312f0a693d101ffffffffd035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed0400000000a74ca5a281a1a0819ca28194a067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475678140c32058837f4e2823c958462ea24115b88e8280c5c9e6ebdce2843cbafd0c9c624b1870da5cecd5b2743b41abfe24fbc98995eadcd76caf431aa0d9c55c6a2596a129a52780203a76ccf53a3f5978c2102ab5151f744308a5e4071ea7d7dba6d915b05b692d8f8103020000af038001eba10001ffffffffd035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed04010000007b4c79a276a072a26ba067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756781407348f4137b5d80fb5d849a6aa3822cefffbdb855eaa038640b04f89d5bd426f47b64a8459092c8d5aeda3ef1cad3732bd80c8206d271689af4efb788d5c3287ea100af038001eba10001ffffffff06808b874702000000302ea22c80205a8d5650f7e869c80fbe5b5e9b04d909f86800a579e21a26404799a98c47e0ff81031210008203000401cc1027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401cc8058840c0000000023210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634ace0950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb50d035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed042102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634d303000015000000000000000e49b7aaf567407247e0cefc8d990a4a19607846423c16cb0deb42b56ed00f5700000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"channelspayment", "params":["04ed7f0d7c90036bad2822ea32564e38cc517f2ac86c8c53a031543e7d8235d0" ,"210000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "010000000307f4bba340b8a8b45864613f0b608360a2df80a2ebc116ad0f1d8f9680bb85890000000049483045022100ffccb5b9ba7e2d2e0c3a0e8b4378d004932731c4116853df38ea3727b24bb2540220370d76eb59eb2b9de7087d96242b0c0d47598b4b8500bc586f04d312f0a693d101ffffffffd035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed0400000000a74ca5a281a1a0819ca28194a067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475678140c32058837f4e2823c958462ea24115b88e8280c5c9e6ebdce2843cbafd0c9c624b1870da5cecd5b2743b41abfe24fbc98995eadcd76caf431aa0d9c55c6a2596a129a52780203a76ccf53a3f5978c2102ab5151f744308a5e4071ea7d7dba6d915b05b692d8f8103020000af038001eba10001ffffffffd035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed04010000007b4c79a276a072a26ba067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756781407348f4137b5d80fb5d849a6aa3822cefffbdb855eaa038640b04f89d5bd426f47b64a8459092c8d5aeda3ef1cad3732bd80c8206d271689af4efb788d5c3287ea100af038001eba10001ffffffff06808b874702000000302ea22c80205a8d5650f7e869c80fbe5b5e9b04d909f86800a579e21a26404799a98c47e0ff81031210008203000401cc1027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401cc8058840c0000000023210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634ace0950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb50d035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed042102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634d303000015000000000000000e49b7aaf567407247e0cefc8d990a4a19607846423c16cb0deb42b56ed00f5700000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Broadcast using `sendrawtransaction` + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000307f4bba340b8a8b45864613f0b608360a2df80a2ebc116ad0f1d8f9680bb85890000000049483045022100ffccb5b9ba7e2d2e0c3a0e8b4378d004932731c4116853df38ea3727b24bb2540220370d76eb59eb2b9de7087d96242b0c0d47598b4b8500bc586f04d312f0a693d101ffffffffd035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed0400000000a74ca5a281a1a0819ca28194a067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475678140c32058837f4e2823c958462ea24115b88e8280c5c9e6ebdce2843cbafd0c9c624b1870da5cecd5b2743b41abfe24fbc98995eadcd76caf431aa0d9c55c6a2596a129a52780203a76ccf53a3f5978c2102ab5151f744308a5e4071ea7d7dba6d915b05b692d8f8103020000af038001eba10001ffffffffd035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed04010000007b4c79a276a072a26ba067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756781407348f4137b5d80fb5d849a6aa3822cefffbdb855eaa038640b04f89d5bd426f47b64a8459092c8d5aeda3ef1cad3732bd80c8206d271689af4efb788d5c3287ea100af038001eba10001ffffffff06808b874702000000302ea22c80205a8d5650f7e869c80fbe5b5e9b04d909f86800a579e21a26404799a98c47e0ff81031210008203000401cc1027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401cc8058840c0000000023210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634ace0950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb50d035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed042102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634d303000015000000000000000e49b7aaf567407247e0cefc8d990a4a19607846423c16cb0deb42b56ed00f5700000000 +``` + + + ```bash + d16b372eff7de8e0b2fa44bf74d13784c4f1ab45b64296b7e36f74950f892fad + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000307f4bba340b8a8b45864613f0b608360a2df80a2ebc116ad0f1d8f9680bb85890000000049483045022100ffccb5b9ba7e2d2e0c3a0e8b4378d004932731c4116853df38ea3727b24bb2540220370d76eb59eb2b9de7087d96242b0c0d47598b4b8500bc586f04d312f0a693d101ffffffffd035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed0400000000a74ca5a281a1a0819ca28194a067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475678140c32058837f4e2823c958462ea24115b88e8280c5c9e6ebdce2843cbafd0c9c624b1870da5cecd5b2743b41abfe24fbc98995eadcd76caf431aa0d9c55c6a2596a129a52780203a76ccf53a3f5978c2102ab5151f744308a5e4071ea7d7dba6d915b05b692d8f8103020000af038001eba10001ffffffffd035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed04010000007b4c79a276a072a26ba067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756781407348f4137b5d80fb5d849a6aa3822cefffbdb855eaa038640b04f89d5bd426f47b64a8459092c8d5aeda3ef1cad3732bd80c8206d271689af4efb788d5c3287ea100af038001eba10001ffffffff06808b874702000000302ea22c80205a8d5650f7e869c80fbe5b5e9b04d909f86800a579e21a26404799a98c47e0ff81031210008203000401cc1027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401cc8058840c0000000023210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634ace0950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb50d035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed042102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634d303000015000000000000000e49b7aaf567407247e0cefc8d990a4a19607846423c16cb0deb42b56ed00f5700000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "d16b372eff7de8e0b2fa44bf74d13784c4f1ab45b64296b7e36f74950f892fad", + "error": null, + "id": "curltest" + } + ``` + + +Check that the transaction is confirmed: + +```bash +./komodo-cli -ac_name=HELLOWORLD getrawmempool +``` + +## channelsrefund + +**channelsrefund open\_tx\_id close\_tx\_id** + +The `channelsrefund` method withdraws funds directly to the Antara address of the channel creator. + +The method can only be executed after the channel `close_tx_id` has either one notarization or 100 confirmations. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +### Arguments + +| Name | Type | Description | +| ------------- | -------- | ----------------------------------------- | +| open\_tx\_id | (string) | the id of the Channel opening transaction | +| close\_tx\_id | (string) | the id of the Channel closing transaction | + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Command + +```bash +./komodo-cli -ac_name=HELLOWORLD channelsrefund 04ed7f0d7c90036bad2822ea32564e38cc517f2ac86c8c53a031543e7d8235d0 3f22afe66f0dd0e7d45ea1f89509f60673efa026c545118b309cdc03fa3bec98 +``` + + + ```json + { + "result": "success", + "hex": "0400008085202f8903040759ca1117f2514e2f4e67acd095720b0ad0beadf71882ae0b11b3b88f59280000000049483045022100f16f085e286641494fc0773f2bdbb426b78708ea0d441a37781a964b60e110100220744abdc3830999492b1f5b96ea8cde9f6318c9e040a4e65c3497364455ea3f5501ffffffff98ec3bfa03dc9c308b1145c526a0ef7306f60995f8a15ed4e7d00d6fe6af223f00000000a74ca5a281a1a0819ca28194a067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756781407b41b291afeda4e533d22565b23542159af5079b1e1408da5b3f9188bed059e6751349e0d3d9b7b7e26aeadfb6b2fc839cc471b947d1b811325386f84abe3120a129a52780203a76ccf53a3f5978c2102ab5151f744308a5e4071ea7d7dba6d915b05b692d8f8103020000af038001eba10001ffffffff98ec3bfa03dc9c308b1145c526a0ef7306f60995f8a15ed4e7d00d6fe6af223f010000007b4c79a276a072a26ba067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475678140f0a00a6b0f008e01f88308245f7cd6001af33e7fe909a1d4b1eb54c3663620a34ed2c2d692075915ed02c4ac72e3341e6af2196016a72609f4ca3fcb4f842f13a100af038001eba10001ffffffff051027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401cc808b874702000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ace0950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb52d035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed042102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634d3030000809698000000000098ec3bfa03dc9c308b1145c526a0ef7306f60995f8a15ed4e7d00d6fe6af223f00000000330100000000000000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"channelsrefund", "params":["04ed7f0d7c90036bad2822ea32564e38cc517f2ac86c8c53a031543e7d8235d0" ,"3f22afe66f0dd0e7d45ea1f89509f60673efa026c545118b309cdc03fa3bec98"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "0400008085202f8903040759ca1117f2514e2f4e67acd095720b0ad0beadf71882ae0b11b3b88f59280000000049483045022100f16f085e286641494fc0773f2bdbb426b78708ea0d441a37781a964b60e110100220744abdc3830999492b1f5b96ea8cde9f6318c9e040a4e65c3497364455ea3f5501ffffffff98ec3bfa03dc9c308b1145c526a0ef7306f60995f8a15ed4e7d00d6fe6af223f00000000a74ca5a281a1a0819ca28194a067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756781407b41b291afeda4e533d22565b23542159af5079b1e1408da5b3f9188bed059e6751349e0d3d9b7b7e26aeadfb6b2fc839cc471b947d1b811325386f84abe3120a129a52780203a76ccf53a3f5978c2102ab5151f744308a5e4071ea7d7dba6d915b05b692d8f8103020000af038001eba10001ffffffff98ec3bfa03dc9c308b1145c526a0ef7306f60995f8a15ed4e7d00d6fe6af223f010000007b4c79a276a072a26ba067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475678140f0a00a6b0f008e01f88308245f7cd6001af33e7fe909a1d4b1eb54c3663620a34ed2c2d692075915ed02c4ac72e3341e6af2196016a72609f4ca3fcb4f842f13a100af038001eba10001ffffffff051027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401cc808b874702000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ace0950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb52d035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed042102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634d3030000809698000000000098ec3bfa03dc9c308b1145c526a0ef7306f60995f8a15ed4e7d00d6fe6af223f00000000330100000000000000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Broadcast the hex using `sendrawtransaction` + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f8903040759ca1117f2514e2f4e67acd095720b0ad0beadf71882ae0b11b3b88f59280000000049483045022100f16f085e286641494fc0773f2bdbb426b78708ea0d441a37781a964b60e110100220744abdc3830999492b1f5b96ea8cde9f6318c9e040a4e65c3497364455ea3f5501ffffffff98ec3bfa03dc9c308b1145c526a0ef7306f60995f8a15ed4e7d00d6fe6af223f00000000a74ca5a281a1a0819ca28194a067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756781407b41b291afeda4e533d22565b23542159af5079b1e1408da5b3f9188bed059e6751349e0d3d9b7b7e26aeadfb6b2fc839cc471b947d1b811325386f84abe3120a129a52780203a76ccf53a3f5978c2102ab5151f744308a5e4071ea7d7dba6d915b05b692d8f8103020000af038001eba10001ffffffff98ec3bfa03dc9c308b1145c526a0ef7306f60995f8a15ed4e7d00d6fe6af223f010000007b4c79a276a072a26ba067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475678140f0a00a6b0f008e01f88308245f7cd6001af33e7fe909a1d4b1eb54c3663620a34ed2c2d692075915ed02c4ac72e3341e6af2196016a72609f4ca3fcb4f842f13a100af038001eba10001ffffffff051027000000000000302ea22c8020928bb24f3e778e69a0fcec948892ddd7f2e33334a9e3ee602182056e648be0ec8103120c008203000401cc1027000000000000302ea22c8020fcfca0608f930c2b02e6b5a84a96815804f3ea22e7eab032b94ad5a377d281b18103120c008203000401cc808b874702000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ace0950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000956a4c92eb52d035827d3e5431a0538c6cc82a7f51cc384e5632ea2228ad6b03907c0d7fed042102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567210257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634d3030000809698000000000098ec3bfa03dc9c308b1145c526a0ef7306f60995f8a15ed4e7d00d6fe6af223f00000000330100000000000000000000000000 +``` +export const title = "Custom CC: A tutorial on building CC"; +export const description = + "This customcc library example is something that simply sends 1 coin."; + +# Custom CC (WIP) + +This document is a work in progress (WIP) + +We are fortunate to have been gifted the ability to launch provable ecosystems to build upon. This tutorial begins with a quick foundation of core concepts then moving into how to make software with layer-1, on-chain consensus. The smart-UTXO system of Komodo's Crypto-Conditions. Consensus & Smart Contract customizations. + +## Blockchain Core Concepts + +* Public key cryptography is used when a private and public key pair are used for proving something. +* Private Keys are stored in a wallet, not on the blockchain. +* Private keys sign transactions. +* Signatures on transaction are proven by the network using the corresponding public key to spend the claimed ownership of funds. +* Transactions fill blocks, like an item on a shopping list fills a piece of paper. +* Blocks are arranged in sequential order, forming a chain. +* Each block contains agreed transactional information. The proof of the transactional detail and it's arrangement in the block is called consensus. Consensus is achieved by each participant relying on their own computation. +* Coins & Tokens are used in transaction details to transfer value. +* Nodes is the jargon term for computers that do the computations to maintain the network. +* Maintaining the network is done by validating. OP\_CODES are the instructions of the network that need validating. +* Some nodes are heavily computational (miners), some are quiet and store a valuable private key within the wallet. +* There's additional software to make this blockchain useful (for transfering value) & easier to use. Like the internet became useful for transfering information, blockchain technology enables software to create new ways of collaborating. Blockchain: Mobile Wallets, DEX, Explorers vs WWW: webserver, database, email & streaming protocols) + +## Goal of our Antara Module + +This `customcc` loadable library example is simply something that requires to send 1 coin. It can't get much simpler. + +## Use jl777 branch + +```bash +git clone https://github.com/jl777/komodo.git +git checkout jl777 +cd komodo/src/cc +code . +``` + +Open the 3 files + +* customcc.h [src](https://github.com/jl777/komodo/blob/jl777/src/cc/customcc.h) +* customcc.cpp [src](https://github.com/jl777/komodo/blob/jl777/src/cc/customcc.cpp) +* makecustom [src](https://github.com/jl777/komodo/blob/jl777/src/cc/makecustom) + +These are the three files we'll work on for learning how to apply custom consensus to a blockchain. For most 1st & 2nd generation blockchain projects, changing consensus is a bold undertaking. Komodo has turned it into a loadable module removing the risk of severe bugs - no other project offers this to a custom blockchain. + +These 3 files are not boilercode. It may look like boilercode but it's the gateway to much more powerful stuff. This is the pandoras box of dApps. Get ready to understand how to develop on a secure multi-chain distrbuted transactional system. + +## customcc.h header file - definitions of functions and variables + +From the top, the comments provide a nice summary of what our custom cclib will do. + +### Name of our custom cclib + +One is referenced externally (`MYCCLIBNAME`) at komodo start. The other internally (`MYCCNAME`) when programming for function name prefixes. + +```cpp +std::string MYCCLIBNAME = (char *)"customcc"; +#define MYCCNAME "custom" +``` + +`MYCCLIBNAME` This is the name of the loadable library module being created. Here it is "customcc". This is what is used on the command line to load your custom consensus when [starting your custom blockchain](/smart-chains/tutorials/create-a-default-smart-chain/). + +```bash +komodod -ac_name=CUSTOM -ac_cc=1 -ac_cclib=customcc ... +``` + +The `MYCCNAME` is the prefix for RPC calls and standard consensus functions (e.g. `validate`). +The naming convention used for building a custom consensus library follows: + +* MYCCNAME\_FUNCTIONNAME + +For example `custom_validate`. + +### Declaration of constants + +```cpp +#define EVAL_CUSTOM (EVAL_FAUCET2+1) +#define CUSTOM_TXFEE 10000 +``` + +The `EVAL_FAUCET2` is a constant (footnote: 1a & 1b) (`0x10` or decimal 16). These `EVAL_...` constants are identifiers. They are used to route the validation code. The low-level bitcoin script in Komodo has a new op\*code called `OP_CHECKCRYPTOCONDITION`. When any node on the network needs to validate this `OP_CHECKCRYPTOCONDITION` op\_code, it looks up which `EVAL*...` code it is. + +Custom consensus starts at `EVAL_FAUCET2` and add `+1` to it for your customcc library. Therefore, `EVAL_CUSTOM` is `0x11` = decimal 17. + +The `CUSTOM_TXFEE` is the default transaction fee for this type of transaction. The default txfee for this `EVAL_...` code consensus is `10000` assetoshis (0.0001). + +### Declarations of the RPC calls + +This is the way 3rd party developers (e.g. front-end developers) and command-line users will interact with your custom crypto condition. For example commands like `komodo-cli -ac_name=CUSTOM custom_func0` and `komodo-cli -ac_name=CUSTOM custom_func1`. + +```cpp +{ (char *)MYCCNAME, (char *)"func0", (char *)"", 1, 1, '0', EVAL_CUSTOM }, +{ (char *)MYCCNAME, (char *)"func1", (char *)"", 0, 0, '1', EVAL_CUSTOM }, +``` + +The declarations for the functions in customcc.cpp - func0 and func1 + +* `MYCCNAME` is declared previously as "custom" +* `func0` is the name of the first RPC call +* The `` can be replaced with your functions help text. +* The `1,1,'0', EVAL_CUSTOM` means: 1 mandatory parameter, maximum of 1 parameter, 0 is the function id for custom consensus `EVAL_CUSTOM`, in this case `0x11` (decimal 17) +* `func1` is the name of the next RPC call +* The `` is the real help text this time. This RPC call `func1` requires no arguments, like `komodo-cli getinfo` +* The `0,0,'1', EVAL_CUSTOM` mean: 0 mandatory parameters, maximum of 0 parameters, 1 is the function id for custom consensus `EVAL_CUSTOM`, in this case `0x11` (decimal 17) + +### Declaration of functions + +```cpp +bool custom_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const CTransaction tx); +UniValue custom_func0(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); +UniValue custom_func1(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); +``` + +These functions follow the naming convention of `MYCCNAME` with a `_`. Validation is always required and named `MYCCNAME` + `_validate`. MYCCNAME is `custom`, therefore the validate function is called `custom_validate`. If MYCCNAME was defined as `mylo`, then my validate function would be called `mylo_validate`. Odds are you will name your first cclib after yourself or someone else just as loveable. + +The validation code is the most important code - it is what makes blockchains sources of truth. Their truthiness relies on validation based on cryptographic principles. + +Functions `custom_func0` and `custom_func1` follow the internal automatic module wiring of cclib. Again `MYCCNAME` + `_` + `RPCFUNCS` declared earlier. + +### Automatic wiring, custom RPC function dispatcher + +The following code is part of the automatic wiring that allows a developer to use 3 files, the `.h` the `.cpp` and the `makecustom` makefile. Automatic wiring saves a developer from potentially introducing bugs in the consensus and by virtue of this saving, testers, users and organizations many hours of resources. + +The custom dispatch is used for dispatching the RPC function declared earlier. + +```cpp +#define CUSTOM_DISPATCH \ +if ( cp->evalcode == EVAL_CUSTOM ) \ +{ \ + if ( strcmp(method,"func0") == 0 ) \ + return(custom_func0(txfee,cp,params)); \ + else if ( strcmp(method,"func1") == 0 ) \ + return(custom_func1(txfee,cp,params)); \ + else \ + { \ + result.push_back(Pair("result","error")); \ + result.push_back(Pair("error","invalid customcc method")); \ + result.push_back(Pair("method",method)); \ + return(result); \ + } \ +} +``` + +The developer must then map the RPC names to the function/method. This mapping follows the same naming convention that has already been defined. Namely, `MYCCNAME` + `_` + `FUNCTIONNAME`. If no match, then an error message returned and no harm done. + +e.g. + +```cpp + if ( strcmp(method,"func0") == 0 ) \ + return(custom_func0(txfee,cp,params)); \ +``` + +Finally, in the course of looking where to route the RPC request + +## customcc.cpp file - implementation of functions + +Ref: [^1a](https://github.com/jl777/komodo/blob/jl777/src/cc/eval.h#L63) + +Ref: [^1b](https://github.com/jl777/komodo/blob/jl777/src/cc/cclib.cpp#L31) +export const title = "Dice: Decentralized Blockchain Gaming"; +export const description = "The Dice Antara Module allows for a decentralized dice game on a blockchain."; + +# Dice + +## Introduction + +The Dice Antara Module allows for a decentralized `dice` game on a blockchain. The `dice` module is essentially a simple, but fully functional example of decentralized software. + +It is also useful as a demonstration to show how Antara-based modules can leverage provably random entropy to enable blockchain-enforced real-time gameplay. + +The Dice Module is a simple gambling game, where one node creates a "house" contract, with seed funds and other parameters, and other users place bets within the indicated parameters. Winners and losers are determined through blockchain technology. This technology includes on-chain, consensus based, provably random entropy that derives from the activity of both the "house" and the users. + +The "house" node should be running the [dicestatus](/antara/api/dice/#introduction) method at a regular frequency. This method resolves unfinished bets and generates new entropy utxos for the "house" contract. + +To create a "house" contract, use [dicefund](/antara/api/dice/#dicefund) to initiate the contract, and then add several utxos to the fund with [diceaddfunds.](/antara/api/dice/#diceaddfunds) + +Once the contract is created and funded, users can place a bet using [dicebet.](/antara/api/dice/#dicebet) + +Anyone can execute a [dicefinish](/antara/api/dice/#dicefinish) RPC after the contract's time expires. This prevents the "house" node from cheating by going offline. + +## diceaddfunds + +**diceaddfunds name fundingtxid amount** + +The `diceaddfunds` method adds funds to the desired `dice` contract. + +Only the owner of the `dice` contract is able to add funds. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | --------------------------------------------------------------------- | +| name | (string) | the name of the user's dice contract | +| fundingtxid | (string) | the txid of the transaction that created and funded this contract | +| amount | (number) | the amount of funds you want to add to your contract from your wallet | + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Create a raw transaction hex value for adding funds + +```bash +./komodo-cli -ac_name=HELLOWORLD diceaddfunds MYDICECONTRACT ebfcff20fa5ab7bebf14b778e74bd6b34b02f100ff75e4cb611190f160ae4cf7 10 +``` + + + ```json + { + "result": "success", + "hex": "0100000001646b59153d05ed0cb2b241dbbc42cd86df446ea43db8a66c68fdc2462e1bc6850000000049483045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b39501ffffffff0400ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1027000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacf0aed71218090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff29000000000000000000000000000000000000000000000000000000000000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"diceaddfunds", "params":["MYDICECONTRACT" ,"ebfcff20fa5ab7bebf14b778e74bd6b34b02f100ff75e4cb611190f160ae4cf7" ,"10"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "0100000001646b59153d05ed0cb2b241dbbc42cd86df446ea43db8a66c68fdc2462e1bc6850000000049483045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b39501ffffffff0400ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1027000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacf0aed71218090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff29000000000000000000000000000000000000000000000000000000000000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Send the raw transaction / broadcast the hex value + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0100000001646b59153d05ed0cb2b241dbbc42cd86df446ea43db8a66c68fdc2462e1bc6850000000049483045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b39501ffffffff0400ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1027000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacf0aed71218090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff29000000000000000000000000000000000000000000000000000000000000000000000000 +``` + + + ```bash + 83370785623efc679de990b0d90bd45b375a0a53ce9e011259c31a8c747fd1ff + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["0100000001646b59153d05ed0cb2b241dbbc42cd86df446ea43db8a66c68fdc2462e1bc6850000000049483045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b39501ffffffff0400ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1027000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacf0aed71218090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff29000000000000000000000000000000000000000000000000000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "83370785623efc679de990b0d90bd45b375a0a53ce9e011259c31a8c747fd1ff", + "error": null, + "id": "curltest" + } + ``` + + +Step 3: Decode the raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 0100000001646b59153d05ed0cb2b241dbbc42cd86df446ea43db8a66c68fdc2462e1bc6850000000049483045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b39501ffffffff0400ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1027000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacf0aed71218090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff29000000000000000000000000000000000000000000000000000000000000000000000000 +``` + + + ```json + { + "txid": "83370785623efc679de990b0d90bd45b375a0a53ce9e011259c31a8c747fd1ff", + "size": 387, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "85c61b2e46c2fd686ca6b83da46e44df86cd42bcdb41b2b20ced053d15596b64", + "vout": 0, + "scriptSig": { + "asm": "3045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b39501", + "hex": "483045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b39501" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 10.0, + "valueSat": 1000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["REabWB7KjFN5C3LFMZ5odExHPenYzHLtVw"] + } + }, + { + "value": 0.0001, + "valueSat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 99989.9999, + "valueSat": 9998999990000, + "n": 2, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN e6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff290000000000000000000000000000000000000000000000000000000000000000", + "hex": "6a4c6ae6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff290000000000000000000000000000000000000000000000000000000000000000", + "type": "nulldata" + } + } + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["0100000001646b59153d05ed0cb2b241dbbc42cd86df446ea43db8a66c68fdc2462e1bc6850000000049483045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b39501ffffffff0400ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1027000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacf0aed71218090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff29000000000000000000000000000000000000000000000000000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "83370785623efc679de990b0d90bd45b375a0a53ce9e011259c31a8c747fd1ff", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "85c61b2e46c2fd686ca6b83da46e44df86cd42bcdb41b2b20ced053d15596b64", + "vout": 0, + "scriptSig": { + "asm": "3045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b395[ALL]", + "hex": "483045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b39501" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 10.0, + "valueZat": 1000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["REabWB7KjFN5C3LFMZ5odExHPenYzHLtVw"] + } + }, + { + "value": 0.0001, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 99989.9999, + "valueZat": 9998999990000, + "n": 2, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN e6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff290000000000000000000000000000000000000000000000000000000000000000", + "hex": "6a4c6ae6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff290000000000000000000000000000000000000000000000000000000000000000", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## diceaddress + +**diceaddress (pubkey)** + +The `diceaddress` method takes either your pubkey or a pubkey that you provide and returns the smart-contract address for the `dice` smart contract. + +### Arguments + +| Name | Type | Description | +| ------ | ------------------ | -------------------------------------------------------------------------------------- | +| pubkey | (string, optional) | the pubkey of the requested info; by default it is the pubkey used to launch the chain | + +### Response + +| Name | Type | Description | +| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ | +| result | (string) | whether the diceaddress method was successful | +| DiceCCaddress | (string) | taking the dice contract's EVAL code as a modifier, this is the public address that corresponds to the dice contract's privkey | +| Dicemarker | (string) | the unmodified public address generated from the dice contract's privkey | +| DiceCCassets | (string) | the internal address; this value is not related to the usage of the Dice Antara module | +| GatewaysPubkey | (string) | the global pubkey for this Gateways Antara module | +| myCCaddress | (string) | taking the dice contract's EVAL code as a modifier, this is the Antara address from the pubkey of the user | +| myaddress | (string) | the public address of the pubkey used to launch the chain | + +#### 📌 Examples + +For the non-default pubkey. + +```bash +./komodo-cli -ac_name=HELLOWORLD diceaddress 03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc +``` + + + ```json + { + "result": "success", + "DiceCCAddress": "REabWB7KjFN5C3LFMZ5odExHPenYzHLtVw", + "DiceCCBalance": 0.0, + "DiceNormalAddress": "RLEe8f7Eg3TDuXii9BmNiiiaVGraHUt25c", + "DiceNormalBalance": 0.0, + "DiceCCTokensAddress": "RUjcZD5jMXjz5VVACKQ57Pcs4ATeHEmBgv", + "PubkeyCCaddress(Dice)": "RNZBxcH9ntcB8cJMTtbWZJrjzJNQ4ADLkz", + "PubkeyCCbalance(Dice)": 0.0, + "myCCAddress(Dice)": "RMpKdiS2giMq57DMqHJRqtMEG8m7apqy7e", + "myCCbalance(Dice)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"diceaddress", "params":["03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "DiceCCAddress": "REabWB7KjFN5C3LFMZ5odExHPenYzHLtVw", + "DiceCCBalance": 0.0, + "DiceNormalAddress": "RLEe8f7Eg3TDuXii9BmNiiiaVGraHUt25c", + "DiceNormalBalance": 0.0, + "DiceCCTokensAddress": "RUjcZD5jMXjz5VVACKQ57Pcs4ATeHEmBgv", + "PubkeyCCaddress(Dice)": "RNZBxcH9ntcB8cJMTtbWZJrjzJNQ4ADLkz", + "PubkeyCCbalance(Dice)": 0.0, + "myCCAddress(Dice)": "RMpKdiS2giMq57DMqHJRqtMEG8m7apqy7e", + "myCCbalance(Dice)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + }, + "error": null, + "id": "curltest" + } + ``` + + +## dicebet + +**dicebet name fundingtxid amount odds** + +The `dicebet` method places a bet on the indicated `dice` contract. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | ----------------------------------------------------------------------- | +| name | (string) | the name of the dice contract for which the user desires to place a bet | +| fundingtxid | (string) | the txid of the transaction that created and funded this contract | +| amount | (number) | the amount the user desires to place as a bet | +| odds | (number) | specify the user's odds | + +### Response + +| Name | Type | Description | +| -------- | -------- | ---------------------------------------------------------------------------------------------------------- | +| "result" | (string) | whether the dicebet command executed successfully | +| "hex" | (string) | the data of the user's transaction, in a raw hex-encoded format; broadcast this using `sendrawtransaction` | + +#### 📌 Examples + +Step 1: Set your parameters to create a raw transaction and get the hex value + +```bash +./komodo-cli -ac_name=HELLOWORLD dicebet KMDDice ebfcff20fa5ab7bebf14b778e74bd6b34b02f100ff75e4cb611190f160ae4cf7 7 7 +``` + + + ```json + { + "result": "success", + "hex": "010000000378c9b0720ac4ffda232bd8ebc1ebf10d78efe23daf59ad887439baf72a3ffd03000000007b4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0200000049483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0300000048473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101ffffffff0500ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc0027b92900000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1727000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacc91265bf17090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e06589040067000000000000000000000000000000000000000000000000000000000000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"dicebet", "params":["KMDDice" ,"ebfcff20fa5ab7bebf14b778e74bd6b34b02f100ff75e4cb611190f160ae4cf7" ,"7" ,"7"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "010000000378c9b0720ac4ffda232bd8ebc1ebf10d78efe23daf59ad887439baf72a3ffd03000000007b4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0200000049483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0300000048473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101ffffffff0500ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc0027b92900000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1727000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacc91265bf17090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e06589040067000000000000000000000000000000000000000000000000000000000000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Send/broadcast the raw transaction hex + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000378c9b0720ac4ffda232bd8ebc1ebf10d78efe23daf59ad887439baf72a3ffd03000000007b4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0200000049483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0300000048473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101ffffffff0500ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc0027b92900000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1727000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacc91265bf17090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e06589040067000000000000000000000000000000000000000000000000000000000000000000000000 +``` + + + ```bash + 694c309c86a928fde1919a86381f61670479c3ede85ea0574d08636cc406e798 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000378c9b0720ac4ffda232bd8ebc1ebf10d78efe23daf59ad887439baf72a3ffd03000000007b4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0200000049483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0300000048473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101ffffffff0500ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc0027b92900000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1727000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacc91265bf17090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e06589040067000000000000000000000000000000000000000000000000000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "694c309c86a928fde1919a86381f61670479c3ede85ea0574d08636cc406e798", + "error": null, + "id": "curltest" + } + ``` + + +Step 3: Decode raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 010000000378c9b0720ac4ffda232bd8ebc1ebf10d78efe23daf59ad887439baf72a3ffd03000000007b4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0200000049483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0300000048473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101ffffffff0500ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc0027b92900000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1727000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacc91265bf17090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e06589040067000000000000000000000000000000000000000000000000000000000000000000000000 +``` + + + ```json + { + "txid": "694c309c86a928fde1919a86381f61670479c3ede85ea0574d08636cc406e798", + "size": 721, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "03fd3f2af7ba397488ad59af3de2ef780df1ebc1ebd82b23daffc40a72b0c978", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001", + "hex": "4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001" + }, + "sequence": 4294967295 + }, + { + "txid": "ef63c57deb9308deb13ed0d1d7f771402d58956edfbc33b8423f140dbe61220b", + "vout": 2, + "scriptSig": { + "asm": "3045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801", + "hex": "483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801" + }, + "sequence": 4294967295 + }, + { + "txid": "ef63c57deb9308deb13ed0d1d7f771402d58956edfbc33b8423f140dbe61220b", + "vout": 3, + "scriptSig": { + "asm": "3044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101", + "hex": "473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 10.0, + "valueSat": 1000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["REabWB7KjFN5C3LFMZ5odExHPenYzHLtVw"] + } + }, + { + "value": 7.0, + "valueSat": 700000000, + "n": 1, + "scriptPubKey": { + "asm": "a22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["REabWB7KjFN5C3LFMZ5odExHPenYzHLtVw"] + } + }, + { + "value": 0.00010007, + "valueSat": 10007, + "n": 2, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 99975.99969993, + "valueSat": 9997599969993, + "n": 3, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 4, + "scriptPubKey": { + "asm": "OP_RETURN e6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e065890400670000000000000000000000000000000000000000000000000000000000000000", + "hex": "6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e065890400670000000000000000000000000000000000000000000000000000000000000000", + "type": "nulldata" + } + } + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["010000000378c9b0720ac4ffda232bd8ebc1ebf10d78efe23daf59ad887439baf72a3ffd03000000007b4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0200000049483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0300000048473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101ffffffff0500ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc0027b92900000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1727000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacc91265bf17090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e06589040067000000000000000000000000000000000000000000000000000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "694c309c86a928fde1919a86381f61670479c3ede85ea0574d08636cc406e798", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "03fd3f2af7ba397488ad59af3de2ef780df1ebc1ebd82b23daffc40a72b0c978", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001", + "hex": "4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001" + }, + "sequence": 4294967295 + }, + { + "txid": "ef63c57deb9308deb13ed0d1d7f771402d58956edfbc33b8423f140dbe61220b", + "vout": 2, + "scriptSig": { + "asm": "3045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc8[ALL]", + "hex": "483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801" + }, + "sequence": 4294967295 + }, + { + "txid": "ef63c57deb9308deb13ed0d1d7f771402d58956edfbc33b8423f140dbe61220b", + "vout": 3, + "scriptSig": { + "asm": "3044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e1[ALL]", + "hex": "473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 10.0, + "valueZat": 1000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["REabWB7KjFN5C3LFMZ5odExHPenYzHLtVw"] + } + }, + { + "value": 7.0, + "valueZat": 700000000, + "n": 1, + "scriptPubKey": { + "asm": "a22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["REabWB7KjFN5C3LFMZ5odExHPenYzHLtVw"] + } + }, + { + "value": 0.00010007, + "valueZat": 10007, + "n": 2, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 99975.99969993, + "valueZat": 9997599969993, + "n": 3, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 4, + "scriptPubKey": { + "asm": "OP_RETURN e6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e065890400670000000000000000000000000000000000000000000000000000000000000000", + "hex": "6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e065890400670000000000000000000000000000000000000000000000000000000000000000", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## dicefinish + +**dicefinish name fundingtxid bettxid** + +The `dicefinish` method rebroadcasts a bet that was previously broadcast. + +If the returned `hex` value is `0` the bet is finished. + +If the returned `hex` value is not `0`, the `hex` value should be broadcast with [sendrawtransaction.](/smart-chains/api/rawtransactions/#sendrawtransaction) If the bet has not finished or is stuck, the `hex` will have a value. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | ----------------------------------------------------------------- | +| name | (string) | the name of the dice contract | +| fundingtxid | (string) | the txid of the transaction that created and funded this contract | +| bettxid | (string) | the txid of the bet for which finish status is requested | + +### Response + +| Name | Type | Description | +| ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| result | (string) | whether the command executed successfully | +| hex | (string) | if the contract is already finished, the resulting hex is 0; if the contract is not finished, the value of hex will be a rawtransaction that the user can broadcast to let the blockchain automatically declare a winner and close the bet | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD dicefinish DICE3 4132ca8e8d46df9f8a8cbe83c99794497e06bbd190bd71f4abcdedf84e90952e d54335073e549cd75a050fd4d6ba5939307cda7096ba0f3da779fb7d07e46343 +``` + + + ```json + { + "result": "success", + "hex": "0" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"dicefinish", "params":["DICE3" ,"4132ca8e8d46df9f8a8cbe83c99794497e06bbd190bd71f4abcdedf84e90952e" ,"d54335073e549cd75a050fd4d6ba5939307cda7096ba0f3da779fb7d07e46343"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "0" + }, + "error": null, + "id": "curltest" + } + ``` + + +## dicefund + +**dicefund name funds minbet maxbet maxodds timeoutblocks** + +The `dicefund` method creates and funds a dice contract. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +Ideally, the dice creator node should be online throughout the contract's life, to determine `winning bid` or `losing bid`. + +If the dice creator node is offline after the `timeoutblocks` period completes, the system will automatically declare the bet's winner and payout winning funds. + +Typically, the creator should set the `timeoutblocks` property to a longer period. This prevents the house from losing funds if the house's node unexpectedly experiences downtime. + +The `maxodds` property must be between 1 and 9999. + +### Arguments + +| Name | Type | Description | +| ------------- | -------- | --------------------------------------------------------------------------------------------- | +| name | (string) | the name of the user's dice contract | +| funds | (number) | the amount of funds with which the user desires to start | +| minbet | (number) | the minimum amount allowed for a bet | +| maxbet | (number) | the maximum amount allowed for a bet | +| maxodds | (number) | the largest odds an end-user can use for betting | +| timeoutblocks | (number) | the number of blocks before the contract times out and pays the automatically declared winner | + +### Response + +| Name | Type | Description | +| ------ | -------- | --------------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| hex | (string) | the data of the transaction in raw hex-encoded format; broadcast this using the sendrawtransaction method | + +#### 📌 Examples + +Step 1: Create your customized Dice contract and get the hex value + +```bash +./komodo-cli -ac_name=HELLOWORLD dicefund KMDDice 777777 0.777 7.77 777 7 +``` + + + ```json + { + "result": "success", + "hex": "010000000a5890b79f42a2039d6b661cec3f0a748f8122b51427d2747d7cddb45e7c774988010000004847304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b1201ffffffff5b90bd88124ebd1a0988c612902234782b737b860189fb5871088d2d3aae2481020000004948304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a01ffffffff5bfb06fac51707a69414a1f908ac3f9eb3fca50f303c4ae960f94491e8dc7f5c0100000049483045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd01ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471020000004847304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb01ffffffff5d5132ee6f33ba09b4bcfb84beddfcbdf58888ea7f221cc8078a96865e1e0ea10000000049483045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d001ffffffff5e626ec0b20cd783ee0bf52aa33189796ddd4649d31b64fdee10b6daecbd079200000000494830450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f801ffffffff5eb56cd4df0702b06debcf36de8309432b8140daa0a2544159ff68bbb96ed2050000000048473044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c64101ffffffff603757f4b8370432cf30b12abdbb93b888e7707cd4321851f926779ee126e24402000000484730440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b01ffffffff62347ddc97606a28457514a53b16d7fd9534c3c12d3f890cf72536f130737bae020000004847304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea01ffffffff63686994d134931e0b43809f6d9ab73f7053d9aaa143987c56083345eddb5ec60100000048473044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab01ffffffff0400112e08bd460000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc10270000000000002321039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94eac100b47751c020000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000002c6a2ae6464b4d444469636500a09ba104000000004014502e000000000903000000000000070000000000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"dicefund", "params":["KMDDice" ,"777777" ,"0.777" ,"7.77" ,"777" ,"7"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "010000000a5890b79f42a2039d6b661cec3f0a748f8122b51427d2747d7cddb45e7c774988010000004847304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b1201ffffffff5b90bd88124ebd1a0988c612902234782b737b860189fb5871088d2d3aae2481020000004948304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a01ffffffff5bfb06fac51707a69414a1f908ac3f9eb3fca50f303c4ae960f94491e8dc7f5c0100000049483045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd01ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471020000004847304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb01ffffffff5d5132ee6f33ba09b4bcfb84beddfcbdf58888ea7f221cc8078a96865e1e0ea10000000049483045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d001ffffffff5e626ec0b20cd783ee0bf52aa33189796ddd4649d31b64fdee10b6daecbd079200000000494830450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f801ffffffff5eb56cd4df0702b06debcf36de8309432b8140daa0a2544159ff68bbb96ed2050000000048473044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c64101ffffffff603757f4b8370432cf30b12abdbb93b888e7707cd4321851f926779ee126e24402000000484730440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b01ffffffff62347ddc97606a28457514a53b16d7fd9534c3c12d3f890cf72536f130737bae020000004847304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea01ffffffff63686994d134931e0b43809f6d9ab73f7053d9aaa143987c56083345eddb5ec60100000048473044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab01ffffffff0400112e08bd460000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc10270000000000002321039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94eac100b47751c020000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000002c6a2ae6464b4d444469636500a09ba104000000004014502e000000000903000000000000070000000000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Send raw transaction / Broadcast the hex value + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000a5890b79f42a2039d6b661cec3f0a748f8122b51427d2747d7cddb45e7c774988010000004847304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b1201ffffffff5b90bd88124ebd1a0988c612902234782b737b860189fb5871088d2d3aae2481020000004948304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a01ffffffff5bfb06fac51707a69414a1f908ac3f9eb3fca50f303c4ae960f94491e8dc7f5c0100000049483045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd01ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471020000004847304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb01ffffffff5d5132ee6f33ba09b4bcfb84beddfcbdf58888ea7f221cc8078a96865e1e0ea10000000049483045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d001ffffffff5e626ec0b20cd783ee0bf52aa33189796ddd4649d31b64fdee10b6daecbd079200000000494830450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f801ffffffff5eb56cd4df0702b06debcf36de8309432b8140daa0a2544159ff68bbb96ed2050000000048473044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c64101ffffffff603757f4b8370432cf30b12abdbb93b888e7707cd4321851f926779ee126e24402000000484730440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b01ffffffff62347ddc97606a28457514a53b16d7fd9534c3c12d3f890cf72536f130737bae020000004847304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea01ffffffff63686994d134931e0b43809f6d9ab73f7053d9aaa143987c56083345eddb5ec60100000048473044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab01ffffffff0400112e08bd460000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc10270000000000002321039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94eac100b47751c020000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000002c6a2ae6464b4d444469636500a09ba104000000004014502e000000000903000000000000070000000000000000000000 +``` + + + ```bash + ebfcff20fa5ab7bebf14b778e74bd6b34b02f100ff75e4cb611190f160ae4cf7 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000a5890b79f42a2039d6b661cec3f0a748f8122b51427d2747d7cddb45e7c774988010000004847304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b1201ffffffff5b90bd88124ebd1a0988c612902234782b737b860189fb5871088d2d3aae2481020000004948304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a01ffffffff5bfb06fac51707a69414a1f908ac3f9eb3fca50f303c4ae960f94491e8dc7f5c0100000049483045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd01ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471020000004847304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb01ffffffff5d5132ee6f33ba09b4bcfb84beddfcbdf58888ea7f221cc8078a96865e1e0ea10000000049483045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d001ffffffff5e626ec0b20cd783ee0bf52aa33189796ddd4649d31b64fdee10b6daecbd079200000000494830450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f801ffffffff5eb56cd4df0702b06debcf36de8309432b8140daa0a2544159ff68bbb96ed2050000000048473044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c64101ffffffff603757f4b8370432cf30b12abdbb93b888e7707cd4321851f926779ee126e24402000000484730440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b01ffffffff62347ddc97606a28457514a53b16d7fd9534c3c12d3f890cf72536f130737bae020000004847304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea01ffffffff63686994d134931e0b43809f6d9ab73f7053d9aaa143987c56083345eddb5ec60100000048473044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab01ffffffff0400112e08bd460000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc10270000000000002321039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94eac100b47751c020000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000002c6a2ae6464b4d444469636500a09ba104000000004014502e000000000903000000000000070000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "ebfcff20fa5ab7bebf14b778e74bd6b34b02f100ff75e4cb611190f160ae4cf7", + "error": null, + "id": "curltest" + } + ``` + + +Step 3: Decode raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 010000000a5890b79f42a2039d6b661cec3f0a748f8122b51427d2747d7cddb45e7c774988010000004847304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b1201ffffffff5b90bd88124ebd1a0988c612902234782b737b860189fb5871088d2d3aae2481020000004948304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a01ffffffff5bfb06fac51707a69414a1f908ac3f9eb3fca50f303c4ae960f94491e8dc7f5c0100000049483045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd01ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471020000004847304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb01ffffffff5d5132ee6f33ba09b4bcfb84beddfcbdf58888ea7f221cc8078a96865e1e0ea10000000049483045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d001ffffffff5e626ec0b20cd783ee0bf52aa33189796ddd4649d31b64fdee10b6daecbd079200000000494830450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f801ffffffff5eb56cd4df0702b06debcf36de8309432b8140daa0a2544159ff68bbb96ed2050000000048473044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c64101ffffffff603757f4b8370432cf30b12abdbb93b888e7707cd4321851f926779ee126e24402000000484730440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b01ffffffff62347ddc97606a28457514a53b16d7fd9534c3c12d3f890cf72536f130737bae020000004847304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea01ffffffff63686994d134931e0b43809f6d9ab73f7053d9aaa143987c56083345eddb5ec60100000048473044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab01ffffffff0400112e08bd460000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc10270000000000002321039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94eac100b47751c020000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000002c6a2ae6464b4d444469636500a09ba104000000004014502e000000000903000000000000070000000000000000000000 +``` + + + ```json + { + "txid": "ebfcff20fa5ab7bebf14b778e74bd6b34b02f100ff75e4cb611190f160ae4cf7", + "size": 1342, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "8849777c5eb4dd7c7d74d22714b522818f740a3fec1c666b9d03a2429fb79058", + "vout": 1, + "scriptSig": { + "asm": "304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b1201", + "hex": "47304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b1201" + }, + "sequence": 4294967295 + }, + { + "txid": "8124ae3a2d8d087158fb8901867b732b7834229012c688091abd4e1288bd905b", + "vout": 2, + "scriptSig": { + "asm": "304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a01", + "hex": "48304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a01" + }, + "sequence": 4294967295 + }, + { + "txid": "5c7fdce89144f960e94a3c300fa5fcb39e3fac08f9a11494a60717c5fa06fb5b", + "vout": 1, + "scriptSig": { + "asm": "3045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd01", + "hex": "483045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd01" + }, + "sequence": 4294967295 + }, + { + "txid": "7194ae293330af80fdbe4b4b2c8b51194f12e334b4a0489288288c1b7336a65c", + "vout": 2, + "scriptSig": { + "asm": "304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb01", + "hex": "47304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb01" + }, + "sequence": 4294967295 + }, + { + "txid": "a10e1e5e86968a07c81c227fea8888f5bdfcddbe84fbbcb409ba336fee32515d", + "vout": 0, + "scriptSig": { + "asm": "3045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d001", + "hex": "483045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d001" + }, + "sequence": 4294967295 + }, + { + "txid": "9207bdecdab610eefd641bd34946dd6d798931a32af50bee83d70cb2c06e625e", + "vout": 0, + "scriptSig": { + "asm": "30450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f801", + "hex": "4830450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f801" + }, + "sequence": 4294967295 + }, + { + "txid": "05d26eb9bb68ff594154a2a0da40812b430983de36cfeb6db00207dfd46cb55e", + "vout": 0, + "scriptSig": { + "asm": "3044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c64101", + "hex": "473044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c64101" + }, + "sequence": 4294967295 + }, + { + "txid": "44e226e19e7726f9511832d47c70e788b893bbbd2ab130cf320437b8f4573760", + "vout": 2, + "scriptSig": { + "asm": "30440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b01", + "hex": "4730440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b01" + }, + "sequence": 4294967295 + }, + { + "txid": "ae7b7330f13625f70c893f2dc1c33495fdd7163ba5147545286a6097dc7d3462", + "vout": 2, + "scriptSig": { + "asm": "304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea01", + "hex": "47304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea01" + }, + "sequence": 4294967295 + }, + { + "txid": "c65edbed453308567c9843a1aad953703fb79a6d9f80430b1e9334d194696863", + "vout": 1, + "scriptSig": { + "asm": "3044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab01", + "hex": "473044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab01" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 777777.0, + "valueSat": 77777700000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["REabWB7KjFN5C3LFMZ5odExHPenYzHLtVw"] + } + }, + { + "value": 0.0001, + "valueSat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e OP_CHECKSIG", + "hex": "21039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94eac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RLEe8f7Eg3TDuXii9BmNiiiaVGraHUt25c"] + } + }, + { + "value": 23212.4993, + "valueSat": 2321249930000, + "n": 2, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN e6464b4d444469636500a09ba104000000004014502e0000000009030000000000000700000000000000", + "hex": "6a2ae6464b4d444469636500a09ba104000000004014502e0000000009030000000000000700000000000000", + "type": "nulldata" + } + } + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["010000000a5890b79f42a2039d6b661cec3f0a748f8122b51427d2747d7cddb45e7c774988010000004847304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b1201ffffffff5b90bd88124ebd1a0988c612902234782b737b860189fb5871088d2d3aae2481020000004948304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a01ffffffff5bfb06fac51707a69414a1f908ac3f9eb3fca50f303c4ae960f94491e8dc7f5c0100000049483045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd01ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471020000004847304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb01ffffffff5d5132ee6f33ba09b4bcfb84beddfcbdf58888ea7f221cc8078a96865e1e0ea10000000049483045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d001ffffffff5e626ec0b20cd783ee0bf52aa33189796ddd4649d31b64fdee10b6daecbd079200000000494830450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f801ffffffff5eb56cd4df0702b06debcf36de8309432b8140daa0a2544159ff68bbb96ed2050000000048473044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c64101ffffffff603757f4b8370432cf30b12abdbb93b888e7707cd4321851f926779ee126e24402000000484730440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b01ffffffff62347ddc97606a28457514a53b16d7fd9534c3c12d3f890cf72536f130737bae020000004847304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea01ffffffff63686994d134931e0b43809f6d9ab73f7053d9aaa143987c56083345eddb5ec60100000048473044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab01ffffffff0400112e08bd460000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc10270000000000002321039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94eac100b47751c020000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000002c6a2ae6464b4d444469636500a09ba104000000004014502e000000000903000000000000070000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "ebfcff20fa5ab7bebf14b778e74bd6b34b02f100ff75e4cb611190f160ae4cf7", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "8849777c5eb4dd7c7d74d22714b522818f740a3fec1c666b9d03a2429fb79058", + "vout": 1, + "scriptSig": { + "asm": "304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b12[ALL]", + "hex": "47304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b1201" + }, + "sequence": 4294967295 + }, + { + "txid": "8124ae3a2d8d087158fb8901867b732b7834229012c688091abd4e1288bd905b", + "vout": 2, + "scriptSig": { + "asm": "304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a[ALL]", + "hex": "48304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a01" + }, + "sequence": 4294967295 + }, + { + "txid": "5c7fdce89144f960e94a3c300fa5fcb39e3fac08f9a11494a60717c5fa06fb5b", + "vout": 1, + "scriptSig": { + "asm": "3045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd[ALL]", + "hex": "483045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd01" + }, + "sequence": 4294967295 + }, + { + "txid": "7194ae293330af80fdbe4b4b2c8b51194f12e334b4a0489288288c1b7336a65c", + "vout": 2, + "scriptSig": { + "asm": "304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb[ALL]", + "hex": "47304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb01" + }, + "sequence": 4294967295 + }, + { + "txid": "a10e1e5e86968a07c81c227fea8888f5bdfcddbe84fbbcb409ba336fee32515d", + "vout": 0, + "scriptSig": { + "asm": "3045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d0[ALL]", + "hex": "483045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d001" + }, + "sequence": 4294967295 + }, + { + "txid": "9207bdecdab610eefd641bd34946dd6d798931a32af50bee83d70cb2c06e625e", + "vout": 0, + "scriptSig": { + "asm": "30450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f8[ALL]", + "hex": "4830450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f801" + }, + "sequence": 4294967295 + }, + { + "txid": "05d26eb9bb68ff594154a2a0da40812b430983de36cfeb6db00207dfd46cb55e", + "vout": 0, + "scriptSig": { + "asm": "3044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c641[ALL]", + "hex": "473044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c64101" + }, + "sequence": 4294967295 + }, + { + "txid": "44e226e19e7726f9511832d47c70e788b893bbbd2ab130cf320437b8f4573760", + "vout": 2, + "scriptSig": { + "asm": "30440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b[ALL]", + "hex": "4730440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b01" + }, + "sequence": 4294967295 + }, + { + "txid": "ae7b7330f13625f70c893f2dc1c33495fdd7163ba5147545286a6097dc7d3462", + "vout": 2, + "scriptSig": { + "asm": "304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea[ALL]", + "hex": "47304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea01" + }, + "sequence": 4294967295 + }, + { + "txid": "c65edbed453308567c9843a1aad953703fb79a6d9f80430b1e9334d194696863", + "vout": 1, + "scriptSig": { + "asm": "3044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab[ALL]", + "hex": "473044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab01" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 777777.0, + "valueZat": 77777700000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["REabWB7KjFN5C3LFMZ5odExHPenYzHLtVw"] + } + }, + { + "value": 0.0001, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e OP_CHECKSIG", + "hex": "21039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94eac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RLEe8f7Eg3TDuXii9BmNiiiaVGraHUt25c"] + } + }, + { + "value": 23212.4993, + "valueZat": 2321249930000, + "n": 2, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN e6464b4d444469636500a09ba104000000004014502e0000000009030000000000000700000000000000", + "hex": "6a2ae6464b4d444469636500a09ba104000000004014502e0000000009030000000000000700000000000000", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## diceinfo + +**diceinfo fundingtxid** + +The `diceinfo` method looks up information about the specific `dice` contract referred by the relevant `fundingtxid`. + +A `fundingtxid` is the txid of the transaction that created and funded the relevant contract. + +Use the [dicelist](/antara/api/dice/#dicelist) method to discover a list of available `fundingtxid` hashes on the Smart Chain. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | ----------------------------------------------------------------- | +| fundingtxid | (string) | the txid of the transaction that created and funded this contract | + +### Response + +| Name | Type | Description | +| --------------- | -------- | --------------------------------------------------------------------------------------------------- | +| "result" | (string) | whether the command executed successfully | +| "fundingtxid" | (string) | the txid of the transaction that created and funded this contract | +| "name" | (string) | the name of the dice contract | +| "sbits" | (number) | a 64-bit int binary encoding of the first 8 characters of the name property | +| "minbet" | (number) | the minimum bet amount this contract accepts | +| "maxbet" | (number) | the maximum bet amount this contract accepts | +| "maxodds" | (number) | the maximum odds the contract accepts | +| "timeoutblocks" | (number) | the number of blocks before the contract allows an automatically declared winner and the bet closes | +| "funding" | (number) | the current amount of funds in the contract | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD diceinfo 0d6e82af9959caec14d7af42fd67db68a45bcd23c755457ebf192a52d62c599c +``` + + + ```json + { + "result": "success", + "fundingtxid": "0d6e82af9959caec14d7af42fd67db68a45bcd23c755457ebf192a52d62c599c", + "name": "dice", + "sbits": 1701013860, + "minbet": "1.00000000", + "maxbet": "100.00000000", + "maxodds": 10, + "timeoutblocks": 5, + "funding": "1000.00000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"diceinfo", "params":["0d6e82af9959caec14d7af42fd67db68a45bcd23c755457ebf192a52d62c599c"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "fundingtxid": "0d6e82af9959caec14d7af42fd67db68a45bcd23c755457ebf192a52d62c599c", + "name": "dice", + "sbits": 1701013860, + "minbet": "1.00000000", + "maxbet": "100.00000000", + "maxodds": 10, + "timeoutblocks": 5, + "funding": "1000.00000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +## dicelist + +**dicelist** + +The `dicelist` method displays the total list of `fundingtxid`'s of all `dice` contracts available on the Smart Chain. + +A `fundingtxid` is the txid of the transaction that created and funded the relevant contract. + +### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +### Response + +| Name | Type | Description | +| ----------- | -------- | ------------------------------------------------------------------------- | +| fundingtxid | (string) | the txid of the transaction that created and funded the relevant contract | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD dicelist +``` + + + ```bash + [ + "0d6e82af9959caec14d7af42fd67db68a45bcd23c755457ebf192a52d62c599c" + ] + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"dicelist", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": [ + "0d6e82af9959caec14d7af42fd67db68a45bcd23c755457ebf192a52d62c599c" + ], + "error": null, + "id": "curltest" + } + ``` + + +## dicestatus + +**dicestatus name fundingtxid bettxid** + +The `dicestatus` method prints the status of a `dicebet` and returns whether the `bettxid` received a winning or losing result. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | ----------------------------------------------------------------- | +| name | (string) | the name of the dice contract | +| fundingtxid | (string) | the txid of the transaction that created and funded this contract | +| bettxid | (string) | the bettxid, the result of which is desired | + +### Response + +| Name | Type | Description | +| ------ | -------- | ---------------------------------------------- | +| result | (string) | whether the command executed successfully | +| status | (string) | the result of the bet for the relevant bettxid | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=AT1 dicestatus DICE3 4132ca8e8d46df9f8a8cbe83c99794497e06bbd190bd71f4abcdedf84e90952e d54335073e549cd75a050fd4d6ba5939307cda7096ba0f3da779fb7d07e46343 +``` + + + ```json + { + "result": "success", + "status": "loss" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"dicestatus", "params":["DICE3" ,"4132ca8e8d46df9f8a8cbe83c99794497e06bbd190bd71f4abcdedf84e90952e" ,"d54335073e549cd75a050fd4d6ba5939307cda7096ba0f3da779fb7d07e46343"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "status": "loss" + }, + "error": null, + "id": "curltest" + } + ``` + +export const title = "Dilithium: Quantum-Resistant Smart Chain"; +export const description = "The Dilithium Antara Module facilitates quantum-resistant transactions on a Komodo Smart Chain."; + +# Dilithium + +## Introduction + +The Dilithium Antara Module facilitates quantum-resistant transactions on a Komodo Smart Chain. The module also allows users to create unique, human-readable handles. These handles can be thought of as an address. + +For example, a normal blockchain address may appear as follows. + +``` +RD6GgnrMpPaTSMn8vai6yiGA7mN4QGPVMY +``` + +A Dilithium-based address, however, may appear much simpler, as follows. + +``` +KomodoHaxor +``` + +The handle acts much like an address, allowing only the owner of the associated private key to release funds. + +Users who are familiar with a Smart Chain's method of facilitating privacy transactions can associate the same underlying concepts with Dilithium. A Komodo Smart Chain's privacy transactions are facilitated by [the pre-installed Zcash parameters.](/start-here/core-technology-discussions/miscellaneous/#the-nature-of-privacy-features-in-the-komodo-ecosystem) + +These parameters allow for more than one protocol to influence the outcome of a transaction. In the case of a Zcash-related privacy transaction, the transaction has both the underlying Bitcoin-based [utxo](/start-here/core-technology-discussions/miscellaneous/#the-utxo-an-elusive-yet-fundamental-concept) protocol influencing the transaction, and the Zcash parameters. The latter is what grants the transaction privacy. + +Similarly, a Dilithium-related transaction on a Smart Chain is influenced by both the Bitcoin-based utxo protocol, and the Dilithium protocol. Dilithium's added functionality is quantum resistance, whereas Zcash's added functionality is privacy. + +Dilithium has "q addresses" (handles) and "q transactions." + +Once again, this can be compared to the familiar "z addresses" and "z transactions" of a Zcash-related transaction on a Komodo Smart Chain. + +#### Dilithium Module Flow + +* Register a handle using the [keypair](/antara/api/dilithium/#keypair) and [register](/antara/api/dilithium/#register) methods +* To transfer funds from a `t` address into a `q` address, use the [send](/antara/api/dilithium/#send) method +* To transfer funds from a `q` address to another `q` address, use the [qsend](/antara/api/dilithium/#qsend) method + +## Tutorial Availability + +The Dilithium Antara Module has an associated tutorial. This tutorial provides instructions on installation and usage. + +[Link to Dilithium Module Tutorial](/antara/tutorials/dilithium-module-tutorial/#introduction) + +## handleinfo + +**cclib handleinfo 19 '\["handle"]'** + +The `handleinfo` method displays information associated with the supplied `handle`. + +Use this method to determine if any given `handle` is available for the user to claim. + +#### Arguments + +| Name | Type | Description | +| ------ | -------- | -------------------------------------- | +| handle | (string) | the handle the user desires to inspect | + +#### Response + +##### When a handle is available + +| Name | Type | Description | +| ------ | -------- | -------------------------------------- | +| result | (string) | whether the call executed successfully | +| handle | (string) | the handle the user desires to inspect | +| status | (string) | whether the handle is available | + +##### When a handle is already registered by the node executing the command + +| Name | Type | Description | +| ----------- | -------- | ----------------------------------------------------------- | +| result | (string) | whether the call executed successfully | +| handle | (string) | the handle | +| destpubtxid | (string) | the transaction id generated when the handle was registered | +| pkaddr | (string) | the hashed representation of the Dilithium pubkey | +| pubkey | (string) | the pubkey of the node that registered the handle | + +#### 📌 Examples + +##### When a handle is available + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib handleinfo 19 '["KomodoHaxor"]' +``` + +###### Response + + + ```bash + { + "result": "success", + "handle": "KomodoHaxor", + "status": "available" + } + ``` + + +#### When a handle is already registered by the node executing the command + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib handleinfo 19 '["AtomicWarrior"]' +``` + +###### Response + + + ```bash + { + "result": "success", + "handle": "AtomicWarrior", + "destpubtxid": "ea448ff66aa925239cff7ca748d3aea62474187fefbd1c15fcaaa14c4529b82a", + "pkaddr": "PCD25oVW6JVzkNgg3MUB21uorh7BDj6TtD", + "pubkey": "0225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270a" + } + ``` + + +## keypair + +**cclib keypair 19 '\["hexseed"]'** + +The `keypair` method generates a Dilithium `pubkey` and `privkey`. This method requires a 256 bit seed in hex format (64 characters). + +{/* */} + +If no `hexseed` is provided, the module uses the user's pubkey seed for entropy and generates a new seed. From this new seed the module produces a Dilithium `pubkey` and `privkey`. + +#### Arguments + +| Name | Type | Description | +| ------- | -------- | ------------------------------------------------------------ | +| hexseed | (string) | a random hex to provide entropy for calculating the key pair | + +#### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| status | (string) | the quality of the seed used | +| seed | (string) | either the seed provided by the user or (if no seed was provided of the provided seed does not satisfy the requirements) this value is a randomly generated seed | +| pubkey | (string) | the Dilithium pubkey generated | +| privkey | (string) | the Dilithium private key generated | +| pkaddr | (string) | the hashed representation of the Dilithium pubkey | +| skaddr | (string) | the hashed representation of the Dilithium privkey | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib keypair 19 '["rand"]' +``` + +###### Response + + + ```json + { + "status": "using random high entropy seed", + "seed": "a70a8e7d2281beaf0762a11590fb566d7af32325ae4252609149de37658e2eb5", + "pubkey": "e4f25d02a6aebaa196ef1ba40f9c8156ff691b5505c72c304f9bcb4c0506167447056dc7341b1431132d0099e8e0a7c134fdad28e6ef8a290c24652260502f43876c043b5bc48f8624c2c396ce1a10e2da59fb73d5523bbe830eabfa6271f33981c54b519c25cd6a76f8298d4f380c96c8dda1a95b45c672bce7c67afa1620cafb5650c1b48758256548b6513f4b8862aa2ca959d244a3955fe095cbf07458e6dec3f73d1afa9f4cf40213d3e7355499cc23f9cec63437a352751d2b95a0353e5ccf70eb2ec5b6d00bba3f12d8e5af3ee752612361e0eb474a3f7221175462e9c171bc6cf709aa5ab53a7683c24decd759f97503a2118f798da1eac081ab7c9e61fe8697746dbe1e798690c9ee600ee53eb336b714130404ed9c5f0d1407a007641b723e59c9bd5178cd42953d10b97d367fd75fa0cccdbe7daaee7b11698e667f1fec2a78d5b94a013efc2d9fce26ef7bcb44371e04854a0f039256fbbe0d472f89b572f5a252528d426a6642fb92d243092b35976b54ece95e0ac246491f6dd024a7ba6cc164fd5172e50c893ef974abe1929f286036cdaf7a5c0395bee9d8feab5b80c07cf4d0b88e4df10a08bd4187bcf82e34a5631a32fae96ec25f992e20b7987df6d0d70535dc247640c00a3b4baeca3a579fa91dad116f3fac11223be5848bd9f34edd0fa3528adde06896f1e363ded56ad6feee9b9bda41f32d4d1279d005e6eb7997bb73dd085154738d11ab800a3d0964c441cb2117d6859ce6908b0525161bec38ccfa3ad71f6005b5891facfc54a2a25b758f8067f754abe41fc769ecea5b83c0a91f4edf549760954276d4f3703c7c563c5a9003501ceed81f382903d581fcb1fd823a0a9caea81250005cee48e98676df2f0cea71fc2ef0decf3d3bdd7b0d5c8ef7f64a8b6fe160290b57c2724bbbb264ed2b6f48a585174c30afd51cd5bb43138d7f88853cb9919a697816c9d0ccdee186858eb48d76853abfdf1629a3a3d781786b55ca1d19413304341b3db4e2a390b410d8da35597d53be07149a1da27c1e0c439565f404259cfbf9a90511bca1f3bc2c7d9592c95eb83da99f848f551a402004e7a7af1896d05899da19e2a133ee50dce1eba96ffb626340cdf713cedf8579fd76d65f144f47065b4517b6be66cdf112029300ccdfda9158be86845195f5e7a50c90a7360e4470ec7b28700393d0d8685cc32c5f352de03f38efc2b6a379def182aae527ee18dd69c0e4cf1398b220e26dd052371a83db082f55318c0e0fc27568f5a6122484f889cb73d29c8da6f91a65035543088a87e68c2b8ce2f7c87a0613f89a04d372e19a1aaaa5309a032d01c20b8d56c819a85fa19f2ae1dbdf36c83b65fbdf76026cc91925ca06254759c0b6613e11a9cda6413e52695fb20cd61145d477d779a389e63eaeeefe6bcd1588e7b149cdb234616764f13b8e61e045d2ce9e53668aab202d7d941fb5d314fbb2c12d9baf71ccd2a43ae8745973626ac4d3c15b4d4df8a756bafaa6c56f3cddf78e3cc008c909ab31bf9716283d1c91688efba7ecc048218a5becee52cbb22fdd57f6907563106aae0ba8daded1050a3617d5962d108aece6b25309fbb63f739beba4dd5117c7d36ce5ea324c2fe98b27e9094acd8e9038e41ae5e7f5e7db705f1b297a341f3ba10f3a86942581d97825e97e0e43b0308cb3b283d303b5115c539cf4b51e0e963aff3270b696159fce3e3e7e5887a15e2c40c0fc308d037adcbde18e765915bd990039df9e78c5af9e5a7ab96bfc79680e2c6e937599893a737a8fb0910309cd75dac3b699a048274a987fa1b3d70d80a21eb23ba8191b508440ba5264998d46ba951df5a022226efcf8526e765cb88048675ab5bf3158bde9776f670b3e914c44c1ce5dfbb806a27b7155e8b3a12e728899b61781ddd1e7000ae120afd025675d50c491ffd7e97698feddfb1cff0b0d1cc428d2f0be466e58a081985d444777c4add2475fc80dfb4bba5e191b4bc6b631fad2d96a910254366b94fe45c116d08c8c01c0158073f9f5af721f08d772f95ac5a6d55b69c9adc3abc4e9d816cf4bdb86fec744fcf0817142079fb97c74335eda37b2bb4124c6ed91ef1b1c7285195a197d82dd755697c9136e49b652bfdbf7682558d8f70fa9adb9c4c5c0b32545fdf7313f6d68fe0a77c38c49b18ae79dc57aaba711e8ae3f8be3a007f84bf26b3f8967b95f4696d3a37598f69deab9e3d1e251d6a095280e1e3d1f873aa53942182dac1bf768a4c3bd8df15fa58589ca7e979dc5f6707729f064d1cc24bedbe3ad9404a1767918278677362a253a723223da676331c4cabe11afc441a365abdeb119fa5f6b66107efdd2546ada80014b382a62e90f360127279ffb54835b34ce886d2918160b05d9b4e91996467aacc6dcfffd56c13138c04e50b63693a3a6e3843b649ed2e18986aea35d35634343a7c50de1aeb8730f6276080549bf43a1ba", + "privkey": "e4f25d02a6aebaa196ef1ba40f9c8156ff691b5505c72c304f9bcb4c0506167473024331a811d2426afb3c14f1bbc131918c8f45f845f86b09e346e2bbccedda85ec3acd4d452874cb156f9cd7b87ac7bf5779f34084a2ddf702aef059122e05f3034e2e839c0a94a445e8664beefe5fd8225473cdcc4dd49af6560381b2794ea4c4a91d0da0619b06e4c86c9846a924950a4d11546682014b8febe829ad234f019cb8c454006384ce84bb6e092cb5800ca87509ab66e69565ad026247600268798d3332c08830095c250d0369e54464ac933945828d543c42a3d2618d115260919651dcb00184609c9c45f350422b91ae212241aba040955ca0016702038d84aa222c1a8d94abeada86e29495e8146deab4c31a2dd69665355aa8591c54b44a0ab4a619328cd4ea425252d744e33816cc0a77112a54a8462833d0ccc456348c4a22d432424aed924eca25f154a8b12c855d963868c4a9453a0cebbc68b563872e62217026695c8d0a682268e3b64d4ca0566b5a21f04a2c209d866d03dbab2a8a011cc1cda6a506b05855e3d4e508b6812259126d7680e0728ba09a5a0b5aa897c62d0d124210826b8da0a339b20808cfedb0b5e8a665929c86c182c046d97596b521cba216595b4b162c08a06c7ba6c134ec88b443344c18c084da681312d699204344a0b50e939810f1e01144434909bbd8438acc2804ccaa49d58ca152a63bce6e0a95e5a06000406726352e982047731582ab38b9c1628f4615982c56a43286ca8aeac490104f2cbc60e9c6c988d688a52a23ced204711111b142db2c3232965a7aacdb268e8ac8731a92149200b345b7f010a54bdb766c9dc13297cd206c6b03a1581de9b53590895b29ad985bcb16a10c3355805662d4a0d492934190f42a2facb092209a30a5ac0674cc7aa4028e5a68669e58ce2b6462c53c4349194c1590c9ea16341c1cc588d7861319db4b197a768b7868ddc0a4a94dc9baa8ada40c803d99315ad45907a1cd1c625edb50329369ad6c8b8ec4a1ebc86e6b16a1146a731ce1582e138b992237834baeca360a4017988b425832c49a4a9845a5a4506cab59aca33996c00a8880ca8cdcac35119089317ba929a4b48bcac61cd0dd2618314da1806880066d6558c625924305113173a29049916a7030d00db2c7115445930b51948ee4cdc536b3941754da68b1dedc289314b42241c9413339eca6506b34005c271a351a5794e451e8222045a35652e26ea91a236d94bac1e6010212881d67b1822b19984406649380500d2a1b5b2698528cb3426f806b57656ad5b11c2f4c306dcbaa1a028366350c986c260d61042085ab75ac35a7da662ca20073a04d6628291a3456d02c8dca40b94122016ca9c0859d47d95bbc1893b710828bd4cd067a532d4c66664c58d6248241d0de1658713222b61dce46c9a530a26e1280b481438b84ab6835dbb15c9b12a1e2789e07129dc556ac6d40a552d282380c9b99d5e2cc7444e1d61a40bb9dd2346e023bae14b3a029d2358a51743b4215b58cc884822ee8100266428b432b89da81b156956e222828c80db06530c1a8742d9551edc0d66beb20c48210338382b55c6bacb080b1232c856c84929566b36cc618d402193a15933074a09bd6516574db4e3ab8a3d5a58cf0b982d1761a5ed66d5719ebdbcadaf51a5dd8c490ee10e5308df9dbdf69c58221b98e70e538380499e4a4a64b05a47fd386edba7084fd6a391b6a6235e5d4ecf83a51174da3d60885f500a86fc053de04b7fde8a5060c2d44f766aceb2230842d55940904191215615f58b8b02c6df54bebfe9972d38df18dc25ff2eeb471f0a7eba3520d74c262224ec3d37279a820a28ccde7e1792ecf944fc9c6a2ecd5b86c591e6cf843f3531646209cbb147fd9bbb6a9488357463dcec9d0189c6e224f3bae117a824d0c6a6f7d4e38a051e7a77ec98d3a8238b8ff8d563131727472253400aa37476991400de1207f0cc89d1d9c65f7fb816bf9b4111e57f376f84e6ba8489886596ce6e4501bbb9502b53ab4d6150b3c48f27de4b4af37c986a043d4eb7bd5be503766df1a88f86dd27df577f3572130938ce34840a25ab76326dd71bb5fbf4f33c9cd6402ba21057c9d16909ca5fe90a6f052c57aa5675a3a7c03d29112299cd10bd9d0f097009ded149700de88ad798cd3309181acc3f70ace8ed3be1d8203903d3643b88c178ee8eb28c6a1fb890ae627924177c94ebdcbb76c8592087b44833fcd2a469d403a311230851092b5f1953a8e201c1bc35f218cf58b416373ce35ea39c3d8a3f226a6d0c37b68bd94a81acf16fb122514cfc7efbbe10b9cf569e1a7020f7f6f1dd523c1c1ac6c82e1f5dcba1b0f5556d49c13abd70e94a3aae42e7eac9122d4e3e2900851c03a441c01dff177563501f176b420ffbbcc16b303135177d42d962e4ace37986701c17e9240c4c8f8ae5d15fc2d04717f1d1f2e50538be1aeea264d0e143a9bbda92b4f414d38fc7d63680e1cb9f4c0ff478a7f338534bccb3c48db9364635d100aaad1bcf53ec24676f616e8a3f0e27caf5678d96449bb190ed820c1823e49578df791f904e2f9c6d62d857756fd68d6746b0433dd54659fc4b9c983d12e91c9b58f6f7856f39a5cbf1667270d23e3019e8ae6ea6feb9db6d9336115792a1192805985ddaec7b3f49e46bdbac9611c1cadfcec15b9cfe008c1206411d8ed924ce0fd0485ece48bf86613b9698f41348417a9e2e14b1a8711646b30ffd79b5ca421f17c8f7441d425c2226a409ad766c6554f2affdc872eb9c8c4bb85618b1d3916e422d3ddeedd350e0df4c64bdf16315cd9d485b0d3ceb9ebbfa15afcde35ee690ca3c92b909ce8ead619a6fb43f9260010b70ab92ba88748f7b2a7f8132207278016d3d0642cc6a90635b7da3ba2a611e37f714aa741d186d66b2e075d9a9b53f7aa58dfbbbd3269ed4d63c2b00bc87f4acc2bf04764ac75bc58fdd7dd97003d0bd34ed16d6267e0fc33dc116335a755ee89015b87f21fa7df8b5c978d43c2094a2336ce993844374b90c61b1e2ed3f373306bbf790c100e44ec97719e676892df68aa95f00b267913028c4f1ce11505d2073f2d8cb980a1802389e1cf410c79f4025a21f8d421f95469d4ffc8d96c46c1470a6801da08d6cc2237bb10c0fa818d9fb52e25d727a8e6963f4af39a08cda3dd8fb185443b9cc6d620837c7a2bbd1e41276bacd499e21d71a59581f5e8b96ed936724679e31e91bcd9c5d3714d459b0cfa98b78436c7c99bd196e03023887d3a259176488c4c70e2382ea14bee3f742ac3969e8f8065d01dfe57b0dd06c6bbb8e74b6df22eb37bd27cc8d3cb95b5fea41a2b2d6349e36ece215399fc9cccf5b9ca1905cdb318627a6c7b11ef48fd2ecc2f6bb0b3b1a379fb31af76c0807eb7118115f626194e732e3562cdea7018b252e3df10fc625658a46c0cc60b72109a93059e837fdb4336fb4bac889f44c7628dc8c24b0296f423e3a282f71255efc4b6551400961fc357b0064d7d93dd5edce70dd956243c5d3c8c0c49165ecfcc25549347d945d04cd613c0a82ee6bf44a73e7d90962b39676b46ee9a33e8617632210b195dd10fe7591e5018c772dabf8a705a8c86601cbb63c7db7a7f2d4498429293a69200cac555dff78db1015beef6e1c036ef445a031763cc86597762f77cec2f639a23eccc595276ffd33c50b0da2cbf8f7269530fe6b49f7fb21ae328ce164548dbffc924a0e473041820a12a17a75d5414b3126178eedfcf883f1af59f54315997f962caa2a4653f6a73625cebd62b625da5e0f0e95c7170f1d97eb369dea4f6c7f8cc8178cd167b4a37f235624a901ca458b20dde2e3f84d94c8047df3318801961dc6246dabfd8430bd12ec16e03243611fc23f27c953e4d07fcdf6ec0c1277e613fae3a8dba6a69a2805f11a904ab87e721303296a457f68db798db0af25bf48d64212354a707468379bec321d5ecec490f070cc7a1484764d040ce8447091b75a64d425db982d6b7f03913c0b6aa51496c10c99e4641ff0e2633d0050b3bff1a44ecc6aae2c4cd68051733947ef23afc631ba24a541e5a83e7b2cfd1c4a03bf2dbd5622ef6ed13948316eac730780f915caf436e92894098d8abd3678d43935d572a900f6d2e20c489d3673abfda56c770cebcee5e8e7bd99617d9417f3ce6930381eab20e2817243ecb87bbe2b40c8933a4d7e6bd8244820163ca9456e9cab18f26eef2d53bf74613c64ece1f1d52f4ffe8a615845ec3e015342140a5bc6130fa6f66e47002d23ddb434453e0195bfb836839f39c3fba9c44dce8471b78c27c904dbb87e32fa376dea011f1a4326d0cd3ffc60dc0943545a475702879fe2d4065a187986a6b46f9b4717ddafe8523d0919df6b8b58f35acf096c6f603e31b582494d54485ffb308240c38b60e664906772fdb1062375f40ba0416c82e00fed05389de2080c6e259c9544c0053895c9099bd02c5a6f4b359916e95459e99cbd183a611bf3d8e0889c9ed5005721a4b0f6c286b5508339f0cf366fab25abeddaf094d4a0be7efe2aa92cab1c86e61449d34acf1b8130b63e00ba232dff0e7e959f8e4b79a6a0d5fb09d327a8d15af1a30cd22d2b45bd5bb973f4ce1381ab480b6e9a01bdfe90836e627ce887c91897ff9cf709d7a233d88ed6116a4e8d8cffed1703f4c1a54f3ae24cdb27ebbad874037bea561d6b104aacf3c4854acb5429f351589d5c5d648dea86d7393829fdc59fafb963195f45d810f013ae108e95b50a81a98a22e44bfd60083b930914d33140fbaee8e52d779578eaa6698310d87e0e9b283cdf92fc0d235b159ef7aa53772fb954e54c1ebbec3ad058d6c1c69b2e48728a2e9349805e7c14762f07da8bb5c98923be0dcdc56959cb3c17c5def6a522c560e5b323f8ab261bee3041cff931f38c47cc6d711b2d9c4d94fd7530e4be6f2ce4b52a02f69d9bb63dd9116ee2bad5d1a5ed5b4c947f15dfc21b64ff154d41db91dd1e9ae21561e24445a9e63b725b98ffbf8822985adbf4f949e1db53375d4507e47cd2cd1b8d4d2321b0538c5ad0115ef31f7a67d5168155a76548acaf4fb9d8155c46089d81824750f06d5234d622ac1fe3bbf1421aa4e53c7d3b32a0444e05f8c135967f34c853fb6858883ec5dce51e547ae661f1f42bf5eeb2c5c95d9d393c7219aeed56bf0dfbc5e20b6b73b2307addbc32559312ada1173f9f1808249d6126288ab77e685497f73707f33c467f44ee9a4bdd16494a83c311548a5a4fc56e34c21b95876dca9aa17c0598f361802ed9942dd4c86884c93f5fd4aad237de7b3c4700f61d06a80ab1594bc50146dfbc6810391b00578f728e2ad3ef2d61fd774f1bb32711c5cb66d6a22f6c4adcf3a7158bc12b6ad75ac3d629d2bc67294b58645343443a15695d5d7d21256cce8", + "pkaddr": "PCD25oVW6JVzkNgg3MUB21uorh7BDj6TtD", + "skaddr": "SS5MD2wTc96MqPPeSviWc6pk9MTg8xT137", + "result": "success" + } + ``` + + +## Qsend + +**cclib Qsend 19 '\["mypubtxid", "hexseed/'mypriv'", "destpubtxid1", amount1, "destpubtxid2", amount2, ... ]** + +The `Qsend` method sends coins from the `handle` on the node to any number of other `handles`, as refered by their `pubtxids`. This transaction uses Dilithium signing and is quantum resistant. +Multiple pairs of `"destpubtxid",amount` can be appended to the array to specify multiple recipients. + +#### Arguments + +| Name | Type | Description | +| ---------------- | -------- | ------------------------------------------------------------------ | +| mypubtxid | (string) | the id of the handle-registration transaction of the sender | +| hexseed/'mypriv' | (string) | the seed used to register the handle | +| destpubtxid | (string) | the the id of the handle-registration transaction of the recepient | +| amount | (number) | the amount of coins to send to the referred handle | + +#### Response + +| Name | Type | Description | +| ------ | -------- | -------------------------------------------------------------- | +| hex | (string) | the hex to broadcast; use the sendrawtransaction method | +| txid | (string) | the transaction id generated when the hex is broadcast | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib Qsend 19 "[%22d60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f230940%22,%22e580f34e9bdfd23108409e76475c7df3f924d149d494d5cdbc24aeb280237d4a%22,%22af710c0fd6aeb54556ee401803bc4cc39ea9002ad5228f308b27eb3af0e4c4b6%22,1,%22b625e38064cb0c940a55f0dca7e6b60270aac090d0dd90d4e43e924d696564a2%22,1.1,%2276a914b738b1730cfb58960b1dd1765c6d3276993959e188ac%22,1.2,%22a9144d5e24fcd799f3a3fa15f98a6c69a5829596f56087%22,1.3]" +``` + +###### Response + + + ```json + { + "hex": "0400008085202f89016c21f44da4afe05aad8b271659c6cf8cfccb6b6e33fdb9f5f0935a0d6e8ef616010000007b4c79a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b8140ccb5db05dc45a4ec747705d76f2e71f3ab43830693f093536d23e6ab31c18b0c04c2906a8e600629b9264043d4534da3c22c1fe1dbe2192ebce23b8a99cf35eaa100af03800113a10001ffffffff0600e1f50500000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc80778e0600000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc000e2707000000001976a914b738b1730cfb58960b1dd1765c6d3276993959e188ac80a4bf070000000017a9144d5e24fcd799f3a3fa15f98a6c69a5829596f56087a0244c1200000000302ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc0000000000000000fd100e6a4d0c0e13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460de9fbac397128243cdfe192f73c9eb327fcc75338e694a94f4df8bcf7d668868731be4f2b886f5d1292e3542f31f01a390fcd7491d730b57ce1fcd6abd792efbeb4047f2cc24b98d07577f3121a74a141d1a7ce94b1e03fa69031e91baa38ef209866fb9db448445fc4794331f5efaaadd1ee58c58deac4b26012ed65f876fb056711d3902500d2d45c0e4e082d8a058a7a671a2fd2a855bd882ee5a06962ab72d93783c7f1fcfead9f712dd3af0424572ce58a36b4e558bc9c95650351794134f1d74f8f275500f19bc967a64ee0baef222bf34c50f0bb771759afee0b202a542d4a349e2224820a2fc29259192e1dc1c2648b161a31454d9a6489fb26b280ad6dd3f1916cae118150d49c52401665c8b299608760c83659f88783120974f85f22d9af9b5ea1dd4a145b29aca2929ffa0449dc821cbe0dd8f86017a37573ad8ca33901e10664822a0ff0825f957bda6148a41d8bd48ae42a7fd10e73e4f28198e767abd1b2c1297055729ddbb613d3d4476b8cf228be84248bef116546ec8d773d271b2a850711f2a8cafd3502575c94a5c258c322f1a0123f439d796239dc7a40e996ff282eb605b7bea9336fa2d6443924a3487f3275095a8fbe136918cb6a69afa2881d793d0d70433c0e16ac5218da88ce76194d86ae8c283184249cd4fc3824614f95af655556e3c3c90765358a63c411cf5df4075546c9555feb2fa1057f540a79a30ddf997248e47076418b31514607236ee23f56b8bd7ee03e09dd063199c45b0b120af1e44920b535aae890d51d0134ee24872a995b991efa31bd4bf9e551727a877d29ef269b83efc0368d042086535b6bd956c2f7bbc3b686dbd765d092a98e825911a13ea92ad2cd7604288c0e7595ee3763849a4d61c90ed7686a3902417eb90d59e40350b12353fd5fcffc53c52759ee393e68227018c924ac9c0390d3029fd26dcd93609d57f19868abfce563dbb93921837f85b092b8539447e2696a9d60345fe390200ce741eae671561b54ee0f58c32e944a954143dd274e41179907a99394c9c1c978a964555d91d0acdda655064a824c7673dc84d1d5a94f06ca6b19078dcd657acb9d84518b94c2f56e4aed02c50a1861d536fe19c29cfede262d8cdf1fba7848f017ce53bb99eb9b40d0b2e5951b47099d8d975bf3054baa8019a9299794e9c4e1f7117974d15dcd4bf1f75b732ac65cbbcd9d2c232e8445d93f422a9315d7c7627d5e4d424094d04c6e419e9805b7bb7849214d35e02139463e73989d019cd1ea3a9084f353f3145df38f88ad0baafee1f0e95477cacc7b0246db8b4ed485db10c999c508506d0bbff6185c53903f8565edd90fc16e3f6be972463e3246a73cb1e2cb294209c71838ae86732cab6f648d10459123d30a59c1bf63a2232d32c8cfe0d06c4797c883d0ad452643496dbec37f87a1a90b525a938cf3367c9917e57c506d0fa422e530753589bd9317a775af64de696857705c5efed3037ad7ad7e1a4789ef238c6473cb433eda187484592e48e5d237d73f558cfe24f68bad4ee85b77c01b9924e262534c9a2486432a5be199aea85a935f6b2424a4fbf3a5dc7afc1866692404de45f41393aecc7ca5761c25fa5922ccebeb8b0580633c75a944d473d18318fe0fb999dd61259813bd0f5c62ff50df1148c6d12757b2de3be3098e7c283eaa3acea5049f4a7e1393235dfeda7b0fdcca6cdeee5410f023bc4c1a157cda0044edacb30b4f00d3c647e83aec5b966ed4e1829eb1f9ab7da7715f34e07e17ed59e45922500f493d74ab8f8f645f3e9002d202f9c2ed14ec698548b7d0ea182c8ea9de1b9146b3a77df43e80a2d085636eb5a80f9d643682d211ae13bb6569ce3411aaca39727850155274aa842baef36ade2173aec3d6c3f4039038d55ff69a7a35ef2d08b5478106b9f0364a8c0e95cd4751bd905c4c38dca63bbcdce24538bd08fb0cc7d9cd1f5dfc1853d502e1f38adaad6c468d9e50ff81d2a6b8dd3db7602bc272675d2efb70382dc19b9039a0b32d876787f2d0e0671b11adde48aafef6d684c517e77217be631366bf99f1109e55a389436e915d847f212b07a5c6fb94db999662ba20e92e642e88bce288cdce3dbffc0d52607af784f802eb18e810d49766ca752a6534d7459a97a2bf07787c63cd836862eb05347cebd3882df760b37b873b79d935cc4fa6f444a6f4d2bae51dab832432a258c1d741d7c133e55302920527e02f1ec8b0ab2703df6fb4c3d357efa75a53c91666b59ed6135907edee5b7ce73c3730c90e235cde4e384dd51f7d7e1b82e3c7cedff649fd6a5f247e829ea9e00d58c37ffd545cd311ad369928ac396cb5dbdfad2c6de10d0a0b1047df15f26c51b225ee148d95dd9c5aea4a4da592cd59b3fcdd8478ee264ed68e61aee55585c32b6dee251f593e8a9f492b9003208af4e04d0e5ee00afee4d0d074ae9aeaa8fda26e89fdf4825da2f0211b5c9a8eae9f1070f401cd6583d0296057c9707a481983aa45b76b290aa249cc5a545fe8956000fc2d48c4803dbc642e1ef9ac3904652ddfa3b6a29e405984a2188b31eb358ea04462ac751937ef5a153d865e6b5951392dd6b4c6ee16224705486de08d380827554419ab24b37b58bd351d157194640d9eba45c13dee0bb73429b497e3885568161f286a6b6f67d8054674a717c6d26defc68c734622dacb8a2fef4dfbd425ea78575402d15eeb9d8cc6f99b0ebf33738b34e14f34b4b990deba45abe2d3c81038d4fa3352a4e904d9d6b244585ba1b0f450c9da0fe84e711255846bf56fc483755dc006f74f816bd27c408c1d4102e2882702b7afb187096a1046cd47f1be2a10400040d310b862232ec7b8419764d05ffe3833bc8462c90ea3f4b65af3fb07b885c9403434b6e0326b05188f8c05d157e0e721a9514fc189dd7c6455d261482fc46c4c206d94ba737a1e456cd22a11e3daf0f2c5716af6ba28419cc17ffa7303ee25d52675a1612ec1cc3bb708c1f0a720d9f4e4c5b47d4bca46f393eced4e6de925262ef229adb4405c44c7ba73646ded1bad4879f8024e84eec05c8bd635bcc6372e1f420be1b7e7f764d966b8715b21b73efb19c4c2d612210cd13fe06bf45d79b0886bb67c9d8f7308cdabde24127d7d3181b3283582b27ad46e0076e03c3269c11b613a6e0375992cac30acbdfb42eb99d6b3cdd845a978845dc7acf67882eaa532641b56ab5626581fca7481e4d1f54f1fb6e1accaff130a66cbb61fde59bc2052c48325a45219818648791ac33046832b02cc9e6aa587aaedb6e7f5d2e18f9b2e6727763f9511b715a43d7a4f608cb3cd037f4e26a455f8b4f9706ec408d4d435be1e6482c2db2aa2f08f23a31900128d57f210e34cb61f73dea2614cb51c220789a40cbfa35c9d565e1f9b809c81f9e3bcdfd5fd814b619b9c7a579daac86c60abcb7293de50b0a3702e3b877f828777235a49920c9dbf5ed9ce3a3f885c2bf985c620b7d0dafd7366a22554b6601af7866b5ccef7e8d67a29345598d98f946a204c128487fb672acbc68097d722d9e12f625b62e8b9affbf05539e44b62e72f6e2d917f1660033dd2a171d37387002cc04cf857d6100409a47d2ce9926c781758d0b7405d9d40086f5835685cde5648495864ac138bf81dac0f6d972096e993b49973c7dfa9a942edc9fe8fffccceb312a0e25b3a335e3b4f06c34cfbe4828597aeccf738a8164fefd1e88b62b12d76d13a5cef333bf8f16135dcbb84fa257b24eaa1e2b7d9c9e9fef6bf5d908e57a05c75d950dbd9ed6ab6f72a45f29e8fa80987406cad82c8d57c744928e3c5b5dbb054df82952b6d995d8b981b532170b311d701b1c0613787b3dbba56c254ffd8ff11270888029d9b342f08c891d185f2ec769afbc8d2b5e232c2ff3365c038102e09094d7dba19552a773f5d2fd153b24ebf7950f7d8c9b857413461cd68c464eaacdfa050b05e4b67a842727ae83a560e692fd7c473552e0b4d6c33544bb3498e4f77061bd8b06a279e68e813ba1571744328f27ad2f9d92cd0e33897c649c6cf33f235604e092d002c1f7e5fbe5cbff16b92540e33e4b3afd99e7df80bc23eca979125c0f271eb1f3e309c9a4dc48e82873b918c1b75ef029f3fa80a65d0ba9a3d7739a0763bbeee1920cc953d46921dcecb65a57f608b9092221209f5dcdddd66998f295f043114fb4c263634381cd381fd75e6c9d21620d13a4544a1ff4a9b789ca115d8108f8ee063c4ee9fd4e21886d74c3a54fefae364fc924d9a7d0994796f6753f92b7fb77be7ceae095e8de8b064aa3ac04138fc9c92a5b63714644ca35c9a12559a0b406df0dade4bc2018c029e0f5e87326ba85360788188cfb03873255c2adaa347fe8265f1fc32d0a8b90ea49dfb8aacf01c69744cf0096298559670d515540cc929480b7fe97608111f17b6a39e3e4b9c127e027d4ce00a761c3e3336b91e4bedacaf3a84b44e3f69180d8da4c7ddaed25841351096d7e822ed97c87250f901365c656671b5b80b0c182126333945516f8f9294bdc6c7cef8fd1a1e5c686e8081949a9da4aab4bde0eb0a28292f373e4c51545cf9ff11425c6b6f7a7e7f848ca1a8c2cbdcedf0fbff03192527353e3f55878fb2ccd7fc0000000000000000000000000000000000000000000000000000000000000000081b2b374a588124700005070e14a0805080a84a430004891a4412051202000440190140c06261da92a73502f904c0eab1b16b2d2b60ec32c1863d95069848bfe717ae65f8d8b718f7dc2f5b9c0605b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71afa26465694d923ee4d490ddd090c0aa7002b6e6a7dcf0550a940ccb6480e325b6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd600000000fa6c00000000000000000000000000", + "txid": "5aaf4007d6d9af7883da1ad464b63fff9d97453efe0b181d19558cc15f6ff668", + "result": "success" + } + ``` + + +###### Broadcast the hex + +```bash +./komodo-cli -ac_name=MUSIG sendrawtransaction 0400008085202f89016c21f44da4afe05aad8b271659c6cf8cfccb6b6e33fdb9f5f0935a0d6e8ef616010000007b4c79a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b8140ccb5db05dc45a4ec747705d76f2e71f3ab43830693f093536d23e6ab31c18b0c04c2906a8e600629b9264043d4534da3c22c1fe1dbe2192ebce23b8a99cf35eaa100af03800113a10001ffffffff0600e1f50500000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc80778e0600000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc000e2707000000001976a914b738b1730cfb58960b1dd1765c6d3276993959e188ac80a4bf070000000017a9144d5e24fcd799f3a3fa15f98a6c69a5829596f56087a0244c1200000000302ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc0000000000000000fd100e6a4d0c0e13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460de9fbac397128243cdfe192f73c9eb327fcc75338e694a94f4df8bcf7d668868731be4f2b886f5d1292e3542f31f01a390fcd7491d730b57ce1fcd6abd792efbeb4047f2cc24b98d07577f3121a74a141d1a7ce94b1e03fa69031e91baa38ef209866fb9db448445fc4794331f5efaaadd1ee58c58deac4b26012ed65f876fb056711d3902500d2d45c0e4e082d8a058a7a671a2fd2a855bd882ee5a06962ab72d93783c7f1fcfead9f712dd3af0424572ce58a36b4e558bc9c95650351794134f1d74f8f275500f19bc967a64ee0baef222bf34c50f0bb771759afee0b202a542d4a349e2224820a2fc29259192e1dc1c2648b161a31454d9a6489fb26b280ad6dd3f1916cae118150d49c52401665c8b299608760c83659f88783120974f85f22d9af9b5ea1dd4a145b29aca2929ffa0449dc821cbe0dd8f86017a37573ad8ca33901e10664822a0ff0825f957bda6148a41d8bd48ae42a7fd10e73e4f28198e767abd1b2c1297055729ddbb613d3d4476b8cf228be84248bef116546ec8d773d271b2a850711f2a8cafd3502575c94a5c258c322f1a0123f439d796239dc7a40e996ff282eb605b7bea9336fa2d6443924a3487f3275095a8fbe136918cb6a69afa2881d793d0d70433c0e16ac5218da88ce76194d86ae8c283184249cd4fc3824614f95af655556e3c3c90765358a63c411cf5df4075546c9555feb2fa1057f540a79a30ddf997248e47076418b31514607236ee23f56b8bd7ee03e09dd063199c45b0b120af1e44920b535aae890d51d0134ee24872a995b991efa31bd4bf9e551727a877d29ef269b83efc0368d042086535b6bd956c2f7bbc3b686dbd765d092a98e825911a13ea92ad2cd7604288c0e7595ee3763849a4d61c90ed7686a3902417eb90d59e40350b12353fd5fcffc53c52759ee393e68227018c924ac9c0390d3029fd26dcd93609d57f19868abfce563dbb93921837f85b092b8539447e2696a9d60345fe390200ce741eae671561b54ee0f58c32e944a954143dd274e41179907a99394c9c1c978a964555d91d0acdda655064a824c7673dc84d1d5a94f06ca6b19078dcd657acb9d84518b94c2f56e4aed02c50a1861d536fe19c29cfede262d8cdf1fba7848f017ce53bb99eb9b40d0b2e5951b47099d8d975bf3054baa8019a9299794e9c4e1f7117974d15dcd4bf1f75b732ac65cbbcd9d2c232e8445d93f422a9315d7c7627d5e4d424094d04c6e419e9805b7bb7849214d35e02139463e73989d019cd1ea3a9084f353f3145df38f88ad0baafee1f0e95477cacc7b0246db8b4ed485db10c999c508506d0bbff6185c53903f8565edd90fc16e3f6be972463e3246a73cb1e2cb294209c71838ae86732cab6f648d10459123d30a59c1bf63a2232d32c8cfe0d06c4797c883d0ad452643496dbec37f87a1a90b525a938cf3367c9917e57c506d0fa422e530753589bd9317a775af64de696857705c5efed3037ad7ad7e1a4789ef238c6473cb433eda187484592e48e5d237d73f558cfe24f68bad4ee85b77c01b9924e262534c9a2486432a5be199aea85a935f6b2424a4fbf3a5dc7afc1866692404de45f41393aecc7ca5761c25fa5922ccebeb8b0580633c75a944d473d18318fe0fb999dd61259813bd0f5c62ff50df1148c6d12757b2de3be3098e7c283eaa3acea5049f4a7e1393235dfeda7b0fdcca6cdeee5410f023bc4c1a157cda0044edacb30b4f00d3c647e83aec5b966ed4e1829eb1f9ab7da7715f34e07e17ed59e45922500f493d74ab8f8f645f3e9002d202f9c2ed14ec698548b7d0ea182c8ea9de1b9146b3a77df43e80a2d085636eb5a80f9d643682d211ae13bb6569ce3411aaca39727850155274aa842baef36ade2173aec3d6c3f4039038d55ff69a7a35ef2d08b5478106b9f0364a8c0e95cd4751bd905c4c38dca63bbcdce24538bd08fb0cc7d9cd1f5dfc1853d502e1f38adaad6c468d9e50ff81d2a6b8dd3db7602bc272675d2efb70382dc19b9039a0b32d876787f2d0e0671b11adde48aafef6d684c517e77217be631366bf99f1109e55a389436e915d847f212b07a5c6fb94db999662ba20e92e642e88bce288cdce3dbffc0d52607af784f802eb18e810d49766ca752a6534d7459a97a2bf07787c63cd836862eb05347cebd3882df760b37b873b79d935cc4fa6f444a6f4d2bae51dab832432a258c1d741d7c133e55302920527e02f1ec8b0ab2703df6fb4c3d357efa75a53c91666b59ed6135907edee5b7ce73c3730c90e235cde4e384dd51f7d7e1b82e3c7cedff649fd6a5f247e829ea9e00d58c37ffd545cd311ad369928ac396cb5dbdfad2c6de10d0a0b1047df15f26c51b225ee148d95dd9c5aea4a4da592cd59b3fcdd8478ee264ed68e61aee55585c32b6dee251f593e8a9f492b9003208af4e04d0e5ee00afee4d0d074ae9aeaa8fda26e89fdf4825da2f0211b5c9a8eae9f1070f401cd6583d0296057c9707a481983aa45b76b290aa249cc5a545fe8956000fc2d48c4803dbc642e1ef9ac3904652ddfa3b6a29e405984a2188b31eb358ea04462ac751937ef5a153d865e6b5951392dd6b4c6ee16224705486de08d380827554419ab24b37b58bd351d157194640d9eba45c13dee0bb73429b497e3885568161f286a6b6f67d8054674a717c6d26defc68c734622dacb8a2fef4dfbd425ea78575402d15eeb9d8cc6f99b0ebf33738b34e14f34b4b990deba45abe2d3c81038d4fa3352a4e904d9d6b244585ba1b0f450c9da0fe84e711255846bf56fc483755dc006f74f816bd27c408c1d4102e2882702b7afb187096a1046cd47f1be2a10400040d310b862232ec7b8419764d05ffe3833bc8462c90ea3f4b65af3fb07b885c9403434b6e0326b05188f8c05d157e0e721a9514fc189dd7c6455d261482fc46c4c206d94ba737a1e456cd22a11e3daf0f2c5716af6ba28419cc17ffa7303ee25d52675a1612ec1cc3bb708c1f0a720d9f4e4c5b47d4bca46f393eced4e6de925262ef229adb4405c44c7ba73646ded1bad4879f8024e84eec05c8bd635bcc6372e1f420be1b7e7f764d966b8715b21b73efb19c4c2d612210cd13fe06bf45d79b0886bb67c9d8f7308cdabde24127d7d3181b3283582b27ad46e0076e03c3269c11b613a6e0375992cac30acbdfb42eb99d6b3cdd845a978845dc7acf67882eaa532641b56ab5626581fca7481e4d1f54f1fb6e1accaff130a66cbb61fde59bc2052c48325a45219818648791ac33046832b02cc9e6aa587aaedb6e7f5d2e18f9b2e6727763f9511b715a43d7a4f608cb3cd037f4e26a455f8b4f9706ec408d4d435be1e6482c2db2aa2f08f23a31900128d57f210e34cb61f73dea2614cb51c220789a40cbfa35c9d565e1f9b809c81f9e3bcdfd5fd814b619b9c7a579daac86c60abcb7293de50b0a3702e3b877f828777235a49920c9dbf5ed9ce3a3f885c2bf985c620b7d0dafd7366a22554b6601af7866b5ccef7e8d67a29345598d98f946a204c128487fb672acbc68097d722d9e12f625b62e8b9affbf05539e44b62e72f6e2d917f1660033dd2a171d37387002cc04cf857d6100409a47d2ce9926c781758d0b7405d9d40086f5835685cde5648495864ac138bf81dac0f6d972096e993b49973c7dfa9a942edc9fe8fffccceb312a0e25b3a335e3b4f06c34cfbe4828597aeccf738a8164fefd1e88b62b12d76d13a5cef333bf8f16135dcbb84fa257b24eaa1e2b7d9c9e9fef6bf5d908e57a05c75d950dbd9ed6ab6f72a45f29e8fa80987406cad82c8d57c744928e3c5b5dbb054df82952b6d995d8b981b532170b311d701b1c0613787b3dbba56c254ffd8ff11270888029d9b342f08c891d185f2ec769afbc8d2b5e232c2ff3365c038102e09094d7dba19552a773f5d2fd153b24ebf7950f7d8c9b857413461cd68c464eaacdfa050b05e4b67a842727ae83a560e692fd7c473552e0b4d6c33544bb3498e4f77061bd8b06a279e68e813ba1571744328f27ad2f9d92cd0e33897c649c6cf33f235604e092d002c1f7e5fbe5cbff16b92540e33e4b3afd99e7df80bc23eca979125c0f271eb1f3e309c9a4dc48e82873b918c1b75ef029f3fa80a65d0ba9a3d7739a0763bbeee1920cc953d46921dcecb65a57f608b9092221209f5dcdddd66998f295f043114fb4c263634381cd381fd75e6c9d21620d13a4544a1ff4a9b789ca115d8108f8ee063c4ee9fd4e21886d74c3a54fefae364fc924d9a7d0994796f6753f92b7fb77be7ceae095e8de8b064aa3ac04138fc9c92a5b63714644ca35c9a12559a0b406df0dade4bc2018c029e0f5e87326ba85360788188cfb03873255c2adaa347fe8265f1fc32d0a8b90ea49dfb8aacf01c69744cf0096298559670d515540cc929480b7fe97608111f17b6a39e3e4b9c127e027d4ce00a761c3e3336b91e4bedacaf3a84b44e3f69180d8da4c7ddaed25841351096d7e822ed97c87250f901365c656671b5b80b0c182126333945516f8f9294bdc6c7cef8fd1a1e5c686e8081949a9da4aab4bde0eb0a28292f373e4c51545cf9ff11425c6b6f7a7e7f848ca1a8c2cbdcedf0fbff03192527353e3f55878fb2ccd7fc0000000000000000000000000000000000000000000000000000000000000000081b2b374a588124700005070e14a0805080a84a430004891a4412051202000440190140c06261da92a73502f904c0eab1b16b2d2b60ec32c1863d95069848bfe717ae65f8d8b718f7dc2f5b9c0605b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71afa26465694d923ee4d490ddd090c0aa7002b6e6a7dcf0550a940ccb6480e325b6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd600000000fa6c00000000000000000000000000 +``` + +###### Response + + + ```bash + 5aaf4007d6d9af7883da1ad464b63fff9d97453efe0b181d19558cc15f6ff668 + ``` + + +## register + +**cclib register 19 '\["handle", "hexseed"]'** + +The `register` method allows a user to register an arbitrary `handle` (such as an online anonymous username) to the `pubkey` the user used to launch the Smart Chain. + +This method requires a valid `seed`, as provided from the [keypair](/antara/api/dilithium/#keypair) method. + +#### Arguments + +| Name | Type | Description | +| ------- | -------- | --------------------------------------------- | +| handle | (string) | the desired handle | +| hexseed | (string) | the seed used to create the Dilithium keypair | + +#### Response + +| Name | Type | Description | +| ------ | -------- | -------------------------------------------------------- | +| handle | (string) | the handle registered | +| pkaddr | (string) | the hashed representation of the Dilithium pubkey | +| skaddr | (string) | the hashed representation of the Dilithium privkey | +| hex | (string) | the hex that should be broadcast to register the handle | +| txid | (string) | the transaction id generated when the hex is broadcasted | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib register 19 '["AtomicWarrior","a70a8e7d2281beaf0762a11590fb566d7af32325ae4252609149de37658e2eb5"]' +``` + +###### Response + + + ```json + { + "handle": "AtomicWarrior", + "pkaddr": "PCD25oVW6JVzkNgg3MUB21uorh7BDj6TtD", + "skaddr": "SS5MD2wTc96MqPPeSviWc6pk9MTg8xT137", + "hex": "0400008085202f890c3ac9dfb08a10d3e47274ad9c1f3de2e59b4dc34b433ec7a171cc15880b67fed5000000007b4c79a276a072a26ba067a565802102f1c7993a9bf3863c77853315af7e37c12008ea1c5c3d8722c91bc3b5a019652681408acebab227b096d42a78dddf98b4e834a164e5627e63d1223cceac25e6f8e41617c30ee7463ab48b1229b9ead2aed29b2472f265d5d347f4ab17b3c93f47d5c1a100af03800113a10001ffffffff05ddc1a108a5313bb185ded05ace4d8e29a2f4608f0c7ff7251d11595f3a445f000000004847304402200b10d4b69c39a3fbb15060908c82703e2bf5e573eb01c852fbc2ef531ebafd81022036e4faa9a8ed04ca8502da4c0c20ce6d3b25f82716d1c694557b56e98a26b95e01ffffffff07cd294b67f76a3745a00fb2ab20f6c329eb9f69bd5ef924773bec9caf95821a000000004847304402204a18f2084fd6ce364267bdc708d610028ba41c3155dc895db578c7739abb33950220656b8184a333f806923a29a24f9aca24a122e482d1c66cbab5d811790edb69e201ffffffff076950481295bc4ed92a1967107684288f9702951c302cbd1dcd769e51b42114000000004847304402206c294c39d279f44f7d36d72706a25b296d9fe4a5f8f675dd607cbdc5ba9b93b402201660a9d6d935355fe979b33c50b25b267125a9fc463abc5346355cb953e6e7c801ffffffff07386ff4ac0a46d343afc36786709ca93f08bcf1feb3562ea7baf3bd58cd7a2f000000004847304402207e66ea8cf31bcbbc156cc2d8b020a95440183ea3034dea20607b6a7ef28b9efc02206577bf339d49ecbf698cf434e6ad63f3ca41f83be446a3998d397f097b9d0e3f01ffffffff071395c451379d66ee21321e376721d67fe510287393499ebcf1a67683f3d611000000004847304402203ed2d7ebbe1165bfc02efec4f95905473d2fe4f0fafbe7d0fccac39d379958eb022008c385d3fe93f3a6e10ec4ce78b67f5a93f3df43c08be7534ca55036aef291d701ffffffff0682a878de10392b1807abf35589c9a3aea4137b12d61716be974934a9b116cd0000000049483045022100f6dd23ae75da9f0ba01927f32bbe03e90e16f0f216227400c58f331b3526619002202c522e7b622409ee1974f03022940daf7b0046523b1c69c03fc16b3a55c21f1d01ffffffff066f21010b80faee30bca88603439389aa2274e52ca8f4d288d6881997a1f06f000000004847304402201d98276f505fc969ecc1f5f4df2d71e371b9537f94e466ab6b35594b13afbf1d02202dca6c57312019400809d9bcc7fedccda65d02ca0fb492a72f98128ca4b95d1001ffffffff066e38c8bf4aa889d9dcc53aeec1a95d548400211280fe24d4c0e73de69309bb0000000049483045022100e8255e4b42d3084a66afd9984c7345cec47a15b509f49c4b04d4fafce5bfb77c02206152baa639a6393a4f86db5fd6739cfd096701a1617210aa7138dd8c752bd46701ffffffff06507713eb6ba1246886e7c8364b5c7aeece7251f85d0ba50190365651e161c7000000004847304402203a19e60986b7f45ba8dedaaefae62ab3d9052787c650d6bb5b1168a5afdeafb002201e9691b6093383af569463158d6dcfb6dd6649054c6a3aeaafa435d36b74dc0201ffffffff06195fcbe6c657da6cbfc69892ffb67470fbae568fa826169201aabdc2f2ad82000000004948304502210080952f9f65195b4f2122bba7e14c049a4253b5c356d548c550bb38f1317a31f002205b7c3743bfbab00ff100174edf1367aee599c6df02afde5c62680b68d1ecd64901ffffffff0612f70038d70cfff5a1bf02d39357d567aa0b02e98c97fd877399fbd0763dff0000000048473044022056104b269b860662025808532cc594a11de207be0b0121a247aa1c3abfa834cc02204486e95cb0d1b27a41e4b3af458c6181c0e6d2a97eb8fb32df313ce423e8f81601ffffffff06204e000000000000302ea22c8020979f9b424db4e028cdba433622c6cd17b9193763e68b4572cd7f3727dcd335978103120c008203000401cc1027000000000000302ea22c8020749dd6534e79a31aeba03df3b0ea58632a0beffc3411b54b7cc0e714ae2dd61f8103120c008203000401cc00e1f50500000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc1027000000000000302ea22c8020979f9b424db4e028cdba433622c6cd17b9193763e68b4572cd7f3727dcd335978103120c008203000401cc502198000000000023210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac0000000000000000fd19076a4d150713520d41746f6d696357617272696f72210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270afde006e4f25d02a6aebaa196ef1ba40f9c8156ff691b5505c72c304f9bcb4c0506167447056dc7341b1431132d0099e8e0a7c134fdad28e6ef8a290c24652260502f43876c043b5bc48f8624c2c396ce1a10e2da59fb73d5523bbe830eabfa6271f33981c54b519c25cd6a76f8298d4f380c96c8dda1a95b45c672bce7c67afa1620cafb5650c1b48758256548b6513f4b8862aa2ca959d244a3955fe095cbf07458e6dec3f73d1afa9f4cf40213d3e7355499cc23f9cec63437a352751d2b95a0353e5ccf70eb2ec5b6d00bba3f12d8e5af3ee752612361e0eb474a3f7221175462e9c171bc6cf709aa5ab53a7683c24decd759f97503a2118f798da1eac081ab7c9e61fe8697746dbe1e798690c9ee600ee53eb336b714130404ed9c5f0d1407a007641b723e59c9bd5178cd42953d10b97d367fd75fa0cccdbe7daaee7b11698e667f1fec2a78d5b94a013efc2d9fce26ef7bcb44371e04854a0f039256fbbe0d472f89b572f5a252528d426a6642fb92d243092b35976b54ece95e0ac246491f6dd024a7ba6cc164fd5172e50c893ef974abe1929f286036cdaf7a5c0395bee9d8feab5b80c07cf4d0b88e4df10a08bd4187bcf82e34a5631a32fae96ec25f992e20b7987df6d0d70535dc247640c00a3b4baeca3a579fa91dad116f3fac11223be5848bd9f34edd0fa3528adde06896f1e363ded56ad6feee9b9bda41f32d4d1279d005e6eb7997bb73dd085154738d11ab800a3d0964c441cb2117d6859ce6908b0525161bec38ccfa3ad71f6005b5891facfc54a2a25b758f8067f754abe41fc769ecea5b83c0a91f4edf549760954276d4f3703c7c563c5a9003501ceed81f382903d581fcb1fd823a0a9caea81250005cee48e98676df2f0cea71fc2ef0decf3d3bdd7b0d5c8ef7f64a8b6fe160290b57c2724bbbb264ed2b6f48a585174c30afd51cd5bb43138d7f88853cb9919a697816c9d0ccdee186858eb48d76853abfdf1629a3a3d781786b55ca1d19413304341b3db4e2a390b410d8da35597d53be07149a1da27c1e0c439565f404259cfbf9a90511bca1f3bc2c7d9592c95eb83da99f848f551a402004e7a7af1896d05899da19e2a133ee50dce1eba96ffb626340cdf713cedf8579fd76d65f144f47065b4517b6be66cdf112029300ccdfda9158be86845195f5e7a50c90a7360e4470ec7b28700393d0d8685cc32c5f352de03f38efc2b6a379def182aae527ee18dd69c0e4cf1398b220e26dd052371a83db082f55318c0e0fc27568f5a6122484f889cb73d29c8da6f91a65035543088a87e68c2b8ce2f7c87a0613f89a04d372e19a1aaaa5309a032d01c20b8d56c819a85fa19f2ae1dbdf36c83b65fbdf76026cc91925ca06254759c0b6613e11a9cda6413e52695fb20cd61145d477d779a389e63eaeeefe6bcd1588e7b149cdb234616764f13b8e61e045d2ce9e53668aab202d7d941fb5d314fbb2c12d9baf71ccd2a43ae8745973626ac4d3c15b4d4df8a756bafaa6c56f3cddf78e3cc008c909ab31bf9716283d1c91688efba7ecc048218a5becee52cbb22fdd57f6907563106aae0ba8daded1050a3617d5962d108aece6b25309fbb63f739beba4dd5117c7d36ce5ea324c2fe98b27e9094acd8e9038e41ae5e7f5e7db705f1b297a341f3ba10f3a86942581d97825e97e0e43b0308cb3b283d303b5115c539cf4b51e0e963aff3270b696159fce3e3e7e5887a15e2c40c0fc308d037adcbde18e765915bd990039df9e78c5af9e5a7ab96bfc79680e2c6e937599893a737a8fb0910309cd75dac3b699a048274a987fa1b3d70d80a21eb23ba8191b508440ba5264998d46ba951df5a022226efcf8526e765cb88048675ab5bf3158bde9776f670b3e914c44c1ce5dfbb806a27b7155e8b3a12e728899b61781ddd1e7000ae120afd025675d50c491ffd7e97698feddfb1cff0b0d1cc428d2f0be466e58a081985d444777c4add2475fc80dfb4bba5e191b4bc6b631fad2d96a910254366b94fe45c116d08c8c01c0158073f9f5af721f08d772f95ac5a6d55b69c9adc3abc4e9d816cf4bdb86fec744fcf0817142079fb97c74335eda37b2bb4124c6ed91ef1b1c7285195a197d82dd755697c9136e49b652bfdbf7682558d8f70fa9adb9c4c5c0b32545fdf7313f6d68fe0a77c38c49b18ae79dc57aaba711e8ae3f8be3a007f84bf26b3f8967b95f4696d3a37598f69deab9e3d1e251d6a095280e1e3d1f873aa53942182dac1bf768a4c3bd8df15fa58589ca7e979dc5f6707729f064d1cc24bedbe3ad9404a1767918278677362a253a723223da676331c4cabe11afc441a365abdeb119fa5f6b66107efdd2546ada80014b382a62e90f360127279ffb54835b34ce886d2918160b05d9b4e91996467aacc6dcfffd56c13138c04e50b63693a3a6e3843b649ed2e18986aea35d35634343a7c50de1aeb8730f6276080549bf43a1ba00000000f55700000000000000000000000000", + "txid": "ea448ff66aa925239cff7ca748d3aea62474187fefbd1c15fcaaa14c4529b82a", + "result": "success" + } + ``` + + +###### Broadcast the hex + +```bash +./komodo-cli -ac_name=MUSIG sendrawtransaction 0400008085202f890c3ac9dfb08a10d3e47274ad9c1f3de2e59b4dc34b433ec7a171cc15880b67fed5000000007b4c79a276a072a26ba067a565802102f1c7993a9bf3863c77853315af7e37c12008ea1c5c3d8722c91bc3b5a019652681408acebab227b096d42a78dddf98b4e834a164e5627e63d1223cceac25e6f8e41617c30ee7463ab48b1229b9ead2aed29b2472f265d5d347f4ab17b3c93f47d5c1a100af03800113a10001ffffffff05ddc1a108a5313bb185ded05ace4d8e29a2f4608f0c7ff7251d11595f3a445f000000004847304402200b10d4b69c39a3fbb15060908c82703e2bf5e573eb01c852fbc2ef531ebafd81022036e4faa9a8ed04ca8502da4c0c20ce6d3b25f82716d1c694557b56e98a26b95e01ffffffff07cd294b67f76a3745a00fb2ab20f6c329eb9f69bd5ef924773bec9caf95821a000000004847304402204a18f2084fd6ce364267bdc708d610028ba41c3155dc895db578c7739abb33950220656b8184a333f806923a29a24f9aca24a122e482d1c66cbab5d811790edb69e201ffffffff076950481295bc4ed92a1967107684288f9702951c302cbd1dcd769e51b42114000000004847304402206c294c39d279f44f7d36d72706a25b296d9fe4a5f8f675dd607cbdc5ba9b93b402201660a9d6d935355fe979b33c50b25b267125a9fc463abc5346355cb953e6e7c801ffffffff07386ff4ac0a46d343afc36786709ca93f08bcf1feb3562ea7baf3bd58cd7a2f000000004847304402207e66ea8cf31bcbbc156cc2d8b020a95440183ea3034dea20607b6a7ef28b9efc02206577bf339d49ecbf698cf434e6ad63f3ca41f83be446a3998d397f097b9d0e3f01ffffffff071395c451379d66ee21321e376721d67fe510287393499ebcf1a67683f3d611000000004847304402203ed2d7ebbe1165bfc02efec4f95905473d2fe4f0fafbe7d0fccac39d379958eb022008c385d3fe93f3a6e10ec4ce78b67f5a93f3df43c08be7534ca55036aef291d701ffffffff0682a878de10392b1807abf35589c9a3aea4137b12d61716be974934a9b116cd0000000049483045022100f6dd23ae75da9f0ba01927f32bbe03e90e16f0f216227400c58f331b3526619002202c522e7b622409ee1974f03022940daf7b0046523b1c69c03fc16b3a55c21f1d01ffffffff066f21010b80faee30bca88603439389aa2274e52ca8f4d288d6881997a1f06f000000004847304402201d98276f505fc969ecc1f5f4df2d71e371b9537f94e466ab6b35594b13afbf1d02202dca6c57312019400809d9bcc7fedccda65d02ca0fb492a72f98128ca4b95d1001ffffffff066e38c8bf4aa889d9dcc53aeec1a95d548400211280fe24d4c0e73de69309bb0000000049483045022100e8255e4b42d3084a66afd9984c7345cec47a15b509f49c4b04d4fafce5bfb77c02206152baa639a6393a4f86db5fd6739cfd096701a1617210aa7138dd8c752bd46701ffffffff06507713eb6ba1246886e7c8364b5c7aeece7251f85d0ba50190365651e161c7000000004847304402203a19e60986b7f45ba8dedaaefae62ab3d9052787c650d6bb5b1168a5afdeafb002201e9691b6093383af569463158d6dcfb6dd6649054c6a3aeaafa435d36b74dc0201ffffffff06195fcbe6c657da6cbfc69892ffb67470fbae568fa826169201aabdc2f2ad82000000004948304502210080952f9f65195b4f2122bba7e14c049a4253b5c356d548c550bb38f1317a31f002205b7c3743bfbab00ff100174edf1367aee599c6df02afde5c62680b68d1ecd64901ffffffff0612f70038d70cfff5a1bf02d39357d567aa0b02e98c97fd877399fbd0763dff0000000048473044022056104b269b860662025808532cc594a11de207be0b0121a247aa1c3abfa834cc02204486e95cb0d1b27a41e4b3af458c6181c0e6d2a97eb8fb32df313ce423e8f81601ffffffff06204e000000000000302ea22c8020979f9b424db4e028cdba433622c6cd17b9193763e68b4572cd7f3727dcd335978103120c008203000401cc1027000000000000302ea22c8020749dd6534e79a31aeba03df3b0ea58632a0beffc3411b54b7cc0e714ae2dd61f8103120c008203000401cc00e1f50500000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc1027000000000000302ea22c8020979f9b424db4e028cdba433622c6cd17b9193763e68b4572cd7f3727dcd335978103120c008203000401cc502198000000000023210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac0000000000000000fd19076a4d150713520d41746f6d696357617272696f72210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270afde006e4f25d02a6aebaa196ef1ba40f9c8156ff691b5505c72c304f9bcb4c0506167447056dc7341b1431132d0099e8e0a7c134fdad28e6ef8a290c24652260502f43876c043b5bc48f8624c2c396ce1a10e2da59fb73d5523bbe830eabfa6271f33981c54b519c25cd6a76f8298d4f380c96c8dda1a95b45c672bce7c67afa1620cafb5650c1b48758256548b6513f4b8862aa2ca959d244a3955fe095cbf07458e6dec3f73d1afa9f4cf40213d3e7355499cc23f9cec63437a352751d2b95a0353e5ccf70eb2ec5b6d00bba3f12d8e5af3ee752612361e0eb474a3f7221175462e9c171bc6cf709aa5ab53a7683c24decd759f97503a2118f798da1eac081ab7c9e61fe8697746dbe1e798690c9ee600ee53eb336b714130404ed9c5f0d1407a007641b723e59c9bd5178cd42953d10b97d367fd75fa0cccdbe7daaee7b11698e667f1fec2a78d5b94a013efc2d9fce26ef7bcb44371e04854a0f039256fbbe0d472f89b572f5a252528d426a6642fb92d243092b35976b54ece95e0ac246491f6dd024a7ba6cc164fd5172e50c893ef974abe1929f286036cdaf7a5c0395bee9d8feab5b80c07cf4d0b88e4df10a08bd4187bcf82e34a5631a32fae96ec25f992e20b7987df6d0d70535dc247640c00a3b4baeca3a579fa91dad116f3fac11223be5848bd9f34edd0fa3528adde06896f1e363ded56ad6feee9b9bda41f32d4d1279d005e6eb7997bb73dd085154738d11ab800a3d0964c441cb2117d6859ce6908b0525161bec38ccfa3ad71f6005b5891facfc54a2a25b758f8067f754abe41fc769ecea5b83c0a91f4edf549760954276d4f3703c7c563c5a9003501ceed81f382903d581fcb1fd823a0a9caea81250005cee48e98676df2f0cea71fc2ef0decf3d3bdd7b0d5c8ef7f64a8b6fe160290b57c2724bbbb264ed2b6f48a585174c30afd51cd5bb43138d7f88853cb9919a697816c9d0ccdee186858eb48d76853abfdf1629a3a3d781786b55ca1d19413304341b3db4e2a390b410d8da35597d53be07149a1da27c1e0c439565f404259cfbf9a90511bca1f3bc2c7d9592c95eb83da99f848f551a402004e7a7af1896d05899da19e2a133ee50dce1eba96ffb626340cdf713cedf8579fd76d65f144f47065b4517b6be66cdf112029300ccdfda9158be86845195f5e7a50c90a7360e4470ec7b28700393d0d8685cc32c5f352de03f38efc2b6a379def182aae527ee18dd69c0e4cf1398b220e26dd052371a83db082f55318c0e0fc27568f5a6122484f889cb73d29c8da6f91a65035543088a87e68c2b8ce2f7c87a0613f89a04d372e19a1aaaa5309a032d01c20b8d56c819a85fa19f2ae1dbdf36c83b65fbdf76026cc91925ca06254759c0b6613e11a9cda6413e52695fb20cd61145d477d779a389e63eaeeefe6bcd1588e7b149cdb234616764f13b8e61e045d2ce9e53668aab202d7d941fb5d314fbb2c12d9baf71ccd2a43ae8745973626ac4d3c15b4d4df8a756bafaa6c56f3cddf78e3cc008c909ab31bf9716283d1c91688efba7ecc048218a5becee52cbb22fdd57f6907563106aae0ba8daded1050a3617d5962d108aece6b25309fbb63f739beba4dd5117c7d36ce5ea324c2fe98b27e9094acd8e9038e41ae5e7f5e7db705f1b297a341f3ba10f3a86942581d97825e97e0e43b0308cb3b283d303b5115c539cf4b51e0e963aff3270b696159fce3e3e7e5887a15e2c40c0fc308d037adcbde18e765915bd990039df9e78c5af9e5a7ab96bfc79680e2c6e937599893a737a8fb0910309cd75dac3b699a048274a987fa1b3d70d80a21eb23ba8191b508440ba5264998d46ba951df5a022226efcf8526e765cb88048675ab5bf3158bde9776f670b3e914c44c1ce5dfbb806a27b7155e8b3a12e728899b61781ddd1e7000ae120afd025675d50c491ffd7e97698feddfb1cff0b0d1cc428d2f0be466e58a081985d444777c4add2475fc80dfb4bba5e191b4bc6b631fad2d96a910254366b94fe45c116d08c8c01c0158073f9f5af721f08d772f95ac5a6d55b69c9adc3abc4e9d816cf4bdb86fec744fcf0817142079fb97c74335eda37b2bb4124c6ed91ef1b1c7285195a197d82dd755697c9136e49b652bfdbf7682558d8f70fa9adb9c4c5c0b32545fdf7313f6d68fe0a77c38c49b18ae79dc57aaba711e8ae3f8be3a007f84bf26b3f8967b95f4696d3a37598f69deab9e3d1e251d6a095280e1e3d1f873aa53942182dac1bf768a4c3bd8df15fa58589ca7e979dc5f6707729f064d1cc24bedbe3ad9404a1767918278677362a253a723223da676331c4cabe11afc441a365abdeb119fa5f6b66107efdd2546ada80014b382a62e90f360127279ffb54835b34ce886d2918160b05d9b4e91996467aacc6dcfffd56c13138c04e50b63693a3a6e3843b649ed2e18986aea35d35634343a7c50de1aeb8730f6276080549bf43a1ba00000000f55700000000000000000000000000 +``` + +###### Response + + + ```bash + ea448ff66aa925239cff7ca748d3aea62474187fefbd1c15fcaaa14c4529b82a + ``` + + +## send + +**cclib send 19 '\["handle", "pubtxid", amount]'** + +The `send` method sends the specified amount of coins to a `handle` associated with the `pubtxid` + +#### Arguments + +| Name | Type | Description | +| ------- | -------- | --------------------------------------------- | +| handle | (string) | the recipient's handle | +| pubtxid | (string) | the id of the handle-registration transaction | +| amount | (number) | the amount of coins to send | + +#### Response + +| Name | Type | Description | +| ------ | -------- | ------------------------------------------------------------------------------ | +| handle | (string) | the recipient's handle | +| hex | (string) | the transaction hex; broadcast this using the sendrawtransaction method | +| txid | (string) | the transaction id generated when the hex is broadcast | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib send 19 '["AtomicWarrior","ea448ff66aa925239cff7ca748d3aea62474187fefbd1c15fcaaa14c4529b82a",1]' +``` + +###### Response + + + ```json + { + "handle": "AtomicWarrior", + "hex": "0400008085202f890b07d7463ac5b5ff1212587b75c8415a92a628e4dc211561b90ea5ac7b37af2935000000004847304402205055d1e1babbd1216613d6e57e23b7de86ebc6a4df935db181a10ad9b1e6d23302202d69603b098a0565df5ddf1cafe96cd0fd591fe47c4fa2701e77135ed3c797af01ffffffff0ac7f5fbcfa6fe533bb619d98cca38406b6b97e69d91090c2a1b9fc210163890000000004847304402201b4cf6a262534b5e1ddeca3e1289cb0d32e4a9f1349b557a998ea455c02a890d022008eed182ee47bff2d14af9d130704c4a38bc7bd683c38c9cee81142c208e112e01ffffffff0a43b879094d181d1d3746320f50edd11b931a32fb666ffac69b3fabf52e78e40000000048473044022067c0ca1d5166566b82c73217369ab19acbb53a01a8d7ff1636c5f77d735e5f7202201d542b4dbe7ea47a102f460f7930c183d9022fcfe35437b5f7898c154267e56a01ffffffff0a33490539d3829b5a7c2f6de716003a50ecd5228c79104517c718aa8de2ce8c0000000049483045022100c683d67b101ecc094c84607a3e10d9387aa47520a48e3f60d446fc9e8d85624b02203d520bb85d860858c947d7e138b7228ad810da47a6ce37cbb530f8811d24c0d301ffffffff0a3292a70b1a9fe7a3617abc9ba62da3d01bd0388b18dce657b795ee83a0b1390000000049483045022100f2cb8a23e21256dccfc778be883bd0a2961c5df5295cf66ec0ba6bfb8b4bc046022035c25c9b477946fe89c3ca5e26a045c441d13ec17e34864e16155ff9146be98e01ffffffff09be749efbfc980b15412a17871be7dbf521e13670bf1c8361c5a25e63daf69a000000004847304402200c5aa79cf8cb57c2907996b12671137ae8703e95b446ff16bcc719f64405a6ec02201e01bf4cf19899de0de7f171511e726618d9ea85534537d15b2ebfd74e2876c501ffffffff09970f055331edf5f93031a82fb909bb1aa6002eb557b4a6edbd858eb966febf0000000049483045022100a2fb27660fbdb3d5781e57a81cc3984cdf180855c6ef7335dd01d2ec35c709b5022069059395a6fa1bbb43ab2235f7f80c73bd3c8d29bc7fd50892c70cf15508a17001ffffffff093930519de533d4330040a695cc8646f61fa748542101b8d3d8345d4d35af700000000047463043021f3046d7bc0279e1c8fe114ccbdee8f15056371c66f0cef0beab44f6f522732f0220686b590b057847912c3e80eae4de68dc6a28c331917fd3671d1ee4aad31c785601ffffffff087d867b365921b9f063a2e58575b86fb52a6ad8d119edcc8714eba24e770a0100000000484730440220020d29a6f465428fd481b1ed11b4b9e2f086e2b6a19aa67c1002f5db65a92fa502205befab5889abb22d4e774633d6073f46827424325317d2813f3b64058fb544b001ffffffff08172d2236ac25430e3bdb64593fd2a440ceb32b007779f6f792f319d187a6570000000048473044022056060b04e790137ae7891d050063c2dda3be5ffbc7f1be30be8d9312949d47a702205634bca2147819b6b9a497783075d78636cd73d1fd263b380317ae1015c9b63601ffffffff0807d4a2de4712a21cf48b89f8667765506bd8a525265c836adbcc43c3fdb3b70000000049483045022100e45854defca9139c4f12ed2d4a8123758978ec9e8c685e580484dbfa72179858022019a354068e28c4807cecb95d85dc6a6b67b83657d8636108f28ba1eddf30037b01ffffffff0300e1f50500000000302ea22c8020749dd6534e79a31aeba03df3b0ea58632a0beffc3411b54b7cc0e714ae2dd61f8103120c008203000401cc706f98000000000023210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac0000000000000000246a2213782ab829454ca1aafc151cbdef7f187424a6aed348a77cff9c2325a96af68f44ea00000000f55700000000000000000000000000", + "txid": "18e3a7c746e8eb7a7e1835e54e46ef6f227fb41c7142bf0304b453c0034b31fb", + "result": "success" + } + ``` + + +###### Broadcast the hex + +```bash +./komodo-cli -ac_name=MUSIG sendrawtransaction 0400008085202f890b07d7463ac5b5ff1212587b75c8415a92a628e4dc211561b90ea5ac7b37af2935000000004847304402205055d1e1babbd1216613d6e57e23b7de86ebc6a4df935db181a10ad9b1e6d23302202d69603b098a0565df5ddf1cafe96cd0fd591fe47c4fa2701e77135ed3c797af01ffffffff0ac7f5fbcfa6fe533bb619d98cca38406b6b97e69d91090c2a1b9fc210163890000000004847304402201b4cf6a262534b5e1ddeca3e1289cb0d32e4a9f1349b557a998ea455c02a890d022008eed182ee47bff2d14af9d130704c4a38bc7bd683c38c9cee81142c208e112e01ffffffff0a43b879094d181d1d3746320f50edd11b931a32fb666ffac69b3fabf52e78e40000000048473044022067c0ca1d5166566b82c73217369ab19acbb53a01a8d7ff1636c5f77d735e5f7202201d542b4dbe7ea47a102f460f7930c183d9022fcfe35437b5f7898c154267e56a01ffffffff0a33490539d3829b5a7c2f6de716003a50ecd5228c79104517c718aa8de2ce8c0000000049483045022100c683d67b101ecc094c84607a3e10d9387aa47520a48e3f60d446fc9e8d85624b02203d520bb85d860858c947d7e138b7228ad810da47a6ce37cbb530f8811d24c0d301ffffffff0a3292a70b1a9fe7a3617abc9ba62da3d01bd0388b18dce657b795ee83a0b1390000000049483045022100f2cb8a23e21256dccfc778be883bd0a2961c5df5295cf66ec0ba6bfb8b4bc046022035c25c9b477946fe89c3ca5e26a045c441d13ec17e34864e16155ff9146be98e01ffffffff09be749efbfc980b15412a17871be7dbf521e13670bf1c8361c5a25e63daf69a000000004847304402200c5aa79cf8cb57c2907996b12671137ae8703e95b446ff16bcc719f64405a6ec02201e01bf4cf19899de0de7f171511e726618d9ea85534537d15b2ebfd74e2876c501ffffffff09970f055331edf5f93031a82fb909bb1aa6002eb557b4a6edbd858eb966febf0000000049483045022100a2fb27660fbdb3d5781e57a81cc3984cdf180855c6ef7335dd01d2ec35c709b5022069059395a6fa1bbb43ab2235f7f80c73bd3c8d29bc7fd50892c70cf15508a17001ffffffff093930519de533d4330040a695cc8646f61fa748542101b8d3d8345d4d35af700000000047463043021f3046d7bc0279e1c8fe114ccbdee8f15056371c66f0cef0beab44f6f522732f0220686b590b057847912c3e80eae4de68dc6a28c331917fd3671d1ee4aad31c785601ffffffff087d867b365921b9f063a2e58575b86fb52a6ad8d119edcc8714eba24e770a0100000000484730440220020d29a6f465428fd481b1ed11b4b9e2f086e2b6a19aa67c1002f5db65a92fa502205befab5889abb22d4e774633d6073f46827424325317d2813f3b64058fb544b001ffffffff08172d2236ac25430e3bdb64593fd2a440ceb32b007779f6f792f319d187a6570000000048473044022056060b04e790137ae7891d050063c2dda3be5ffbc7f1be30be8d9312949d47a702205634bca2147819b6b9a497783075d78636cd73d1fd263b380317ae1015c9b63601ffffffff0807d4a2de4712a21cf48b89f8667765506bd8a525265c836adbcc43c3fdb3b70000000049483045022100e45854defca9139c4f12ed2d4a8123758978ec9e8c685e580484dbfa72179858022019a354068e28c4807cecb95d85dc6a6b67b83657d8636108f28ba1eddf30037b01ffffffff0300e1f50500000000302ea22c8020749dd6534e79a31aeba03df3b0ea58632a0beffc3411b54b7cc0e714ae2dd61f8103120c008203000401cc706f98000000000023210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac0000000000000000246a2213782ab829454ca1aafc151cbdef7f187424a6aed348a77cff9c2325a96af68f44ea00000000f55700000000000000000000000000 +``` + +###### Response + + + ```bash + 18e3a7c746e8eb7a7e1835e54e46ef6f227fb41c7142bf0304b453c0034b31fb + ``` + + +## sign + +**cclib sign 19 '\["msg", "hexseed"]'** + +The `sign` method signs a given 32 byte `msg` (message) in hex format using the supplied Dilithium `hexseed`. + +#### Arguments + +| Name | Type | Description | +| ------- | -------- | ------------------------------ | +| msg | (string) | the 32 byte hexmessage to sign | +| hexseed | (string) | the seed to sign the message | + +#### Response + +| Name | Type | Description | +| --------- | -------- | -------------------------------------------------- | +| msg32 | (string) | the signed message | +| pkaddr | (string) | the hashed representation of the Dilithium pubkey | +| skaddr | (string) | the hashed representation of the Dilithium privkey | +| signature | (string) | the signature generated | +| sighash | (string) | the hash of the signature | + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib sign 19 '["5175616e74756d20526573697374616e636520697320617765736f6d65212121","a70a8e7d2281beaf0762a11590fb566 +d7af32325ae4252609149de37658e2eb5"]' +``` + +###### Response + + + ```json + { + "msg32": "5175616e74756d20526573697374616e636520697320617765736f6d65212121", + "pkaddr": "PCD25oVW6JVzkNgg3MUB21uorh7BDj6TtD", + "skaddr": "SS5MD2wTc96MqPPeSviWc6pk9MTg8xT137", + "signature": "d89f666a168c6c704a80c63165a93edb1c8c4a23f1e47feb160122669fc081735a66f5c95d1ac524e6bc2e719114e13be356e8e890ba16358464c5498181e2cc6d9f49066588c11f89f89c5f09a3ca122990cbe576c85c81a283a1ef9d69e162dfb6547f5fc09265cac4cca94a30850ee5f6fd638e4d3a9f59576fa1ef6bf621a04f506aa7cbe76bfad672f107131948de8fdc2925e90268bf240de4aa1859a20b529432dedb5253490f0b45295e81e1541e9ffb2c8774b6822c45a038dee590fc9f2ab1826015d37c678d2b9a91349b7f2c78c43379af0ec5dc85206d192142ed14be09acb304d1b8531a3885a2bf48022600b911420ff99340899fe4f7e4c921f10a65948c145ac5f7c685e72bbb23a1ac4557b1a91b3191a5ec7f229254c740a03a4c296fc1249cf953bb9a17f0a1fe6a63b351b3ff8a2bfb0bb0c047564e01dcfa87c5616e1cf09578672c64269b5277cb82b8f054a058b8fed76159bfa82fdcd9b65662f63a1cad4ce74941ebf342760ce1511b435b9d4b77a3aa9c48964543e711a32a8d76de338647ba6f9d0c7582a517fe4f6bc2a25b976ba7214cf88b09857e365780d2c8d5fe158b53c02ffc5083eb83effbf41cc33051214d8b97d510ae4cf76cbc8c2e03c3f17ffed1cc2143d6f6154b9ed8bc7db97a06843ca1de096e4050a81e4bec673bd333380bc824bc80e9a1e6a4dae1846cd5738bca677365e6166ee87ba34b86ac74bcd322be3434fda5ef802a7714248f4854ce39f9c6f9a1249353dbef610b2616f6a083c3699bc7c8e5ca6865cc15fde196b2faa88e3e1126c818185bca2275762d9ec8ec440d0489c0725908c8fd104f99c8bf730bda01e31c202e43f186d09f11c0de4825c49f88ece9ffa23d462c502332210afa9af5110134c35b68718b0f117df6b45b9aa0466c95e95f81ed19794a2dc33cfd58ee4fcb4f824ffdc8e238a32317f2584db98e7bda9b2f661842b3924edaa441dea32b4e5357c3f8d424d48acf3d3f0964e69e64130b2d3c5ebc806135cc53fa8f1e1a04444ac5116177dd08e17c2c29cfa49971ec083cf8ebe424f3e84c4e5630c7b5053f9607a9b4df56195d8a07c3eee4bb265cd6fea253fb7af45855c712b83a0f5c01732fbf73ac8931edaccae71367956c5374f4d7c96c1ffcde9fc2d0d8fbc5eb4fc8d3829be53f1b2e537ac1ee659111438c2a6d11acb4f502594ae617685b1176aba19a79dc9d754b48db84cb6a83c9dbcc4ce0ed6b640d31bfed99df78f8a34521e0fde9bd14e168eeaf6cb4da6a29b48df655fba872312f9f876fcc8125b7b3768046e8f9d28f0c5526b9dc2b26887fe79e0b1e0b065055698ff27c68bb0dbdda057d0b5616cdcc89a8538ee1d030ca6ca6f6db71d0b1cd0f03cdc96c9cb3bb45689e923820d17f36d675a764402bf6b08fe7b3356f75fe51644ee577dc209760c6195afe71c7d8e32fdedd2a035ddf29561252ea92e4f7e674eb0c6a679f1fe4d1a63e3423f3e36e60ce93ec12a4e88bd2546b25d8c702990a55fdc37d1d5bfc1fdb029851464ebecadef443f03eb126bf48a06f43afac89278e9e8b100295137139b7d37706c36d0a3687181cf10ede3a4e2cbcc478831dbbd99eee03f9bcff02a2f1887a9ee85f932d3e22eb43d4541ef48528a921814e1d203086507df78f84bc119afc2febf445660c73e88739d53be3762ae3c6800413cb2d963239b4ce1b0a2634e938df33d20f8e056d56047adca62876c5db389a71a9f11376c39295c69ebf09dd0a30d4d5d91971b6ff60e5a0d755863ba813a0fd8f8a7baab677a455f930308499bbc86c36ceadf1b9c37e6118fae9ce015d5851db272799bf75da81545d57b6a2d36358e1f4f5fdc00e9121a9d531ce52c89a64b24705daa0a8dad8707dc5e11ac6565fd763758b530f7a890cfb1dd7561d94c6df9681bf528252f4c99beb5fdcb2cca134b50ffe69d2160df4bd3c7ec51da9c189c8743f19624c9ec69dfd52bce1a8da90fef8d5294c2f477489bbfc23be3a65d0a797485d0235c40b56fc2aab90fcff1da0a3b065a439cde62d895b1111f33c7ecbb96991908757ff47b053bdb8afca97e5f2acabbc8c37f35185b25ac2c43b8c30aafca78c371ee0c1e0dd7132e603309b702b8de2f185f527fd6b74855599f70353cc3befc3654b557761027cc867dfa1632bb3ad94a5458296588333991d2e16a296450de5e4a0599af4f79a011b02c657ff045a8a95572ce069f3362f82fe7558ad76e1272f45badb32900c1cc47643f5476f9dafbf0f6d5a50da8d2405cea4777e1e1b293a766f448ef6ef94fd185ceeb341e369ff2ec9dfe37a18978557ea22336eee6e57a21614e457a46ef2711f112f925ad111d08c88bb05b0bd9d9f8fe9a53250c562b5f18a2534118a2221b91b1420b801d48115c99f91285483cf5d7a7bd23af0bea1dfc034b6941b9b2dc6181614cfb7328c3f4894485c1dd59b11e646498e3957911d87e3a0e1d602046527b7de329acf1ea0f5a8e9b5112d174004454a11b1e594c1f7f14bc1bb51047042b5d99b8b4e9bd0aa47502dd00557585dd36d19a93c48a935434f59b8aacdef2fadbddd5bba5c55f864e01c7648a16f6c7f35b9d1c08aaaa53e42c2200be756dbeb2ebfb8222f0dffad6683f640c7dab52d1c3d501b7c72628aba1bfd4ee089325e4972e62f8313487864737ad29714417af7357c8ac967a4dc0e8fb3ed55d94dd9094529f6f71a4f6afbc65556e556251b988e751deb1a4a898fa4af1ce50db0173709bf8265259862676ae3ba2a399994b36474ef3b44b18321bdadbbede76bf7e5313e0e197587f7e674edf402a01136fb0d366d5c9e9d6ab804fa73b630585346e6d271cf012b2891ebd85f308c5f97b179c18ee6f4ad6b10e33e9a7e2142b21a06afd5b65b773b1d0a5dc9f879d40ab264069689db4644c3d631bd8efab0c9721525e31d25dcd1af9c71dfa9a5da7cbc84811ec97e63f1f3b3c3f443bb6e59f6c1a115bd336cf2d485b53fafc84f8018c4a2ee1b9319a9b2d7a1e06b8862bc4ba82313d74a9fceabe2eab540fdb1434edb0339df7217b2125ab2bb9079fd1859877ef11e16fdcf7bbb9654be4f829760f51f439e05baa0c283b7576adfd43329cc044416b45cb3078646bcbc69bcb5dd23f3e0ae5a695fe3ac96b0a934696445bc395fb12c5b8d1e4d256c1a61aa79397a6453dc4adf11d79320f0294ad2e95e3ace72f616be3b02b40953b24e3d724baca91d2dc435c22e527df93cd48d65fa3e63f4cf355d97a4ddf2ee87ce09f919846df7a16c13584ad0dd10002e6f166121392eb7c8f081edefa703b73882f61b0f77946e16b4625b6f814df9e7392274387406a05d8fe7c58e664745813a65ce16133e55d49ebfdac252da5682f1a41d51ac38ae579e643098a4ae5172be6fbf9f6c51c124eabb90a28978825f3ed67f53bcdd4f81247121369c5974343ac939c4384088a35ba2473d8e81ad6834f7bdb949b92a21ba258f7b246966d4343e7ea44e4b6f9909cf112a1f25362fe8c684b010f875e994fb87b65aef8ff59b2df4703261a57cbaba9962915d50ae7405c89163a093a21c782a62fa524d4921078f896d61aecca2128a9ce0c3f481cc0cdb16b3666239383e7e180890819297c60a93b2f5841cf665eb5266394a10e6d0afc4f600938826fd13858e88e19b319876168de379162c578b25c4c87f46b47c005ebc79073e4770a46e9ccc5009b19d4a84d68bd68a7bac9fe0bd6a51ebae9ee6e6a7cd082802f0a53c7cdb4a4f3b2d7b15a9fc23bfdc10c88c185938916c0f70ba40dc26e80d86602051de0faa3503841b3ff12ec2cd0ac1bd9d86e2f098ad1246a93d63619d482634bea69a1c883a7b9e35b91fe67b35a02837750f363616a4ed572e8d6dd8595abe0bf1571ad6ebd5b16df8bad53b1d6bdb1e391702c91abf0e8feb3499fddd040e06c46647cecfbef85505b0670f1184878e3ee15bd3d93546a028917ef445a8fc1c26319b00c0b0e41e74e00447a6c5cfd63bfa09d3d68c3ecae03d2335662ee2e79dc907a4f5f91b5650d29020c99b3be715d225a9d8a21cf5394235bf035209052b76f815cebc0afa5993f8eb6ff944a3ce56ec14bd3e3ad84f1bfe05073c3d970082a852efd037537ba299fea304cc6e6c61cfa08e013df36501937f6cbd84cc7057ec8a471ea2e4931287db6c62d923f4c902382cc7ee4f9d49ae9857f59d67bfc58c277e44b1ea3f9582864733d1b898ba98108478dc003012b4010bca9e8ece18e3180b11cb8a31e293951e07ebfba7e770faea8b2f674eb535375f2254a3e20f1e2da32631a4752295ece3b072d21c1fba4d33a3415c9578c1c2052e34d5fabbf957ef2352e0c4e8885461841a3d47436738cc5c53e2c043a424f30458d1ed9d6b6b30cf6a7eda861b540ac25164e00f220496c46f93b3fa7fb7ea8a843ef3b3cde50882422bd9414f858f603c108f2c3c157c0c9eb41c185a27fcdb149e210a1e252a4647496e7477acb5b6c0dbe4fafbff1a26576162a0cef1f502071b1d333650666a91939aa8b0d9eef2fb08101319246d7e9ca8b4b9bac5d0d7f1fa0f25283540516169778385abbfd4e2ff0d141a566a7f8688969ed5d8ef00000000000000000000000000000000000000000000000000000000131c2e3f4f5c0526a000cc00420628b002b0002ced051021a0029004103b8840111402048000ae8f26f33c9de7075175616e74756d20526573697374616e636520697320617765736f6d65212121", + "sighash": "d75fc97edbb645e4aeb1605da41208e57159c6e7" + } + ``` + + +## spend + +**cclib spend 19 '\["sendtxid", "scriptPubKey", "hexseed"]'** + +The `spend` method spends the coins recieved in the transaction of id `sendtxid` to a [scriptPubkey](/antara/api/musig/#calcmsg) using the supplied seed. + +{/* */} + +#### Arguments + +| Name | Type | Description | +| ------------ | -------- | ----------------------------------------------------------------------------------------- | +| sendtxid | (string) | the id of the transaction that sent coins to the handle associated with the seed supplied | +| scriptPubKey | (string) | the [scriptPubkey](/antara/api/musig/#calcmsg) to which the coins are to be spent | +| hexseed | (string) | the seed used to register the handle which holds the funds | + +#### Response + +| Name | Type | Description | +| ------ | -------- | -------------------------------------------------------------- | +| hex | (string) | the hex to broadcast; use the sendrawtransaction method | +| txid | (string) | the transaction id generated when the hex is broadcast | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib spend 19 '["18e3a7c746e8eb7a7e1835e54e46ef6f227fb41c7142bf0304b453c0034b31fb","21029b086d4e3e0358f668ccc3da07df6343fb29970b742f0bc128f180994c5222c1ac","a70a8e7d2281beaf0762a11590fb566d7af32325ae4252609149de37658e2eb5"]' +``` + +###### Response + + + ```json + { + "hex": "0400008085202f8901fb314b03c053b40403bf42711cb47f226fef464ee535187e7aebe846c7a7e318000000007b4c79a276a072a26ba067a56580210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270a81409082aa1e061a82c0fd261b98af3a394cea7d269ac4656882335356cd315e426a128eccbbea03b6cfafe2349a193ccc587c08f6e2cdec8d71ce5ad8dbdd60f0bba100af03800113a10001ffffffff02f0b9f505000000002321029b086d4e3e0358f668ccc3da07df6343fb29970b742f0bc128f180994c5222c1ac0000000000000000fd6f0d6a4d6b0d13792ab829454ca1aafc151cbdef7f187424a6aed348a77cff9c2325a96af68f44eafd460d7e7405e78304eb2eb0e65a6e5cea9c82009db2977b7796f053d1ae5751ce9a12df055271025697ab447b5aacec5cd324f1b603407f71e711d7f88bc96915b91b5a8177d683f9b035c6a44aa2ae0a1b4be468c7875b4953139c8480ec5e6e5681e86edb715fd351cc2e4074f1d2905bb181d0072bf3effe370e891303485eb998c642e2b4182d527a06e18e1dc3d695f3278b571964ec59371fb17e6cbdf51c73983d8ea17c567c000b9229416a15dd4a812498840c77df30a0b68560afe1d97ba9b11610f0653f367c62245221d038d68eba0b4d9ed76f05b54e5a628c1ed79b29efe42e19f1956d1d660f45d53a3a9fe2a28692a212298a474ed94429c4760a2cc7db794632cb088de11082c1b6dc3db667329dc6988f1a74104bdf8db9805c98fbac074c187e62903305a4be8aa56ee5642123938493e0592ef288088e3124d0c6f621fa2bbc75812bd462fb5ba083d7e945cbf873c00e2b27b97493af56b83430dbaa5ca91be559ab062b7eccca238dbd756a5b8d4782800cd8ae6d511d2cf83234fa47af57fcd198a95c0ab120cbf448ba80ff2b517d28813e97019a055f62bea952c28d6f0f4f413af1bc34bdb07b01c4ed56447f45a89ef6d8c241926f9a35458ada85037455bced29d22e5e4ca0794155f291fcf96462ff3511df5887c2930134698d3bf8eba86640a07515078c543ae0e2c27e4c39d51da85c3d0bf27989100e112b36ab27c92a0c747c72a5ecad465c2084bc0f84d9782a6bbc07c28e0758d343e5f9f58bf21fc7b9c0c4e4eedeca95418a3d08df03b45505e6926df5742051f5aed11dce0932971e61e219e099438ae07cbb74b9d4372430473661eb2740d6198e7c1dcdc2adcbffb10e7a0320a5c41914201a350bdc69faf68f3ccc81904313672497c2d73aa80d2b0cece6d7687f482aee558d4e1b8f10875c419ad9b43711163c5de99598b9f214f29b0e413dd7dad0082aeae8526339b76bc051bc487c6872bc48f92108a053aad48101352439845c0207914ce503ad8f3bb34ee741ce89283f87e3b63fe1bfccd3ed0fde43224169b852877d6600cbb8d5abbc0c97bb0661439f42f2b35aaa88490aeabff7f783412f192fdb7d8857e20ec773a852dbeca61b9a94af50499e2159ca57caf68d87abd2519a8271187e8ed4cb47dc836a96fc230e99238e4839516f19e132356b31c35a14be7e4a05e3c4965bbe06dc0478768370b755816f727fc567141c53a704377f8f819574c114394665e7864a2fe2287f06bac869548a8a074435df870d9b5b903184efa7b27d57cbaa173efdd687317d0efbc9d33807f2f30ad0169b23a6e7624785ffd036db3abebff5fb9e83c6bcb126f59e8afcc3ece4f394051317e5886209270a591a49ce5a9eee6d57fd71e8ddacb3217cd8e9516c5087a58a2aac9b3244ccede7f8de1ed036d54721e0ed1d4c64173856bb7b9cb29885d94b251e0b81b9c7402dabebd18aac425df134dde8caa698267b293deff4df5d57081ef4a05985af681a0b92e3711157e4e9b39657c76098d6ff7723c7798dfb3ab717e301305aa224beac01a4108848d930f7d745cf985598832141b23ed65c27944e6b1a0a6af68696d31df5e14be28c0da6eef05170fc57c8ca54ac3bf6d0485ed8c56c3d50bfde244ab41bf6567a0da6375d3ccb2e9084e73be94f38afda17e843d8c23e703a7f8b14b52b7e7ff7c793b9ac6ee263265025813b1d0a69b762bddce2fbae197c3e2888abe307418b57b5ac0f2f62b1ae9dca2ff58e11440abf3bb952d1c40556dea5e4cae13982a8f79fe0664aff78328141f1e5ae3eb38b76c8906c540cf02d78ff411df6d433689f7ab3f76cddf0479c201dddb80681d9d0df66a33f9f110d71d93198b9e344a4661d48ae106e7372c578d408559f088a921956be384ce6aaa7e83ca90d6343b099fbc19fa8a7219018bca05cebb38c774cc24e0ac37f736ba1ccdf7b4f6d789cd2a945270bffdce7ddbb0e55512cb08853bd91244569662919d4973601fb21f37c3fc097e14679bb6cdeab7e81745993e630d9bbf75a871e45fb122543991447cd460b95c04fdf8aadf88bd4a1de392391a80fc8984090ba64e9f567fe471099fa887d5ec72f2fd192d88e2c12f3ee51b5e7ad7c06cfbd1becc5c94513a37c863e0c8678073777bd88bba225f4aed3b63cceab77e137c947b87573c29f925f1cb29ddb8bb478111d01b245c950a67637920187c1e2fff3b3ecec1444d9c8311d45e481e0093d54518285f9245c9f55a268e0249181a7986c4c48920a805cffe53ae9df7b894c9fc354c18f5e5cc2630129fd2a761cc93318cea211e934b3e5e74517210569a99578720b35746f25e7a7b8577afc93b5090624d8c337b9013a5050c15fb797a160ed00afc7367999170f6d81ffff30bb7487089a0323dc6702d94c023f2c0154b9308edfa61aca8df3df665f1f39e17c4ec109a68113487e70fac8701207656709bb154cb50301690d9521d06a49f5bff9e8f6e3789640bfd40bbbbec24d4d6842b31a5af7622e827b40e541959f034d491065b2c918d0852c5bd147cce268fb6368a2a08b993344a9bc6d9b74241a3d0cd49a350b6ab7b11d8bb81cfd8a2b51dd3847328b07086f4acb28fc8c04dce254882bb3aa538defd288510d4ae5bdc21f24a6e5efc34da8306bc2c44249930433fc80b0087c23d1f0d0978d2af4a53210ef652588b8400c79098b9eb0d72a0a0e48691037fa84cc2d168a4f964041cf5c41500a0841c988bf5448025c5603ae71fa0e6ce30015c7cc6b5a2d68a38b5e6b94d2b51c2c59c3f4a5718419a0964b42f50ef7e87646a4277bf7d74722a46baa01e24fa2d5fef6cf88df6754615cddb7c360f3adaa1f0652d0164e71c2579ba98e41c99e09d752c086db28b35bb5a5969863cce2011b66cf2f9dd90767d4fb75b9a41e8a71f00b296e99e70f77b718e18b16f2abf9f80da69f6e8bf976c8dc853ce71b38794f5aea7177fcd92dec08613070c29bc25bfb2e7b0759627b57df705e19e1d9c913ce29283078e50beea2f13b4647890e1e9efb2b4464fec741ee582c1f3ddaac2a80cea1bd1445505da5e47ca3791cd28221cf95fe0157d8639a35fdf6bde533220c86087d4a3d2ae07565901cc3334cb553ce1c46cb265ba8d96a43ac0899d73caa1ac336179ee4a4de37e098d5172bcddea4711549817ea9a03fcc59072692493ca9e8bff63be80bcb7866fe0e30716e2993b556850e5584fc2a31ae6df849f287015804c4d77411f26d6027f6217f490690d42c63fe593320fb1bf42d9a6fc5c43b686241f321b14eb7712f67be9adb0fcb494c0a595886c6a5bd53cdc40dd2fe457b7f2b2d08e24a610bd77912a90eaf3556728c88c6fc5096d6f990ee76ecf25d7c2057233256aca0a87558e6c8c9177cd3c72cb79f00c9114dddd8387509a3d42c2d9432b36a4f194ec6de793e0ff0d298a819a9c49c2f2dd18ad6bc2ebd307da5c8accc1fadc7fb5af63ddaa9ddd87141b2dc48999adc9dd2de3f3fc03b64c5e411716d6d7777405e844897f5e004602521824e01f20b55cd22a0efea4e6527a4a83e3bfe51d2f9f9955856d1dc1f9ba908d395cdfa09c913d6af648e7b003c2ae7fdd8ca071bd3178d4125b127e30c397916ddc26253cf99b1f92d416df36eef8a6a3390ef1dfae0094472eebe902e83548b3632688f069bf9df56a3487aa8f40c0fd977d1d5f9a8e5b7c5d9d622a511b1729648921a940f47ba5624018f0c2d2ffd432be4a35fda337ff1c07988585b00bb2d0c4777e8592ee4cb13824e0df605b3a133e3f2b3aa7cfb80caff54abfd960d75815d7b168ab546135041f6216790536cd3622877c7145f71a37e3b4f545c8e2b7a7511c926f922d277b1d79b964d9ded9251f2d4ed331b553a775e03986b7913693d226e4d3103132ff373459703f579def3fabb5ba75db75a46e6daecd1929448aa8c8754146f917ceabf1544edb8e6591d52deb5a76fe70a97fcdaa40f6cb1f5b3909b7722d6c5c80be5246398a7b7fea634676cd566b7902cc41ff420972db2e5b3ec32fdb7c5e3bbed55528dcd8dd95b5776fef3cdb0f47f891f7b845b39fb17d5a36ab486e76a15546869ffb91e7fa8b1524597751ef6dcd1a10d2be2c46a7116d5c77dd7a70116299aa0814a7094f9f998f47ac913ea33c3b0b8cb4daf28a056ee46ec2d5c70ee2ae28f0435d929dcd8351b06e0a977eca513d36de77428cff3ac5caeb2a8a1d839821fb15f8b5ecc3d8264030a3f1d83abd82eaa4d1166c6f898b756e5219e49f45ef1a6568357cac25d01cbddeb7d7657ec026d7de1c2110533f8a71d188e2f69b7845edc83b5c06532514c15dad6d93f682420ab48307413f3d620a97812a79b6cfdf570062c4707c9c5ccdaf38d638ffcbbdae3beb134fa621db08a58e90835496015f3fb0cf703987926a6e11a720d6d8e007942db9832053c6c99277ef30b5ed2e5283dae6856585cae24f4f9d7dd5d12161c38565d63898ccacde4044352577b828797a3a4a5b3b8d3d4dcdfeef0ff083544838babb6ced70d10151d2451616785a0b9dbe6eefc13204c4f7a848e9ca5cfd0d7dbe736393f619cc0cacde400000000000000000000000000000000000000000000000000000000000000000000000000000000000c202938464f24a12050276312810a8b40180800084828a083a202408000121311408308420055225fa43850a109000000000000000000000000000000000000000000000000000000000000000000000000f55700000000000000000000000000", + "txid": "b8ab2925fc4bd183299dcd06a5c460a3ac81a817e7ff3af049a8fd029a076bf2", + "result": "success" + } + ``` + + +##### Broadcast the hex + +```bash +./komodo-cli -ac_name=MUSIG sendrawtransaction 0400008085202f8901fb314b03c053b40403bf42711cb47f226fef464ee535187e7aebe846c7a7e318000000007b4c79a276a072a26ba067a56580210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270a81409082aa1e061a82c0fd261b98af3a394cea7d269ac4656882335356cd315e426a128eccbbea03b6cfafe2349a193ccc587c08f6e2cdec8d71ce5ad8dbdd60f0bba100af03800113a10001ffffffff02f0b9f505000000002321029b086d4e3e0358f668ccc3da07df6343fb29970b742f0bc128f180994c5222c1ac0000000000000000fd6f0d6a4d6b0d13792ab829454ca1aafc151cbdef7f187424a6aed348a77cff9c2325a96af68f44eafd460d7e7405e78304eb2eb0e65a6e5cea9c82009db2977b7796f053d1ae5751ce9a12df055271025697ab447b5aacec5cd324f1b603407f71e711d7f88bc96915b91b5a8177d683f9b035c6a44aa2ae0a1b4be468c7875b4953139c8480ec5e6e5681e86edb715fd351cc2e4074f1d2905bb181d0072bf3effe370e891303485eb998c642e2b4182d527a06e18e1dc3d695f3278b571964ec59371fb17e6cbdf51c73983d8ea17c567c000b9229416a15dd4a812498840c77df30a0b68560afe1d97ba9b11610f0653f367c62245221d038d68eba0b4d9ed76f05b54e5a628c1ed79b29efe42e19f1956d1d660f45d53a3a9fe2a28692a212298a474ed94429c4760a2cc7db794632cb088de11082c1b6dc3db667329dc6988f1a74104bdf8db9805c98fbac074c187e62903305a4be8aa56ee5642123938493e0592ef288088e3124d0c6f621fa2bbc75812bd462fb5ba083d7e945cbf873c00e2b27b97493af56b83430dbaa5ca91be559ab062b7eccca238dbd756a5b8d4782800cd8ae6d511d2cf83234fa47af57fcd198a95c0ab120cbf448ba80ff2b517d28813e97019a055f62bea952c28d6f0f4f413af1bc34bdb07b01c4ed56447f45a89ef6d8c241926f9a35458ada85037455bced29d22e5e4ca0794155f291fcf96462ff3511df5887c2930134698d3bf8eba86640a07515078c543ae0e2c27e4c39d51da85c3d0bf27989100e112b36ab27c92a0c747c72a5ecad465c2084bc0f84d9782a6bbc07c28e0758d343e5f9f58bf21fc7b9c0c4e4eedeca95418a3d08df03b45505e6926df5742051f5aed11dce0932971e61e219e099438ae07cbb74b9d4372430473661eb2740d6198e7c1dcdc2adcbffb10e7a0320a5c41914201a350bdc69faf68f3ccc81904313672497c2d73aa80d2b0cece6d7687f482aee558d4e1b8f10875c419ad9b43711163c5de99598b9f214f29b0e413dd7dad0082aeae8526339b76bc051bc487c6872bc48f92108a053aad48101352439845c0207914ce503ad8f3bb34ee741ce89283f87e3b63fe1bfccd3ed0fde43224169b852877d6600cbb8d5abbc0c97bb0661439f42f2b35aaa88490aeabff7f783412f192fdb7d8857e20ec773a852dbeca61b9a94af50499e2159ca57caf68d87abd2519a8271187e8ed4cb47dc836a96fc230e99238e4839516f19e132356b31c35a14be7e4a05e3c4965bbe06dc0478768370b755816f727fc567141c53a704377f8f819574c114394665e7864a2fe2287f06bac869548a8a074435df870d9b5b903184efa7b27d57cbaa173efdd687317d0efbc9d33807f2f30ad0169b23a6e7624785ffd036db3abebff5fb9e83c6bcb126f59e8afcc3ece4f394051317e5886209270a591a49ce5a9eee6d57fd71e8ddacb3217cd8e9516c5087a58a2aac9b3244ccede7f8de1ed036d54721e0ed1d4c64173856bb7b9cb29885d94b251e0b81b9c7402dabebd18aac425df134dde8caa698267b293deff4df5d57081ef4a05985af681a0b92e3711157e4e9b39657c76098d6ff7723c7798dfb3ab717e301305aa224beac01a4108848d930f7d745cf985598832141b23ed65c27944e6b1a0a6af68696d31df5e14be28c0da6eef05170fc57c8ca54ac3bf6d0485ed8c56c3d50bfde244ab41bf6567a0da6375d3ccb2e9084e73be94f38afda17e843d8c23e703a7f8b14b52b7e7ff7c793b9ac6ee263265025813b1d0a69b762bddce2fbae197c3e2888abe307418b57b5ac0f2f62b1ae9dca2ff58e11440abf3bb952d1c40556dea5e4cae13982a8f79fe0664aff78328141f1e5ae3eb38b76c8906c540cf02d78ff411df6d433689f7ab3f76cddf0479c201dddb80681d9d0df66a33f9f110d71d93198b9e344a4661d48ae106e7372c578d408559f088a921956be384ce6aaa7e83ca90d6343b099fbc19fa8a7219018bca05cebb38c774cc24e0ac37f736ba1ccdf7b4f6d789cd2a945270bffdce7ddbb0e55512cb08853bd91244569662919d4973601fb21f37c3fc097e14679bb6cdeab7e81745993e630d9bbf75a871e45fb122543991447cd460b95c04fdf8aadf88bd4a1de392391a80fc8984090ba64e9f567fe471099fa887d5ec72f2fd192d88e2c12f3ee51b5e7ad7c06cfbd1becc5c94513a37c863e0c8678073777bd88bba225f4aed3b63cceab77e137c947b87573c29f925f1cb29ddb8bb478111d01b245c950a67637920187c1e2fff3b3ecec1444d9c8311d45e481e0093d54518285f9245c9f55a268e0249181a7986c4c48920a805cffe53ae9df7b894c9fc354c18f5e5cc2630129fd2a761cc93318cea211e934b3e5e74517210569a99578720b35746f25e7a7b8577afc93b5090624d8c337b9013a5050c15fb797a160ed00afc7367999170f6d81ffff30bb7487089a0323dc6702d94c023f2c0154b9308edfa61aca8df3df665f1f39e17c4ec109a68113487e70fac8701207656709bb154cb50301690d9521d06a49f5bff9e8f6e3789640bfd40bbbbec24d4d6842b31a5af7622e827b40e541959f034d491065b2c918d0852c5bd147cce268fb6368a2a08b993344a9bc6d9b74241a3d0cd49a350b6ab7b11d8bb81cfd8a2b51dd3847328b07086f4acb28fc8c04dce254882bb3aa538defd288510d4ae5bdc21f24a6e5efc34da8306bc2c44249930433fc80b0087c23d1f0d0978d2af4a53210ef652588b8400c79098b9eb0d72a0a0e48691037fa84cc2d168a4f964041cf5c41500a0841c988bf5448025c5603ae71fa0e6ce30015c7cc6b5a2d68a38b5e6b94d2b51c2c59c3f4a5718419a0964b42f50ef7e87646a4277bf7d74722a46baa01e24fa2d5fef6cf88df6754615cddb7c360f3adaa1f0652d0164e71c2579ba98e41c99e09d752c086db28b35bb5a5969863cce2011b66cf2f9dd90767d4fb75b9a41e8a71f00b296e99e70f77b718e18b16f2abf9f80da69f6e8bf976c8dc853ce71b38794f5aea7177fcd92dec08613070c29bc25bfb2e7b0759627b57df705e19e1d9c913ce29283078e50beea2f13b4647890e1e9efb2b4464fec741ee582c1f3ddaac2a80cea1bd1445505da5e47ca3791cd28221cf95fe0157d8639a35fdf6bde533220c86087d4a3d2ae07565901cc3334cb553ce1c46cb265ba8d96a43ac0899d73caa1ac336179ee4a4de37e098d5172bcddea4711549817ea9a03fcc59072692493ca9e8bff63be80bcb7866fe0e30716e2993b556850e5584fc2a31ae6df849f287015804c4d77411f26d6027f6217f490690d42c63fe593320fb1bf42d9a6fc5c43b686241f321b14eb7712f67be9adb0fcb494c0a595886c6a5bd53cdc40dd2fe457b7f2b2d08e24a610bd77912a90eaf3556728c88c6fc5096d6f990ee76ecf25d7c2057233256aca0a87558e6c8c9177cd3c72cb79f00c9114dddd8387509a3d42c2d9432b36a4f194ec6de793e0ff0d298a819a9c49c2f2dd18ad6bc2ebd307da5c8accc1fadc7fb5af63ddaa9ddd87141b2dc48999adc9dd2de3f3fc03b64c5e411716d6d7777405e844897f5e004602521824e01f20b55cd22a0efea4e6527a4a83e3bfe51d2f9f9955856d1dc1f9ba908d395cdfa09c913d6af648e7b003c2ae7fdd8ca071bd3178d4125b127e30c397916ddc26253cf99b1f92d416df36eef8a6a3390ef1dfae0094472eebe902e83548b3632688f069bf9df56a3487aa8f40c0fd977d1d5f9a8e5b7c5d9d622a511b1729648921a940f47ba5624018f0c2d2ffd432be4a35fda337ff1c07988585b00bb2d0c4777e8592ee4cb13824e0df605b3a133e3f2b3aa7cfb80caff54abfd960d75815d7b168ab546135041f6216790536cd3622877c7145f71a37e3b4f545c8e2b7a7511c926f922d277b1d79b964d9ded9251f2d4ed331b553a775e03986b7913693d226e4d3103132ff373459703f579def3fabb5ba75db75a46e6daecd1929448aa8c8754146f917ceabf1544edb8e6591d52deb5a76fe70a97fcdaa40f6cb1f5b3909b7722d6c5c80be5246398a7b7fea634676cd566b7902cc41ff420972db2e5b3ec32fdb7c5e3bbed55528dcd8dd95b5776fef3cdb0f47f891f7b845b39fb17d5a36ab486e76a15546869ffb91e7fa8b1524597751ef6dcd1a10d2be2c46a7116d5c77dd7a70116299aa0814a7094f9f998f47ac913ea33c3b0b8cb4daf28a056ee46ec2d5c70ee2ae28f0435d929dcd8351b06e0a977eca513d36de77428cff3ac5caeb2a8a1d839821fb15f8b5ecc3d8264030a3f1d83abd82eaa4d1166c6f898b756e5219e49f45ef1a6568357cac25d01cbddeb7d7657ec026d7de1c2110533f8a71d188e2f69b7845edc83b5c06532514c15dad6d93f682420ab48307413f3d620a97812a79b6cfdf570062c4707c9c5ccdaf38d638ffcbbdae3beb134fa621db08a58e90835496015f3fb0cf703987926a6e11a720d6d8e007942db9832053c6c99277ef30b5ed2e5283dae6856585cae24f4f9d7dd5d12161c38565d63898ccacde4044352577b828797a3a4a5b3b8d3d4dcdfeef0ff083544838babb6ced70d10151d2451616785a0b9dbe6eefc13204c4f7a848e9ca5cfd0d7dbe736393f619cc0cacde400000000000000000000000000000000000000000000000000000000000000000000000000000000000c202938464f24a12050276312810a8b40180800084828a083a202408000121311408308420055225fa43850a109000000000000000000000000000000000000000000000000000000000000000000000000f55700000000000000000000000000 +``` + +###### Response + + + ```bash + b8ab2925fc4bd183299dcd06a5c460a3ac81a817e7ff3af049a8fd029a076bf2 + ``` + + +## verify + +**cclib verify 19 '\["pubtxid", "msg", "sig"]'** + +The `verify` method verifies whether the supplied signature was generated for the `msg` (message) by the seed corresponding to the `pubtxid`. + +The returned `handle` is directly associated with the same `pubtxid`. + +#### Arguments + +| Name | Type | Description | +| ------- | -------- | --------------------------------------------- | +| pubtxid | (string) | the id of the handle-registration transaction | +| msg | (string) | the signed message | +| sig | (string) | the signature generated | + +#### Response + +| Name | Type | Description | +| ------- | -------- | --------------------------------------------------------------------------- | +| sighash | (string) | the hash of the signature | +| msg32 | (string) | the signed message | +| handle | (string) | the handle that was registered with the seed used to sign the message | +| pkaddr | (string) | the hashed representation of the Dilithium pubkey corresponding to the seed | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib verify 19 '["ea448ff66aa925239cff7ca748d3aea62474187fefbd1c15fcaaa14c4529b82a","5175616e74756d20526573697374616e636520697320617765736f6d65212121","d89f666a168c6c704a80c63165a93edb1c8c4a23f1e47feb160122669fc081735a66f5c95d1ac524e6bc2e719114e13be356e8e890ba16358464c5498181e2cc6d9f49066588c11f89f89c5f09a3ca122990cbe576c85c81a283a1ef9d69e162dfb6547f5fc09265cac4cca94a30850ee5f6fd638e4d3a9f59576fa1ef6bf621a04f506aa7cbe76bfad672f107131948de8fdc2925e90268bf240de4aa1859a20b529432dedb5253490f0b45295e81e1541e9ffb2c8774b6822c45a038dee590fc9f2ab1826015d37c678d2b9a91349b7f2c78c43379af0ec5dc85206d192142ed14be09acb304d1b8531a3885a2bf48022600b911420ff99340899fe4f7e4c921f10a65948c145ac5f7c685e72bbb23a1ac4557b1a91b3191a5ec7f229254c740a03a4c296fc1249cf953bb9a17f0a1fe6a63b351b3ff8a2bfb0bb0c047564e01dcfa87c5616e1cf09578672c64269b5277cb82b8f054a058b8fed76159bfa82fdcd9b65662f63a1cad4ce74941ebf342760ce1511b435b9d4b77a3aa9c48964543e711a32a8d76de338647ba6f9d0c7582a517fe4f6bc2a25b976ba7214cf88b09857e365780d2c8d5fe158b53c02ffc5083eb83effbf41cc33051214d8b97d510ae4cf76cbc8c2e03c3f17ffed1cc2143d6f6154b9ed8bc7db97a06843ca1de096e4050a81e4bec673bd333380bc824bc80e9a1e6a4dae1846cd5738bca677365e6166ee87ba34b86ac74bcd322be3434fda5ef802a7714248f4854ce39f9c6f9a1249353dbef610b2616f6a083c3699bc7c8e5ca6865cc15fde196b2faa88e3e1126c818185bca2275762d9ec8ec440d0489c0725908c8fd104f99c8bf730bda01e31c202e43f186d09f11c0de4825c49f88ece9ffa23d462c502332210afa9af5110134c35b68718b0f117df6b45b9aa0466c95e95f81ed19794a2dc33cfd58ee4fcb4f824ffdc8e238a32317f2584db98e7bda9b2f661842b3924edaa441dea32b4e5357c3f8d424d48acf3d3f0964e69e64130b2d3c5ebc806135cc53fa8f1e1a04444ac5116177dd08e17c2c29cfa49971ec083cf8ebe424f3e84c4e5630c7b5053f9607a9b4df56195d8a07c3eee4bb265cd6fea253fb7af45855c712b83a0f5c01732fbf73ac8931edaccae71367956c5374f4d7c96c1ffcde9fc2d0d8fbc5eb4fc8d3829be53f1b2e537ac1ee659111438c2a6d11acb4f502594ae617685b1176aba19a79dc9d754b48db84cb6a83c9dbcc4ce0ed6b640d31bfed99df78f8a34521e0fde9bd14e168eeaf6cb4da6a29b48df655fba872312f9f876fcc8125b7b3768046e8f9d28f0c5526b9dc2b26887fe79e0b1e0b065055698ff27c68bb0dbdda057d0b5616cdcc89a8538ee1d030ca6ca6f6db71d0b1cd0f03cdc96c9cb3bb45689e923820d17f36d675a764402bf6b08fe7b3356f75fe51644ee577dc209760c6195afe71c7d8e32fdedd2a035ddf29561252ea92e4f7e674eb0c6a679f1fe4d1a63e3423f3e36e60ce93ec12a4e88bd2546b25d8c702990a55fdc37d1d5bfc1fdb029851464ebecadef443f03eb126bf48a06f43afac89278e9e8b100295137139b7d37706c36d0a3687181cf10ede3a4e2cbcc478831dbbd99eee03f9bcff02a2f1887a9ee85f932d3e22eb43d4541ef48528a921814e1d203086507df78f84bc119afc2febf445660c73e88739d53be3762ae3c6800413cb2d963239b4ce1b0a2634e938df33d20f8e056d56047adca62876c5db389a71a9f11376c39295c69ebf09dd0a30d4d5d91971b6ff60e5a0d755863ba813a0fd8f8a7baab677a455f930308499bbc86c36ceadf1b9c37e6118fae9ce015d5851db272799bf75da81545d57b6a2d36358e1f4f5fdc00e9121a9d531ce52c89a64b24705daa0a8dad8707dc5e11ac6565fd763758b530f7a890cfb1dd7561d94c6df9681bf528252f4c99beb5fdcb2cca134b50ffe69d2160df4bd3c7ec51da9c189c8743f19624c9ec69dfd52bce1a8da90fef8d5294c2f477489bbfc23be3a65d0a797485d0235c40b56fc2aab90fcff1da0a3b065a439cde62d895b1111f33c7ecbb96991908757ff47b053bdb8afca97e5f2acabbc8c37f35185b25ac2c43b8c30aafca78c371ee0c1e0dd7132e603309b702b8de2f185f527fd6b74855599f70353cc3befc3654b557761027cc867dfa1632bb3ad94a5458296588333991d2e16a296450de5e4a0599af4f79a011b02c657ff045a8a95572ce069f3362f82fe7558ad76e1272f45badb32900c1cc47643f5476f9dafbf0f6d5a50da8d2405cea4777e1e1b293a766f448ef6ef94fd185ceeb341e369ff2ec9dfe37a18978557ea22336eee6e57a21614e457a46ef2711f112f925ad111d08c88bb05b0bd9d9f8fe9a53250c562b5f18a2534118a2221b91b1420b801d48115c99f91285483cf5d7a7bd23af0bea1dfc034b6941b9b2dc6181614cfb7328c3f4894485c1dd59b11e646498e3957911d87e3a0e1d602046527b7de329acf1ea0f5a8e9b5112d174004454a11b1e594c1f7f14bc1bb51047042b5d99b8b4e9bd0aa47502dd00557585dd36d19a93c48a935434f59b8aacdef2fadbddd5bba5c55f864e01c7648a16f6c7f35b9d1c08aaaa53e42c2200be756dbeb2ebfb8222f0dffad6683f640c7dab52d1c3d501b7c72628aba1bfd4ee089325e4972e62f8313487864737ad29714417af7357c8ac967a4dc0e8fb3ed55d94dd9094529f6f71a4f6afbc65556e556251b988e751deb1a4a898fa4af1ce50db0173709bf8265259862676ae3ba2a399994b36474ef3b44b18321bdadbbede76bf7e5313e0e197587f7e674edf402a01136fb0d366d5c9e9d6ab804fa73b630585346e6d271cf012b2891ebd85f308c5f97b179c18ee6f4ad6b10e33e9a7e2142b21a06afd5b65b773b1d0a5dc9f879d40ab264069689db4644c3d631bd8efab0c9721525e31d25dcd1af9c71dfa9a5da7cbc84811ec97e63f1f3b3c3f443bb6e59f6c1a115bd336cf2d485b53fafc84f8018c4a2ee1b9319a9b2d7a1e06b8862bc4ba82313d74a9fceabe2eab540fdb1434edb0339df7217b2125ab2bb9079fd1859877ef11e16fdcf7bbb9654be4f829760f51f439e05baa0c283b7576adfd43329cc044416b45cb3078646bcbc69bcb5dd23f3e0ae5a695fe3ac96b0a934696445bc395fb12c5b8d1e4d256c1a61aa79397a6453dc4adf11d79320f0294ad2e95e3ace72f616be3b02b40953b24e3d724baca91d2dc435c22e527df93cd48d65fa3e63f4cf355d97a4ddf2ee87ce09f919846df7a16c13584ad0dd10002e6f166121392eb7c8f081edefa703b73882f61b0f77946e16b4625b6f814df9e7392274387406a05d8fe7c58e664745813a65ce16133e55d49ebfdac252da5682f1a41d51ac38ae579e643098a4ae5172be6fbf9f6c51c124eabb90a28978825f3ed67f53bcdd4f81247121369c5974343ac939c4384088a35ba2473d8e81ad6834f7bdb949b92a21ba258f7b246966d4343e7ea44e4b6f9909cf112a1f25362fe8c684b010f875e994fb87b65aef8ff59b2df4703261a57cbaba9962915d50ae7405c89163a093a21c782a62fa524d4921078f896d61aecca2128a9ce0c3f481cc0cdb16b3666239383e7e180890819297c60a93b2f5841cf665eb5266394a10e6d0afc4f600938826fd13858e88e19b319876168de379162c578b25c4c87f46b47c005ebc79073e4770a46e9ccc5009b19d4a84d68bd68a7bac9fe0bd6a51ebae9ee6e6a7cd082802f0a53c7cdb4a4f3b2d7b15a9fc23bfdc10c88c185938916c0f70ba40dc26e80d86602051de0faa3503841b3ff12ec2cd0ac1bd9d86e2f098ad1246a93d63619d482634bea69a1c883a7b9e35b91fe67b35a02837750f363616a4ed572e8d6dd8595abe0bf1571ad6ebd5b16df8bad53b1d6bdb1e391702c91abf0e8feb3499fddd040e06c46647cecfbef85505b0670f1184878e3ee15bd3d93546a028917ef445a8fc1c26319b00c0b0e41e74e00447a6c5cfd63bfa09d3d68c3ecae03d2335662ee2e79dc907a4f5f91b5650d29020c99b3be715d225a9d8a21cf5394235bf035209052b76f815cebc0afa5993f8eb6ff944a3ce56ec14bd3e3ad84f1bfe05073c3d970082a852efd037537ba299fea304cc6e6c61cfa08e013df36501937f6cbd84cc7057ec8a471ea2e4931287db6c62d923f4c902382cc7ee4f9d49ae9857f59d67bfc58c277e44b1ea3f9582864733d1b898ba98108478dc003012b4010bca9e8ece18e3180b11cb8a31e293951e07ebfba7e770faea8b2f674eb535375f2254a3e20f1e2da32631a4752295ece3b072d21c1fba4d33a3415c9578c1c2052e34d5fabbf957ef2352e0c4e8885461841a3d47436738cc5c53e2c043a424f30458d1ed9d6b6b30cf6a7eda861b540ac25164e00f220496c46f93b3fa7fb7ea8a843ef3b3cde50882422bd9414f858f603c108f2c3c157c0c9eb41c185a27fcdb149e210a1e252a4647496e7477acb5b6c0dbe4fafbff1a26576162a0cef1f502071b1d333650666a91939aa8b0d9eef2fb08101319246d7e9ca8b4b9bac5d0d7f1fa0f25283540516169778385abbfd4e2ff0d141a566a7f8688969ed5d8ef00000000000000000000000000000000000000000000000000000000131c2e3f4f5c0526a000cc00420628b002b0002ced051021a0029004103b8840111402048000ae8f26f33c9de7075175616e74756d20526573697374616e636520697320617765736f6d65212121"]' +``` + +###### Response + + + ```json + { + "sighash": "d75fc97edbb645e4aeb1605da41208e57159c6e7", + "msg32": "5175616e74756d20526573697374616e636520697320617765736f6d65212121", + "handle": "AtomicWarrior", + "pkaddr": "PCD25oVW6JVzkNgg3MUB21uorh7BDj6TtD", + "result": "success" + } + ``` + +export const title = "Faucet: On-Chain Crypto Funding Made Easy"; +export const description = "The Faucet Antara Module enables anyone to fund an on-chain faucet on any Smart Chain where it is enabled."; + +# Faucet + +## Introduction + +The Faucet Antara Module enables anyone to fund an on-chain faucet on any chain where modules are [enabled.](/antara/setup/antara-customizations/#ac-cc) A Smart Chain may have only one on-chain `faucet`. + +To receive funds from a `faucet`, the [faucetget](/antara/api/faucet/#faucetget) method can be executed by anyone on the Smart Chain, as long as their public address satisfies a few constraints. Their daemon's pubkey (corresponding to the address) must have no history of funds or transactions, and an address can claim faucet funds only once on a chain. The call also requires the node to perform a small PoW calculation; this deters leeching. + +When `faucetget` is executed, the on-chain `faucet` sends 0.1 coins to the address that corresponds to the node's pubkey. This requires about 30 seconds of CPU time. + +## faucetaddress + +**faucetaddress \[pubkey]** + +The `faucetaddress` method returns the Antara address information for the specified pubkey. If no pubkey is provided, the method returns information for the pubkey used to launch the daemon. + +### Arguments + +| Name | Type | Description | +| ------ | ------------------ | ------------------------------------------------------------------------------------------------- | +| pubkey | (string, optional) | the desired pubkey; the method uses the pubkey used to launch the daemon if no pubkey is provided | + +### Response + +| Name | Type | Description | +| --------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- | +| FaucetCCaddress | (string) | taking the faucet module's `EVAL` code as a modifier, this is the public address that corresponds to the faucet module's privkey | +| Faucetmarker | (string) | the internal address (not related to usage of faucet) | +| FaucetCCassets | (string) | the internal address (not related to usage of faucet) | +| GatewaysPubkey | (string) | the global pubkey for this Gateways module | +| CCaddress | (string) | taking the faucet module's `EVAL` code as a modifier, this is the Antara address from the pubkey of the user | +| myCCaddress | (string) | taking the faucet module's `EVAL` code as a modifier, this is the Antara address from the pubkey of the user | +| myaddress | (string) | the unmodified public address of the pubkey used to launch the chain | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD faucetaddress 03336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8 +``` + + + ```json + { + "result": "success", + "FaucetCCAddress": "R9zHrofhRbub7ER77B7NrVch3A63R39GuC", + "FaucetCCBalance": 0.0, + "FaucetNormalAddress": "RKQV4oYs4rvxAWx1J43VnT73rSTVtUeckk", + "FaucetNormalBalance": 0.0, + "FaucetCCTokensAddress": "RKaT8VfRSsu4qWL2kfW3PCzejrzJxi1TcJ", + "PubkeyCCaddress(Faucet)": "RReGLfH2MTrkeLSepkVy5vnQPE29g7KofS", + "PubkeyCCbalance(Faucet)": 0.0, + "myCCAddress(Faucet)": "RTedsYkavdn39m2jrQcKjCnq4MvikGCiZS", + "myCCbalance(Faucet)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"faucetaddress", "params":["03336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "FaucetCCAddress": "R9zHrofhRbub7ER77B7NrVch3A63R39GuC", + "FaucetCCBalance": 0.0, + "FaucetNormalAddress": "RKQV4oYs4rvxAWx1J43VnT73rSTVtUeckk", + "FaucetNormalBalance": 0.0, + "FaucetCCTokensAddress": "RKaT8VfRSsu4qWL2kfW3PCzejrzJxi1TcJ", + "PubkeyCCaddress(Faucet)": "RReGLfH2MTrkeLSepkVy5vnQPE29g7KofS", + "PubkeyCCbalance(Faucet)": 0.0, + "myCCAddress(Faucet)": "RTedsYkavdn39m2jrQcKjCnq4MvikGCiZS", + "myCCbalance(Faucet)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + }, + "error": null, + "id": "curltest" + } + ``` + + +## faucetfund + +**faucetfund amount** + +The `faucetfund` method funds the on-chain faucet. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +### Arguments + +| Name | Type | Description | +| ------ | -------- | ---------------------------------------------------------------------- | +| amount | (number) | the amount to add to the faucet, taken from the user's available funds | + +### Response + +| Name | Type | Description | +| ------ | -------- | ------------------------------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| hex | (string) | the data in hex-encoded format; you must broadcast this hex using the`sendrawtransaction` RPC for the command to complete | + +#### 📌 Examples + +Step 1: Specify faucet amount and get the raw transaction HEX value + +```bash +./komodo-cli -ac_name=HELLOWORLD faucetfund 100 +``` + + + ```json + { + "result": "success", + "hex": "01000000013c34d14c6a32219f4b633a1fe01f5826b3bd7b4cbe01c20cfc0c29138d9c99720100000049483045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf4885259501ffffffff0200e40b5402000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cce06d66fa15090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"faucetfund", "params":["100"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "01000000013c34d14c6a32219f4b633a1fe01f5826b3bd7b4cbe01c20cfc0c29138d9c99720100000049483045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf4885259501ffffffff0200e40b5402000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cce06d66fa15090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Broadcast/send raw transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000013c34d14c6a32219f4b633a1fe01f5826b3bd7b4cbe01c20cfc0c29138d9c99720100000049483045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf4885259501ffffffff0200e40b5402000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cce06d66fa15090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000 +``` + + + ```bash + f2baf8d9a1eaf42bb1a85462b5699ffc0f04e8c54aafc4661767df96be9022b7 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["01000000013c34d14c6a32219f4b633a1fe01f5826b3bd7b4cbe01c20cfc0c29138d9c99720100000049483045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf4885259501ffffffff0200e40b5402000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cce06d66fa15090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "f2baf8d9a1eaf42bb1a85462b5699ffc0f04e8c54aafc4661767df96be9022b7", + "error": null, + "id": "curltest" + } + ``` + + +Step 3: Decode raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 01000000013c34d14c6a32219f4b633a1fe01f5826b3bd7b4cbe01c20cfc0c29138d9c99720100000049483045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf4885259501ffffffff0200e40b5402000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cce06d66fa15090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000 +``` + + + ```json + { + "txid": "f2baf8d9a1eaf42bb1a85462b5699ffc0f04e8c54aafc4661767df96be9022b7", + "size": 225, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "72999c8d13290cfc0cc201be4c7bbdb326581fe01f3a634b9f21326a4cd1343c", + "vout": 1, + "scriptSig": { + "asm": "3045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf4885259501", + "hex": "483045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf4885259501" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 100.0, + "valueSat": 10000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc", + "reqSigs": 1, + "type": "condition", + "addresses": ["R9zHrofhRbub7ER77B7NrVch3A63R39GuC"] + } + }, + { + "value": 99899.9998, + "valueSat": 9989999980000, + "n": 1, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + } + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["01000000013c34d14c6a32219f4b633a1fe01f5826b3bd7b4cbe01c20cfc0c29138d9c99720100000049483045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf4885259501ffffffff0200e40b5402000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cce06d66fa15090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "f2baf8d9a1eaf42bb1a85462b5699ffc0f04e8c54aafc4661767df96be9022b7", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "72999c8d13290cfc0cc201be4c7bbdb326581fe01f3a634b9f21326a4cd1343c", + "vout": 1, + "scriptSig": { + "asm": "3045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf48852595[ALL]", + "hex": "483045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf4885259501" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 100.0, + "valueZat": 10000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["R9zHrofhRbub7ER77B7NrVch3A63R39GuC"] + } + }, + { + "value": 99899.9998, + "valueZat": 9989999980000, + "n": 1, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## faucetget + +**faucetget** + +The `faucetget` method requests the `faucet` module to send coins. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +The `faucetget` command yields 0.1 coins and requires about 30 seconds of CPU time to execute. + +### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +### Response + +| Name | Type | Description | +| ------ | -------- | ---------------------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| hex | (string) | the data in hex-encoded format; you must broadcast this hex using sendrawtransaction for the command to complete | + +#### 📌 Examples + +Step 1: Use faucetget and get the raw HEX value + +```bash +./komodo-cli -ac_name=HELLOWORLD faucetget +``` + + + ```json + { + "result": "success", + "hex": "01000000010941cea65a560aeae02f0d49770965490bd99eeac4185f25075685da58e99d40000000007b4c79a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001ffffffff02b077a43018090000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc00e1f50500000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"faucetget", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "01000000010941cea65a560aeae02f0d49770965490bd99eeac4185f25075685da58e99d40000000007b4c79a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001ffffffff02b077a43018090000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc00e1f50500000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Broadcast/send the raw transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000010941cea65a560aeae02f0d49770965490bd99eeac4185f25075685da58e99d40000000007b4c79a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001ffffffff02b077a43018090000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc00e1f50500000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000 +``` + + + ```bash + faucetget validated + 64760e66c49df97eea14896ecdd505d2d78ea214eb583c8a6a0ac863b2b989b3 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["01000000010941cea65a560aeae02f0d49770965490bd99eeac4185f25075685da58e99d40000000007b4c79a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001ffffffff02b077a43018090000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc00e1f50500000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "64760e66c49df97eea14896ecdd505d2d78ea214eb583c8a6a0ac863b2b989b3", + "error": null, + "id": "curltest" + } + ``` + + +Step 3: Decode the raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 01000000010941cea65a560aeae02f0d49770965490bd99eeac4185f25075685da58e99d40000000007b4c79a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001ffffffff02b077a43018090000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc00e1f50500000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000 +``` + + + ```json + { + "txid": "64760e66c49df97eea14896ecdd505d2d78ea214eb583c8a6a0ac863b2b989b3", + "size": 275, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "409de958da855607255f18c4ea9ed90b49650977490d2fe0ea0a565aa6ce4109", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001", + "hex": "4c79a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 99994.9995, + "valueSat": 9999499950000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc", + "reqSigs": 1, + "type": "condition", + "addresses": ["R9zHrofhRbub7ER77B7NrVch3A63R39GuC"] + } + }, + { + "value": 1.0, + "valueSat": 100000000, + "n": 1, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + } + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["01000000010941cea65a560aeae02f0d49770965490bd99eeac4185f25075685da58e99d40000000007b4c79a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001ffffffff02b077a43018090000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc00e1f50500000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "64760e66c49df97eea14896ecdd505d2d78ea214eb583c8a6a0ac863b2b989b3", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "409de958da855607255f18c4ea9ed90b49650977490d2fe0ea0a565aa6ce4109", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001", + "hex": "4c79a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 99994.9995, + "valueZat": 9999499950000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["R9zHrofhRbub7ER77B7NrVch3A63R39GuC"] + } + }, + { + "value": 1.0, + "valueZat": 100000000, + "n": 1, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## faucetinfo + +**faucetinfo** + +The `faucetinfo` method displays the balance of funds in the chain's faucet. + +### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +### Response + +| Name | Type | Description | +| ------- | -------- | ------------------------------------------- | +| result | (string) | whether the command executed successfully | +| name | (string) | the name of the faucet module | +| funding | (number) | the amount of funds available in the faucet | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD faucetinfo +``` + + + ```json + { + "result": "success", + "name": "Faucet", + "funding": "200207.99860023" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"faucetinfo", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "name": "Faucet", + "funding": "200207.99860023" + }, + "error": null, + "id": "curltest" + } + ``` + +export const title = "Antara Gaming SDK"; +export const description = + "This module-based software is programmed in C++ 17 and is designed for high-speed runtime execution."; + +# Gaming + +## Introduction + +Welcome to the Antara Gaming SDK documentation. This module-based software is programmed in C++ 17 and is designed for high-speed runtime execution. + + + The modules of the Antara Gaming SDK rely on other modules, such as [Oracles](/antara/api/oracles/) + + +## config + +The `antara::gaming::config` class provides a function to load customized configuration settings for the Antara Gaming SDK. + +### load\_configuration + +#### Public Function + +The `load_configuration` function loads customizable configuration settings from a path and filename. + +* If the parameter path does not exist the function attempts to create the directories of the given path +* If the configuration does not exist, the function creates a default configuration +* If the path and the name of the file exists, the function loads the configuration contents + +#### Usage Pattern + +```cpp +template + +TConfig antara::gaming::config::load_configuration(std::filesystem::path &&config_path, std::string filename) +``` + +#### Template Parameters + +| Name | Type | Description | +| ------- | -------- | ---------------------------- | +| TConfig | typename | the type of template to load | + +#### Function Parameters + +| Name | Type | Description | +| ------------ | --------------------- | -------------------------------------------------------------------- | +| config\_path | std::filesystem::path | the path to the directory in which the configuration file is located | +| filename | std::string | the name of the configuration file | + +#### Response + +| Name | Type | Description | +| ------- | -------- | ------------ | +| TConfig | template | the template | + +#### 📌 Example + +```c +auto cfg = config::load_configuration(std::filesystem::current_path() / "assets/config", "my_game.config.json"); +``` + +## core + +The `antara::gaming::core` class provides functions and information relevant to +the core Antara Gaming SDK library. + +### version + +#### Public Function + +The `version` function returns the current version of the Antara Gaming SDK. + + + The result of this function can be deduced at compile time. + + +#### Usage Pattern + +```cpp +#include + +constexpr const char *antara::gaming::version() +``` + +#### Function Parameters + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +#### Response + +| Name | Type | Description | +| --------------- | ------------- | -------------------------------------------- | +| current version | const char \* | the current version of the Antara Gaming SDK | + +#### 📌 Example + +```c +#include +#include + +void print_version() { + std::cout << antara::gaming::version() << std::endl; +} +``` + +## ecs::system\_manager + +The `antara::gaming::ecs::system_manager` class provides methods to perform tasks such as the manipulation of systems, the addition, deletion, and update of systems, and the deactivation of a system. + +### system\_manager + +#### Public Function + +The primary constructor function. + +#### Usage Pattern + +```cpp +#include + +system_manager(entt::registry ®istry, bool subscribe_to_internal_events = true) +``` + +#### Destructor + +``` +~system_manager() +``` + +#### Function Parameters + +| Name | Type | Description | +| ------------------------------- | -------------- | ------------------------------------------------------ | +| registry | entt::registry | an entity\_registry object | +| subscribe\_to\_internal\_events | bool | whether to subscribe to default system\_manager events | + +#### Response + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | void | | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager mgr{entity_registry}; +} +``` + +### receive\_add\_base\_system + +#### Public Function + +Public member functions. + +{/* The description in the documentation was unclear to me. Can you please provide more information about what "Public member functions" means here? Thx */} + +#### Usage Pattern + +``` +void receive_add_base_system(const ecs::event::add_base_system &evt) +``` + +#### Function Parameters + +| Name | Type | Description | +| ---- | ------------------------------ | ------------------------------- | +| evt | ecs::event::add\_base\_system& | {/* need a description here */} | + +#### Response + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | void | | + +{/* needs an example */} + +### start + +#### Public Function + +The `start` function informs the system manager instance that the developer's game is initiated and spinning. + + + This function allows for the execution of actions at the end of each frame. For example, an action could be the deletion of a sytem, or the addition of a new system which will continue to receive iterations and updates. + + +#### Usage Pattern + +```cpp +#include + +system_manager_instance.start(); +``` + +#### Function Parameters + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +#### Response + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | void | | + +{/* Does this return something such as a bool value, for successful execution, by chance? */} + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + system_manager.start(); + return 0; +} +``` + +### update + +#### Public Function + +The `update` function updates a system-manager instance. + +The logic of the function is designed to automatically manage the correct order of updates for the different types of systems the developer has added to their system-manager instance. + +* If the developer's logic has not loaded any systems into the system\_manager instance the function returns `0` +* If the developer's logic marks a system for deletion, the function deletes the system is automatically at the end of the current loop tick +* If the developer's logic adds a system through an `ecs::event::add_base_system` event, the function automatically adds the system at the end of the current loop tick + +#### Usage Pattern + +```cpp +#include + +std::size\_t nb\_systems\_updated = system\_manager.update(); +``` + +#### Function Parameters + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +#### Response + +| Name | Type | Description | +| ------------------------- | ------------ | ----------------------------- | +| number of systems updated | std::size\_t | the number of systems updated | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + system_manager.start(); + // ... add 5 differents systems here + std::size_t nb_systems_updated = system_manager.update(); + if (nb_systems_updated != 5) { + std::cerr << "Expect 5 system updates from system_manager.update(), but received only " << nb_systems_updated << std::endl; + } + return 0; +} +``` + +### update\_systems + +#### Public Function + +The `update_systems` function updates specific systems in a system\_manager instance. + +The [update](/antara/api/gaming/#update) (listed above) function calls this `update_systems` function multiple times each time the `update` function executes. + +The `update_systems` function is useful when the developer wishes to manually perform an update of a specific system. + +#### Usage Pattern + +```cpp +#include + +std::size\_t nb\_systems\_updated = system\_manager.update(); +``` + +#### Function Parameters + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +#### Response + +| Name | Type | Description | +| ------------------------- | ------------ | ----------------------------- | +| number of systems updated | std::size\_t | the number of systems updated | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + system_manager.start(); + // ... add 5 differents systems here + std::size_t nb_systems_updated = system_manager.update(); + if (nb_systems_updated != 5) { + std::cerr << "Expect 5 system updates from system_manager.update(), but received only " << nb_systems_updated << std::endl; + } + return 0; +} +``` + +### get\_system | 1 + +#### Public Function + +The `get_system` function uses a template parameter to return a reference to a system. + +#### Usage Pattern + +``` +template +const TSystem &get_system() const +``` + +#### Function and Template Type + +| Name | Type | Description | +| ------- | ----------------------------- | ------------------------------------------------------------------------------------ | +| TSystem | (determined by the developer) | the TSystem type represents any type of valid template, as designed by the developer | + +#### Response + +| Name | Type | Description | +| ------- | --------- | --------------------------------------------------- | +| TSystem | \&TSystem | a reference to the template chosen by the developer | + +{/* Need an example here */} + +### get\_system | 2 + +#### Public Function + +An overloaded version of the `get_system` function above. + +This overloaded function accepts different parameters. + +#### Usage Pattern + +```cpp +template + +TSystem &get_system() +``` + +#### Function and Template Type + +| Name | Type | Description | +| ------- | ----------------------------- | ------------------------------------------------------------------------------------ | +| TSystem | (determined by the developer) | the TSystem type represents any type of valid template, as designed by the developer | + +#### Response + +| Name | Type | Description | +| ------- | --------- | --------------------------------------------------- | +| TSystem | \&TSystem | a reference to the template chosen by the developer | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + system_manager.start(); + // ... added 2 differents systems here (render_system, and a log_system) + auto& render_system = system_manager.get_system(); + + const auto& log_system = system_manager.get_system(); + return 0; +} +``` + +### get\_systems | 1 + +#### Public Function + +The `get_systems` function accepts multiple template parameters and returns multiple systems. + +This function recursively calls the [get\_system](/antara/api/gaming/#get-system-1) function. Based on the logic of the different kinds of systems requested, this function updates the indicated systems in the correct order. + +#### Usage Pattern + +```cpp +template +std::tuple...> get_systems() +``` + +#### Function and Template Type + +| Name | Type | Description | +| ------- | ----------------------------------------------------- | ---------------------------------------------- | +| TSystem | std::tuple\ | a tuple containing multiple TSystems templates | + +#### Response + +| Name | Type | Description | +| -------- | ----------------------------------------------------- | --------------------------------------------------- | +| TSystems | std::tuple\ | a reference to the template chosen by the developer | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + system_manager.start(); + // ... added 2 differents systems here (render_system, and a log_system) + auto& render_system = system_manager.get_system(); + + const auto& log_system = system_manager.get_system(); + return 0; +} +``` + +### get\_systems | 2 + +#### Public Function + +An overloaded version of the [get\_systems](/antara/api/gaming/#get-systems-1) function. + + + This function is marked as [nodiscard.](https://en.cppreference.com/w/cpp/language/attributes/nodiscard) + + +#### Usage Pattern + +```cpp +template +std::tuple>...> get_systems() const +``` + +#### Function and Template Type + +| Name | Type | Description | +| ----------------- | ------------------------------------------------------------------------------ | ---------------------------------------------------- | +| tuple of TSystems | std::tuple\>...> | a tuple containing multiple TSystems templates types | + +#### Response + +| Name | Type | Description | +| ----------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------ | +| tuple of TSystems | std::tuple\>...> | a tuple containing multiple references to TSystems templates | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + // ... added differents systems here + // Called from a const context + auto &&[system_foo, system_bar] = system_manager.get_systems(); + + // Called from a non const context + auto&&[system_foo_nc, system_bar_nc] = system_manager.get_systems(); + + // Get it as a tuple + auto tuple_systems = system_manager.get_systems(); + return 0; +} +``` + +### has\_system + +#### Public Function + +The `has_system` function verifies whether or not a system is already registered in the [system\_manager](/antara/api/gaming/#system-manager). + +#### Usage Pattern + +```cpp +template +bool has_system() const +``` + +#### Template Type + +| Name | Type | Description | +| ------- | ----------------------------- | ------------------------------------ | +| TSystem | (determined by the developer) | the system that needs to be verified | + +#### Response + +| Name | Type | Description | +| ---------- | ---- | -------------------------------------------------------------------------------- | +| (variable) | bool | whether or not the indicated system is registered in the system manager instance | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + + bool result = system_manager.has_system(); + if (!result) { + // Oh no, i don't have a rendering system. + } + return 0; +} +``` + +### has\_systems | 1 + +#### Public Function + +The `has_systems` function verifies whether or not a list of systems is already registered in the [system\_manager](/antara/api/gaming/#system-manager). + +This function recursively calls the [has\_system](/antara/api/gaming/#has-system) function. + + + This function is marked as [nodiscard.](https://en.cppreference.com/w/cpp/language/attributes/nodiscard) + + +#### Usage Pattern + +```cpp +#include + +bool result = system_manager.has_systems(); +``` + +#### Template Type + +| Name | Type | Description | +| ---------------- | ------------------------------- | --------------------------------------------- | +| list of TSystems | template\ | the list of systems that needs to be verified | + +#### Response + +| Name | Type | Description | +| ---------- | ---- | ---------------------------------------------------------------------------------- | +| (variable) | bool | whether or not the indicated systems are registered in the system manager instance | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + + bool result = system_manager.has_systems(); + if (!result) { + // Oh no, atleast one of the systems is not present + } + return 0; +} +``` + +### has\_systems | 2 + +#### Public Function + +The `has_systems` function verifies whether or not a list of systems is already registered in the [system\_manager](/antara/api/gaming/#system-manager). + +#### Usage Pattern + +```cpp +template +bool has_systems() const +``` + +#### Template Type + +| Name | Type | Description | +| ---------------- | ------------------------------- | --------------------------------------------- | +| list of TSystems | template\ | the list of systems that needs to be verified | + +#### Response + +| Name | Type | Description | +| ---------- | ---- | ---------------------------------------------------------------------------------- | +| (variable) | bool | whether or not the indicated systems are registered in the system manager instance | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + + bool result = system_manager.has_systems(); + if (!result) { + // Oh no, atleast one of the systems is not present + } + return 0; +} +``` + +### has\_systems | 3 + +#### Public Function + +The `has_systems` function verifies whether or not a list of systems is already registered in the [system\_manager](/antara/api/gaming/#system-manager). + +This function recursively calls the [has\_system](/antara/api/gaming/#has-system) function. + + + This function is marked as [nodiscard.](https://en.cppreference.com/w/cpp/language/attributes/nodiscard) + + +#### Usage Pattern + +```cpp +#include + +bool result = system_manager.has_systems(); +``` + +#### Template Type + +| Name | Type | Description | +| ---------------- | ------------------------------ | --------------------------------------------- | +| list of TSystems | templat\ | the list of systems that needs to be verified | + +#### Response + +| Name | Type | Description | +| ---------- | ---- | ---------------------------------------------------------------------------------- | +| (variable) | bool | whether or not the indicated systems are registered in the system manager instance | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + + bool result = system_manager.has_systems(); + if (!result) { + // Oh no, atleast one of the systems is not present + } + return 0; +} +``` + +### has\_systems | 4 + +#### Public Function + +The `has_systems` function verifies whether or not a list of systems is already registered in the [system\_manager](/antara/api/gaming/#system-manager). + +This function recursively calls the [has\_system](/antara/api/gaming/#has-system) function. + + + This function is marked [nodiscard.](https://en.cppreference.com/w/cpp/language/attributes/nodiscard) + + +#### Usage Pattern + +```cpp +template +bool has\_systems() const +``` + +#### Template Type + +| Name | Type | Description | +| ---------------- | ------------------------------ | --------------------------------------------- | +| list of TSystems | template\ | the list of systems that needs to be verified | + +#### Response + +| Name | Type | Description | +| ---------- | ---- | ------------------------------------------------------------------------------ | +| (variable) | bool | whether or not the indicated systems are loaded in the system-manager instance | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + + bool result = system_manager.has_systems(); + if (!result) { + // Oh no, atleast one of the systems is not present + } + return 0; +} +``` + +### mark\_system + +#### Public Function + +The`mark_system` function marks a system for destruction at the next tick of the game loop. + +#### Usage Pattern + +```cpp +template +bool mark_system() +``` + +#### Template Type + +| Name | Type | Description | +| ------- | ------- | ---------------------------------- | +| TSystem | TSystem | the system to mark for destruction | + +#### Response + +| Name | Type | Description | +| ---------- | ---- | ------------------------------------------------- | +| (variable) | bool | whether or not the system was successfully marked | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + + bool result = system_manager.mark_system(); + if (!result) { + // Oh no the system has not been marked. + // Did you mark a system that is not present in the system_manager ? + } + return 0; +} +``` + +### mark\_systems | 1 + +#### Public Function + +The`mark_systems` function marks a system for destruction at the next tick of the game loop. + +#### Usage Pattern + +```cpp +template +bool mark_system() +``` + +#### Template Type + +| Name | Type | Description | +| ------- | ------- | ---------------------------------- | +| TSystem | TSystem | the system to mark for destruction | + +#### Response + +| Name | Type | Description | +| ---------- | ---- | ------------------------------------------------- | +| (variable) | bool | whether or not the system was successfully marked | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + + bool result = system_manager.mark_system(); + if (!result) { + // Oh no the system has not been marked. + // Did you mark a system that is not present in the system_manager ? + } + return 0; +} +``` + +### mark\_systems | 2 + +#### Public Function + +The `mark_systems` function marks a list of systems for destruction at the next tick of the game loop. + +This function recursively calls the [mark\_system](/antara/api/gaming/#mark-system) function. + + + This system is marked as [nodiscard.](https://en.cppreference.com/w/cpp/language/attributes/nodiscard) + + +#### Usage Pattern + +```cpp +template +bool mark_systems() +``` + +#### Template Type + +| Name | Type | Description | +| -------- | -------- | ----------------------------------- | +| TSystems | TSystems | the systems to mark for destruction | + +#### Response + +| Name | Type | Description | +| ---------- | ---- | ------------------------------------------------- | +| (variable) | bool | whether or not the system was successfully marked | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + + bool result = system_manager.mark_system(); + if (!result) { + // Oh no the system has not been marked. + // Did you mark a system that is not present in the system_manager ? + } + return 0; +} +``` + +### enable\_system + +#### Public Function + +The `enable_system` function enables a system. + +#### Usage Pattern + +```cpp +template +bool enable_system() +``` + +#### Template Type + +| Name | Type | Description | +| ------- | ------- | -------------------- | +| TSystem | TSystem | the system to enable | + +#### Response + +| Name | Type | Description | +| ---------- | ---- | -------------------------------------------------- | +| (variable) | bool | whether or not the system was successfully enabled | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + + bool result = system_manager.enable_system(); + if (!result) { + // Oh no, this system cannot be enabled. + // Did you enable a system that is not present in the system_manager ? + } + return 0; +} +``` + +### enable\_systems + +#### Public Function + +The `enable_systems` function enables a list of systems. + +This function recursively calls the [enable\_system](/antara/api/gaming/#enable-system) function. + +#### Usage Pattern + +```cpp +template +bool enable_systems() +``` + +#### Template Type + +| Name | Type | Description | +| -------- | -------- | --------------------- | +| TSystems | TSystems | the systems to enable | + +#### Response + +| Name | Type | Description | +| ---------- | ---- | ---------------------------------------------------- | +| (variable) | bool | whether or not the systems were successfully enabled | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + + bool result = system_manager.enable_systems(); + if (!result) { + // Oh no, atleast one of the requested systems cannot be enabled. + } + return 0; +} +``` + +### disable\_system + +#### Public Function + +The `disable_system` function disables a system. + +A disabled system is ignored during the game loop, but the system is not destroyed. + +#### Usage Pattern + +```cpp +template +bool disable_system() +``` + +#### Template Type + +| Name | Type | Description | +| ------- | ------- | --------------------- | +| TSystem | TSystem | the system to disable | + +#### Response + +| Name | Type | Description | +| ---------- | ---- | --------------------------------------------------- | +| (variable) | bool | whether or not the system was successfully disabled | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + + bool result = system_manager.disable_system(); + if (!result) { + // Oh no the system_manager cannot disable this system. + } + return 0; +} +``` + +### disable\_systems + +#### Public Function + +The `disable_systems` function disables a list of systems. + +This function recursively calls the [disable\_system](/antara/api/gaming/#disable-system) function. + +#### Usage Pattern + +```cpp +template +bool disable_systems() +``` + +#### Template Type + +| Name | Type | Description | +| -------- | -------- | ---------------------- | +| TSystems | TSystems | the systems to disable | + +#### Response + +| Name | Type | Description | +| ---------- | ---- | ----------------------------------------------------- | +| (variable) | bool | whether or not the systems were successfully disabled | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + + bool result = system_manager.disable_systems(); + if (!result) { + // Oh no, atleast one of the requested systems cannot be disabled. + } + return 0; +} +``` + +### nb\_systems | 1 + +#### Public Function + +The `nb_systems` function returns the number of systems registered in the system manager. + +#### Usage Pattern + +``` +std::size_t nb_systems() const +``` + +#### Template Type + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +#### Response + +| Name | Type | Description | +| ----------------- | ------------ | -------------------------------- | +| number of systems | std::size\_t | the number of systems registered | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + // added 2 systems here + auto nb_systems = system_manager.nb_systems(); + if (nb_systems) { + // Oh no, was expecting atleast 2 systems. + } + return 0; +} +``` + +### nb\_systems | 2 + +#### Public Function + +The `nb_systems` function is an overloaded version of the `nb_systems` function. This version returns the system number of a certain type to register in the system manager. + +#### Usage Pattern + +``` +std::size_t nb_systems(system_type sys_type) const +``` + +#### Template Type + +| Name | Type | Description | +| --------- | ------------ | ------------------------------ | +| sys\_type | system\_type | represents the type of systems | + +#### Response + +| Name | Type | Description | +| ----------------- | ------------ | ----------------------------------------- | +| number of systems | std::size\_t | the number of systems of a specified type | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + // added 2 systems of update type here + auto nb_systems = system_manager.nb_systems(system_type::pre_update); + if (nb_systems) { + // Oh no, was expecting atleast 2 systems of pre_update type. + } + return 0; +} +``` + +### create\_system + +#### Public Function + +The `create_system` function creates a system with the provided argument. + +This function is a factory. + +#### Usage Pattern + +```cpp +template +TSystem &create_system(TSystemArgs&&... args) +``` + +#### Template Type + +| Name | Type | Description | +| ----------- | ------- | ---------------------------------------------- | +| TSystem | TSystem | represents the type of system to create | +| TSystemArgs | (logic) | the arguments to create the constructed system | + +#### Response + +| Name | Type | Description | +| ------- | ------- | --------------------------------- | +| TSystem | TSystem | a reference to the created system | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + auto& foo_system = system_manager.create_system(); // you can send argument of the foo constructor here. + foo_system.update(); + return 0; +} +``` + +### create\_system\_rt + +#### Public Function + +{/* Requires documentation */} + +#### Usage Pattern + +```cpp +template +void create_system_rt(TSystemArgs&&... args) +``` + +### load\_systems + +#### Public Function + +The `load_systems` function loads many os systems. + +{/* What does "os" mean above? Operating systems? That would make it operating systems systems */} + +This function recursively calls the [create\_system](/antara/api/gaming/#create-system) function. + +#### Usage Pattern + +```cpp +template +auto load_systems(TArgs&&... args) +``` + +#### Template Type + +| Name | Type | Description | +| -------- | -------- | ------------------------------------ | +| TSystems | TSystems | represents a list of systems to load | + +#### Response + +| Name | Type | Description | +| ---------- | ------- | ------------------------- | +| (variable) | (tuple) | a tuple of systems loaded | + +#### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + antara::gaming::ecs::system_manager system_manager{entity_registry}; + auto&& [foo_system, bar_system] = system_manager.load_systems(); + foo_system.update(); + bar_system.update(); + return 0; +} +``` + +### clock + +#### Private Type + +#### Usage Pattern + +``` +using clock = std::chrono::steady_clock +``` + +``` +Private typedefs. + +syntactic sugar name for a chrono steady clock + +``` + +### system\_ptr + +#### Private Type + +#### Usage Pattern + +```cpp +using system_ptr = std::unique_ptr +``` + +``` +syntactic sugar name for a pointer to base_system +``` + +### system\_array + +#### Private Type + +#### Usage Pattern + +```cpp +using system_array = std::vector +``` + +``` +syntactic sugar name for an array of system_ptr +``` + +### system\_registry + +#### Private Type + +#### Usage Pattern + +```cpp +using system_registry = std::array +``` + +``` +syntactic sugar name for a multidimensional array of system_array (pre_update, logic_update, post_update) +``` + +### systems\_queue + +#### Private Type + +```cpp +using systems_queue = std::queue +``` + +``` +syntactic sugar name for a queue of system pointer to add. +``` + +### add\_system\_ + +#### Private Function + +#### Usage Pattern + +``` +base*system &add_system*(system_ptr &&system, system_type sys_type) +``` + +{/* Not clear about any of this, just placing here for now in the format */} + +### entity\_registry\_ + +#### Private Data Members + +## event::key\* + +The `antara::gaming::event` class contains functions and other elements that are common in gaming. + +### event::key\_pressed + +**struct key\_pressed** + +The `key_pressed` struct provides functions that execute when a user presses a key. + + + This class is automatically reflected for scripting systems such as Lua, Python. + + +#### Public Functions + +##### key\_pressed | 1 + +The `key_pressed` function is a constructor that takes arguments to associate a key with logic. + +This is the principal constructor for key-press functions. + +###### Usage Pattern + +``` + +key_pressed(input::key key_, bool alt_, bool control_, bool shift_, bool system_) + +``` + +###### Template Type + +| Name | Type | Description | +| --------- | ---------- | -------------------------------------------------- | +| key\_ | input::key | represents the keyboard key currently pressed | +| alt\_ | bool | true if the alt key on the keyboard is pressed | +| control\_ | bool | true if the control key on the keyboard is pressed | +| shift\_ | bool | true if the shift key on the keyboard is pressed | +| system\_ | bool | true if the system key on the keyboard is pressed | + +###### Response + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +###### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + dispatcher.trigger(input::key::a, false, false, false, false); +} +``` + +##### key\_pressed | 2 + +The `key_pressed` function that takes no arguments is the default constructor, provided for scripting-system convenience. + +{/* Is there more information we can provide here? */} + +Please see the [key\_pressed | 1](/antara/api/gaming/#key-pressed-1) function for more information. + +###### Usage Pattern + +``` +key_pressed() +``` + +#### Public Members + +##### antara::gaming::input::key key + +``` +Fields. +``` + +{/* I don't have enough information/knowledge to edit this portion. What is this section? What do you mean by "Fields" and "key pressed" specifically? */} + +``` +key pressed +``` + +##### bool alt = {"{false}"} + +``` +is alt pressed at the same time. +``` + +##### bool control = {"{false}"} + +``` +is ctrl pressed at the same time. +``` + +##### bool shift = {"{false}"} + +``` +is shift pressed at the same time. +``` + +##### bool system = {"{false}"} + +``` +is system pressed at the same time. +``` + +### event::key\_released + +The `antara::gaming::event::key\_released` class provides functions and other elements that associate the release of a key with logic. + + + This class is automatically reflected for scripting systems such as Lua, Python. + + +#### Public Functions + +##### key\_released + +The `key_released` function is a constructor that takes arguments to associate a key with logic. + +This is the principal constructor for key-release functions. + +###### Usage Pattern + +``` +key_released(input::key key_, bool alt_, bool control_, bool shift_, bool system_) +``` + +###### Template Type + +| Name | Type | Description | +| --------- | ---------- | --------------------------------------------------- | +| key\_ | input::key | represents the keyboard key currently released | +| alt\_ | bool | true if the alt key on the keyboard is released | +| control\_ | bool | true if the control key on the keyboard is released | +| shift\_ | bool | true if the shift key on the keyboard is released | +| system\_ | bool | true if the system key on the keyboard is released | + +###### Response + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +###### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + dispatcher.trigger(input::key::a, false, false, false, false); +} +``` + +##### key\_released | 2 + +The `key_released` function that takes no arguments is the default constructor, provided for scripting-system convenience. + +Please see the [key\_released | 1](/antara/api/gaming/#key-released) function for more information. + +###### Usage Pattern + +``` +key_released() +``` + +#### Public Members + +##### input::key key + +{/* Again, I don't understand this content well enough to edit */} + +``` +Fields. + +key released +``` + +bool alt = {"{false}"} + +``` +is alt released at the same time. +``` + +bool control = {"{false}"} + +``` +is ctrl released at the same time. +``` + +bool shift = {"{false}"} + +``` +is shift released at the same time. +``` + +bool system = {"{false}"} + +``` +is system released at the same time. +``` + +## event::quit\_game + +The `antara::gaming::event::quit_game` class provides functions and other methods to quit a game. + +### quit\_game + +The `quit_game` struct is an event that leaves a game and provides a return value. + + + This class is automatically reflected for scripting systems such as Lua, Python. + + +#### Public Functions + +##### quit\_game | 1 + +The `quit_game` function is a constructor that takes arguments and quits the game. + +This is the principal constructor for `quit_game` functions. + +###### Usage Pattern + +``` +quit_game(int return_value) +``` + +###### Template Type + +| Name | Type | Description | +| ------------- | ---- | ----------------------------------------------------- | +| return\_value | int | the return value of the program when leaving the game | + +###### Response + +| Name | Type | Description | +| ------------- | ---- | ----------------------------------------------------- | +| return\_value | int | the return value of the program when leaving the game | + +###### 📌 Example + +```c +#include +#include +#include + +int main() +{ + entt::registry entity_registry; + entt::dispatcher& dispatcher{registry.set()}; + dispatcher.trigger(0); +} +``` + +##### quit\_game | 2 + +The `quit_game` function that takes no arguments is the default constructor, provided for scripting-system convenience. + +Please see the [quit\_game | 1](/antara/api/gaming/#quit-game-1) function for more information. + +###### Usage Pattern + +``` +quit_game() +``` + +#### Public Members + +##### return\_value\_ + +{/* need more information to edit this part */} + +###### Usage Pattern + +``` +int return_value_ +``` + +``` +Fields. + +the return value of the program when leaving the game +``` + +#### Public Static Attributes + +##### invoker\_dispatcher + +###### Usage Pattern + +```cpp +constexpr const event::invoker_dispatcher invoker = {} +``` + +``` +Static fields. +``` + +## sfml + +The `antara::gaming::sfml` class provides functions and other elements for SFML-related (Simple and Fast Multimedia Library) logic purposes. + +### sfml::audio\_system + +The `antara::gaming::sfml::audio_system` class provides audio-related functions and other elements. + +###### Usage Pattern + +```cpp +class audio_system : public antara::gaming::ecs::system +``` + +#### Public Functions + +##### audio\_system + +{/* Need a description */} + +###### Usage Pattern + +```cpp +audio_system(entt::registry ®istry) +``` + +###### Function Parameters + +| Name | Type | Description | +| -------- | ------------- | -------------------- | +| registry | ent::registry | the entity\_registry | + +###### Response + +| Name | Type | Description | +| ------------- | ---- | ----------------------------------------------------- | +| return\_value | int | the return value of the program when leaving the game | + +##### update + +The `update` function destroys and clears the sounds when they are finished. + +###### Usage Pattern + +``` +void update() +``` + +###### Function Parameters + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +###### Response + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | void | | + +### sfml::component\_sound + +The `antara::gaming::sfml::component_sound` struct contains sound and the sound's attributes (such as volume). + +#### Public Members + +##### sound + +The `sf::Sound sound` object is the SFML Sound instance and contains the sound data. + +{/* Any other information here */} +export const title = "Gateways: Tokenizing Blockchain Assets Seamlessly"; +export const description = "The Gateway Antara Module allows the user to facilitate, manage, and trade tokenized representations of foreign blockchain assets."; + +# Gateways + +## Introduction + +The Gateway Antara Module allows the user to facilitate, manage, and trade tokenized representations of foreign blockchain assets. + +For example, a user is able to deposit their real-world BTC into a monitored address on the Bitcoin blockchain. Then, on the Gateways-enabled Smart Chain, the ownership of this BTC is tokenized. Only the owner of the token has the right to withdraw the BTC to a chosen address. The user that made the deposit can use the token either for asset trading, or for other creative purposes. + +This allows the Gateways-enabled Smart Chain to feature secure, on-chain, high-speed trading. + +Using an established Gateways contract is not considered difficult. However, setting up the gateway requires the user to closely follow several detailed steps. + +## Tutorial Availability + +The Antara Tutorials section features a full walkthrough of the Gateways module. + +[Link to Gateways Module Tutorial](/antara/tutorials/gateways-module-tutorial/#tutorial) + +## gatewaysaddress + +**gatewaysaddress** + +The `gatewaysaddress` method returns information about the on-chain gateway. + +### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +### Response + +| Name | Type | Description | +| ------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- | +| "result" | (string) | whether the command executed successfully | +| "GatewaysCCaddress" | (string) | taking the contract's EVAL code as a modifier, this is the public address that corresponds to the contract's privkey | +| "Gatewaysmarker" | (string) | the unmodified public address generated from the contract's privkey | +| "GatewaysPubkey" | (string) | the pubkey for the gateways module | +| "GatewaysCCassets" | (string) | this property is used for development purposes only and can otherwise be ignored | +| "myCCaddress" | (string) | taking the contract's EVAL code as a modifier, this is the Antara address from the pubkey of the user | +| "myaddress" | (string) | the public address of the pubkey used to launch the chain | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysaddress +``` + + + ```json + { + "result": "success", + "GatewaysCCAddress": "RKWpoK6vTRtq5b9qrRBodLkCzeURHeEk33", + "GatewaysCCBalance": 0.0, + "GatewaysNormalAddress": "RGJKV97ZN1wBfunuMt1tebiiHENNEq73Yh", + "GatewaysNormalBalance": 0.0, + "GatewaysPubkey": "03ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb40", + "GatewaysCCTokensAddress": "RSDw91hbCKkkNct6XtPRbq389eu2xKgHUC", + "myCCAddress(Gateways)": "RDrfw1gN8k2BXv6dPa9fqPH4TorbG7wiGf", + "myCCbalance(Gateways)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"gatewaysaddress", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "GatewaysCCAddress": "RKWpoK6vTRtq5b9qrRBodLkCzeURHeEk33", + "GatewaysCCBalance": 0.0, + "GatewaysNormalAddress": "RGJKV97ZN1wBfunuMt1tebiiHENNEq73Yh", + "GatewaysNormalBalance": 0.0, + "GatewaysPubkey": "03ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb40", + "GatewaysCCTokensAddress": "RSDw91hbCKkkNct6XtPRbq389eu2xKgHUC", + "myCCAddress(Gateways)": "RDrfw1gN8k2BXv6dPa9fqPH4TorbG7wiGf", + "myCCbalance(Gateways)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + }, + "error": null, + "id": "curltest" + } + ``` + + +## gatewaysbind + +**gatewaysbind tokenid oracletxid coin tokensupply M N pubkey(s) pubtype p2shtype wiftype \[taddr]** + +The `gatewaysbind` method binds the provided sources into a new gateway. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | ------------------------------------------------------------------------------------------------------------- | +| tokenid | (string) | the `tokenid` that the gateway will control as a proxy of foreign (off-chain) assets | +| oracletxid | (string) | the `oracletxid` under which the gateway should be created | +| name | (string) | the name of the coin represented by the gateway's proxy token | +| tokensupply | (number) | the maximum available supply of the proxy token; this should be equal to the total number of `tokenid` tokens | +| M | (number) | the minimum number of gateway signatory nodes required to facilitate a gateway transaction | +| N | (number) | the full number of gateway signatory nodes that will control the gateway | +| pubkey | (string) | the pubkey on which tokens will be available after conversion | +| pubtype | (number) | the prefix number of pubkey type of external chain | +| p2shtype | (number) | the prefix number of p2sh type of external chain | +| wiftype | (number) | the prefix number of wif type of external chain | +| taddr | (number) | the 2nd byte of prefix number of pubkey type (optional, only for 2 byte prefix chains) | + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step One: + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysbind 202277c3a48ef168b164f7995eaced940e6416afefd6acd5aac0cb0a439df210 51a3fa99ef2abb3c1ce8248896d934bd348b7a1e0c5dbc06688c976247263a25 KMD 100000000 1 1 024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0 60 85 188 +``` + + + ```json + { + "result": "success", + "hex": "010000000152d7d470197f5dc650c9ec09e1c8f4975d315219e3b6edad3c927c2fc23197ca0200000048473044022006bf373f1dd51c638a38d1e592741db73387e6acc186fca2011cd7283520ff770220673be91d346ba72adcbc9ab1df712f750047c2609399256c07ad3170d9ea850401ffffffff031027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cce05c9836180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac0000000000000000796a4c76f142034b4d443c550010f29d430acbc0aad5acd6efaf16640e94edac5e99f764b168f18ea4c377222000e1f5050000000001010121024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0253a264762978c6806bc5d0c1e7a8b34bd34d9968824e81c3cbb2aef99faa35100000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"gatewaysbind", "params":["202277c3a48ef168b164f7995eaced940e6416afefd6acd5aac0cb0a439df210" ,"51a3fa99ef2abb3c1ce8248896d934bd348b7a1e0c5dbc06688c976247263a25" ,"KMD" ,"100000000" ,"1" ,"1" ,"024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0" ,"60" ,"85" ,"188"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "010000000152d7d470197f5dc650c9ec09e1c8f4975d315219e3b6edad3c927c2fc23197ca0200000048473044022006bf373f1dd51c638a38d1e592741db73387e6acc186fca2011cd7283520ff770220673be91d346ba72adcbc9ab1df712f750047c2609399256c07ad3170d9ea850401ffffffff031027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cce05c9836180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac0000000000000000796a4c76f142034b4d443c550010f29d430acbc0aad5acd6efaf16640e94edac5e99f764b168f18ea4c377222000e1f5050000000001010121024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0253a264762978c6806bc5d0c1e7a8b34bd34d9968824e81c3cbb2aef99faa35100000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step Two: + +Broadcast using [sendrawtransction:](/smart-chains/api/rawtransactions/#sendrawtransaction) + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000152d7d470197f5dc650c9ec09e1c8f4975d315219e3b6edad3c927c2fc23197ca0200000048473044022006bf373f1dd51c638a38d1e592741db73387e6acc186fca2011cd7283520ff770220673be91d346ba72adcbc9ab1df712f750047c2609399256c07ad3170d9ea850401ffffffff031027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cce05c9836180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac0000000000000000796a4c76f142034b4d443c550010f29d430acbc0aad5acd6efaf16640e94edac5e99f764b168f18ea4c377222000e1f5050000000001010121024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0253a264762978c6806bc5d0c1e7a8b34bd34d9968824e81c3cbb2aef99faa35100000000 +``` + + + ```bash + aa1b82d78398184c93405ccd15e3cf00b63634aac98a7b75053aa90eaf9cb47d + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000152d7d470197f5dc650c9ec09e1c8f4975d315219e3b6edad3c927c2fc23197ca0200000048473044022006bf373f1dd51c638a38d1e592741db73387e6acc186fca2011cd7283520ff770220673be91d346ba72adcbc9ab1df712f750047c2609399256c07ad3170d9ea850401ffffffff031027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cce05c9836180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac0000000000000000796a4c76f142034b4d443c550010f29d430acbc0aad5acd6efaf16640e94edac5e99f764b168f18ea4c377222000e1f5050000000001010121024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0253a264762978c6806bc5d0c1e7a8b34bd34d9968824e81c3cbb2aef99faa35100000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "aa1b82d78398184c93405ccd15e3cf00b63634aac98a7b75053aa90eaf9cb47d", + "error": null, + "id": "curltest" + } + ``` + + +This is the `bindtxid` for the gateway. + + + FIXME new RPC added + gatewaysclaim and gatewayscompletesigning need a review and completion + + +## gatewaysclaim + +**gatewaysclaim bindtxid coin deposittxid destpub amount** + +The `gatewaysclaim` method allows the owner of the `deposittxid` to claim their on-chain proxy tokens. This method can only be executed by the owner of the `pubkey` that was used to launch the daemon from which the `gatewaysdeposit` call was executed. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | ------------------------------------------------------------------------------------------------ | +| bindtxid | (string) | the `bindtxid` of the gateway | +| coin | (string) | the name of the proxy token | +| deposittxid | (string) | the `deposittxid` returned after broadcasting the hex returned from the `gatewaysdeposit` method | +| destpub | (string) | the `pubkey` address to which the proxy tokens should be sent | +| amount | (number) | the amount to send to the `pubkey` | + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### :pushpin: Examples + +Step One: + +Command + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysclaim 897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d KMD 07d79e39354cc38a76dfe2ca8a5fb711432192237608ea066621662f13e0c08e 02d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d 0.1 +``` + + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"gatewaysclaim", "params":["897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d" ,"KMD" ,"07d79e39354cc38a76dfe2ca8a5fb711432192237608ea066621662f13e0c08e" ,"02d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d" ,"0.1"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + +Step Two: Broadcast using `sendrawtransction` + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000030a9a982a898012f4cc982796f381f16c9e2e5fe28e0be58ad59c7c90409530f8020000004847304402207959e4befae9e917cde7d6ba6f5e62e4cf679858b1a5c8b1eb270b1c7eac7c7e0220503ea9a24245db21b4db8ae68e48da6c5d33ef436371c6d03872d45d1364047c01ffffffffc6fc3b75a37a6ed10507a1bb73f2c5d5c8f75bcb358b0aa4bab3b80b5aa39f19010000007b4c79a276a072a26ba067a565802103ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb408140d4c46b8282d42d7e7ebe99361264c21b9ee221b7b3a47e1549e06bf06659fa194298618a2969a421543753a5994ebc3944e93ac6072a233ab617b229b3922a52a100af038001f1a10001ffffffff8ec0e0132f66216606ea08762392214311b75f8acae2df768ac34c35399ed707000000007b4c79a276a072a26ba067a565802102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d8140f3938953c9087e1e25c31263c5a717dd59d2f7d6f0815cfd7c0cb01a6c4d586b630b11cca1e60a19036d937095941660e488a07494fc721471d4a53f5eb89a25a100af038001f1a10001ffffffff048096980000000000302ea22c8020abd72b18452f1bc72f4312dbb1cd341b7c7f38a994ddacd8b35412231f01cb088103120c008203000401cc804a5d0500000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cc1027000000000000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000936a4c90e374bff603b64f309e344e34b10fd2053db59788909914f8488a7f73ddddc2165d31034b4d440d8d1f63bf680d6191b100d90992b0f6bf6ce1cc851f259da8b49e74524e7a898ec0e0132f66216606ea08762392214311b75f8acae2df768ac34c35399ed7072102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d809698000000000000000000 +``` + + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["01000000030a9a982a898012f4cc982796f381f16c9e2e5fe28e0be58ad59c7c90409530f8020000004847304402207959e4befae9e917cde7d6ba6f5e62e4cf679858b1a5c8b1eb270b1c7eac7c7e0220503ea9a24245db21b4db8ae68e48da6c5d33ef436371c6d03872d45d1364047c01ffffffffc6fc3b75a37a6ed10507a1bb73f2c5d5c8f75bcb358b0aa4bab3b80b5aa39f19010000007b4c79a276a072a26ba067a565802103ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb408140d4c46b8282d42d7e7ebe99361264c21b9ee221b7b3a47e1549e06bf06659fa194298618a2969a421543753a5994ebc3944e93ac6072a233ab617b229b3922a52a100af038001f1a10001ffffffff8ec0e0132f66216606ea08762392214311b75f8acae2df768ac34c35399ed707000000007b4c79a276a072a26ba067a565802102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d8140f3938953c9087e1e25c31263c5a717dd59d2f7d6f0815cfd7c0cb01a6c4d586b630b11cca1e60a19036d937095941660e488a07494fc721471d4a53f5eb89a25a100af038001f1a10001ffffffff048096980000000000302ea22c8020abd72b18452f1bc72f4312dbb1cd341b7c7f38a994ddacd8b35412231f01cb088103120c008203000401cc804a5d0500000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cc1027000000000000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000936a4c90e374bff603b64f309e344e34b10fd2053db59788909914f8488a7f73ddddc2165d31034b4d440d8d1f63bf680d6191b100d90992b0f6bf6ce1cc851f259da8b49e74524e7a898ec0e0132f66216606ea08762392214311b75f8acae2df768ac34c35399ed7072102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d809698000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + +## gatewayscompletesigning + +**gatewayscompletesigning withdrawtxid coin hex** + +## gatewaysdeposit + +**gatewaysdeposit bindtxid height coin cointxid claimvout deposithex proof destpub amount** + +The `gatewaysdeposit` method is used to alert the gateway of the completed deposit of the foreign (off-chain) asset. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +The `sendrawtransaction` method then returns a `txid` which serves as the **deposittxid**. + +### Arguments + +| Name | Type | Description | +| ---------- | -------- | -------------------------------------------------------------------------------------------------------------------- | +| bindtxid | (string) | the bindtxid of the gateway | +| height | (number) | the block height of the `txid` wherein the funds were sent to the foreign-asset gateway pubkey | +| name | (string) | the name of the foreign asset | +| cointxid | (string) | the `txid` returned when the foreign assets were sent to the gateway pubkey | +| claimvout | (string) | the `vout` of the claim (on the first use, this value should be 0) | +| deposithex | (string) | returned from the `txid` wherein the funds were sent to the foreign-asset gateway pubkey | +| proof | (string) | the proof for the `txid`; can be found using the [gettxoutproof](/smart-chains/api/blockchain/#gettxoutproof) method | +| destpub | (string) | the public key where the tokens should be received on the Smart Chain | +| amount | (number) | the amount of the deposit | + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysdeposit 897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d 1116196 KMD 907812ee8d2762b589f6ca88ee8ba18a65ebf5c7486c472df7395628d22d0d98 0 010000000197d6ea16c68dc5db95b72e029a0e23cb403ae0a33b561b863963cfd9cbfec747000000006b483045022100aca47515602989979b514b6211c375e4d0d9471dd8297c5238c12245ad01dd830220191105caf1b63313c6988194f5f03fd6f70d4a30edc7820add1185d35edff1bb012102924664b536f3710a8e8abea38bb4bf71b470a653a4dceabd50df08d7b2a38436ffffffff0310270000000000001976a9141b355cb6b76cab1b16cb873db8828fe5d2521ae488ac80969800000000001976a914f0d1fc29f8962ac2805a1659192d9ad26794d22988ac38c7fa00000000001976a91482804b943dd6a2008af73f8ba40449c062f0935188ac50e6fd5b 04000000380b8fd2b9bdf570358980a4c9fc94e418ac656913999b5f9a016ec5afc46b0b188320f231637a0ded0b0bdada1f34c81ad5873b8c3f096b2014018af13f43980000000000000000000000000000000000000000000000000000000000000000b2e6fd5ba786061d57fff87a00000000000046430000000000000200000000000000000000000000fd40050035435dd2c1df5c20cb48e0617b6cee81f5349f0735b36fe93f17f82d678ad3eb374d0e398b049fddcb21a4d7ddf7345867c6a363eddcfe61f31d49dbc35652794c60da61bd5f164fd554f17b5bd669f636744412822af2ebd0f318dacb71514720164c59c392ef2b1ccc3a5dc5c9c83cd37a11f98b97c8f5170a357a972ec3cacbeb0dab34b757354883b46a598f2b93fcd735b4163db6b2b037f7d7d71a773e909ac4ce3f1228012d5bebfd9edad9842ae8c6cddf6942c543594b85013591a604c4223a3d2e007ed25f5994e9d8f6b6a704daf57cad41aea9609923612eee2fc55ad075c91c23a8cc46af9a45a7390c537d2e2302994239ae44230537ceaa2188e7f4eb6a0ab55471d152b9177e9fd90843504f29d3e92fd3d7142caae018b51318ec6b86083b7e2d155ce868f6b673b13cf1ed59107d15c6c84201441dde14074930f4755ec64975f354a99bd957021c073768f575dde3ab020dd73b488e2d03d57bc414a16d45b3e2052b24fb2360ec5f73524525fc59d2151b89310b19764541b801ad72171085bc6275832222484b8d7ee6ed91ab6a544c45af5c4d8445b0624f04a234aec6997eecf007f0e971eea33b21e45ba8f72825fa84605cdfa929aeb6dc425f2612000e7ce2ba04ff8c53061154eb38cba7f6d0bfe5dab031dadea2095e01e93f9e063d0b42e412f865572625f77aa8b10b58f7b0428ea0ff530ea10d37150496bb181e37fc5814ad524ce4618955e9158b6aebb956b02b961f920ee48eb5a08efc39d27fc2fd4ec175e38798bcca7331a7b5da2ca6c56fcb98e740c2f471eac6b67ced78125c5fcecd4f76eac1d76233aa58ed808e398b9e2b1eaa74e773d18276b732239403ce0c452cb26f0f34156a0a63e007ccfbd76f168fb941fbd2fbe23b57e519835c804ace6e22e281b3d0adda7c4b93a87d94500103315c780fe91ee67320a422eecb4a6daedc2d774567bfebc1d5b72fa693178f3443aa1eb47f18d6931f7b0fc6ec151caad4eae5f787c2a963c3963ffc924ba66a7ea1754763faf2884de0c86a0f75fe7f8dfb1265b449184668cb7348520810cf731663f5180ac31642d6b135d5ce7de88ba63d6db3d6c5dfa19492281dfed3b3765451717f3497ac2b4c040e2e4e77219b2586c227cd138b8d94ccc273fbfbb51a35523870c503e2d8527b840ced11917075e8a41ae9616f1df8d41df5bae39c6d6de5bb8d43d401bb9089723db59f0f06aa4fdf4145a905812ef799eb574abb9985de878a289e5f4b1256ca2121d553465f44065580cb5bde170459d1c22e8d388cbec9e37dc3cca07e489a9859942a9ccef4a5e45eed7228b94c86d10a233b5a1ddfcb1735cb9b16de6e8f49f3c841796acba31a8e9c90b531952ed03bd72e0b00fa3373ea4bc845d7469afae305639c772285a5223bf2d86a12c92312dc19db86400c6760b9e75af40ce4c16278bba8a804d5a69b88290dd4c2b43423bee9eb97c54261f956a32d80fdd3f421d1199ee45d42ad657e928be2e9fa54d844cff60b06bc525ce54daca9689e0616bfdbdbc36e09bea11a276d25d3ca9a80ed7109183784dfd1d23b7c791a7913a633e2d28948c655e68ade706654e38f717fe29119af4282430c8d1f702a52ea189f1e9e6faafb213205a195dab1c2d01dc6a3711f671ea118e8a3c995632903c58ebbd4eae5dbc4555b24c1649e89e03efb92134b9e24fb9fc649462f928d992fa33d45edcb4ef13f0d5c2cb6663e7dbf2414b5ed617e56b8715ace6910807e4a901ba603dab4092f9eeb46566ec3f38f3a1789c60822530c390d19b1d939217b7a691abb91454fce76cccf3557ddb3fc55bd4f44761aa9363db0f38360adf60e743ba3b902788bb254637f6074df62460400000003a973b7134b7fcbcb1fe70fdfaaf056c209a9f5dd77800eb37b065ca8317cbb3a980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890445df562c183ed7279f2f8e37ba249447439884d5b7030eac6485112eb07ea2d010b 02d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d 0.1 +``` + + + ```json + { + "result": "success", + "hex": "01000000010db4b1686d1f27de5e2a11c793dfd30f09b296754f95ae8649858cca97d5b07a0000000049483045022100ad6bc26f0c66b89f5d63aff251c78965a50201f909a997b8ed6469da0334aa0c0220136d71f5ad1f4496785df81864f9be3ae7b8dd012dae08d59fd544869eacb3ba01ffffffff041027000000000000302ea22c80205fd998129698de9cf1455f4f4795794c9e57bf1fd5f28598b5e6c0322de5d0358103120c008203000401cc1027000000000000232102980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890acd02a724e18090000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000fd04096a4d0009f144034b4d440d8d1f63bf680d6191b100d90992b0f6bf6ce1cc851f259da8b49e74524e7a890121024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0012fea85ecfda42975a2aaed72e946792df41a486033af8dc45ab1e4ddcb34b1b424081100980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee12789000000000fd080230313030303030303031393764366561313663363864633564623935623732653032396130653233636234303361653061333362353631623836333936336366643963626665633734373030303030303030366234383330343530323231303061636134373531353630323938393937396235313462363231316333373565346430643934373164643832393763353233386331323234356164303164643833303232303139313130356361663162363333313363363938383139346635663033666436663730643461333065646337383230616464313138356433356564666631626230313231303239323436363462353336663337313061386538616265613338626234626637316234373061363533613464636561626435306466303864376232613338343336666666666666666630333130323730303030303030303030303031393736613931343162333535636236623736636162316231366362383733646238383238666535643235323161653438386163383039363938303030303030303030303139373661393134663064316663323966383936326163323830356131363539313932643961643236373934643232393838616333386337666130303030303030303030313937366139313438323830346239343364643661323030386166373366386261343034343963303632663039333531383861633530653666643562fd360604000000380b8fd2b9bdf570358980a4c9fc94e418ac656913999b5f9a016ec5afc46b0b188320f231637a0ded0b0bdada1f34c81ad5873b8c3f096b2014018af13f43980000000000000000000000000000000000000000000000000000000000000000b2e6fd5ba786061d57fff87a00000000000046430000000000000200000000000000000000000000fd40050035435dd2c1df5c20cb48e0617b6cee81f5349f0735b36fe93f17f82d678ad3eb374d0e398b049fddcb21a4d7ddf7345867c6a363eddcfe61f31d49dbc35652794c60da61bd5f164fd554f17b5bd669f636744412822af2ebd0f318dacb71514720164c59c392ef2b1ccc3a5dc5c9c83cd37a11f98b97c8f5170a357a972ec3cacbeb0dab34b757354883b46a598f2b93fcd735b4163db6b2b037f7d7d71a773e909ac4ce3f1228012d5bebfd9edad9842ae8c6cddf6942c543594b85013591a604c4223a3d2e007ed25f5994e9d8f6b6a704daf57cad41aea9609923612eee2fc55ad075c91c23a8cc46af9a45a7390c537d2e2302994239ae44230537ceaa2188e7f4eb6a0ab55471d152b9177e9fd90843504f29d3e92fd3d7142caae018b51318ec6b86083b7e2d155ce868f6b673b13cf1ed59107d15c6c84201441dde14074930f4755ec64975f354a99bd957021c073768f575dde3ab020dd73b488e2d03d57bc414a16d45b3e2052b24fb2360ec5f73524525fc59d2151b89310b19764541b801ad72171085bc6275832222484b8d7ee6ed91ab6a544c45af5c4d8445b0624f04a234aec6997eecf007f0e971eea33b21e45ba8f72825fa84605cdfa929aeb6dc425f2612000e7ce2ba04ff8c53061154eb38cba7f6d0bfe5dab031dadea2095e01e93f9e063d0b42e412f865572625f77aa8b10b58f7b0428ea0ff530ea10d37150496bb181e37fc5814ad524ce4618955e9158b6aebb956b02b961f920ee48eb5a08efc39d27fc2fd4ec175e38798bcca7331a7b5da2ca6c56fcb98e740c2f471eac6b67ced78125c5fcecd4f76eac1d76233aa58ed808e398b9e2b1eaa74e773d18276b732239403ce0c452cb26f0f34156a0a63e007ccfbd76f168fb941fbd2fbe23b57e519835c804ace6e22e281b3d0adda7c4b93a87d94500103315c780fe91ee67320a422eecb4a6daedc2d774567bfebc1d5b72fa693178f3443aa1eb47f18d6931f7b0fc6ec151caad4eae5f787c2a963c3963ffc924ba66a7ea1754763faf2884de0c86a0f75fe7f8dfb1265b449184668cb7348520810cf731663f5180ac31642d6b135d5ce7de88ba63d6db3d6c5dfa19492281dfed3b3765451717f3497ac2b4c040e2e4e77219b2586c227cd138b8d94ccc273fbfbb51a35523870c503e2d8527b840ced11917075e8a41ae9616f1df8d41df5bae39c6d6de5bb8d43d401bb9089723db59f0f06aa4fdf4145a905812ef799eb574abb9985de878a289e5f4b1256ca2121d553465f44065580cb5bde170459d1c22e8d388cbec9e37dc3cca07e489a9859942a9ccef4a5e45eed7228b94c86d10a233b5a1ddfcb1735cb9b16de6e8f49f3c841796acba31a8e9c90b531952ed03bd72e0b00fa3373ea4bc845d7469afae305639c772285a5223bf2d86a12c92312dc19db86400c6760b9e75af40ce4c16278bba8a804d5a69b88290dd4c2b43423bee9eb97c54261f956a32d80fdd3f421d1199ee45d42ad657e928be2e9fa54d844cff60b06bc525ce54daca9689e0616bfdbdbc36e09bea11a276d25d3ca9a80ed7109183784dfd1d23b7c791a7913a633e2d28948c655e68ade706654e38f717fe29119af4282430c8d1f702a52ea189f1e9e6faafb213205a195dab1c2d01dc6a3711f671ea118e8a3c995632903c58ebbd4eae5dbc4555b24c1649e89e03efb92134b9e24fb9fc649462f928d992fa33d45edcb4ef13f0d5c2cb6663e7dbf2414b5ed617e56b8715ace6910807e4a901ba603dab4092f9eeb46566ec3f38f3a1789c60822530c390d19b1d939217b7a691abb91454fce76cccf3557ddb3fc55bd4f44761aa9363db0f38360adf60e743ba3b902788bb254637f6074df62460400000003a973b7134b7fcbcb1fe70fdfaaf056c209a9f5dd77800eb37b065ca8317cbb3a980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890445df562c183ed7279f2f8e37ba249447439884d5b7030eac6485112eb07ea2d010b2102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d809698000000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"gatewaysdeposit", "params":["897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d" ,"1116196" ,"KMD" ,"907812ee8d2762b589f6ca88ee8ba18a65ebf5c7486c472df7395628d22d0d98" ,"0" ,"010000000197d6ea16c68dc5db95b72e029a0e23cb403ae0a33b561b863963cfd9cbfec747000000006b483045022100aca47515602989979b514b6211c375e4d0d9471dd8297c5238c12245ad01dd830220191105caf1b63313c6988194f5f03fd6f70d4a30edc7820add1185d35edff1bb012102924664b536f3710a8e8abea38bb4bf71b470a653a4dceabd50df08d7b2a38436ffffffff0310270000000000001976a9141b355cb6b76cab1b16cb873db8828fe5d2521ae488ac80969800000000001976a914f0d1fc29f8962ac2805a1659192d9ad26794d22988ac38c7fa00000000001976a91482804b943dd6a2008af73f8ba40449c062f0935188ac50e6fd5b" ,"04000000380b8fd2b9bdf570358980a4c9fc94e418ac656913999b5f9a016ec5afc46b0b188320f231637a0ded0b0bdada1f34c81ad5873b8c3f096b2014018af13f43980000000000000000000000000000000000000000000000000000000000000000b2e6fd5ba786061d57fff87a00000000000046430000000000000200000000000000000000000000fd40050035435dd2c1df5c20cb48e0617b6cee81f5349f0735b36fe93f17f82d678ad3eb374d0e398b049fddcb21a4d7ddf7345867c6a363eddcfe61f31d49dbc35652794c60da61bd5f164fd554f17b5bd669f636744412822af2ebd0f318dacb71514720164c59c392ef2b1ccc3a5dc5c9c83cd37a11f98b97c8f5170a357a972ec3cacbeb0dab34b757354883b46a598f2b93fcd735b4163db6b2b037f7d7d71a773e909ac4ce3f1228012d5bebfd9edad9842ae8c6cddf6942c543594b85013591a604c4223a3d2e007ed25f5994e9d8f6b6a704daf57cad41aea9609923612eee2fc55ad075c91c23a8cc46af9a45a7390c537d2e2302994239ae44230537ceaa2188e7f4eb6a0ab55471d152b9177e9fd90843504f29d3e92fd3d7142caae018b51318ec6b86083b7e2d155ce868f6b673b13cf1ed59107d15c6c84201441dde14074930f4755ec64975f354a99bd957021c073768f575dde3ab020dd73b488e2d03d57bc414a16d45b3e2052b24fb2360ec5f73524525fc59d2151b89310b19764541b801ad72171085bc6275832222484b8d7ee6ed91ab6a544c45af5c4d8445b0624f04a234aec6997eecf007f0e971eea33b21e45ba8f72825fa84605cdfa929aeb6dc425f2612000e7ce2ba04ff8c53061154eb38cba7f6d0bfe5dab031dadea2095e01e93f9e063d0b42e412f865572625f77aa8b10b58f7b0428ea0ff530ea10d37150496bb181e37fc5814ad524ce4618955e9158b6aebb956b02b961f920ee48eb5a08efc39d27fc2fd4ec175e38798bcca7331a7b5da2ca6c56fcb98e740c2f471eac6b67ced78125c5fcecd4f76eac1d76233aa58ed808e398b9e2b1eaa74e773d18276b732239403ce0c452cb26f0f34156a0a63e007ccfbd76f168fb941fbd2fbe23b57e519835c804ace6e22e281b3d0adda7c4b93a87d94500103315c780fe91ee67320a422eecb4a6daedc2d774567bfebc1d5b72fa693178f3443aa1eb47f18d6931f7b0fc6ec151caad4eae5f787c2a963c3963ffc924ba66a7ea1754763faf2884de0c86a0f75fe7f8dfb1265b449184668cb7348520810cf731663f5180ac31642d6b135d5ce7de88ba63d6db3d6c5dfa19492281dfed3b3765451717f3497ac2b4c040e2e4e77219b2586c227cd138b8d94ccc273fbfbb51a35523870c503e2d8527b840ced11917075e8a41ae9616f1df8d41df5bae39c6d6de5bb8d43d401bb9089723db59f0f06aa4fdf4145a905812ef799eb574abb9985de878a289e5f4b1256ca2121d553465f44065580cb5bde170459d1c22e8d388cbec9e37dc3cca07e489a9859942a9ccef4a5e45eed7228b94c86d10a233b5a1ddfcb1735cb9b16de6e8f49f3c841796acba31a8e9c90b531952ed03bd72e0b00fa3373ea4bc845d7469afae305639c772285a5223bf2d86a12c92312dc19db86400c6760b9e75af40ce4c16278bba8a804d5a69b88290dd4c2b43423bee9eb97c54261f956a32d80fdd3f421d1199ee45d42ad657e928be2e9fa54d844cff60b06bc525ce54daca9689e0616bfdbdbc36e09bea11a276d25d3ca9a80ed7109183784dfd1d23b7c791a7913a633e2d28948c655e68ade706654e38f717fe29119af4282430c8d1f702a52ea189f1e9e6faafb213205a195dab1c2d01dc6a3711f671ea118e8a3c995632903c58ebbd4eae5dbc4555b24c1649e89e03efb92134b9e24fb9fc649462f928d992fa33d45edcb4ef13f0d5c2cb6663e7dbf2414b5ed617e56b8715ace6910807e4a901ba603dab4092f9eeb46566ec3f38f3a1789c60822530c390d19b1d939217b7a691abb91454fce76cccf3557ddb3fc55bd4f44761aa9363db0f38360adf60e743ba3b902788bb254637f6074df62460400000003a973b7134b7fcbcb1fe70fdfaaf056c209a9f5dd77800eb37b065ca8317cbb3a980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890445df562c183ed7279f2f8e37ba249447439884d5b7030eac6485112eb07ea2d010b" ,"02d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d" ,"0.1"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "01000000010db4b1686d1f27de5e2a11c793dfd30f09b296754f95ae8649858cca97d5b07a0000000049483045022100ad6bc26f0c66b89f5d63aff251c78965a50201f909a997b8ed6469da0334aa0c0220136d71f5ad1f4496785df81864f9be3ae7b8dd012dae08d59fd544869eacb3ba01ffffffff041027000000000000302ea22c80205fd998129698de9cf1455f4f4795794c9e57bf1fd5f28598b5e6c0322de5d0358103120c008203000401cc1027000000000000232102980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890acd02a724e18090000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000fd04096a4d0009f144034b4d440d8d1f63bf680d6191b100d90992b0f6bf6ce1cc851f259da8b49e74524e7a890121024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0012fea85ecfda42975a2aaed72e946792df41a486033af8dc45ab1e4ddcb34b1b424081100980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee12789000000000fd080230313030303030303031393764366561313663363864633564623935623732653032396130653233636234303361653061333362353631623836333936336366643963626665633734373030303030303030366234383330343530323231303061636134373531353630323938393937396235313462363231316333373565346430643934373164643832393763353233386331323234356164303164643833303232303139313130356361663162363333313363363938383139346635663033666436663730643461333065646337383230616464313138356433356564666631626230313231303239323436363462353336663337313061386538616265613338626234626637316234373061363533613464636561626435306466303864376232613338343336666666666666666630333130323730303030303030303030303031393736613931343162333535636236623736636162316231366362383733646238383238666535643235323161653438386163383039363938303030303030303030303139373661393134663064316663323966383936326163323830356131363539313932643961643236373934643232393838616333386337666130303030303030303030313937366139313438323830346239343364643661323030386166373366386261343034343963303632663039333531383861633530653666643562fd360604000000380b8fd2b9bdf570358980a4c9fc94e418ac656913999b5f9a016ec5afc46b0b188320f231637a0ded0b0bdada1f34c81ad5873b8c3f096b2014018af13f43980000000000000000000000000000000000000000000000000000000000000000b2e6fd5ba786061d57fff87a00000000000046430000000000000200000000000000000000000000fd40050035435dd2c1df5c20cb48e0617b6cee81f5349f0735b36fe93f17f82d678ad3eb374d0e398b049fddcb21a4d7ddf7345867c6a363eddcfe61f31d49dbc35652794c60da61bd5f164fd554f17b5bd669f636744412822af2ebd0f318dacb71514720164c59c392ef2b1ccc3a5dc5c9c83cd37a11f98b97c8f5170a357a972ec3cacbeb0dab34b757354883b46a598f2b93fcd735b4163db6b2b037f7d7d71a773e909ac4ce3f1228012d5bebfd9edad9842ae8c6cddf6942c543594b85013591a604c4223a3d2e007ed25f5994e9d8f6b6a704daf57cad41aea9609923612eee2fc55ad075c91c23a8cc46af9a45a7390c537d2e2302994239ae44230537ceaa2188e7f4eb6a0ab55471d152b9177e9fd90843504f29d3e92fd3d7142caae018b51318ec6b86083b7e2d155ce868f6b673b13cf1ed59107d15c6c84201441dde14074930f4755ec64975f354a99bd957021c073768f575dde3ab020dd73b488e2d03d57bc414a16d45b3e2052b24fb2360ec5f73524525fc59d2151b89310b19764541b801ad72171085bc6275832222484b8d7ee6ed91ab6a544c45af5c4d8445b0624f04a234aec6997eecf007f0e971eea33b21e45ba8f72825fa84605cdfa929aeb6dc425f2612000e7ce2ba04ff8c53061154eb38cba7f6d0bfe5dab031dadea2095e01e93f9e063d0b42e412f865572625f77aa8b10b58f7b0428ea0ff530ea10d37150496bb181e37fc5814ad524ce4618955e9158b6aebb956b02b961f920ee48eb5a08efc39d27fc2fd4ec175e38798bcca7331a7b5da2ca6c56fcb98e740c2f471eac6b67ced78125c5fcecd4f76eac1d76233aa58ed808e398b9e2b1eaa74e773d18276b732239403ce0c452cb26f0f34156a0a63e007ccfbd76f168fb941fbd2fbe23b57e519835c804ace6e22e281b3d0adda7c4b93a87d94500103315c780fe91ee67320a422eecb4a6daedc2d774567bfebc1d5b72fa693178f3443aa1eb47f18d6931f7b0fc6ec151caad4eae5f787c2a963c3963ffc924ba66a7ea1754763faf2884de0c86a0f75fe7f8dfb1265b449184668cb7348520810cf731663f5180ac31642d6b135d5ce7de88ba63d6db3d6c5dfa19492281dfed3b3765451717f3497ac2b4c040e2e4e77219b2586c227cd138b8d94ccc273fbfbb51a35523870c503e2d8527b840ced11917075e8a41ae9616f1df8d41df5bae39c6d6de5bb8d43d401bb9089723db59f0f06aa4fdf4145a905812ef799eb574abb9985de878a289e5f4b1256ca2121d553465f44065580cb5bde170459d1c22e8d388cbec9e37dc3cca07e489a9859942a9ccef4a5e45eed7228b94c86d10a233b5a1ddfcb1735cb9b16de6e8f49f3c841796acba31a8e9c90b531952ed03bd72e0b00fa3373ea4bc845d7469afae305639c772285a5223bf2d86a12c92312dc19db86400c6760b9e75af40ce4c16278bba8a804d5a69b88290dd4c2b43423bee9eb97c54261f956a32d80fdd3f421d1199ee45d42ad657e928be2e9fa54d844cff60b06bc525ce54daca9689e0616bfdbdbc36e09bea11a276d25d3ca9a80ed7109183784dfd1d23b7c791a7913a633e2d28948c655e68ade706654e38f717fe29119af4282430c8d1f702a52ea189f1e9e6faafb213205a195dab1c2d01dc6a3711f671ea118e8a3c995632903c58ebbd4eae5dbc4555b24c1649e89e03efb92134b9e24fb9fc649462f928d992fa33d45edcb4ef13f0d5c2cb6663e7dbf2414b5ed617e56b8715ace6910807e4a901ba603dab4092f9eeb46566ec3f38f3a1789c60822530c390d19b1d939217b7a691abb91454fce76cccf3557ddb3fc55bd4f44761aa9363db0f38360adf60e743ba3b902788bb254637f6074df62460400000003a973b7134b7fcbcb1fe70fdfaaf056c209a9f5dd77800eb37b065ca8317cbb3a980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890445df562c183ed7279f2f8e37ba249447439884d5b7030eac6485112eb07ea2d010b2102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d809698000000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step Two: Broadcast using `sendrawtransction` + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000010db4b1686d1f27de5e2a11c793dfd30f09b296754f95ae8649858cca97d5b07a0000000049483045022100ad6bc26f0c66b89f5d63aff251c78965a50201f909a997b8ed6469da0334aa0c0220136d71f5ad1f4496785df81864f9be3ae7b8dd012dae08d59fd544869eacb3ba01ffffffff041027000000000000302ea22c80205fd998129698de9cf1455f4f4795794c9e57bf1fd5f28598b5e6c0322de5d0358103120c008203000401cc1027000000000000232102980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890acd02a724e18090000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000fd04096a4d0009f144034b4d440d8d1f63bf680d6191b100d90992b0f6bf6ce1cc851f259da8b49e74524e7a890121024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0012fea85ecfda42975a2aaed72e946792df41a486033af8dc45ab1e4ddcb34b1b424081100980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee12789000000000fd080230313030303030303031393764366561313663363864633564623935623732653032396130653233636234303361653061333362353631623836333936336366643963626665633734373030303030303030366234383330343530323231303061636134373531353630323938393937396235313462363231316333373565346430643934373164643832393763353233386331323234356164303164643833303232303139313130356361663162363333313363363938383139346635663033666436663730643461333065646337383230616464313138356433356564666631626230313231303239323436363462353336663337313061386538616265613338626234626637316234373061363533613464636561626435306466303864376232613338343336666666666666666630333130323730303030303030303030303031393736613931343162333535636236623736636162316231366362383733646238383238666535643235323161653438386163383039363938303030303030303030303139373661393134663064316663323966383936326163323830356131363539313932643961643236373934643232393838616333386337666130303030303030303030313937366139313438323830346239343364643661323030386166373366386261343034343963303632663039333531383861633530653666643562fd360604000000380b8fd2b9bdf570358980a4c9fc94e418ac656913999b5f9a016ec5afc46b0b188320f231637a0ded0b0bdada1f34c81ad5873b8c3f096b2014018af13f43980000000000000000000000000000000000000000000000000000000000000000b2e6fd5ba786061d57fff87a00000000000046430000000000000200000000000000000000000000fd40050035435dd2c1df5c20cb48e0617b6cee81f5349f0735b36fe93f17f82d678ad3eb374d0e398b049fddcb21a4d7ddf7345867c6a363eddcfe61f31d49dbc35652794c60da61bd5f164fd554f17b5bd669f636744412822af2ebd0f318dacb71514720164c59c392ef2b1ccc3a5dc5c9c83cd37a11f98b97c8f5170a357a972ec3cacbeb0dab34b757354883b46a598f2b93fcd735b4163db6b2b037f7d7d71a773e909ac4ce3f1228012d5bebfd9edad9842ae8c6cddf6942c543594b85013591a604c4223a3d2e007ed25f5994e9d8f6b6a704daf57cad41aea9609923612eee2fc55ad075c91c23a8cc46af9a45a7390c537d2e2302994239ae44230537ceaa2188e7f4eb6a0ab55471d152b9177e9fd90843504f29d3e92fd3d7142caae018b51318ec6b86083b7e2d155ce868f6b673b13cf1ed59107d15c6c84201441dde14074930f4755ec64975f354a99bd957021c073768f575dde3ab020dd73b488e2d03d57bc414a16d45b3e2052b24fb2360ec5f73524525fc59d2151b89310b19764541b801ad72171085bc6275832222484b8d7ee6ed91ab6a544c45af5c4d8445b0624f04a234aec6997eecf007f0e971eea33b21e45ba8f72825fa84605cdfa929aeb6dc425f2612000e7ce2ba04ff8c53061154eb38cba7f6d0bfe5dab031dadea2095e01e93f9e063d0b42e412f865572625f77aa8b10b58f7b0428ea0ff530ea10d37150496bb181e37fc5814ad524ce4618955e9158b6aebb956b02b961f920ee48eb5a08efc39d27fc2fd4ec175e38798bcca7331a7b5da2ca6c56fcb98e740c2f471eac6b67ced78125c5fcecd4f76eac1d76233aa58ed808e398b9e2b1eaa74e773d18276b732239403ce0c452cb26f0f34156a0a63e007ccfbd76f168fb941fbd2fbe23b57e519835c804ace6e22e281b3d0adda7c4b93a87d94500103315c780fe91ee67320a422eecb4a6daedc2d774567bfebc1d5b72fa693178f3443aa1eb47f18d6931f7b0fc6ec151caad4eae5f787c2a963c3963ffc924ba66a7ea1754763faf2884de0c86a0f75fe7f8dfb1265b449184668cb7348520810cf731663f5180ac31642d6b135d5ce7de88ba63d6db3d6c5dfa19492281dfed3b3765451717f3497ac2b4c040e2e4e77219b2586c227cd138b8d94ccc273fbfbb51a35523870c503e2d8527b840ced11917075e8a41ae9616f1df8d41df5bae39c6d6de5bb8d43d401bb9089723db59f0f06aa4fdf4145a905812ef799eb574abb9985de878a289e5f4b1256ca2121d553465f44065580cb5bde170459d1c22e8d388cbec9e37dc3cca07e489a9859942a9ccef4a5e45eed7228b94c86d10a233b5a1ddfcb1735cb9b16de6e8f49f3c841796acba31a8e9c90b531952ed03bd72e0b00fa3373ea4bc845d7469afae305639c772285a5223bf2d86a12c92312dc19db86400c6760b9e75af40ce4c16278bba8a804d5a69b88290dd4c2b43423bee9eb97c54261f956a32d80fdd3f421d1199ee45d42ad657e928be2e9fa54d844cff60b06bc525ce54daca9689e0616bfdbdbc36e09bea11a276d25d3ca9a80ed7109183784dfd1d23b7c791a7913a633e2d28948c655e68ade706654e38f717fe29119af4282430c8d1f702a52ea189f1e9e6faafb213205a195dab1c2d01dc6a3711f671ea118e8a3c995632903c58ebbd4eae5dbc4555b24c1649e89e03efb92134b9e24fb9fc649462f928d992fa33d45edcb4ef13f0d5c2cb6663e7dbf2414b5ed617e56b8715ace6910807e4a901ba603dab4092f9eeb46566ec3f38f3a1789c60822530c390d19b1d939217b7a691abb91454fce76cccf3557ddb3fc55bd4f44761aa9363db0f38360adf60e743ba3b902788bb254637f6074df62460400000003a973b7134b7fcbcb1fe70fdfaaf056c209a9f5dd77800eb37b065ca8317cbb3a980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890445df562c183ed7279f2f8e37ba249447439884d5b7030eac6485112eb07ea2d010b2102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d809698000000000000000000 +``` + + + (This is the `deposittxid`) + + ```bash + 07d79e39354cc38a76dfe2ca8a5fb711432192237608ea066621662f13e0c08e + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["01000000010db4b1686d1f27de5e2a11c793dfd30f09b296754f95ae8649858cca97d5b07a0000000049483045022100ad6bc26f0c66b89f5d63aff251c78965a50201f909a997b8ed6469da0334aa0c0220136d71f5ad1f4496785df81864f9be3ae7b8dd012dae08d59fd544869eacb3ba01ffffffff041027000000000000302ea22c80205fd998129698de9cf1455f4f4795794c9e57bf1fd5f28598b5e6c0322de5d0358103120c008203000401cc1027000000000000232102980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890acd02a724e18090000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000fd04096a4d0009f144034b4d440d8d1f63bf680d6191b100d90992b0f6bf6ce1cc851f259da8b49e74524e7a890121024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0012fea85ecfda42975a2aaed72e946792df41a486033af8dc45ab1e4ddcb34b1b424081100980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee12789000000000fd080230313030303030303031393764366561313663363864633564623935623732653032396130653233636234303361653061333362353631623836333936336366643963626665633734373030303030303030366234383330343530323231303061636134373531353630323938393937396235313462363231316333373565346430643934373164643832393763353233386331323234356164303164643833303232303139313130356361663162363333313363363938383139346635663033666436663730643461333065646337383230616464313138356433356564666631626230313231303239323436363462353336663337313061386538616265613338626234626637316234373061363533613464636561626435306466303864376232613338343336666666666666666630333130323730303030303030303030303031393736613931343162333535636236623736636162316231366362383733646238383238666535643235323161653438386163383039363938303030303030303030303139373661393134663064316663323966383936326163323830356131363539313932643961643236373934643232393838616333386337666130303030303030303030313937366139313438323830346239343364643661323030386166373366386261343034343963303632663039333531383861633530653666643562fd360604000000380b8fd2b9bdf570358980a4c9fc94e418ac656913999b5f9a016ec5afc46b0b188320f231637a0ded0b0bdada1f34c81ad5873b8c3f096b2014018af13f43980000000000000000000000000000000000000000000000000000000000000000b2e6fd5ba786061d57fff87a00000000000046430000000000000200000000000000000000000000fd40050035435dd2c1df5c20cb48e0617b6cee81f5349f0735b36fe93f17f82d678ad3eb374d0e398b049fddcb21a4d7ddf7345867c6a363eddcfe61f31d49dbc35652794c60da61bd5f164fd554f17b5bd669f636744412822af2ebd0f318dacb71514720164c59c392ef2b1ccc3a5dc5c9c83cd37a11f98b97c8f5170a357a972ec3cacbeb0dab34b757354883b46a598f2b93fcd735b4163db6b2b037f7d7d71a773e909ac4ce3f1228012d5bebfd9edad9842ae8c6cddf6942c543594b85013591a604c4223a3d2e007ed25f5994e9d8f6b6a704daf57cad41aea9609923612eee2fc55ad075c91c23a8cc46af9a45a7390c537d2e2302994239ae44230537ceaa2188e7f4eb6a0ab55471d152b9177e9fd90843504f29d3e92fd3d7142caae018b51318ec6b86083b7e2d155ce868f6b673b13cf1ed59107d15c6c84201441dde14074930f4755ec64975f354a99bd957021c073768f575dde3ab020dd73b488e2d03d57bc414a16d45b3e2052b24fb2360ec5f73524525fc59d2151b89310b19764541b801ad72171085bc6275832222484b8d7ee6ed91ab6a544c45af5c4d8445b0624f04a234aec6997eecf007f0e971eea33b21e45ba8f72825fa84605cdfa929aeb6dc425f2612000e7ce2ba04ff8c53061154eb38cba7f6d0bfe5dab031dadea2095e01e93f9e063d0b42e412f865572625f77aa8b10b58f7b0428ea0ff530ea10d37150496bb181e37fc5814ad524ce4618955e9158b6aebb956b02b961f920ee48eb5a08efc39d27fc2fd4ec175e38798bcca7331a7b5da2ca6c56fcb98e740c2f471eac6b67ced78125c5fcecd4f76eac1d76233aa58ed808e398b9e2b1eaa74e773d18276b732239403ce0c452cb26f0f34156a0a63e007ccfbd76f168fb941fbd2fbe23b57e519835c804ace6e22e281b3d0adda7c4b93a87d94500103315c780fe91ee67320a422eecb4a6daedc2d774567bfebc1d5b72fa693178f3443aa1eb47f18d6931f7b0fc6ec151caad4eae5f787c2a963c3963ffc924ba66a7ea1754763faf2884de0c86a0f75fe7f8dfb1265b449184668cb7348520810cf731663f5180ac31642d6b135d5ce7de88ba63d6db3d6c5dfa19492281dfed3b3765451717f3497ac2b4c040e2e4e77219b2586c227cd138b8d94ccc273fbfbb51a35523870c503e2d8527b840ced11917075e8a41ae9616f1df8d41df5bae39c6d6de5bb8d43d401bb9089723db59f0f06aa4fdf4145a905812ef799eb574abb9985de878a289e5f4b1256ca2121d553465f44065580cb5bde170459d1c22e8d388cbec9e37dc3cca07e489a9859942a9ccef4a5e45eed7228b94c86d10a233b5a1ddfcb1735cb9b16de6e8f49f3c841796acba31a8e9c90b531952ed03bd72e0b00fa3373ea4bc845d7469afae305639c772285a5223bf2d86a12c92312dc19db86400c6760b9e75af40ce4c16278bba8a804d5a69b88290dd4c2b43423bee9eb97c54261f956a32d80fdd3f421d1199ee45d42ad657e928be2e9fa54d844cff60b06bc525ce54daca9689e0616bfdbdbc36e09bea11a276d25d3ca9a80ed7109183784dfd1d23b7c791a7913a633e2d28948c655e68ade706654e38f717fe29119af4282430c8d1f702a52ea189f1e9e6faafb213205a195dab1c2d01dc6a3711f671ea118e8a3c995632903c58ebbd4eae5dbc4555b24c1649e89e03efb92134b9e24fb9fc649462f928d992fa33d45edcb4ef13f0d5c2cb6663e7dbf2414b5ed617e56b8715ace6910807e4a901ba603dab4092f9eeb46566ec3f38f3a1789c60822530c390d19b1d939217b7a691abb91454fce76cccf3557ddb3fc55bd4f44761aa9363db0f38360adf60e743ba3b902788bb254637f6074df62460400000003a973b7134b7fcbcb1fe70fdfaaf056c209a9f5dd77800eb37b065ca8317cbb3a980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890445df562c183ed7279f2f8e37ba249447439884d5b7030eac6485112eb07ea2d010b2102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d809698000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "07d79e39354cc38a76dfe2ca8a5fb711432192237608ea066621662f13e0c08e", + "error": null, + "id": "curltest" + } + ``` + + +## gatewaysdumpprivkey + +**gatewaysdumpprivkey bindtxid address** + +The `gatewaysdumpprivkey` method returns the private key for the given `address` and `bindtxid`. + +The private key is returned in the wif format of the associated external chain. + +### Arguments + +| Name | Type | Description | +| -------- | -------- | ---------------------------------------------------- | +| bindtxid | (string) | the `bindtxid` for the associated gateway | +| address | (string) | the `address` for which the private key is requested | + +### Response + +| Name | Type | Description | +| ------- | -------- | ----------------------------------------- | +| result | (string) | whether the command executed successfully | +| privkey | (string) | the private key | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysdumpprivkey 897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d RVHLGTE3aFGwqpUVsoHJiJGs9pmsnd3fNB +``` + + + ```json + { + "result": "success", + "privkey": "1pAcQXouEKKjuCpH25AjPoiihGNWB7DGwgfRCRAhJtRVGKvRHrk" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"gatewaysdumpprivkey", "params":["897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d" ,"RVHLGTE3aFGwqpUVsoHJiJGs9pmsnd3fNB"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "privkey": "1pAcQXouEKKjuCpH25AjPoiihGNWB7DGwgfRCRAhJtRVGKvRHrk" + }, + "error": null, + "id": "curltest" + } + ``` + + +## gatewaysexternaladdress + +**gatewaysexternaladdress bindtxid pubkey** + +The `gatewaysexternaladdress` method returns the address on the external chain for the gateways associated with the given `pubkey` and `bindtxid` values. + +### Arguments + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------------------------------- | +| bindtxid | (string) | the `bindtxid` for the associated gateway | +| pubkey | (string) | the `pubkey` needed to generate the address on the external chain | + +### Response + +| Name | Type | Description | +| ------- | -------- | ----------------------------------------- | +| result | (string) | whether the command executed successfully | +| address | (string) | the address for the given pubkey | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysexternaladdress 897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d 02ebb42018347eb3a4da76e85347bb0f042355ff3d16e323b21f8e6cb10098654e +``` + + + ```json + { + "result": "success", + "address": "RPq3opCLxV3xgpiM8ewUvyRE5aqovfVeH5" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"gatewaysexternaladdress", "params":["897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d" ,"02ebb42018347eb3a4da76e85347bb0f042355ff3d16e323b21f8e6cb10098654e"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "address": "RPq3opCLxV3xgpiM8ewUvyRE5aqovfVeH5" + }, + "error": null, + "id": "curltest" + } + ``` + + +## gatewaysinfo + +**gatewaysinfo bindtxid** + +The `gatewaysinfo` method returns information about the `bindtxid` gateway. + +### Arguments + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------- | +| bindtxid | (string) | the `bindtxid` for the associated gateway | + +### Response + +| Name | Type | Description | +| ----------- | -------- | ------------------------------------------------------------------------------------------ | +| result | (string) | whether the command executed successfully | +| name | (string) | the name of the command | +| pubkey | (string) | the pubkey that holds the converted proxy tokens | +| coin | (string) | the name of the asset that the proxy token represents | +| oracletxid | (string) | the `oracletxid` of the associated oracle | +| taddr | (number) | the coin-specific address that customizes the address for the relevant foreign coin | +| prefix | (number) | the coin-specific address prefix that customizes the address for the relevant foreign coin | +| prefix2 | (number) | the coin-specific address prefix that customizes the address for the relevant foreign coin | +| deposit | (string) | the t address associated with the gateway pubkey | +| tokenid | (string) | the `tokenid` of the proxy token | +| totalsupply | (number) | the total available supply of proxy tokens | +| remaining | (number) | the amount of proxy tokens not currently issued | +| issued | (number) | the amount of proxy tokens currently issued | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysinfo 897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d +``` + + + ```json + { + "result": "success", + "name": "Gateways", + "pubkey": "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0", + "coin": "KMD", + "oracletxid": "ba26ba27dc17a017a2c0915378c0a8430e468dffb42c4fc1cd36abf69c88388b", + "taddr": 0, + "prefix": 60, + "prefix2": 85, + "deposit": "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp", + "tokenid": "07646d72dec393f486f8a116facd9b8a575dcf00ec99f819151fd1784015941b", + "totalsupply": "1.00000000", + "remaining": "1.00000000", + "issued": "0.00000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"gatewaysinfo", "params":["897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "name": "Gateways", + "pubkey": "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0", + "coin": "KMD", + "oracletxid": "ba26ba27dc17a017a2c0915378c0a8430e468dffb42c4fc1cd36abf69c88388b", + "taddr": 0, + "prefix": 60, + "prefix2": 85, + "deposit": "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp", + "tokenid": "07646d72dec393f486f8a116facd9b8a575dcf00ec99f819151fd1784015941b", + "totalsupply": "1.00000000", + "remaining": "1.00000000", + "issued": "0.00000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +## gatewayslist + +**gatewayslist** + +The `gatewayslist` method displays a list of `bindtxids` for the available gateways. + +### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +### Response + +| Name | Type | Description | +| -------- | -------- | ------------------------------------ | +| bindtxid | (string) | the bindtxid of an available gateway | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewayslist +``` + + + ```bash + [ + "4114e3c5dcddc464c5fd94efebf8215322f12226bffc93f84d6d5e0b4ca131a9", + "aeef4320afe73e1cfe43c4c129b31da018990f49d65b5eeb45cb9a348fdf6ece" + ] + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"gatewayslist", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": [ + "4114e3c5dcddc464c5fd94efebf8215322f12226bffc93f84d6d5e0b4ca131a9", + "aeef4320afe73e1cfe43c4c129b31da018990f49d65b5eeb45cb9a348fdf6ece" + ], + "error": null, + "id": "curltest" + } + ``` + + +## gatewayswithdraw + +**gatewayswithdraw bindtxid coin withdrawpub amount** + +The `gatewayswithdraw` method sends proxy tokens in the gateways `pubkey`. The gateway then sends the foreign assets to the indicated foreign `withdrawpub` pubkey. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- | +| bindtxid | (string) | the `bindtxid` of the gateway | +| coin | (string) | the name of the asset | +| withdrawpub | (string) | the `pubkey` to which the foreign assets should be sent | +| amount | (number) | the number of proxy tokens to send to the gateway, which will then be exchanged for the relevant amount of the foreign asset | + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewayswithdraw 897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d KMD 0271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328 0.1 +``` + + + ```json + { + "result": "success", + "hex": "01000000020e2778e5c0917b00a995ffd0e027ac896492b70b2004ca0096d5309bc1d695ce0000000048473044022072bd3e74c1fb6a56111fc34caab1d605cedfbcb0a9dcd1a4c8d0dae9db61d43902205ccea739077b3374559353af3392e637b7c462ca699f9b9dba786b5398491b4201ffffffff8425c1bf730444ceac45a47376164d66a156e6c2a48116ec14cd17a88f8ab8e5010000007b4c79a276a072a26ba067a565802102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d814051e39b89bace8226f3ca1779b754f2b57ee480e9636b16322bb36a89ec22de967ea66cdc906debb5f6b7c26a51ac2d089966aeb92d07aacc43507b1555c02313a100af038001f1a10001ffffffff058096980000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cc102700000000000023210271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328ac1027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401ccd02a724e18090000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000536a4c50f157bff603b64f309e344e34b10fd2053db59788909914f8488a7f73ddddc2165d31034b4d44210271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328809698000000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"gatewayswithdraw", "params":["897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d" ,"KMD" ,"0271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328" ,"0.1"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "01000000020e2778e5c0917b00a995ffd0e027ac896492b70b2004ca0096d5309bc1d695ce0000000048473044022072bd3e74c1fb6a56111fc34caab1d605cedfbcb0a9dcd1a4c8d0dae9db61d43902205ccea739077b3374559353af3392e637b7c462ca699f9b9dba786b5398491b4201ffffffff8425c1bf730444ceac45a47376164d66a156e6c2a48116ec14cd17a88f8ab8e5010000007b4c79a276a072a26ba067a565802102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d814051e39b89bace8226f3ca1779b754f2b57ee480e9636b16322bb36a89ec22de967ea66cdc906debb5f6b7c26a51ac2d089966aeb92d07aacc43507b1555c02313a100af038001f1a10001ffffffff058096980000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cc102700000000000023210271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328ac1027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401ccd02a724e18090000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000536a4c50f157bff603b64f309e344e34b10fd2053db59788909914f8488a7f73ddddc2165d31034b4d44210271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328809698000000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step Two: Broadcast using `sendrawtransction`: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000020e2778e5c0917b00a995ffd0e027ac896492b70b2004ca0096d5309bc1d695ce0000000048473044022072bd3e74c1fb6a56111fc34caab1d605cedfbcb0a9dcd1a4c8d0dae9db61d43902205ccea739077b3374559353af3392e637b7c462ca699f9b9dba786b5398491b4201ffffffff8425c1bf730444ceac45a47376164d66a156e6c2a48116ec14cd17a88f8ab8e5010000007b4c79a276a072a26ba067a565802102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d814051e39b89bace8226f3ca1779b754f2b57ee480e9636b16322bb36a89ec22de967ea66cdc906debb5f6b7c26a51ac2d089966aeb92d07aacc43507b1555c02313a100af038001f1a10001ffffffff058096980000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cc102700000000000023210271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328ac1027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401ccd02a724e18090000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000536a4c50f157bff603b64f309e344e34b10fd2053db59788909914f8488a7f73ddddc2165d31034b4d44210271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328809698000000000000000000 +``` + + + ```bash + 79d41ffefa359a7ae2f62adf728a3ec3f3d2653889780ed9776bf9b74fe9a6fe + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["01000000020e2778e5c0917b00a995ffd0e027ac896492b70b2004ca0096d5309bc1d695ce0000000048473044022072bd3e74c1fb6a56111fc34caab1d605cedfbcb0a9dcd1a4c8d0dae9db61d43902205ccea739077b3374559353af3392e637b7c462ca699f9b9dba786b5398491b4201ffffffff8425c1bf730444ceac45a47376164d66a156e6c2a48116ec14cd17a88f8ab8e5010000007b4c79a276a072a26ba067a565802102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d814051e39b89bace8226f3ca1779b754f2b57ee480e9636b16322bb36a89ec22de967ea66cdc906debb5f6b7c26a51ac2d089966aeb92d07aacc43507b1555c02313a100af038001f1a10001ffffffff058096980000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cc102700000000000023210271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328ac1027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401ccd02a724e18090000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000536a4c50f157bff603b64f309e344e34b10fd2053db59788909914f8488a7f73ddddc2165d31034b4d44210271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328809698000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "79d41ffefa359a7ae2f62adf728a3ec3f3d2653889780ed9776bf9b74fe9a6fe", + "error": null, + "id": "curltest" + } + ``` + +import heirCC from "@/public/images/antara/heirCC-with-labels.png"; +export const title = "Heir: Secure Cryptocurrency Inheritance Solution"; +export const description = + "The Heir Antara Module allows cryptocurrency funds to be passed on as an inheritance."; + +# Heir + +## Introduction + +The Heir Antara Module allows cryptocurrency funds to be passed on as an inheritance. + +The module functions by the means of a special `1of2` Antara address. In this type of address there are two private keys that are capable of spending funds from the address. However, only the first private key may spend funds by default. + +This first private key belongs to the owner of the `1of2` Antara address. The owner may use this key to freely spend funds and also to add more funds to the address. + +Should the owner fail to interact with the `1of2` Antara address for a specified period of time (`inactivitytime`), the address automatically unlocks to the second key. This second key is owned by the heir. Once unlocked, both the creator and the heir may freely spend funds from the address. + +The [heiradd](/antara/api/heir/#heiradd) method allows anyone, including users who are neither the owner nor the heir, to add funds to the address. These additions are considered donations and they do not affect the `inactivitytime` calculations that can unlock the funds for the heir. The `heiradd` method warns the user that they are making a donation if the method detects that the user is neither the owner nor the heir. + +The Heir Antara Module accepts both coins and tokens. These can be the base coin of the Smart Chain, on-chain tokens created via the [Tokens](/antara/api/tokens/#introduction) Antara Module that represent on-chain assets, or even tokens that are formed via the [Gateways](/antara/api/gateways/) Module to represent off-chain assets or other cryptocurrencies. + +#### Heir Module Flow + +* Anyone can create a new Heir Antara address using [heirfund](/antara/api/heir/#heirfund) +* The owner of this address can add more funds using [heiradd](/antara/api/heir/#heiradd) +* Any other user, including the heir, can add donations using [heiradd](/antara/api/heir/#heiradd) +* The owner can claim funds at any time using [heirclaim](/antara/api/heir/#heirclaim) +* Once `inactivitytime` period is reached, the heir can also claim funds using [heirclaim](/antara/api/heir/#heirclaim) +* To retrieve the details of a particular funding plan, use [heirinfo](/antara/api/heir/#heirinfo) +* To retrieve a list of all funding plans on the Smart Chain, use [heirlist](/antara/api/heir/#heirlist) +* To output Heir Antara addresses, use [heiraddress](/antara/api/heir/#heiraddress) + + + + + If an owner of an Heir Antara address seeking to add funds to their account + avoids the normal methods (the RPC provided) and instead manually creates a + utxo contribution, this utxo will not follow the normal patterns. + Specifically, if the owner manually creates a contribution utxo that derives + from both the owner pubkey and also from another pubkey, this utxo will not + affect the `inactivitytime` calculation. Instead of resetting the + `inactivitytime`, the utxo will count only as a donation. + + +## heiradd + +**heiradd amount fundingtxid** + +The `heiradd` method adds more funds to the Heir plan. + +When the owner uses the `heiradd` method the `inactivitytime` calculations are reset, thus renewing the owner's sole access to the funds. + +When anyone other than the owner uses the `heiradd` method to add funds, these funds are considered to be donations and won't affect the calculation of the elapsed `inactivitytime`. The method also sends a warning to the contributor to ensure they agree to submit the given funds as a donation. + +For each transaction using `heiradd`, the funds may be sent either from the owner's pubkey, or from a non-owner's pubkey. Funds cannot be sent from both owner and non-owner pubkeys at the same time. This can cause confusion for the owner if the funds available in their wallet are held partially in the owner's declared pubkey for this Heir account, and partially in other pubkeys. Therefore, the owner should ensure that all funds they desire to add to the account are within their declared Heir Antara pubkey before attempting to use `heiradd`. + + + Use the [heirlist](/antara/api/heir/#heirlist) method to find a{" "} + fundingtxid. + + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | (number) | the amount of funds to be added; this amount will be withdrawn from the contributor's coins or tokens, as determined by the `tokenid` parameter used when the `heirfund` method was executed | +| fundingtxid | (string) | the transaction id returned from the original [heirfund](/antara/api/heir/#heirfund) transaction | + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +##### Step 1: Create a raw transaction (in coins) and get the HEX value + +```bash +./komodo-cli -ac_name=HELLOWORLD heiradd 0 5 b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0 +``` + + + ```json + { + "result": "success", + "hex": "0400008085202f8902f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b80200000049483045022100a37d7b5929af0928f1dad10ddd686a8e2e47503c96ba5485e982c72d6fb3dfb00220304b039011774652f89eb3e7b6bf187e441ed4a82339623d5d8f058816e2f43a01fffffffff0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b80300000049483045022100c9297262cc12d300ef068d4de7a3d8e6006b87002e4c7a5c8b262be8d87da86102203f73e991704ef492ae57550a3c3cbb57494299d5ef2b3b64b6d88a1fff36a19d01ffffffff050065cd1d00000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc1027000000000000232102f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b8ace0303e36020000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eace0144a8a040000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000256a23ea41b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f00000000000620000000000000000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"heiradd", "params":["0" ,"5" ,"b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "0400008085202f8902f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b80200000049483045022100a37d7b5929af0928f1dad10ddd686a8e2e47503c96ba5485e982c72d6fb3dfb00220304b039011774652f89eb3e7b6bf187e441ed4a82339623d5d8f058816e2f43a01fffffffff0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b80300000049483045022100c9297262cc12d300ef068d4de7a3d8e6006b87002e4c7a5c8b262be8d87da86102203f73e991704ef492ae57550a3c3cbb57494299d5ef2b3b64b6d88a1fff36a19d01ffffffff050065cd1d00000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc1027000000000000232102f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b8ace0303e36020000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eace0144a8a040000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000256a23ea41b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f00000000000620000000000000000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +##### Step 2: Broadcast raw transaction + +```bash + ./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f8902f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b80200000049483045022100a37d7b5929af0928f1dad10ddd686a8e2e47503c96ba5485e982c72d6fb3dfb00220304b039011774652f89eb3e7b6bf187e441ed4a82339623d5d8f058816e2f43a01fffffffff0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b80300000049483045022100c9297262cc12d300ef068d4de7a3d8e6006b87002e4c7a5c8b262be8d87da86102203f73e991704ef492ae57550a3c3cbb57494299d5ef2b3b64b6d88a1fff36a19d01ffffffff050065cd1d00000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc1027000000000000232102f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b8ace0303e36020000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eace0144a8a040000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000256a23ea41b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f00000000000620000000000000000000000000000 +``` + + + `bash e7b8f58539e2554a51d8438e5e58b0a12896f076e2a2850a503f372e402521b ` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"heiradd", "params":["0" ,"5" ,"b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "e7b8f58539e2554a51d8438e5e58b0a12896f076e2a2850a503f372e402521b", + "error": null, + "id": "curltest" + } + ``` + + +##### Step 3: Decode raw transaction to ensure values are sane (optional) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 0400008085202f8902f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b80200000049483045022100a37d7b5929af0928f1dad10ddd686a8e2e47503c96ba5485e982c72d6fb3dfb00220304b039011774652f89eb3e7b6bf187e441ed4a82339623d5d8f058816e2f43a01fffffffff0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b80300000049483045022100c9297262cc12d300ef068d4de7a3d8e6006b87002e4c7a5c8b262be8d87da86102203f73e991704ef492ae57550a3c3cbb57494299d5ef2b3b64b6d88a1fff36a19d01ffffffff050065cd1d00000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc1027000000000000232102f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b8ace0303e36020000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eace0144a8a040000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000256a23ea41b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f00000000000620000000000000000000000000000 +``` + + + ```json + { + "txid": "e7b8f58539e2554a51d8438e5e58b0a12896f076e2a2850a503f372e402521b3", + "overwintered": true, + "version": 4, + "versiongroupid": "892f2085", + "locktime": 0, + "expiryheight": 98, + "vin": [ + { + "txid": "b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0", + "vout": 2, + "scriptSig": { + "asm": "3045022100a37d7b5929af0928f1dad10ddd686a8e2e47503c96ba5485e982c72d6fb3dfb00220304b039011774652f89eb3e7b6bf187e441ed4a82339623d5d8f058816e2f43a[ALL]", + "hex": "483045022100a37d7b5929af0928f1dad10ddd686a8e2e47503c96ba5485e982c72d6fb3dfb00220304b039011774652f89eb3e7b6bf187e441ed4a82339623d5d8f058816e2f43a01" + }, + "sequence": 4294967295 + }, + { + "txid": "b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0", + "vout": 3, + "scriptSig": { + "asm": "3045022100c9297262cc12d300ef068d4de7a3d8e6006b87002e4c7a5c8b262be8d87da86102203f73e991704ef492ae57550a3c3cbb57494299d5ef2b3b64b6d88a1fff36a19d[ALL]", + "hex": "483045022100c9297262cc12d300ef068d4de7a3d8e6006b87002e4c7a5c8b262be8d87da86102203f73e991704ef492ae57550a3c3cbb57494299d5ef2b3b64b6d88a1fff36a19d01" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 5.0, + "valueZat": 500000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RL4bWeVxLen2np68Uxp7eNHRVqquwzSPHV"] + } + }, + { + "value": 0.0001, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "02f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b8 OP_CHECKSIG", + "hex": "2102f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b8ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RDyrGQzYgjS9urojBjcSMPaecHpLQiLruB"] + } + }, + { + "value": 94.9998, + "valueZat": 9499980000, + "n": 2, + "scriptPubKey": { + "asm": "036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e OP_CHECKSIG", + "hex": "21036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["REXP3kgaa5wbio76aqnTJDb8CQJHBiZy2b"] + } + }, + { + "value": 194.9998, + "valueZat": 19499980000, + "n": 3, + "scriptPubKey": { + "asm": "036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e OP_CHECKSIG", + "hex": "21036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["REXP3kgaa5wbio76aqnTJDb8CQJHBiZy2b"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 4, + "scriptPubKey": { + "asm": "OP_RETURN ea41b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f000", + "hex": "6a23ea41b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f000", + "type": "nulldata" + } + } + ], + "vjoinsplit": [], + "valueBalance": 0.0, + "vShieldedSpend": [], + "vShieldedOutput": [] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["0400008085202f8902f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b80200000049483045022100a37d7b5929af0928f1dad10ddd686a8e2e47503c96ba5485e982c72d6fb3dfb00220304b039011774652f89eb3e7b6bf187e441ed4a82339623d5d8f058816e2f43a01fffffffff0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b80300000049483045022100c9297262cc12d300ef068d4de7a3d8e6006b87002e4c7a5c8b262be8d87da86102203f73e991704ef492ae57550a3c3cbb57494299d5ef2b3b64b6d88a1fff36a19d01ffffffff050065cd1d00000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc1027000000000000232102f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b8ace0303e36020000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eace0144a8a040000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000256a23ea41b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f00000000000620000000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "e7b8f58539e2554a51d8438e5e58b0a12896f076e2a2850a503f372e402521b3", + "overwintered": true, + "version": 4, + "versiongroupid": "892f2085", + "locktime": 0, + "expiryheight": 98, + "vin": [ + { + "txid": "b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0", + "vout": 2, + "scriptSig": { + "asm": "3045022100a37d7b5929af0928f1dad10ddd686a8e2e47503c96ba5485e982c72d6fb3dfb00220304b039011774652f89eb3e7b6bf187e441ed4a82339623d5d8f058816e2f43a[ALL]", + "hex": "483045022100a37d7b5929af0928f1dad10ddd686a8e2e47503c96ba5485e982c72d6fb3dfb00220304b039011774652f89eb3e7b6bf187e441ed4a82339623d5d8f058816e2f43a01" + }, + "sequence": 4294967295 + }, + { + "txid": "b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0", + "vout": 3, + "scriptSig": { + "asm": "3045022100c9297262cc12d300ef068d4de7a3d8e6006b87002e4c7a5c8b262be8d87da86102203f73e991704ef492ae57550a3c3cbb57494299d5ef2b3b64b6d88a1fff36a19d[ALL]", + "hex": "483045022100c9297262cc12d300ef068d4de7a3d8e6006b87002e4c7a5c8b262be8d87da86102203f73e991704ef492ae57550a3c3cbb57494299d5ef2b3b64b6d88a1fff36a19d01" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 5.0, + "valueZat": 500000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RL4bWeVxLen2np68Uxp7eNHRVqquwzSPHV"] + } + }, + { + "value": 0.0001, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "02f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b8 OP_CHECKSIG", + "hex": "2102f0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b8ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RDyrGQzYgjS9urojBjcSMPaecHpLQiLruB"] + } + }, + { + "value": 94.9998, + "valueZat": 9499980000, + "n": 2, + "scriptPubKey": { + "asm": "036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e OP_CHECKSIG", + "hex": "21036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["REXP3kgaa5wbio76aqnTJDb8CQJHBiZy2b"] + } + }, + { + "value": 194.9998, + "valueZat": 19499980000, + "n": 3, + "scriptPubKey": { + "asm": "036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e OP_CHECKSIG", + "hex": "21036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["REXP3kgaa5wbio76aqnTJDb8CQJHBiZy2b"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 4, + "scriptPubKey": { + "asm": "OP_RETURN ea41b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f000", + "hex": "6a23ea41b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f000", + "type": "nulldata" + } + } + ], + "vjoinsplit": [], + "valueBalance": 0.0, + "vShieldedSpend": [], + "vShieldedOutput": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## heiraddress + +**heiraddress pubkey** + +The `heiraddress` method shows the owner's addresses and balances for the Heir plan. + + + * The functionality of this method is only applicable when executed on a + daemon that was launched using the pubkey of the owner of the relevant Heir + plan. For all other daemons, the method is available, but has no functional + purpose. \* The argument of this method is the **heir's** pubkey. + + +### Arguments + +| Name | Type | Description | +| ------ | -------- | ---------------------------------- | +| pubkey | (string) | the heir's pubkey (in hexademical) | + +### Response + +| Name | Type | Description | +| ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | (string) | whether the method executed successfully | +| HeirCCaddress | (string) | taking the module's EVAL code as a modifier, this is the public address that corresponds to the module's privkey | +| CCbalance | (number) | the unspent amount in the HeirCCaddress | +| HeirNormalAddress | (string) | the unmodified normal public address generated from the module's privkey, used for markers | +| HeirCC`1of2`Address | (string) | the address for storing funds in **coins** spendable by either the owner or the heir (funds address) | +| HeirCC`1of2`TokensAddress | (string) | the address for storing funds in **tokens** spendable by either the owner or the heir (token funds address) | +| myCCaddress(Heir) | (string) | taking the module's EVAL code as a modifier, this is the Antara address from the pubkey of the **heir** | +| myaddress | (string) | the unmodified normal public address of the pubkey [used to launch the daemon.](/antara/tutorials/understanding-antara-addresses/#creating-and-launching-with-a-pubkey) This is the normal address used to withdraw funds in coins from from HeirCC`1of2`Address. This property is applicable to any user who wants to use the Heir plan (owner or heir) | +| mybalance | (number) | the balance of myaddress in coins | +| MyTokenAddress | (string) | the user's address to withdraw funds in tokens from HeirCC`1of2`TokensAddress (in development) | + +#### 📌 Example + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD heiraddress 036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e +``` + + + ```json + { + "result": "success", + "HeirCCAddress": "RDVHcSekmXgeYBqRupNTmqo3Rn8QRXNduy", + "CCbalance": 0.0001, + "HeirNormalAddress": "RTPwUjKYECcGn6Y4KYChLhgaht1RSU4jwf", + "HeirCC`1of2`Address": "RCiaNQq9yVb5biyEy8xWrAJCjjvQ9oW8rn", + "HeirCC`1of2`TokensAddress": "RGKHD8UaTU2avj6LdmuSgpuaukk6XY4fss", + "myAddress": "REXP3kgaa5wbio76aqnTJDb8CQJHBiZy2b", + "myCCAddress(Heir)": "RTF9g6SRzbgZXTT7arGZrmTeNKuLoGYyZA", + "PubkeyCCaddress(Heir)": "RTF9g6SRzbgZXTT7arGZrmTeNKuLoGYyZA", + "myCCaddress": "RTF9g6SRzbgZXTT7arGZrmTeNKuLoGYyZA", + "myCCbalance": 0.0, + "myaddress": "REXP3kgaa5wbio76aqnTJDb8CQJHBiZy2b", + "mybalance": 296.9995 + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"heiraddress", "params":["036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "HeirCCAddress": "RDVHcSekmXgeYBqRupNTmqo3Rn8QRXNduy", + "CCbalance": 0.0001, + "HeirNormalAddress": "RTPwUjKYECcGn6Y4KYChLhgaht1RSU4jwf", + "HeirCC`1of2`Address": "RCiaNQq9yVb5biyEy8xWrAJCjjvQ9oW8rn", + "HeirCC`1of2`TokensAddress": "RGKHD8UaTU2avj6LdmuSgpuaukk6XY4fss", + "myAddress": "REXP3kgaa5wbio76aqnTJDb8CQJHBiZy2b", + "myCCAddress(Heir)": "RTF9g6SRzbgZXTT7arGZrmTeNKuLoGYyZA", + "PubkeyCCaddress(Heir)": "RTF9g6SRzbgZXTT7arGZrmTeNKuLoGYyZA", + "myCCaddress": "RTF9g6SRzbgZXTT7arGZrmTeNKuLoGYyZA", + "myCCbalance": 0.0, + "myaddress": "REXP3kgaa5wbio76aqnTJDb8CQJHBiZy2b", + "mybalance": 296.9995 + }, + "error": null, + "id": "curltest" + } + ``` + + +## heirclaim + +**heirclaim amount fundingtxid** + +The `heirclaim` method allows the owner to claim funds from the plan. + +After the `inactivitytime` period has elapsed, the `heirclaim` method also allows the heir to claim funds. + + + Use the [heirlist](/antara/api/heir/#heirlist) method to find a{" "} + fundingtxid. + + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| amount | (number) | the amount of funds to be added; this amount will be withdrawn from the contributor's coins or tokens, as determined by the `tokenid` parameter used when the `heirfund` method was executed | +| fundingtxid | (string) | the transaction id returned from the original [heirfund](/antara/api/heir/#heirfund) transaction | + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +##### Step 1 Create a raw transaction (in coins) and get the HEX value + +```bash +./komodo-cli -ac_name=HELLOWORLD heirclaim 0 7 b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0 +``` + + + ```json + { + "result": "success", + "hex": "0400008085202f8903b32125402e373f500a85a2e276f09628a1b0585e8e43d8514a55e23985f5b8e70200000049483045022100f3805c1424472626ee89e2f4c5ab4f7c310d37774604eb97860200d1dfb120d102202a0ffcc6e5c1f8893dde1ab3a67eafa554ac1af17dce14cf0580a55f5b9fdc6e01ffffffffb32125402e373f500a85a2e276f09628a1b0585e8e43d8514a55e23985f5b8e700000000a74ca5a281a1a0819ca28194a067a5658021036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e81404827886fbbd2c8d3337dabfa69e69e5af03151a00fa1c7d3b6f33b68e36974f2228bf0aac209eaa55d16e8c2cdcb9c3993590e47c3e524a29a223db7042b7fa1a129a52780201011d4a0870dff12319f1b00e9a537fb9ddda81d2bba8b0d492cc6b4e9f7b1c98103020000af038001eaa10001fffffffff0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b800000000a74ca5a281a1a0819ca28194a067a5658021036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e8140bb6e5c5c6b1e3a97d99e5dd1cf8e30942069260f8a482f7004d7638b4f5a53dd4d592d4a1d099cc7c0d6b79fcaeec262606d38c56abd7d13cea0753e73a3985aa129a52780201011d4a0870dff12319f1b00e9a537fb9ddda81d2bba8b0d492cc6b4e9f7b1c98103020000af038001eaa10001ffffffff040027b929000000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac00a3e11100000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401ccd0093e36020000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000256a23ea43b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f00000000000680000000000000000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"heirclaim", "params":["0" ,"7" ,"b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "0400008085202f8903b32125402e373f500a85a2e276f09628a1b0585e8e43d8514a55e23985f5b8e70200000049483045022100f3805c1424472626ee89e2f4c5ab4f7c310d37774604eb97860200d1dfb120d102202a0ffcc6e5c1f8893dde1ab3a67eafa554ac1af17dce14cf0580a55f5b9fdc6e01ffffffffb32125402e373f500a85a2e276f09628a1b0585e8e43d8514a55e23985f5b8e700000000a74ca5a281a1a0819ca28194a067a5658021036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e81404827886fbbd2c8d3337dabfa69e69e5af03151a00fa1c7d3b6f33b68e36974f2228bf0aac209eaa55d16e8c2cdcb9c3993590e47c3e524a29a223db7042b7fa1a129a52780201011d4a0870dff12319f1b00e9a537fb9ddda81d2bba8b0d492cc6b4e9f7b1c98103020000af038001eaa10001fffffffff0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b800000000a74ca5a281a1a0819ca28194a067a5658021036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e8140bb6e5c5c6b1e3a97d99e5dd1cf8e30942069260f8a482f7004d7638b4f5a53dd4d592d4a1d099cc7c0d6b79fcaeec262606d38c56abd7d13cea0753e73a3985aa129a52780201011d4a0870dff12319f1b00e9a537fb9ddda81d2bba8b0d492cc6b4e9f7b1c98103020000af038001eaa10001ffffffff040027b929000000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac00a3e11100000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401ccd0093e36020000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000256a23ea43b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f00000000000680000000000000000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +##### Step 2: Broadcast raw transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f8903b32125402e373f500a85a2e276f09628a1b0585e8e43d8514a55e23985f5b8e70200000049483045022100f3805c1424472626ee89e2f4c5ab4f7c310d37774604eb97860200d1dfb120d102202a0ffcc6e5c1f8893dde1ab3a67eafa554ac1af17dce14cf0580a55f5b9fdc6e01ffffffffb32125402e373f500a85a2e276f09628a1b0585e8e43d8514a55e23985f5b8e700000000a74ca5a281a1a0819ca28194a067a5658021036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e81404827886fbbd2c8d3337dabfa69e69e5af03151a00fa1c7d3b6f33b68e36974f2228bf0aac209eaa55d16e8c2cdcb9c3993590e47c3e524a29a223db7042b7fa1a129a52780201011d4a0870dff12319f1b00e9a537fb9ddda81d2bba8b0d492cc6b4e9f7b1c98103020000af038001eaa10001fffffffff0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b800000000a74ca5a281a1a0819ca28194a067a5658021036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e8140bb6e5c5c6b1e3a97d99e5dd1cf8e30942069260f8a482f7004d7638b4f5a53dd4d592d4a1d099cc7c0d6b79fcaeec262606d38c56abd7d13cea0753e73a3985aa129a52780201011d4a0870dff12319f1b00e9a537fb9ddda81d2bba8b0d492cc6b4e9f7b1c98103020000af038001eaa10001ffffffff040027b929000000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac00a3e11100000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401ccd0093e36020000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000256a23ea43b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f00000000000680000000000000000000000000000 +``` + + + `bash f0f7f536a261ee8e02fb592d81305b6052939a510e3e3435280b0bad454626c7 ` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["" ,"0400008085202f8903b32125402e373f500a85a2e276f09628a1b0585e8e43d8514a55e23985f5b8e70200000049483045022100f3805c1424472626ee89e2f4c5ab4f7c310d37774604eb97860200d1dfb120d102202a0ffcc6e5c1f8893dde1ab3a67eafa554ac1af17dce14cf0580a55f5b9fdc6e01ffffffffb32125402e373f500a85a2e276f09628a1b0585e8e43d8514a55e23985f5b8e700000000a74ca5a281a1a0819ca28194a067a5658021036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e81404827886fbbd2c8d3337dabfa69e69e5af03151a00fa1c7d3b6f33b68e36974f2228bf0aac209eaa55d16e8c2cdcb9c3993590e47c3e524a29a223db7042b7fa1a129a52780201011d4a0870dff12319f1b00e9a537fb9ddda81d2bba8b0d492cc6b4e9f7b1c98103020000af038001eaa10001fffffffff0e19c37f7b97f00041baf06404980ddfeaade5aebbab3ba8f5445b546fab5b800000000a74ca5a281a1a0819ca28194a067a5658021036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e8140bb6e5c5c6b1e3a97d99e5dd1cf8e30942069260f8a482f7004d7638b4f5a53dd4d592d4a1d099cc7c0d6b79fcaeec262606d38c56abd7d13cea0753e73a3985aa129a52780201011d4a0870dff12319f1b00e9a537fb9ddda81d2bba8b0d492cc6b4e9f7b1c98103020000af038001eaa10001ffffffff040027b929000000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac00a3e11100000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401ccd0093e36020000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000256a23ea43b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f00000000000680000000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "f0f7f536a261ee8e02fb592d81305b6052939a510e3e3435280b0bad454626c7", + "error": null, + "id": "curltest" + } + ``` + + +## heirfund + +**heirfund amount name heirpubkey inactivitytime memo ( tokenid )** + +The `heirfund` method creates a new Heir funding plan. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +### Arguments + +| Name | Type | Description | +| -------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| amount | (number) | the initial funding amount, in coins or tokens (this parameter is considered to be the amount of tokens if the (tokenid) parameter is present) | +| name | (string) | the name of the heir funding plan (arbitrary) | +| heirpubkey | (string) | the heir's public key (in hexademical) | +| inactivitytime | (number) | the time (in seconds) that must pass without the owner executing an `heiradd` or `heirclaim` method, after which the address unlocks to the heir | +| memo | (string) | a store for arbitrary data; for example, this can hold a digital copy of a physical will or other relevant documents | +| tokenid | (string, optional) | the token id in hexademical; if set, the funds contributed to this address must be of the variety specified by the tokenid | + + + * All data for this transaction, including the memo field, must be less than + or equal to 10000 bytes \* To store documents of large sizes, include a + [URI](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier) in the{" "} + memo field which links to such a document on the World Wide Web and its + hash for verification. + + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +##### Step 1: Create a raw transaction (in coins) and get the HEX value + + + The following example demonstrates Heir usage when utilizing coins, instead of + tokens. When instead using tokens, create the tokens first with the + [tokencreate](/antara/api/tokens/#tokencreate) method and pass the `tokenid` + as the last parameter of [heirfund.](/antara/api/heir/#heirfund) + + +```bash +./komodo-cli -ac_name=HELLOWORLD heirfund 0 5 MyDogHeir 037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f9299 100 'http://billionaire.com/mywill md5=5385639869' +``` + + + ```json + { + "result": "success", + "hex": "0400008085202f8902bbc0db728486b88284ac9fc4580a32869009f0ceabc659c5929d1ca5fac0a9a1010000006a47304402202e9e6a63905789547c35d3be0d0c6e022d954ba55efede20b81334e805a6e31902201a72890bfa4fff37ddf9c87c9cb567d70e89b35a82709ea14332481c860a91c10121036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562effffffffdbc39ae947682e4c3c835d9326fc32a6f7e64dde869a93c9b17a9c97f5b4aeb5010000006a473044022001b04d40674eb7f309dc17ccd822a6362ade310eb37024303a110731870ccb2702204fd975db4a21995487fac94f49da90901a0c3047ac1a22cf161cacff2a256ab80121036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562effffffff050065cd1d00000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc1027000000000000302ea22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401cc00634a8a040000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eace0950b54020000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000886a4c85ea4621036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e21037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f92996400000000000000094d79446f67486569722c687474703a2f2f62696c6c696f6e616972652e636f6d2f6d7977696c6c206d64353d3533383536333938363900000000570000000000000000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"heirfund", "params":["0" ,"5" ,"MyDogHeir" ,"037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f9299" ,"100" ,"'http://billionaire.com/mywill" ,"md5=5385639869'"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "0400008085202f89020005c599652725a611ae25aa5e2cec2520960328e82cd0151a1f9f319af983a50000000049483045022100ef5e198b9703e4f46171a99050826cdc4102b75249c9ff6886c574475beb808602204ef42ff9c4b1082c73c670e052cdc4f86b30347b6d60d20ceed2a44514b90c8301ffffffff6e0bb6725ffc34e57d3768b6d422d7f734ab23c5b770e20c869578c28d59dcb40000000049483045022100a060d0a95a5dd34c28987992692185360beaf4075d04a0bd58ae01951daeab0b02200fe42e6ec74e886f294d600fdb82c0fe8c5fa17763d3c1e6b12bf49862cd5bb501ffffffff050065cd1d00000000302ea22c80206540dfdd9c18a1aa2cedf1d2bf94b4983ee8c1d462d1a99a2ae4ed8ceb8b733181031210008203000401cc1027000000000000302ea22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401ccaa6f753118090000232102f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2ac6048980000000000232102f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2ac0000000000000000896a4c86ea462102f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a221037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f92996400000000000000094d79446f67486569722d687474703a2f2f62696c6c696f6e616972652e636f6d2f6d7977696c6c202c6d64353d3533383536333938363900000000410100000000000000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +##### Step 2: Broadcast raw transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f8902bbc0db728486b88284ac9fc4580a32869009f0ceabc659c5929d1ca5fac0a9a1010000006a47304402202e9e6a63905789547c35d3be0d0c6e022d954ba55efede20b81334e805a6e31902201a72890bfa4fff37ddf9c87c9cb567d70e89b35a82709ea14332481c860a91c10121036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562effffffffdbc39ae947682e4c3c835d9326fc32a6f7e64dde869a93c9b17a9c97f5b4aeb5010000006a473044022001b04d40674eb7f309dc17ccd822a6362ade310eb37024303a110731870ccb2702204fd975db4a21995487fac94f49da90901a0c3047ac1a22cf161cacff2a256ab80121036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562effffffff050065cd1d00000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc1027000000000000302ea22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401cc00634a8a040000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eace0950b54020000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000886a4c85ea4621036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e21037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f92996400000000000000094d79446f67486569722c687474703a2f2f62696c6c696f6e616972652e636f6d2f6d7977696c6c206d64353d3533383536333938363900000000570000000000000000000000000000 +``` + + + `bash b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0 ` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["0400008085202f8902bbc0db728486b88284ac9fc4580a32869009f0ceabc659c5929d1ca5fac0a9a1010000006a47304402202e9e6a63905789547c35d3be0d0c6e022d954ba55efede20b81334e805a6e31902201a72890bfa4fff37ddf9c87c9cb567d70e89b35a82709ea14332481c860a91c10121036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562effffffffdbc39ae947682e4c3c835d9326fc32a6f7e64dde869a93c9b17a9c97f5b4aeb5010000006a473044022001b04d40674eb7f309dc17ccd822a6362ade310eb37024303a110731870ccb2702204fd975db4a21995487fac94f49da90901a0c3047ac1a22cf161cacff2a256ab80121036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562effffffff050065cd1d00000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc1027000000000000302ea22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401cc00634a8a040000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eace0950b54020000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000886a4c85ea4621036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e21037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f92996400000000000000094d79446f67486569722c687474703a2f2f62696c6c696f6e616972652e636f6d2f6d7977696c6c206d64353d3533383536333938363900000000570000000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0", + "error": null, + "id": "curltest" + } + ``` + + +This transaction id is the funding transaction id of this Heir plan. Copy and save this to a safe location. + +Wait until the transaction is confirmed. + +##### Step 3: Decode the raw transaction to ensure the values are sane (optional) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 0400008085202f8902d47a3327514aedd15ba54f8a7a46cf47f54abc7af8ab816afae87c1b5db683420100000049483045022100a363ff9049cb6178bd0f328f4b99daf4e9ea4135a1a9cc95dc06423807d7fa2b0220402e51e3ca9db0377b3a4975aacc59b7249ee9154c95a0a3500c101ca6ccc68301fffffffffc9f94352e0215037cced1d2b888687afa841310e4451bb0f97dd3303704d8d90200000049483045022100deee8e926637e91cec15d695f6b2a178ef74a3f50c9a31dd2d64f045087e46f5022049e19c838249e1ae9945cac652b3bbb10c05071e3aaab0771f7d75815135a46901ffffffff040065cd1d00000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc1027000000000000302ea22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401cce4a79216000000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000886a4c85ea4621036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e21037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f92996400000000000000094d79446f67486569722c687474703a2f2f62696c6c696f6e616972652e636f6d2f6d7977696c6c206d64353d3533383536333938363900000000e60000000000000000000000000000 +``` + + + ```json + { + "txid": "b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0", + "overwintered": true, + "version": 4, + "versiongroupid": "892f2085", + "locktime": 0, + "expiryheight": 87, + "vin": [ + { + "txid": "a1a9c0faa51c9d92c559c6abcef0099086320a58c49fac8482b8868472dbc0bb", + "vout": 1, + "scriptSig": { + "asm": "304402202e9e6a63905789547c35d3be0d0c6e022d954ba55efede20b81334e805a6e31902201a72890bfa4fff37ddf9c87c9cb567d70e89b35a82709ea14332481c860a91c1[ALL] 036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e", + "hex": "47304402202e9e6a63905789547c35d3be0d0c6e022d954ba55efede20b81334e805a6e31902201a72890bfa4fff37ddf9c87c9cb567d70e89b35a82709ea14332481c860a91c10121036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e" + }, + "sequence": 4294967295 + }, + { + "txid": "b5aeb4f5979c7ab1c9939a86de4de6f7a632fc26935d833c4c2e6847e99ac3db", + "vout": 1, + "scriptSig": { + "asm": "3044022001b04d40674eb7f309dc17ccd822a6362ade310eb37024303a110731870ccb2702204fd975db4a21995487fac94f49da90901a0c3047ac1a22cf161cacff2a256ab8[ALL] 036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e", + "hex": "473044022001b04d40674eb7f309dc17ccd822a6362ade310eb37024303a110731870ccb2702204fd975db4a21995487fac94f49da90901a0c3047ac1a22cf161cacff2a256ab80121036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 5.0, + "valueZat": 500000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RL4bWeVxLen2np68Uxp7eNHRVqquwzSPHV"] + } + }, + { + "value": 0.0001, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "a22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RDVHcSekmXgeYBqRupNTmqo3Rn8QRXNduy"] + } + }, + { + "value": 195.0, + "valueZat": 19500000000, + "n": 2, + "scriptPubKey": { + "asm": "036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e OP_CHECKSIG", + "hex": "21036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["REXP3kgaa5wbio76aqnTJDb8CQJHBiZy2b"] + } + }, + { + "value": 99.9998, + "valueZat": 9999980000, + "n": 3, + "scriptPubKey": { + "asm": "036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e OP_CHECKSIG", + "hex": "21036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["REXP3kgaa5wbio76aqnTJDb8CQJHBiZy2b"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 4, + "scriptPubKey": { + "asm": "OP_RETURN ea4621036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e21037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f92996400000000000000094d79446f67486569722c687474703a2f2f62696c6c696f6e616972652e636f6d2f6d7977696c6c206d64353d35333835363339383639", + "hex": "6a4c85ea4621036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e21037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f92996400000000000000094d79446f67486569722c687474703a2f2f62696c6c696f6e616972652e636f6d2f6d7977696c6c206d64353d35333835363339383639", + "type": "nulldata" + } + } + ], + "vjoinsplit": [], + "valueBalance": 0.0, + "vShieldedSpend": [], + "vShieldedOutput": [] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["0400008085202f8902d47a3327514aedd15ba54f8a7a46cf47f54abc7af8ab816afae87c1b5db683420100000049483045022100a363ff9049cb6178bd0f328f4b99daf4e9ea4135a1a9cc95dc06423807d7fa2b0220402e51e3ca9db0377b3a4975aacc59b7249ee9154c95a0a3500c101ca6ccc68301fffffffffc9f94352e0215037cced1d2b888687afa841310e4451bb0f97dd3303704d8d90200000049483045022100deee8e926637e91cec15d695f6b2a178ef74a3f50c9a31dd2d64f045087e46f5022049e19c838249e1ae9945cac652b3bbb10c05071e3aaab0771f7d75815135a46901ffffffff040065cd1d00000000302ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc1027000000000000302ea22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401cce4a79216000000002321036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac0000000000000000886a4c85ea4621036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e21037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f92996400000000000000094d79446f67486569722c687474703a2f2f62696c6c696f6e616972652e636f6d2f6d7977696c6c206d64353d3533383536333938363900000000e60000000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "7dccdd51034bec6e3c7d40acf4c99c218935eb819d0bc2e77cc1e9bea1a0a820", + "overwintered": true, + "version": 4, + "versiongroupid": "892f2085", + "locktime": 0, + "expiryheight": 230, + "vin": [ + { + "txid": "4283b65d1b7ce8fa6a81abf87abc4af547cf467a8a4fa55bd1ed4a5127337ad4", + "vout": 1, + "scriptSig": { + "asm": "3045022100a363ff9049cb6178bd0f328f4b99daf4e9ea4135a1a9cc95dc06423807d7fa2b0220402e51e3ca9db0377b3a4975aacc59b7249ee9154c95a0a3500c101ca6ccc683[ALL]", + "hex": "483045022100a363ff9049cb6178bd0f328f4b99daf4e9ea4135a1a9cc95dc06423807d7fa2b0220402e51e3ca9db0377b3a4975aacc59b7249ee9154c95a0a3500c101ca6ccc68301" + }, + "sequence": 4294967295 + }, + { + "txid": "d9d8043730d37df9b01b45e4101384fa7a6888b8d2d1ce7c0315022e35949ffc", + "vout": 2, + "scriptSig": { + "asm": "3045022100deee8e926637e91cec15d695f6b2a178ef74a3f50c9a31dd2d64f045087e46f5022049e19c838249e1ae9945cac652b3bbb10c05071e3aaab0771f7d75815135a469[ALL]", + "hex": "483045022100deee8e926637e91cec15d695f6b2a178ef74a3f50c9a31dd2d64f045087e46f5022049e19c838249e1ae9945cac652b3bbb10c05071e3aaab0771f7d75815135a46901" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 5.0, + "valueZat": 500000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020fa433cc47b98f7d1eed7441a529eaa6a91425abdda9b28306a9f19e5fda64ab481031210008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RL4bWeVxLen2np68Uxp7eNHRVqquwzSPHV"] + } + }, + { + "value": 0.0001, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "a22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RDVHcSekmXgeYBqRupNTmqo3Rn8QRXNduy"] + } + }, + { + "value": 3.78709988, + "valueZat": 378709988, + "n": 2, + "scriptPubKey": { + "asm": "036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e OP_CHECKSIG", + "hex": "21036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562eac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["REXP3kgaa5wbio76aqnTJDb8CQJHBiZy2b"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN ea4621036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e21037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f92996400000000000000094d79446f67486569722c687474703a2f2f62696c6c696f6e616972652e636f6d2f6d7977696c6c206d64353d35333835363339383639", + "hex": "6a4c85ea4621036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e21037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f92996400000000000000094d79446f67486569722c687474703a2f2f62696c6c696f6e616972652e636f6d2f6d7977696c6c206d64353d35333835363339383639", + "type": "nulldata" + } + } + ], + "vjoinsplit": [], + "valueBalance": 0.0, + "vShieldedSpend": [], + "vShieldedOutput": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## heirinfo + +**heirinfo fundingtxid** + +The `heirinfo` method returns detailed information about the funding plan. + + + Use the [heirlist](/antara/api/heir/#heirlist) method to find a{" "} + fundingtxid. + + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | ------------------------------------------------------------------------------------------------ | +| fundingtxid | (string) | the transaction id returned from the original [heirfund](/antara/api/heir/#heirfund) transaction | + +### Response + +| Name | Type | Description | +| --------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| fundingtxid | (string) | the id of the funding plan, the txid of [heirfund](/antara/api/heir/#heirfund) transaction | +| name | (string) | the name of the heir plan | +| tokenid | (string) | `token id`, if applicable | +| owner | (string) | the owner's public key | +| heir | (string) | the heir's public key | +| type | (string) | the type of this funding plan (coins or tokens) | +| lifetime | (number) | the total amount contributed to this plan since inception, given in the relevant currency (coins or tokens) | +| available | (number) | the amount available, given in the relevant currency (coins or tokens) | +| OwnerRemainderTokens | (number) | the amount of funds remaining in the account that were contributed by the owner | +| InactivityTimeSetting | (number) | the `inactivitytime` (in secs) that is required to elapse without owner activity before the plan is automatically unlocked to the heir | +| IsHeirSpendingAllowed | (boolean) | a boolean flag that indicates whether the heir is allowed to claim funds | +| InactivityTime | (number) | the owner's real inactivity time (in seconds) | +| memo | (string) | a store for arbitrary data; for example, this can hold a digital copy of a physical will or other relevant documents | +| result: | (string) | whether the command succeeded | + +#### 📌 Example + +```bash +./komodo-cli -ac_name=HELLOWORLD heirinfo b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0 +``` + + + ```json + { + "fundingtxid": "b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0", + "name": "MyDogHeir", + "owner": "036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e", + "heir": "037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f9299", + "type": "coins", + "lifetime": "0.00000000", + "available": "0.00000000", + "InactivityTimeSetting": "100", + "IsHeirSpendingAllowed": "true", + "memo": "http://billionaire.com/mywill md5=5385639869", + "result": "success" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"heirinfo", "params":["b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "fundingtxid": "b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0", + "name": "MyDogHeir", + "owner": "036a2ec9095b7c2abb748548e6cec53e0c462121aa6037fd83a01ce1b2affa562e", + "heir": "037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f9299", + "type": "coins", + "lifetime": "0.00000000", + "available": "0.00000000", + "InactivityTimeSetting": "100", + "IsHeirSpendingAllowed": "true", + "memo": "http://billionaire.com/mywill md5=5385639869", + "result": "success" + }, + "error": null, + "id": "curltest" + } + ``` + + +## heirlist + +**heirlist** + +The `heirlist` method outputs a list of all available `fundingtxid`'s on the Smart Chain. + +### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | ---- | ---- | + +### Response + +| Name | Type | Description | +| ----------- | ------------------ | ---------------------------------------------------------- | +| fundingtxid | (array of strings) | an array containing all `fundingtxid`'s on the Smart Chain | + +#### 📌 Example + +```bash +./komodo-cli -ac_name=HELLOWORLD heirlist +``` + + + ```bash [ "b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0" ] + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"heirlist", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": [ + "b8b5fa46b545548fbab3baeb5adeaafedd80494006af1b04007fb9f7379ce1f0" + ], + "error": null, + "id": "curltest" + } + ``` + +export const title = "Antara API"; +export const description = + "This section contains descriptions of the various methods available for each of the Antara modules."; + +# Antara API + +This section of the documentation contains descriptions of the various methods available for each of the Antara modules. +export const title = "MuSig: Efficient, Private Multi-Signature Solution"; +export const description = "The MuSig Antara Module implements a new type of on-chain multi-signature functionality."; + +# MuSig + +## Introduction + + + Notice + + The MuSig Module is an experimental feature. It is provided as a demonstration of Antara capabilities and of the MuSig concept. If you would like to use MuSig on a production-level Smart Chain, please reach out to the Komodo team on [Discord.](https://komodoplatform.com/discord) + + +The MuSig Antara Module implements a new type of multi-signature functionality. MuSig allows a blockchain to process multi-signature transactions in a more data-efficient manner. MuSig also keeps private the number of signers partaking in a multi-signature transaction. + +This functionality is facilitated by MuSig's implementation of Schnorr Signature technology. Schnorr Signatures are unique in that each signature is 64 bytes in size, regardless of the number of signers in a transaction. Also, a multi-signature Schnorr Signature can be processed in one verification. + +Schnorr Signatures differs from the existing multi-signature method (ECDSA), as the ECDSA method requires each signer of a transaction to be verified separately. Also, with the ECDSA method each set of signers must be collected into a final verification. The size of the ECDSA multi-signature transaction can vary according to the number of signers in the set, and this can disclose information that would otherwise remain private. + +Therefore, Schnorr Signatures greatly reduce verification time and data-storage requirements, and enhance user privacy. + +For further information, see this [article.](https://blockstream.com/2019/02/18/musig-a-new-multisignature-standard/) Also, the reader may refer to the comments in the following core `komodod` files, [File 1](https://github.com/jl777/komodo/blob/jl777/src/secp256k1/include/secp256k1_musig.h) and [File 2.](https://github.com/jl777/komodo/blob/jl777/src/secp256k1/src/modules/musig/example.c) + +#### MuSig Module Flow + +* Create a combined pubkey using the [combine](/antara/api/musig/#combine) method + * From the response, take note of the `combined_pk` and `pkhash` values +* Send coins to `combined_pk` using the [send](/antara/api/musig/#send) method + * Decode the returned raw transaction using [getrawtransaction](/smart-chains/api/rawtransactions/#getrawtransaction) + * From the decoded raw transaction, take note of the `sendtxid` value +* Calculate the message that needs to be signed using the [calcmsg](/antara/api/musig/#calcmsg) method + * From the response, take note of `msg` + * This `msg` needs to be signed by all participating pubkeys +* On each node create a session using the [session](/antara/api/musig/#session) method + * From the response on each node take note of the `commitment` value + * Transfer each node's `commitment` value to each other node + * Do not stop the `komodod` daemon on any node from this point forward + * The `komodod` daemon stores the `commitment` value as a part of a `global data structure` + * Should any `komodod` daemon be stopped, the MuSig workflow must be restarted from the beginning + * Also, execute the `sessions` method only once on each node +* On each node use the [commit](/antara/api/musig/#commit) method + * Transfer each node's `nonce` value to each other node +* On each node use the [nonce](/antara/api/musig/#nonce) method + * Transfer each node's `partialsig` value to each other node +* On each node execute the [partialsig](/antara/api/musig/#partialsig) method + * Verify that the `combinedsig` value of each node is the same as each other node by transferring one `combinedsig` value on one node to all other nodes +* On at least one node execute the [verify](/antara/api/musig/#verify) method + * Use the returned output to verify that the `combinedsig` value will be able to successfully execute the `spend` method for the desired `msg` +* On one node execute the [spend](/antara/api/musig/#spend) method and broadcast the returned raw transaction + +## Tutorial Availability + +The Antara Tutorials section features a full installation and walkthrough tutorial of the Musig module. + +[Link to Musig Module Tutorial](/antara/tutorials/musig-module-tutorial/) + +## calcmsg + +**cclib calcmsg 18 '\["sendtxid", "scriptPubKey"]'** + +The `calcmsg` method can be used by any one of the signers to initiate a `spend` transaction. + +To calculate the `msg` value, this method requires a `sendtxid` and a `scriptPubKey`. + +* The `sendtxid` is the id of a transaction that added funds to the `combined_pk` through the [send](/antara/api/musig/#send) method. +* The `scriptPubKey` expected here is of the type [p2pk](https://learnmeabitcoin.com/technical/p2pk) in `hex` form. + +To create a `scriptPubkey` from a normal `pubkey`, add the characters `21` to the beginning of the `pubkey` string and the characters `ac` to the end of the string: + +```bash +scriptPubkey = 21 + pubkey + ac +``` + +For example: + +* The `pubkey` is: `02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e` +* The associated `scriptPubkey` is: `2102f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193eac` + +Usage of this method depends on the [cclib](/smart-chains/api/cclib/#cclib) method. The `EVALCODE` is `18`. + +#### Arguments + +| Name | Type | Description | +| ------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| sendtxid | (string) | the transaction id of the transaction created by the [send](/antara/api/musig/#send) method that was executed to fund the MuSig address; only the funds in the `vout0` of the `sendtxid` are spent | +| scriptPubKey | (string) | a modified form of a pubkey; this is the pubkey that will receive the spent funds | + +#### Response + +| Name | Type | Description | +| ------ | -------- | ------------------------------------------------------------------------------------------------------------- | +| msg | (string) | the message that must be signed by all the signers for the final [spend](/antara/api/musig/#spend) to succeed | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib calcmsg 18 '["09daa45cb6e17028f9568347291a993cbf29c152a527b53e9ac0925d4900c293","210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac"]' +``` + + + ```json + { + "msg": "3ef43614242afd3c57e02a75a3bc99342fea7c731f6190b791c0f99826789603", + "result": "success" + } + ``` + + +## combine + +**cclib combine 18 '\[ "pubkey1", "pubkey2", .....]'** + +The `combine` method produces the combined pubkey ( `combined_pk` ) from all pubkeys provided. + +Usage of this method depends upon the [cclib](/smart-chains/api/cclib/#cclib) method. The `EVALCODE` is `18`. + +#### Arguments + +| Name | Type | Description | +| ---------------------- | -------- | --------------------------------------------------- | +| pubkey1, pubkey2, .... | (string) | the pubkeys of all the signers of the MuSig address | + +#### Response + +| Name | Type | Description | +| ------------ | -------- | -------------------------------------------- | +| pkhash | (string) | the 32-byte hash of the original public keys | +| combined\_pk | (string) | the combined pubkey of all the signers | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib combine 18 '["0225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270a","02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567"]' +``` + + + ```json + { + "pkhash": "8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9", + "combined_pk": "03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a", + "result": "success" + } + ``` + + +## commit + +**cclib commit 18 '\["pkhash", ind, "commitment"]'** + +The `commit` method produces a `nonce` for each set of `index` and `commitment` values provided. + +The returned `nonce` must be shared with all corresponding nodes. + +Usage of this method depends on the [cclib](/smart-chains/api/cclib/#cclib) method. The `EVALCODE` is `18`. + +#### Arguments + +| Name | Type | Description | +| ---------- | ---------------- | --------------------------------------------------------------------------------------- | +| pkhash | (string) | the 32-byte hash of the original public keys | +| ind | (decimal number) | the index of the node, whose `commitment` is being added to the `global data structure` | +| commitment | (string) | the `commitment` value produced by the node with index `ind` | + +#### Response + +| Name | Type | Description | +| ------------ | ---------------- | ----------------------------------------------------------------------- | +| added\_index | (decimal number) | the index of the node whose `commitment` is added | +| myind | (decimal number) | the index of the node on which this method is executed | +| nonce | (string) | the `nonce` value produced by the node on which this method is executed | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib commit 18 '["8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9",1,"2854473733147ebdbf2fb70b956c8086c9d7659ca0093627fe0371098f8bc003"]' +``` + + + ```json + { + "added_index": 1, + "myind": 0, + "nonce": "0379f6f42cf4c2cb30d064a6cac22ab6ffb3d93388d49b07f0623ff9bc8d191f89", + "result": "success" + } + ``` + + +## nonce + +**cclib nonce 18 '\["pkhash", ind, "nonce"]'** + +The `nonce` method produces a `partialsig` for each set of `index` and `nonce` value provided. + +The returned `partialsig` must be shared with all corresponding nodes. + +Usage of this method depends on the [cclib](/smart-chains/api/cclib/#cclib) method. The `EVALCODE` is `18`. + +#### Arguments + +| Name | Type | Description | +| ------ | ---------------- | ---------------------------------------------------------------------------------- | +| pkhash | (string) | the 32-byte hash of the original public keys | +| ind | (decimal number) | the index of the node, whose `nonce` is being added to the `global data structure` | +| nonce | (string) | the `nonce` value produced by the node with index `ind` | + +#### Response + +| Name | Type | Description | +| ------------ | ---------------- | ---------------------------------------------------------------------------- | +| added\_index | (decimal number) | the index of the node whose `nonce` is added | +| myind | (decimal number) | the index of the node on which this method is executed | +| partialsig | (string) | the `partialsig` value produced by the node on which this method is executed | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib nonce 18 '["8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9",1,"02402fe26abd7ed2cf22d872a6b22ced4309aac8ec273b9c89e0f8f5b77f1574db"]' +``` + + + ```json + { + "added_index": 1, + "myind": 0, + "partialsig": "dc913a9e7532c8edf2f822f482afdcf48c61919bf905fb77f6684a2d7e58d972", + "result": "success" + } + ``` + + +## partialsig + +**cclib partialsig 18 '\["pkhash", ind, "partialsig"]'** + +The `partialsig` method produces a `combinedsig` for each set of `index` and `nonce` values provided. + +The returned `combinedsig` must be shared with all corresponding nodes. + +Usage of this method depends on the [cclib](/smart-chains/api/cclib/#cclib) method. The `EVALCODE` is `18`. + +#### Arguments + +| Name | Type | Description | +| ---------- | ---------------- | ------------------------------------------------------------------------------------- | +| pkhash | (string) | the 32-byte hash of the original public keys | +| ind | (decimal number) | the index of the node, whose `partialsig` is now added to the `global data structure` | +| partialsig | (string) | the `partialsig` value produced by the node with index `ind` | + +#### Response + +| Name | Type | Description | +| ------------ | ---------------- | ----------------------------------------------------------------------------- | +| added\_index | (decimal number) | the index of the node whose `partialsig` is added | +| myind | (decimal number) | the index of the node on which this method is executed | +| combinedsig | (string) | the `combinedsig` value produced by the node on which this method is executed | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib partialsig 18 '["8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9",1,"9e964dfd402f973ea1e9407e19918b1c3897ff6544d60dcdb19cfb0e5bc4c0c1"]' +``` + + + ```json + { + "added_index": 1, + "result": "success", + "combinedsig": "4b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f2" + } + ``` + + +## send + +**cclib send 18 '\["combined\_pk", amount]'** + +The `send` method allows any node on the network to fund the `combined_pk` with the specified `amount` . + +The returned transaction id is called the `sendtxid`. It is used as a parameter for the methods [calcmsg](/antara/api/musig/#calcmsg) and [spend.](/antara/api/musig/#spend) + +Usage of this method depends upon the [cclib](/smart-chains/api/cclib/#cclib) method. The `EVALCODE` is `18`. + +#### Arguments + +| Name | Type | Description | +| ------------ | -------- | --------------------------------------------------- | +| combined\_pk | (string) | the combined pubkey of all the signers | +| amount | (number) | the amount of coins to be sent to the `combined_pk` | + +#### Response + +| Name | Type | Description | +| ------ | -------- | ------------------------------------------------------------------------ | +| hex | (string) | the send\_transaction in raw-transaction format, provided in hexadecimal | +| txid | (string) | the transaction id of the send transaction | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib send 18 '["03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a",1]' +``` + + + ```json + { + "hex": "0400008085202f890b02b1bdd8707f82bc6f4cdeb4756eb04dfc3cc7a4b5ac38a388c0205cf8f31a0e0000000048473044022004de31b5132f03f761fc0d0d9761efbf77bb27b07ee99f2cc54928e2150f1f16022069381b36bb9839cc9cb3e1d584e00dbd52efadf7e2f3fa092e0bcca839cdce6801ffffffff04949d5bf1722c5df04f58cf2c7e662f32ab65de2f7990ce4c734df4f2991eb60000000049483045022100ab3ab2bb95ef095763dd3eeb56961d1234aa25efd91a30fa14e397717368e6a0022048d7f8268463cfb44f34467bd77eb2aee962eaec09a079741c75c5de898b4f6c01ffffffff0476a06188887bf93bec4e64a3a5681b5e271cb7055a11d0667dc565e498b6190000000048473044022022ef03c33b5942b1af16f7e4a9acd2aa485d73f6f6b5e0a01e15f70238cd85cd022063779c69511ee4eba179b40ce28d80da22d43f19110be2a9a97d0b47d6a5cca201ffffffff045587699381853735482dbfb1fe25dda8d5a7a238c05b872ecfcd97be38232f00000000484730440220051e6047dd9e82b004c29a2837bf127f94caa638c65d96c761371c18ff36170002204e73ddfbbe748f295d7a93e46d942618f291d302b7a666b78b49ab38594a89ac01ffffffff0426d8098ed0c5ee19ac8d4254ec9887ab7a231c68a8d9b024a50f417f0a94ff0000000049483045022100ebd193262a04f8c9cf1872527d2a7d4933222f8ce8ea11add90e263c483ca56a02204a29902ae6b31dc41f84b5ffad3b2076755ad19f25be47479704b2ab5e37463a01ffffffff040e294b76ca4492909b75b829566b3702b35245595e8c4806b7ef6a7f612dd6000000004847304402201573d230af50aa6d326b607ac6ba77bb15c1a143256e5141197ce6729195b0e602201301be6ad22ba5599597205cdfb7e2cf6823ce4597e5b902b6d4336958e0fbe101ffffffff03d9a453070627c94d940f57b40829713ee6b6bce4d801e591117c801221225900000000494830450221009d5eec551265274ade816fdb3a0dfee20e716a7d3f56155b698a9d0c41ccd11202202e811c4611ebf982b34db8a43002c759c54a077023ced1498421c4af2b12a0f901ffffffff03ce7cb872bdfdf264576c45ed899c00731959051cade1a19b088eabc02e07780000000049483045022100a9c8c795e34a393fafb839ef4bbf11e4adf04b4c8a8493ef0bd2353e7a1ddd430220251ff7eb5ca3d2ed4ee4145906532af803caaed756ff3d21e86ac4876333067e01ffffffff030d66186013342f71335bc67d0d87240b4a27809e67ba55e01dd72e7ae1b0af0000000049483045022100d4c82867562aa040a7695ffd53056018e0dc3a071d971b3774cdb8511b0f49aa022029b72c5af1b9c16e27d81827d478910ec3135415037cf2b3492922ff618538bc01ffffffff02f9b92abfa0324272e0ce465b856e6d9b53e3e2e0828934c8a0c8c2c10e67d5000000004847304402205df4c99c581bfe95ea95740320b16c423531663b42e25b97315d3126250c24a202206dff5da29fbb0fe21ae6ce3da7bac1e502feb8fdd7b803c0fafa6541e80ec0ff01ffffffff02bd8679e8383e6d9c4a10917b68b8918ed3f518fe2deef5b23e0012461fbf370000000049483045022100a04210427173ea0721f3cf859b99328c8e234ba39250c033aebfb37fb2c5a1d502200d5cb16ed0dccc5dfc0385a8763340cf98a162e863994069354a5fee187b8bd401ffffffff031008f60500000000302ea22c8020c71ddb3aac7f9b9e4bdacf032aaa8b8e4433c4ff9f8a43cebb9c1f5da96928a48103120c008203000401cc604898000000000023210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac0000000000000000266a2412782103d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a000000003f0800000000000000000000000000", + "txid": "09daa45cb6e17028f9568347291a993cbf29c152a527b53e9ac0925d4900c293", + "result": "success" + } + ``` + + +## session + +**cclib session 18 '\["myindex", "numsigners", "combined\_pk", "pkhash", "msg"]'** + +The `session` method creates a `global data structure` on each node on which the method is executed. The method also adds a `commitment` to sign the `msg` message provided. + +Usage of this method depends on the [cclib](/smart-chains/api/cclib/#cclib) method. The `EVALCODE` is `18`. + +#### Arguments + +| Name | Type | Description | +| ------------ | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | +| myindex | (decimal number) | the index of the node that is running this method; each node must be assigned a unique index from the set: \{0,1,2,3, ... , (`numsigners` - 1)} | +| numsigners | (decimal number) | the total number of signers participating | +| combined\_pk | (string) | the combined pubkey of all the signers | +| pkhash | (string) | the 32-byte hash of the original public keys | +| msg | (string) | the message that needs to be signed by all the signers for the final [spend](/antara/api/musig/#spend) to succeed | + +#### Response + +| Name | Type | Description | +| ---------- | ---------------- | ------------------------------------------------------------------------ | +| myind | (decimal number) | the index of the node on which this method is executed | +| numsigners | (decimal number) | the total number of signers participating | +| commitment | (string) | the `commitment` value produced by the node for this `msg` and `session` | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib session 18 '[0,2,"03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a","8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9","3ef43614242afd3c57e02a75a3bc99342fea7c731f6190b791c0f99826789603"]' +``` + + + ```json + { + "myind": 0, + "numsigners": 2, + "commitment": "a886a3a3c57efec161f6f72554b66f837de89ffdabe0acc46ae4cd59aab8129e", + "result": "success" + } + ``` + + +## spend + +**cclib spend 18 '\["sendtxid", "combinedsig", "scriptPubKey"]'** + +The `spend` method spends coins to the indicated `scriptPubKey`. + +The `scriptPubKey` expected here is of the type [p2pk](https://learnmeabitcoin.com/technical/p2pk) in `hex` form. + +To create a `scriptPubkey` from a normal `pubkey`, add the characters `21` to the beginning of the `pubkey` string and the characters `ac` to the end of the string: + +```bash +scriptPubkey = 21 + pubkey + ac +``` + +For example: + +* The `pubkey` is: `02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e` +* The associated `scriptPubkey` is: `2102f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193eac` + +The method generates a raw transaction which must then be broadcast using [sendrawtransaction.](/smart-chains/api/rawtransactions/#sendrawtransaction) + +Usage of this method depends on the [cclib](/smart-chains/api/cclib/#cclib) method. The `EVALCODE` is `18`. + +#### Arguments + +| Name | Type | Description | +| ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| sendtxid | (string) | the transaction id of the transaction created by the [send](/antara/api/musig/#send) method used to fund the MuSig address; only the funds in the `vout0` of the `sendtxid` are spent | +| combinedsig | (string) | the combined signature produced by all the signers | +| scriptPubKey | (string) | a modified form of a pubkey to which funds are to be spent | + +#### Response + +| Name | Type | Description | +| ------------ | -------- | ----------------------------------------------------------------------------------------------------------------- | +| msg | (string) | the message that needs to be signed by all the signers for the final [spend](/antara/api/musig/#spend) to succeed | +| combined\_pk | (string) | the combined pubkey of all the signers | +| combinedsig | (string) | the combined signature produced by all the signers | +| hex | (string) | the `spend` transaction in raw-transaction format, provided in hexadecimal | +| txid | (string) | the transaction id of the spend transaction | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib spend 18 '["09daa45cb6e17028f9568347291a993cbf29c152a527b53e9ac0925d4900c293","210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac","4b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f2"]' +``` + + + ```json + { + "msg": "3ef43614242afd3c57e02a75a3bc99342fea7c731f6190b791c0f99826789603", + "combined_pk": "03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a", + "combinedsig": "4b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f2", + "hex": "0400008085202f890193c200495d92c09a3eb527a552c129bf3c991a29478356f92870e1b65ca4da09000000007b4c79a276a072a26ba067a5658021032d29d6545a2aafad795d9cf50912ecade549137163934dfb2895ebc0e211ce8a8140878ae4c7520e729e74339e1d463d8aabc1e63c0f726c868adcf7ceab268ef62870596c7c87bdd9382bd364749662ffc79e6ee094a155678b7c2127480960b631a100af03800112a10001ffffffff0200e1f5050000000023210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac0000000000000000686a4c6512792103d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a404b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f200000000460800000000000000000000000000", + "txid": "332373cd0e4cbdddd3916e827a408ba4a175eb5039cc5a43725a50b83cb74e52", + "result": "success" + } + ``` + + +## verify + +**cclib verify 18 '\["msg", "combined\_pk", "combinedsig"]'** + +The `verify` method verifies that the `combinedsig` is able to spend the funds owned by `combined_pk`. The funds in question are those which were referenced in the creation of the `msg` value. + +Usage of this method depends on the [cclib](/smart-chains/api/cclib/#cclib) method. The `EVALCODE` is `18`. + +#### Arguments + +| Name | Type | Description | +| ------------ | -------- | ----------------------------------------------------------------------------------------------------------------- | +| msg | (string) | the message that needs to be signed by all the signers for the final [spend](/antara/api/musig/#spend) to succeed | +| combined\_pk | (string) | the combined pubkey of all the signers | +| combinedsig | (string) | the `combinedsig` value produced by the node on which this method is executed | + +#### Response + +| Name | Type | Description | +| ------------ | -------- | ----------------------------------------------------------------------------------------------------------------- | +| msg | (string) | the message that needs to be signed by all the signers for the final [spend](/antara/api/musig/#spend) to succeed | +| combinedsig | (string) | the `combinedsig` value produced by the node on which this method is executed | +| combined\_pk | (string) | the combined pubkey of all the signers | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib verify 18 '["3ef43614242afd3c57e02a75a3bc99342fea7c731f6190b791c0f99826789603","03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a","4b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f2"]' +``` + + + ```json + { + "msg": "3ef43614242afd3c57e02a75a3bc99342fea7c731f6190b791c0f99826789603", + "combined_pk": "03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a", + "combinedsig": "4b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f2", + "result": "success" + } + ``` + +export const title = "Oracles: Bridging Off-Chain Data On-Chain"; +export const description = "The Oracles Antara Module allows a user to make off-chain data available on-chain."; + +# Oracles + +## Introduction + +The Oracles Antara Module allows a user to make off-chain data available on-chain. This enables developers to create and use software that responds to off-chain information and events. + +Those who publish data to an oracle are called publishers. There is a fee-based model to serve as an incentive for publishers. + +### Oracles Module Flow + +* Create an Oracle using [oraclescreate](/antara/api/oracles/#oraclescreate) +* Register as a data publisher for the oracle using the [oraclesregister](/antara/api/oracles/#oraclesregister) method; at this stage, the publisher indicates the fee for their data updates + * Anyone can register as a publisher for any oracle; users subscribe only to the publishers they desire +* The [oracleslist](/antara/api/oracles/#oracleslist), [oraclesinfo](/antara/api/oracles/#oraclesinfo), and [oraclessamples](/antara/api/oracles/#oraclessamples) methods allow the user to find oracles and publishers, find more information about a specific oracle and publisher, and discover samples of an existing publisher, respectively +* Anyone can subscribe to any specific publisher of any oracle using the [oraclessubscribe](/antara/api/oracles/#oraclessubscribe) method +* A publisher can publish data using [oraclesdata](/antara/api/oracles/#oraclesdata), and thereby collect their fee from their subscribers + +## oraclesaddress + +**oraclesaddress (pubkey)** + +The `oraclesaddress` method displays the oracle address for a specific pubkey. + +### Arguments + +| Name | Type | Description | +| ------ | ------------------ | -------------------------------------------------------------------------------------- | +| pubkey | (string, optional) | the pubkey of the requested info; by default it is the pubkey used to launch the chain | + +### Response + +| Name | Type | Description | +| ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------ | +| result | (string) | whether the method executed successfully | +| OraclesCCaddress | (string) | taking the module's EVAL code as a modifier, this is the public address that corresponds to the contract's privkey | +| Oraclesmarker | (string) | the unmodified public address generated from the contract's privkey | +| GatewaysPubkey | (string) | the pubkey for the Gateways Antara Module | +| OraclesCCassets | (string) | this property is used for development purposes only and can otherwise be ignored | +| CCaddress | (string) | taking the module's EVAL code as a modifier, this is the Antara address from the pubkey of the user | +| myCCaddress | (string) | taking the module's EVAL code as a modifier, this is the Antara address from the pubkey of the user | +| myaddress | (string) | the public address of the pubkey used to launch the chain | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclesaddress 03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 +``` + + + ```json + { + "result": "success", + "OraclesCCAddress": "REt2C4ZMnX8YYX1DRpffNA4hECZTFm39e3", + "OraclesCCBalance": 0.0, + "OraclesNormalAddress": "RHkFKzn1csxA3fWzAsxsLWohoCgBbirXb5", + "OraclesNormalBalance": 0.0, + "OraclesCCTokensAddress": "RWGhAG1qPRRxCxtewLixKX6GseGZQWVQ9E", + "PubkeyCCaddress(Oracles)": "RTk2Tgp1iAcxxSeuXYDREmtfydMvNkCmq8", + "PubkeyCCbalance(Oracles)": 0.0, + "myCCAddress(Oracles)": "RM5w8tsRzrHdsSZ9L29x4uDwZNRzZHQd9D", + "myCCbalance(Oracles)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"oraclesaddress", "params":["03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "OraclesCCAddress": "REt2C4ZMnX8YYX1DRpffNA4hECZTFm39e3", + "OraclesCCBalance": 0.0, + "OraclesNormalAddress": "RHkFKzn1csxA3fWzAsxsLWohoCgBbirXb5", + "OraclesNormalBalance": 0.0, + "OraclesCCTokensAddress": "RWGhAG1qPRRxCxtewLixKX6GseGZQWVQ9E", + "PubkeyCCaddress(Oracles)": "RTk2Tgp1iAcxxSeuXYDREmtfydMvNkCmq8", + "PubkeyCCbalance(Oracles)": 0.0, + "myCCAddress(Oracles)": "RM5w8tsRzrHdsSZ9L29x4uDwZNRzZHQd9D", + "myCCbalance(Oracles)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + }, + "error": null, + "id": "curltest" + } + ``` + + +## oraclescreate + +**oraclescreate name description format** + +The `oraclescreate` method creates a new oracle. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- | +| name | (string) | the desired name of the oracle contract | +| description | (string) | the description of the oracle | +| format | (string) | an indication of what format of data is accepted into this contract; use the list of characters provided below for this property | + +The various formats of data that can be registered for an oracle and their symbols are as follows: + +* `s` -> `char string; size < 256 bytes` +* `S` -> `char string; size < 65536 bytes` +* `d` -> `binary data; size < 256 bytes` +* `D` -> `binary data; size < 65536 bytes` +* `c` -> `1 byte signed little endian number, 'C' if unsigned` +* `t` -> `2 byte signed little endian number, 'T' if unsigned` +* `i` -> `4 byte signed little endian number, 'I' if unsigned` +* `l` -> `8 byte signed little endian number, 'L' if unsigned` +* `h` -> `32 byte hash` + + + * Even though the formats `S` and `D` specify that the data size can be up to `65536` bytes, the combination of the transaction size and the data size cannot exceed the limit of `10000` bytes. + * Although the formats `d` and `D` are for raw binary data, they are preferable to the `s` and `S` human-readable formats. This is because the `s` and `S` formats occupy twice the size of data on the blockchain, and yet their only advantage is their ability to show human-readable output in the [oraclessamples](/antara/api/oracles/#oraclessamples) method. + + + + If data to be submitted is larger than `8KB`, break it into chunks of size + `8KB` or lower. + + +### Response + +| Name | Type | Description | +| ------ | -------- | ---------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command succeeded | +| hex | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Create a customized oracle contract and get the hex value + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclescreate "NYWTHR" "Weather in NYC" "L" +``` + + + ```json + { + "result": "success", + "hex": "010000000185b76ed0fbdb9ee2bdb5693f491b6ea23de6498f42c6e83f9f36c1eaf411dd990200000049483045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c01ffffffff0310270000000000002321038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aac378740a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000001c6a1aec43064e5957544852014c0e5765617468657220696e204e594300000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"oraclescreate", "params":["NYWTHR" ,"Weather in NYC", "L"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "010000000185b76ed0fbdb9ee2bdb5693f491b6ea23de6498f42c6e83f9f36c1eaf411dd990200000049483045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c01ffffffff0310270000000000002321038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aac378740a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000001c6a1aec43064e5957544852014c0e5765617468657220696e204e594300000000" + }, + "error": null, + "id": null + } + ``` + + +Step 2: Send raw transaction / broadcast the hex value + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000185b76ed0fbdb9ee2bdb5693f491b6ea23de6498f42c6e83f9f36c1eaf411dd990200000049483045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c01ffffffff0310270000000000002321038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aac378740a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000001c6a1aec43064e5957544852014c0e5765617468657220696e204e594300000000 +# This will output a unique txid which will be refered as oracletxid or transaction ID of the oracle. +``` + + + ```bash + 0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000185b76ed0fbdb9ee2bdb5693f491b6ea23de6498f42c6e83f9f36c1eaf411dd990200000049483045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c01ffffffff0310270000000000002321038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aac378740a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000001c6a1aec43064e5957544852014c0e5765617468657220696e204e594300000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203", + "error": null, + "id": "curltest" + } + ``` + + +(Use `./komodo-cli -ac_name=HELLOWORLD getrawmempool` to ensure that the transaction receives confirmation.) + +Step 3: Decode raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 010000000185b76ed0fbdb9ee2bdb5693f491b6ea23de6498f42c6e83f9f36c1eaf411dd990200000049483045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c01ffffffff0310270000000000002321038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aac378740a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000001c6a1aec43064e5957544852014c0e5765617468657220696e204e594300000000 +``` + + + ```json + { + "txid": "0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203", + "size": 249, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "99dd11f4eac1369f3fe8c6428f49e63da26e1b493f69b5bde29edbfbd06eb785", + "vout": 2, + "scriptSig": { + "asm": "3045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c01", + "hex": "483045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c01" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.0001, + "valueSat": 10000, + "n": 0, + "scriptPubKey": { + "asm": "038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691a OP_CHECKSIG", + "hex": "21038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RHkFKzn1csxA3fWzAsxsLWohoCgBbirXb5"] + } + }, + { + "value": 200.02670391, + "valueSat": 20002670391, + "n": 1, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN ec43064e5957544852014c0e5765617468657220696e204e5943", + "hex": "6a1aec43064e5957544852014c0e5765617468657220696e204e5943", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["010000000185b76ed0fbdb9ee2bdb5693f491b6ea23de6498f42c6e83f9f36c1eaf411dd990200000049483045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c01ffffffff0310270000000000002321038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aac378740a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000001c6a1aec43064e5957544852014c0e5765617468657220696e204e594300000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "99dd11f4eac1369f3fe8c6428f49e63da26e1b493f69b5bde29edbfbd06eb785", + "vout": 2, + "scriptSig": { + "asm": "3045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c[ALL]", + "hex": "483045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c01" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.0001, + "valueZat": 10000, + "n": 0, + "scriptPubKey": { + "asm": "038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691a OP_CHECKSIG", + "hex": "21038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RHkFKzn1csxA3fWzAsxsLWohoCgBbirXb5"] + } + }, + { + "value": 200.02670391, + "valueZat": 20002670391, + "n": 1, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN ec43064e5957544852014c0e5765617468657220696e204e5943", + "hex": "6a1aec43064e5957544852014c0e5765617468657220696e204e5943", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## oraclesdata + +**oraclesdata oracletxid hexstr** + +The `oraclesdata` method publishes data to an oracle. + +A publisher cannot successfully execute this command until they have at least one subscriber. A publisher may create their own subscriber account for this purpose. See [oraclessubscribe.](/antara/api/oracles/#oraclessubscribe) + +Data is submitted using the `hexstr` property. The first bytes of the `hexstr` property must be the length of the data being submitted in hexadecimal format; this sets the string length for the rest of the data. The second portion of the `hexstr` property is the data itself. + +The `oraclesdata` method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +The `sendrawtransaction` method outputs a unique `txid`, called `oraclesdatatxid`, which is the unique identifier for this data sample. + +The following script converts data entered in a normal-text form to a format accepted by an Oracle with the following characteristics. The oracle is of type: `S`, and the first two bytes of data are the length, given in **Little Endian** format. + + + ```python + #!/usr/bin/env python3 + import sys + import codecs + import time + import readline + + + while True: + message = input("Type message: ") + #convert message to hex + rawhex = codecs.encode(message).hex() + + #get length in bytes of hex in decimal + bytelen = int(len(rawhex) / int(2)) + hexlen = format(bytelen, 'x') + + #get length in big endian hex + if bytelen < 16: + bigend = "000" + str(hexlen) + elif bytelen < 256: + bigend = "00" + str(hexlen) + elif bytelen < 4096: + bigend = "0" + str(hexlen) + elif bytelen < 65536: + bigend = str(hexlen) + else: + print("message too large, must be less than 65536 characters") + continue + + #convert big endian length to little endian, append rawhex to little endian length + lilend = bigend[2] + bigend[3] + bigend[0] + bigend[1] + fullhex = lilend + rawhex + + print(fullhex) + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["010000000185b76ed0fbdb9ee2bdb5693f491b6ea23de6498f42c6e83f9f36c1eaf411dd990200000049483045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c01ffffffff0310270000000000002321038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aac378740a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000001c6a1aec43064e5957544852014c0e5765617468657220696e204e594300000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "99dd11f4eac1369f3fe8c6428f49e63da26e1b493f69b5bde29edbfbd06eb785", + "vout": 2, + "scriptSig": { + "asm": "3045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c[ALL]", + "hex": "483045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c01" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.0001, + "valueZat": 10000, + "n": 0, + "scriptPubKey": { + "asm": "038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691a OP_CHECKSIG", + "hex": "21038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RHkFKzn1csxA3fWzAsxsLWohoCgBbirXb5"] + } + }, + { + "value": 200.02670391, + "valueZat": 20002670391, + "n": 1, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN ec43064e5957544852014c0e5765617468657220696e204e5943", + "hex": "6a1aec43064e5957544852014c0e5765617468657220696e204e5943", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + + + * for submitting data of the types `s` and `d`, where the size is less than 256 bytes, the first byte denotes the length + * for submitting data of the types `S` and `D`, where the size is less than 65536 bytes, the first two bytes denotes the length in **Little Endian** format + + +#### 📌 Examples for data submission + +##### Example A + +* The objective: to submit a `10` character string, `"teststring"`, to an oracle of the format `s` +* The data to meet this objective is as follows: `0a74657374737472696e67` + * Notice the first byte, `0a` + * This is the hexadecimal representation of the decimal number `10` + * `10` is the byte size of this `10` character string, because each character requires `1 byte` of space + * Notice the remaining bytes, `74657374737472696e67` + * Each two characters is a byte representing a character + * `74` = `t` + * `65` = `e` + * `73` = `s` + * `74` = `t` etc. + +##### Example B + +* The objective: to submit the `10` character string, `"teststring"`, to an oracle of the format `S` +* The data to meet this objective is as follows: `0a0074657374737472696e67` + * Notice the first two bytes, `0a` and `00` + * These are the hexadecimal representations of the decimal number `10`, written to fill `2 bytes` and in **Little Endian** format + * The remaining data, `74657374737472696e67`, is the same as Example A + +### Arguments + +| Name | Type | Description | +| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| oracletxid | (string) | the unique identifying transaction id of the oracle | +| hexstring | (string) | the first half of the string indicates the length of the string in bytes, the second half of the string is the data, typically provided in hex-encoded format | + +### Response + +| Name | Type | Description | +| ------ | -------- | ---------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command succeeded | +| hex | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Subscribe to a oracle plan and get the hex value + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclesdata 0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203 00000000ffffffff +``` + + + ```json + { + "result": "success", + "hex": "010000000359db76b9b8e9cfaa4514dcc198c375f910b9fb7367d1c9d556cd5eb43b5f4d2d02000000484730440220645b49d6d85454b1015d82a53ec51685fc3b8bf1d092696c3c253b88cab3033a02207023511219897a374ad94951dd2af70b14d99eccbb404eaf783120f3170bd5e301ffffffff75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f010000007b4c79a276a072a26ba067a5658021035933ab0bd2e2ceb712e7cab393a8c9096ba4be2e3a76f5aaeab72bce4aa61857814047697a246e4442888a3b6ffc4a8c5ae940eec7d19f72053a07b6d8a2968a260626c8001c9138e9fd0e3cfabb811ae71bd8c1c555ca8c8410cb9121ce25860507a100af038001eca10001ffffffff59db76b9b8e9cfaa4514dcc198c375f910b9fb7367d1c9d556cd5eb43b5f4d2d000000007b4c79a276a072a26ba067a565802103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b581404fa0de32bbb96b2e2f61fe823cdba4c3b9fef786ea8c65196f97653a942656812e675e91643ff0ec33853fd2481d40fc48fa51e18c9cbffb49e714c15b47babda100af038001eca10001ffffffff05c09ee60500000000302ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc1027000000000000302ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc40420f0000000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5acd7bb49a204000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac0000000000000000706a4c6dec4403921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b50800000000ffffffff00000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"oraclesdata", "params":["0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203" ,"00000000ffffffff"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "010000000359db76b9b8e9cfaa4514dcc198c375f910b9fb7367d1c9d556cd5eb43b5f4d2d02000000484730440220645b49d6d85454b1015d82a53ec51685fc3b8bf1d092696c3c253b88cab3033a02207023511219897a374ad94951dd2af70b14d99eccbb404eaf783120f3170bd5e301ffffffff75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f010000007b4c79a276a072a26ba067a5658021035933ab0bd2e2ceb712e7cab393a8c9096ba4be2e3a76f5aaeab72bce4aa61857814047697a246e4442888a3b6ffc4a8c5ae940eec7d19f72053a07b6d8a2968a260626c8001c9138e9fd0e3cfabb811ae71bd8c1c555ca8c8410cb9121ce25860507a100af038001eca10001ffffffff59db76b9b8e9cfaa4514dcc198c375f910b9fb7367d1c9d556cd5eb43b5f4d2d000000007b4c79a276a072a26ba067a565802103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b581404fa0de32bbb96b2e2f61fe823cdba4c3b9fef786ea8c65196f97653a942656812e675e91643ff0ec33853fd2481d40fc48fa51e18c9cbffb49e714c15b47babda100af038001eca10001ffffffff05c09ee60500000000302ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc1027000000000000302ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc40420f0000000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5acd7bb49a204000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac0000000000000000706a4c6dec4403921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b50800000000ffffffff00000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Send raw transaction / broadcast the hex value + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000359db76b9b8e9cfaa4514dcc198c375f910b9fb7367d1c9d556cd5eb43b5f4d2d02000000484730440220645b49d6d85454b1015d82a53ec51685fc3b8bf1d092696c3c253b88cab3033a02207023511219897a374ad94951dd2af70b14d99eccbb404eaf783120f3170bd5e301ffffffff75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f010000007b4c79a276a072a26ba067a5658021035933ab0bd2e2ceb712e7cab393a8c9096ba4be2e3a76f5aaeab72bce4aa61857814047697a246e4442888a3b6ffc4a8c5ae940eec7d19f72053a07b6d8a2968a260626c8001c9138e9fd0e3cfabb811ae71bd8c1c555ca8c8410cb9121ce25860507a100af038001eca10001ffffffff59db76b9b8e9cfaa4514dcc198c375f910b9fb7367d1c9d556cd5eb43b5f4d2d000000007b4c79a276a072a26ba067a565802103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b581404fa0de32bbb96b2e2f61fe823cdba4c3b9fef786ea8c65196f97653a942656812e675e91643ff0ec33853fd2481d40fc48fa51e18c9cbffb49e714c15b47babda100af038001eca10001ffffffff05c09ee60500000000302ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc1027000000000000302ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc40420f0000000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5acd7bb49a204000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac0000000000000000706a4c6dec4403921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b50800000000ffffffff00000000 +``` + + + ```bash + 9530bdf82744ac57a5ffe0855595f5510c339341cdc3c8728ee547d3f3153433 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000359db76b9b8e9cfaa4514dcc198c375f910b9fb7367d1c9d556cd5eb43b5f4d2d02000000484730440220645b49d6d85454b1015d82a53ec51685fc3b8bf1d092696c3c253b88cab3033a02207023511219897a374ad94951dd2af70b14d99eccbb404eaf783120f3170bd5e301ffffffff75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f010000007b4c79a276a072a26ba067a5658021035933ab0bd2e2ceb712e7cab393a8c9096ba4be2e3a76f5aaeab72bce4aa61857814047697a246e4442888a3b6ffc4a8c5ae940eec7d19f72053a07b6d8a2968a260626c8001c9138e9fd0e3cfabb811ae71bd8c1c555ca8c8410cb9121ce25860507a100af038001eca10001ffffffff59db76b9b8e9cfaa4514dcc198c375f910b9fb7367d1c9d556cd5eb43b5f4d2d000000007b4c79a276a072a26ba067a565802103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b581404fa0de32bbb96b2e2f61fe823cdba4c3b9fef786ea8c65196f97653a942656812e675e91643ff0ec33853fd2481d40fc48fa51e18c9cbffb49e714c15b47babda100af038001eca10001ffffffff05c09ee60500000000302ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc1027000000000000302ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc40420f0000000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5acd7bb49a204000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac0000000000000000706a4c6dec4403921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b50800000000ffffffff00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "9530bdf82744ac57a5ffe0855595f5510c339341cdc3c8728ee547d3f3153433", + "error": null, + "id": "curltest" + } + ``` + + +Step 3: Decode raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 010000000359db76b9b8e9cfaa4514dcc198c375f910b9fb7367d1c9d556cd5eb43b5f4d2d02000000484730440220645b49d6d85454b1015d82a53ec51685fc3b8bf1d092696c3c253b88cab3033a02207023511219897a374ad94951dd2af70b14d99eccbb404eaf783120f3170bd5e301ffffffff75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f010000007b4c79a276a072a26ba067a5658021035933ab0bd2e2ceb712e7cab393a8c9096ba4be2e3a76f5aaeab72bce4aa61857814047697a246e4442888a3b6ffc4a8c5ae940eec7d19f72053a07b6d8a2968a260626c8001c9138e9fd0e3cfabb811ae71bd8c1c555ca8c8410cb9121ce25860507a100af038001eca10001ffffffff59db76b9b8e9cfaa4514dcc198c375f910b9fb7367d1c9d556cd5eb43b5f4d2d000000007b4c79a276a072a26ba067a565802103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b581404fa0de32bbb96b2e2f61fe823cdba4c3b9fef786ea8c65196f97653a942656812e675e91643ff0ec33853fd2481d40fc48fa51e18c9cbffb49e714c15b47babda100af038001eca10001ffffffff05c09ee60500000000302ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc1027000000000000302ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc40420f0000000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5acd7bb49a204000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac0000000000000000706a4c6dec4403921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b50800000000ffffffff00000000 +``` + + + ```json + { + "txid": "9530bdf82744ac57a5ffe0855595f5510c339341cdc3c8728ee547d3f3153433", + "size": 774, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "2d4d5f3bb45ecd56d5c9d16773fbb910f975c398c1dc1445aacfe9b8b976db59", + "vout": 2, + "scriptSig": { + "asm": "30440220645b49d6d85454b1015d82a53ec51685fc3b8bf1d092696c3c253b88cab3033a02207023511219897a374ad94951dd2af70b14d99eccbb404eaf783120f3170bd5e301", + "hex": "4730440220645b49d6d85454b1015d82a53ec51685fc3b8bf1d092696c3c253b88cab3033a02207023511219897a374ad94951dd2af70b14d99eccbb404eaf783120f3170bd5e301" + }, + "sequence": 4294967295 + }, + { + "txid": "8f3c517d023e42bacfd0de8b0174cdc8adab713d08a689c00067ab171488a575", + "vout": 1, + "scriptSig": { + "asm": "a276a072a26ba067a5658021035933ab0bd2e2ceb712e7cab393a8c9096ba4be2e3a76f5aaeab72bce4aa61857814047697a246e4442888a3b6ffc4a8c5ae940eec7d19f72053a07b6d8a2968a2606 + 26c8001c9138e9fd0e3cfabb811ae71bd8c1c555ca8c8410cb9121ce25860507a100af038001eca10001", + "hex": "4c79a276a072a26ba067a5658021035933ab0bd2e2ceb712e7cab393a8c9096ba4be2e3a76f5aaeab72bce4aa61857814047697a246e4442888a3b6ffc4a8c5ae940eec7d19f72053a07b6d8a2968a + 260626c8001c9138e9fd0e3cfabb811ae71bd8c1c555ca8c8410cb9121ce25860507a100af038001eca10001" + }, + "sequence": 4294967295 + }, + { + "txid": "2d4d5f3bb45ecd56d5c9d16773fbb910f975c398c1dc1445aacfe9b8b976db59", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b581404fa0de32bbb96b2e2f61fe823cdba4c3b9fef786ea8c65196f97653a94265681 + 2e675e91643ff0ec33853fd2481d40fc48fa51e18c9cbffb49e714c15b47babda100af038001eca10001", + "hex": "4c79a276a072a26ba067a565802103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b581404fa0de32bbb96b2e2f61fe823cdba4c3b9fef786ea8c65196f97653a9426 + 56812e675e91643ff0ec33853fd2481d40fc48fa51e18c9cbffb49e714c15b47babda100af038001eca10001" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.99000000, + "valueSat": 99000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": [ + "RTk2Tgp1iAcxxSeuXYDREmtfydMvNkCmq8" + ] + } + }, + { + "value": 0.00010000, + "valueSat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "a22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": [ + "RWg43P8s8RtJatAGNa2kV8N2abhQqH93w9" + ] + } + }, + { + "value": 0.01000000, + "valueSat": 1000000, + "n": 2, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": [ + "RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He" + ] + } + }, + { + "value": 199.02610391, + "valueSat": 19902610391, + "n": 3, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": [ + "RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He" + ] + } + }, + { + "value": 0.00000000, + "valueSat": 0, + "n": 4, + "scriptPubKey": { + "asm": "OP_RETURN ec4403921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b50800000000ffffffff", + "hex": "6a4c6dec4403921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b50800000000ffffffff", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["010000000359db76b9b8e9cfaa4514dcc198c375f910b9fb7367d1c9d556cd5eb43b5f4d2d02000000484730440220645b49d6d85454b1015d82a53ec51685fc3b8bf1d092696c3c253b88cab3033a02207023511219897a374ad94951dd2af70b14d99eccbb404eaf783120f3170bd5e301ffffffff75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f010000007b4c79a276a072a26ba067a5658021035933ab0bd2e2ceb712e7cab393a8c9096ba4be2e3a76f5aaeab72bce4aa61857814047697a246e4442888a3b6ffc4a8c5ae940eec7d19f72053a07b6d8a2968a260626c8001c9138e9fd0e3cfabb811ae71bd8c1c555ca8c8410cb9121ce25860507a100af038001eca10001ffffffff59db76b9b8e9cfaa4514dcc198c375f910b9fb7367d1c9d556cd5eb43b5f4d2d000000007b4c79a276a072a26ba067a565802103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b581404fa0de32bbb96b2e2f61fe823cdba4c3b9fef786ea8c65196f97653a942656812e675e91643ff0ec33853fd2481d40fc48fa51e18c9cbffb49e714c15b47babda100af038001eca10001ffffffff05c09ee60500000000302ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc1027000000000000302ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc40420f0000000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5acd7bb49a204000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac0000000000000000706a4c6dec4403921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b50800000000ffffffff00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "9530bdf82744ac57a5ffe0855595f5510c339341cdc3c8728ee547d3f3153433", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "2d4d5f3bb45ecd56d5c9d16773fbb910f975c398c1dc1445aacfe9b8b976db59", + "vout": 2, + "scriptSig": { + "asm": "30440220645b49d6d85454b1015d82a53ec51685fc3b8bf1d092696c3c253b88cab3033a02207023511219897a374ad94951dd2af70b14d99eccbb404eaf783120f3170bd5e3[ALL]", + "hex": "4730440220645b49d6d85454b1015d82a53ec51685fc3b8bf1d092696c3c253b88cab3033a02207023511219897a374ad94951dd2af70b14d99eccbb404eaf783120f3170bd5e301" + }, + "sequence": 4294967295 + }, + { + "txid": "8f3c517d023e42bacfd0de8b0174cdc8adab713d08a689c00067ab171488a575", + "vout": 1, + "scriptSig": { + "asm": "a276a072a26ba067a5658021035933ab0bd2e2ceb712e7cab393a8c9096ba4be2e3a76f5aaeab72bce4aa61857814047697a246e4442888a3b6ffc4a8c5ae940eec7d19f72053a07b6d8a2968a260626c8001c9138e9fd0e3cfabb811ae71bd8c1c555ca8c8410cb9121ce25860507a100af038001eca10001", + "hex": "4c79a276a072a26ba067a5658021035933ab0bd2e2ceb712e7cab393a8c9096ba4be2e3a76f5aaeab72bce4aa61857814047697a246e4442888a3b6ffc4a8c5ae940eec7d19f72053a07b6d8a2968a260626c8001c9138e9fd0e3cfabb811ae71bd8c1c555ca8c8410cb9121ce25860507a100af038001eca10001" + }, + "sequence": 4294967295 + }, + { + "txid": "2d4d5f3bb45ecd56d5c9d16773fbb910f975c398c1dc1445aacfe9b8b976db59", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b581404fa0de32bbb96b2e2f61fe823cdba4c3b9fef786ea8c65196f97653a942656812e675e91643ff0ec33853fd2481d40fc48fa51e18c9cbffb49e714c15b47babda100af038001eca10001", + "hex": "4c79a276a072a26ba067a565802103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b581404fa0de32bbb96b2e2f61fe823cdba4c3b9fef786ea8c65196f97653a942656812e675e91643ff0ec33853fd2481d40fc48fa51e18c9cbffb49e714c15b47babda100af038001eca10001" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.99, + "valueZat": 99000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RTk2Tgp1iAcxxSeuXYDREmtfydMvNkCmq8"] + } + }, + { + "value": 0.0001, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "a22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RWg43P8s8RtJatAGNa2kV8N2abhQqH93w9"] + } + }, + { + "value": 0.01, + "valueZat": 1000000, + "n": 2, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 199.02610391, + "valueZat": 19902610391, + "n": 3, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 4, + "scriptPubKey": { + "asm": "OP_RETURN ec4403921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b50800000000ffffffff", + "hex": "6a4c6dec4403921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d75a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b50800000000ffffffff", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## oraclesfund + +**oraclesfund oracletxid** + +The `oraclesfund` method allows a user to register as a publisher on an oracle. + +This method must be executed before the user attempts to use the oraclesregister method. + +### Arguments + +| Structure | Type | Description | +| ---------- | -------- | --------------------------------------------------- | +| oracletxid | (string) | the unique identifying transaction id of the oracle | + +#### 📌 Examples + +Step 1: Create a customized oracle contract and get the hex value + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclesfund 7b6e7745058ffded423546eecc61dcc05069279b90776384c52692765246b64c +``` + +Response from Step 1: + + + ```json + { + "result": "success", + "hex": "0400008085202f890124839445f1cdca84c42563fa87742a562824815729625184117c80dc2a06510e0000000049483045022100c4442ff211289ebc5967da35843f1d210c4a8985d5797a11c42e245aafdf6985022031e7dfb40e3778033f1fb92c0f1175cb4a658bb32749469d69379968fcf92be701ffffffff031027000000000000302ea22c802083071e46d28313148751bdd5e4ffd0509c4234f4770c4c0550cc48b6d45215188103120c008203000401cce0950b5402000000232102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5ac00000000000000004f6a4c4cec464cb64652769226c5846377909b276950c0dc61ccee463542edfd8f0545776e7b2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5102700000000000000000000b60700000000000000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"oraclesfund", "params":["7b6e7745058ffded423546eecc61dcc05069279b90776384c52692765246b64c"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "0400008085202f890124839445f1cdca84c42563fa87742a562824815729625184117c80dc2a06510e0000000049483045022100c4442ff211289ebc5967da35843f1d210c4a8985d5797a11c42e245aafdf6985022031e7dfb40e3778033f1fb92c0f1175cb4a658bb32749469d69379968fcf92be701ffffffff031027000000000000302ea22c802083071e46d28313148751bdd5e4ffd0509c4234f4770c4c0550cc48b6d45215188103120c008203000401cce0950b5402000000232102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5ac00000000000000004f6a4c4cec464cb64652769226c5846377909b276950c0dc61ccee463542edfd8f0545776e7b2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5102700000000000000000000b60700000000000000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Send raw transaction / broadcast the hex value + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f890124839445f1cdca84c42563fa87742a562824815729625184117c80dc2a06510e0000000049483045022100c4442ff211289ebc5967da35843f1d210c4a8985d5797a11c42e245aafdf6985022031e7dfb40e3778033f1fb92c0f1175cb4a658bb32749469d69379968fcf92be701ffffffff031027000000000000302ea22c802083071e46d28313148751bdd5e4ffd0509c4234f4770c4c0550cc48b6d45215188103120c008203000401cce0950b5402000000232102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5ac00000000000000004f6a4c4cec464cb64652769226c5846377909b276950c0dc61ccee463542edfd8f0545776e7b2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5102700000000000000000000b60700000000000000000000000000 + +# This will output a unique txid which will be refered as oracletxid or transaction ID of the oracle. +``` + +Response from Step 2: + + + ```bash + ab038ff4369974d0596f13be1e69105ed97b5374f694afe7b96b664a9fe07192 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["0400008085202f890124839445f1cdca84c42563fa87742a562824815729625184117c80dc2a06510e0000000049483045022100c4442ff211289ebc5967da35843f1d210c4a8985d5797a11c42e245aafdf6985022031e7dfb40e3778033f1fb92c0f1175cb4a658bb32749469d69379968fcf92be701ffffffff031027000000000000302ea22c802083071e46d28313148751bdd5e4ffd0509c4234f4770c4c0550cc48b6d45215188103120c008203000401cce0950b5402000000232102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5ac00000000000000004f6a4c4cec464cb64652769226c5846377909b276950c0dc61ccee463542edfd8f0545776e7b2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5102700000000000000000000b60700000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "ab038ff4369974d0596f13be1e69105ed97b5374f694afe7b96b664a9fe07192", + "error": null, + "id": "curltest" + } + ``` + + +(Use `./komodo-cli -ac_name=HELLOWORLD getrawmempool` to ensure that the transaction receives confirmation.) + +Step 3: Decode raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 0400008085202f890124839445f1cdca84c42563fa87742a562824815729625184117c80dc2a06510e0000000049483045022100c4442ff211289ebc5967da35843f1d210c4a8985d5797a11c42e245aafdf6985022031e7dfb40e3778033f1fb92c0f1175cb4a658bb32749469d69379968fcf92be701ffffffff031027000000000000302ea22c802083071e46d28313148751bdd5e4ffd0509c4234f4770c4c0550cc48b6d45215188103120c008203000401cce0950b5402000000232102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5ac00000000000000004f6a4c4cec464cb64652769226c5846377909b276950c0dc61ccee463542edfd8f0545776e7b2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5102700000000000000000000b60700000000000000000000000000 +``` + +Response from Step 3: + + + ```json + { + "txid": "ab038ff4369974d0596f13be1e69105ed97b5374f694afe7b96b664a9fe07192", + "overwintered": true, + "version": 4, + "versiongroupid": "892f2085", + "locktime": 0, + "expiryheight": 1974, + "vin": [ + { + "txid": "0e51062adc807c118451622957812428562a7487fa6325c484cacdf145948324", + "vout": 0, + "scriptSig": { + "asm": "3045022100c4442ff211289ebc5967da35843f1d210c4a8985d5797a11c42e245aafdf6985022031e7dfb40e3778033f1fb92c0f1175cb4a658bb32749469d69379968fcf92be7[ALL]", + "hex": "483045022100c4442ff211289ebc5967da35843f1d210c4a8985d5797a11c42e245aafdf6985022031e7dfb40e3778033f1fb92c0f1175cb4a658bb32749469d69379968fcf92be701" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.0001, + "valueZat": 10000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802083071e46d28313148751bdd5e4ffd0509c4234f4770c4c0550cc48b6d45215188103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802083071e46d28313148751bdd5e4ffd0509c4234f4770c4c0550cc48b6d45215188103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RUeZzWCuwGxJTtSDGfRFWL87oyrLWZav6Z"] + } + }, + { + "value": 99.9998, + "valueZat": 9999980000, + "n": 1, + "scriptPubKey": { + "asm": "02c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5 OP_CHECKSIG", + "hex": "2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RFkogpvKojbChm9hMDdv2KUBasUmFNraqg"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN ec464cb64652769226c5846377909b276950c0dc61ccee463542edfd8f0545776e7b2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a51027000000000000", + "hex": "6a4c4cec464cb64652769226c5846377909b276950c0dc61ccee463542edfd8f0545776e7b2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a51027000000000000", + "type": "nulldata" + } + } + ], + "vjoinsplit": [], + "valueBalance": 0.0, + "vShieldedSpend": [], + "vShieldedOutput": [] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["0400008085202f890124839445f1cdca84c42563fa87742a562824815729625184117c80dc2a06510e0000000049483045022100c4442ff211289ebc5967da35843f1d210c4a8985d5797a11c42e245aafdf6985022031e7dfb40e3778033f1fb92c0f1175cb4a658bb32749469d69379968fcf92be701ffffffff031027000000000000302ea22c802083071e46d28313148751bdd5e4ffd0509c4234f4770c4c0550cc48b6d45215188103120c008203000401cce0950b5402000000232102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5ac00000000000000004f6a4c4cec464cb64652769226c5846377909b276950c0dc61ccee463542edfd8f0545776e7b2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5102700000000000000000000b60700000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "ab038ff4369974d0596f13be1e69105ed97b5374f694afe7b96b664a9fe07192", + "overwintered": true, + "version": 4, + "versiongroupid": "892f2085", + "locktime": 0, + "expiryheight": 1974, + "vin": [ + { + "txid": "0e51062adc807c118451622957812428562a7487fa6325c484cacdf145948324", + "vout": 0, + "scriptSig": { + "asm": "3045022100c4442ff211289ebc5967da35843f1d210c4a8985d5797a11c42e245aafdf6985022031e7dfb40e3778033f1fb92c0f1175cb4a658bb32749469d69379968fcf92be7[ALL]", + "hex": "483045022100c4442ff211289ebc5967da35843f1d210c4a8985d5797a11c42e245aafdf6985022031e7dfb40e3778033f1fb92c0f1175cb4a658bb32749469d69379968fcf92be701" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.0001, + "valueZat": 10000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802083071e46d28313148751bdd5e4ffd0509c4234f4770c4c0550cc48b6d45215188103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802083071e46d28313148751bdd5e4ffd0509c4234f4770c4c0550cc48b6d45215188103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RUeZzWCuwGxJTtSDGfRFWL87oyrLWZav6Z"] + } + }, + { + "value": 99.9998, + "valueZat": 9999980000, + "n": 1, + "scriptPubKey": { + "asm": "02c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5 OP_CHECKSIG", + "hex": "2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RFkogpvKojbChm9hMDdv2KUBasUmFNraqg"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN ec464cb64652769226c5846377909b276950c0dc61ccee463542edfd8f0545776e7b2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a51027000000000000", + "hex": "6a4c4cec464cb64652769226c5846377909b276950c0dc61ccee463542edfd8f0545776e7b2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a51027000000000000", + "type": "nulldata" + } + } + ], + "vjoinsplit": [], + "valueBalance": 0.0, + "vShieldedSpend": [], + "vShieldedOutput": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## oraclesinfo + +**oraclesinfo oracletxid** + +The `oraclesinfo` method displays information about a specific oracle using `oracletxid`. + +For a list of all `oracletxid`'s available on the Smart Chain, see the [oracleslist](/antara/api/oracles/#oracleslist) method. + +### Arguments + +| Name | Type | Description | +| ---------- | -------- | --------------------------------------------------- | +| oracletxid | (string) | the unique identifying transaction id of the oracle | + +### Response + +| Name | Type | Description | +| ----------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| txid | (string) | the unique txid, or oracletxid, that identifies the oracle | +| name | (string) | the name of the oracle contract | +| description | (string) | the description of the oracle contract | +| format | (string) | a string that identifies the data type accepted for the oracle contract (see [oraclescreate](/antara/api/oracles/#oraclescreate)) | +| marker | (string) | the unmodified public address generated from the oracle contract's privkey | +| registered: | (array) | | +| publisher | (string) | the unique identifier for the publisher (see [oraclesregister](/antara/api/oracles/#oraclesregister)) | +| baton | (string) | the baton address of the publisher, which is an Antara address (based on the pubkey of the publisher and the EVAL code of the oracle contract) | +| batontxid | (string) | the most recent baton utxo sent to the baton address; this is the tip of the linked list that connects all data samples for the publisher | +| lifetime | (number) | the length of time since publisher's inception | +| funds | (number) | the funds committed by subscribers to the publisher's account, and which are used for payouts | +| datafee | (number) | the amount a subscriber pays for each data upload | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclesinfo 0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203 +``` + + + ```json + { + "result": "success", + "txid": "0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203", + "name": "NYWTHR", + "description": "Weather in NYC", + "format": "L", + "marker": "RGEug5JPPkERBpqsGSgw6GQPYTB9v9i4Fj", + "registered": [ + { + "publisher": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5", + "baton": "RWg43P8s8RtJatAGNa2kV8N2abhQqH93w9", + "batontxid": "8f3c517d023e42bacfd0de8b0174cdc8adab713d08a689c00067ab171488a575", + "lifetime": "0.00000000", + "funds": "0.00000000", + "datafee": "0.01000000" + } + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"oraclesinfo", "params":["0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "txid": "0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203", + "name": "NYWTHR", + "description": "Weather in NYC", + "format": "L", + "marker": "RGEug5JPPkERBpqsGSgw6GQPYTB9v9i4Fj", + "registered": [ + { + "publisher": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5", + "baton": "RWg43P8s8RtJatAGNa2kV8N2abhQqH93w9", + "batontxid": "8f3c517d023e42bacfd0de8b0174cdc8adab713d08a689c00067ab171488a575", + "lifetime": "0.00000000", + "funds": "0.00000000", + "datafee": "0.01000000" + } + ] + }, + "error": null, + "id": "curltest" + } + ``` + + +## oracleslist + +**oracleslist** + +The `oracleslist` method lists all available oracle contracts on the Smart Chain. + +### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +### Response + +| Name | Type | Description | +| ---------- | ------------------ | ------------------------------------ | +| oracletxid | (array of strings) | the unique identifying oracletxid(s) | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD oracleslist +``` + + + ```bash + [ + "66fa795f43534e4d6b038c172172a7c46a3cf37b1628e075e38e94a20cfeae5a", + "79d02351968e6616f3044cb14523d8d2cbdbd1a8b7b75bd14b1aa80ad41a5845", + "665b893bdb801f77fd6620969371f8fc391df568150f0a671c1c23e67a0cf039", + "0fa3c6e12ee4be636f44ce4b2af3b0f213d0403dc46cd42add07816526dd46b2", + "b24a00e2a895baad4c0246ba5b3d36790b43cc0fb5a4c4ea98161299165a8c96" + ] + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"oracleslist", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": [ + "66fa795f43534e4d6b038c172172a7c46a3cf37b1628e075e38e94a20cfeae5a", + "79d02351968e6616f3044cb14523d8d2cbdbd1a8b7b75bd14b1aa80ad41a5845", + "665b893bdb801f77fd6620969371f8fc391df568150f0a671c1c23e67a0cf039", + "0fa3c6e12ee4be636f44ce4b2af3b0f213d0403dc46cd42add07816526dd46b2", + "b24a00e2a895baad4c0246ba5b3d36790b43cc0fb5a4c4ea98161299165a8c96" + ], + "error": null, + "id": "curltest" + } + ``` + + +## oraclesregister + +**oraclesregister oracletxid datafee** + +A user executes the `oraclesregister` method to register as a data publisher for an existing oracle contract. + +The `datafee` property is set in satoshis, and should be `>=` the chain's default transaction fee. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + + + Use `./komodo-cli -ac_name=YOURNAME getrawmempool` to verify the transaction + is confirmed. + + + + After the transaction confirms, use `oraclesinfo` to output registration + information about your oracles plan + + +### Arguments + +| Name | Type | Description | +| ---------- | --------- | ------------------------------------------------------------------------------------------- | +| oracletxid | (string) | the unique identifying transaction id of the oracle | +| datafee | (numbers) | the fee required of a subscriber for each data point the publisher publishes in this oracle | + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Set your parameters to create a raw transaction and get the hex value + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclesregister 0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203 1000000 +``` + + + ```json + { + "result": "success", + "hex": "010000000103921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d010000004847304402207241f313ef2fb65d9eb1f870068ceba436f14996ce79d16ff85f2937c75357ee022025f0b888e742546469ad0b7fae9b85cf7c89cddf307170bbcf794e5e90ae28b101ffffffff04102700000000000023210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dac1027000000000000302ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc071240a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000004f6a4c4cec5203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b540420f000000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"oraclesregister", "params":["0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203" ,"1000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "010000000103921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d010000004847304402207241f313ef2fb65d9eb1f870068ceba436f14996ce79d16ff85f2937c75357ee022025f0b888e742546469ad0b7fae9b85cf7c89cddf307170bbcf794e5e90ae28b101ffffffff04102700000000000023210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dac1027000000000000302ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc071240a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000004f6a4c4cec5203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b540420f000000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Send/broadcast the raw transaction hex + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000103921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d010000004847304402207241f313ef2fb65d9eb1f870068ceba436f14996ce79d16ff85f2937c75357ee022025f0b888e742546469ad0b7fae9b85cf7c89cddf307170bbcf794e5e90ae28b101ffffffff04102700000000000023210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dac1027000000000000302ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc071240a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000004f6a4c4cec5203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b540420f000000000000000000 +``` + + + ```bash + 8f3c517d023e42bacfd0de8b0174cdc8adab713d08a689c00067ab171488a575 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000103921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d010000004847304402207241f313ef2fb65d9eb1f870068ceba436f14996ce79d16ff85f2937c75357ee022025f0b888e742546469ad0b7fae9b85cf7c89cddf307170bbcf794e5e90ae28b101ffffffff04102700000000000023210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dac1027000000000000302ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc071240a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000004f6a4c4cec5203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b540420f000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "8f3c517d023e42bacfd0de8b0174cdc8adab713d08a689c00067ab171488a575", + "error": null, + "id": "curltest" + } + ``` + + +Step 3: Decode raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 010000000103921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d010000004847304402207241f313ef2fb65d9eb1f870068ceba436f14996ce79d16ff85f2937c75357ee022025f0b888e742546469ad0b7fae9b85cf7c89cddf307170bbcf794e5e90ae28b101ffffffff04102700000000000023210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dac1027000000000000302ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc071240a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000004f6a4c4cec5203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b540420f000000000000000000 +``` + + + ```json + { + "txid": "8f3c517d023e42bacfd0de8b0174cdc8adab713d08a689c00067ab171488a575", + "size": 356, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203", + "vout": 1, + "scriptSig": { + "asm": "304402207241f313ef2fb65d9eb1f870068ceba436f14996ce79d16ff85f2937c75357ee022025f0b888e742546469ad0b7fae9b85cf7c89cddf307170bbcf794e5e90ae28b101", + "hex": "47304402207241f313ef2fb65d9eb1f870068ceba436f14996ce79d16ff85f2937c75357ee022025f0b888e742546469ad0b7fae9b85cf7c89cddf307170bbcf794e5e90ae28b101" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.0001, + "valueSat": 10000, + "n": 0, + "scriptPubKey": { + "asm": "0203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d OP_CHECKSIG", + "hex": "210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RGEug5JPPkERBpqsGSgw6GQPYTB9v9i4Fj"] + } + }, + { + "value": 0.0001, + "valueSat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "a22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RWg43P8s8RtJatAGNa2kV8N2abhQqH93w9"] + } + }, + { + "value": 200.02640391, + "valueSat": 20002640391, + "n": 2, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN ec5203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b540420f00000$0000", + "hex": "6a4c4cec5203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b540420f000000000$", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["010000000103921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d010000004847304402207241f313ef2fb65d9eb1f870068ceba436f14996ce79d16ff85f2937c75357ee022025f0b888e742546469ad0b7fae9b85cf7c89cddf307170bbcf794e5e90ae28b101ffffffff04102700000000000023210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dac1027000000000000302ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc071240a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000004f6a4c4cec5203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b540420f000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "8f3c517d023e42bacfd0de8b0174cdc8adab713d08a689c00067ab171488a575", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203", + "vout": 1, + "scriptSig": { + "asm": "304402207241f313ef2fb65d9eb1f870068ceba436f14996ce79d16ff85f2937c75357ee022025f0b888e742546469ad0b7fae9b85cf7c89cddf307170bbcf794e5e90ae28b1[ALL]", + "hex": "47304402207241f313ef2fb65d9eb1f870068ceba436f14996ce79d16ff85f2937c75357ee022025f0b888e742546469ad0b7fae9b85cf7c89cddf307170bbcf794e5e90ae28b101" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.0001, + "valueZat": 10000, + "n": 0, + "scriptPubKey": { + "asm": "0203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d OP_CHECKSIG", + "hex": "210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RGEug5JPPkERBpqsGSgw6GQPYTB9v9i4Fj"] + } + }, + { + "value": 0.0001, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "a22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200648c12e7e058c98f0a5cc288ac271ad08bd493e1fb7de83edeea69789338fc58103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RWg43P8s8RtJatAGNa2kV8N2abhQqH93w9"] + } + }, + { + "value": 200.02640391, + "valueZat": 20002640391, + "n": 2, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN ec5203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b540420f0000000000", + "hex": "6a4c4cec5203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b540420f0000000000", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## oraclessamples + +**oraclessamples oracletxid baton num** + +The `oraclessample` method fetches data samples from a publisher. + +The user indicates the desired publisher by inserting the `batonutxo` by the publisher. Use [oraclesinfo](/antara/api/oracles/#oraclesinfo) to find a list of publishers and their current batonutxo's. + +### Arguments + +| Name | Type | Description | +| ------------ | -------- | ------------------------------------------------------------------ | +| oracletxid | (string) | the unique identifying transaction id of the oracle contract | +| batonaddress | (string) | the baton address, which can be found using the oraclesinfo method | +| num | (number) | the number of sample data points required | + +### Response + +| Name | Type | Description | +| ------------- | ------------------ | ----------------------------------------- | +| result | (string) | whether the command executed successfully | +| samples: | (array of strings) | | +| "XXXXXXXXXXX" | (string) | a sample data point | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclessamples 7b6e7745058ffded423546eecc61dcc05069279b90776384c52692765246b64c RVerJvoYsXp3avQ3xxe54EhajZgn5xidKB 1 +``` + + + ```json + { + "result": "success", + "samples": [ + { + "txid": "bbe51ad50a1a49e0275631c2b8e698ea3514b05bb60b944ee891bdbbd5ce0c17", + "data": ["This here is some data stored on an oracle"] + } + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"oraclessamples", "params":["7b6e7745058ffded423546eecc61dcc05069279b90776384c52692765246b64c" ,"RVerJvoYsXp3avQ3xxe54EhajZgn5xidKB" ,"1"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "samples": [ + { + "txid": "bbe51ad50a1a49e0275631c2b8e698ea3514b05bb60b944ee891bdbbd5ce0c17", + "data": ["This here is some data stored on an oracle"] + } + ] + }, + "error": null, + "id": "curltest" + } + ``` + + +## oraclessubscribe + +**oraclessubscribe oracletxid publisher amount** + +The user executes `oraclessubscribe` to subscribe to a publisher of an oracle plan. + +Every publisher must have at least one subscriber before the [oraclesdata](/antara/api/oracles/#oraclesdata) can successfully execute. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +The `sendrawtransaction` method then returns a unique txid, also called the `oraclesubscriptiontxid`, or the id of the oracle subscription transaction. This can be used for further development purposes. + + + If the **datafee** is 10 COINS and the `amount` submitted is 1000 COINS, the + publisher can publish data 100 times based on this amount. + + +### Arguments + +| Name | Type | Description | +| ---------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| oracletxid | (string) | the unique identifying transaction id of the oracle | +| publisher | (string) | the unique publisher id, which can be found using the oraclesinfo method | +| amount | (number) | the total amount of funds the subscriber commits to pay for data upload by the publisher; this amount is immediately withdrawn from the user's wallet | + +### Response + +| Name | Type | Description | +| ------ | -------- | ---------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command succeeded | +| hex | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Subscribe to an oracle plan and get the hex value: + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclessubscribe 0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203 03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 1 +``` + + + ```json + { + "result": "success", + "hex": "010000000175a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f0200000048473044022006449e2f324ba8c262ca73eea4642f77ccf906fee5bab4fdc85bcc8c350ce81b022047d76840076f6e02aebe77ffb59b052974badb8747c7b435fd77351fcfbee95e01ffffffff0400e1f50500000000302ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc102700000000000023210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dace7e249a204000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000004f6a4c4cec5303921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b500e1f5050000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"oraclessubscribe", "params":["0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203" ,"03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5" ,"1"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "010000000175a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f0200000048473044022006449e2f324ba8c262ca73eea4642f77ccf906fee5bab4fdc85bcc8c350ce81b022047d76840076f6e02aebe77ffb59b052974badb8747c7b435fd77351fcfbee95e01ffffffff0400e1f50500000000302ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc102700000000000023210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dace7e249a204000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000004f6a4c4cec5303921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b500e1f5050000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Send raw transaction / broadcast the hex value + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000175a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f0200000048473044022006449e2f324ba8c262ca73eea4642f77ccf906fee5bab4fdc85bcc8c350ce81b022047d76840076f6e02aebe77ffb59b052974badb8747c7b435fd77351fcfbee95e01ffffffff0400e1f50500000000302ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc102700000000000023210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dace7e249a204000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000004f6a4c4cec5303921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b500e1f5050000000000000000 +``` + + + ```bash + 2d4d5f3bb45ecd56d5c9d16773fbb910f975c398c1dc1445aacfe9b8b976db59 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000175a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f0200000048473044022006449e2f324ba8c262ca73eea4642f77ccf906fee5bab4fdc85bcc8c350ce81b022047d76840076f6e02aebe77ffb59b052974badb8747c7b435fd77351fcfbee95e01ffffffff0400e1f50500000000302ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc102700000000000023210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dace7e249a204000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000004f6a4c4cec5303921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b500e1f5050000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "2d4d5f3bb45ecd56d5c9d16773fbb910f975c398c1dc1445aacfe9b8b976db59", + "error": null, + "id": "curltest" + } + ``` + + +Step 3: Decode raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 010000000175a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f0200000048473044022006449e2f324ba8c262ca73eea4642f77ccf906fee5bab4fdc85bcc8c350ce81b022047d76840076f6e02aebe77ffb59b052974badb8747c7b435fd77351fcfbee95e01ffffffff0400e1f50500000000302ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc102700000000000023210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dace7e249a204000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000004f6a4c4cec5303921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b500e1f5050000000000000000 +``` + + + ```json + { + "txid": "2d4d5f3bb45ecd56d5c9d16773fbb910f975c398c1dc1445aacfe9b8b976db59", + "size": 356, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "8f3c517d023e42bacfd0de8b0174cdc8adab713d08a689c00067ab171488a575", + "vout": 2, + "scriptSig": { + "asm": "3044022006449e2f324ba8c262ca73eea4642f77ccf906fee5bab4fdc85bcc8c350ce81b022047d76840076f6e02aebe77ffb59b052974badb8747c7b435fd77351fcfbee95e01", + "hex": "473044022006449e2f324ba8c262ca73eea4642f77ccf906fee5bab4fdc85bcc8c350ce81b022047d76840076f6e02aebe77ffb59b052974badb8747c7b435fd77351fcfbee95e01" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 1.0, + "valueSat": 100000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RTk2Tgp1iAcxxSeuXYDREmtfydMvNkCmq8"] + } + }, + { + "value": 0.0001, + "valueSat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "0203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d OP_CHECKSIG", + "hex": "210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RGEug5JPPkERBpqsGSgw6GQPYTB9v9i4Fj"] + } + }, + { + "value": 199.02620391, + "valueSat": 19902620391, + "n": 2, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN ec5303921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b500e1f50500000000", + "hex": "6a4c4cec5303921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b500e1f50500000000", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["010000000175a5881417ab6700c089a6083d71abadc8cd74018bded0cfba423e027d513c8f0200000048473044022006449e2f324ba8c262ca73eea4642f77ccf906fee5bab4fdc85bcc8c350ce81b022047d76840076f6e02aebe77ffb59b052974badb8747c7b435fd77351fcfbee95e01ffffffff0400e1f50500000000302ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc102700000000000023210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dace7e249a204000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000004f6a4c4cec5303921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b500e1f5050000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "2d4d5f3bb45ecd56d5c9d16773fbb910f975c398c1dc1445aacfe9b8b976db59", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "8f3c517d023e42bacfd0de8b0174cdc8adab713d08a689c00067ab171488a575", + "vout": 2, + "scriptSig": { + "asm": "3044022006449e2f324ba8c262ca73eea4642f77ccf906fee5bab4fdc85bcc8c350ce81b022047d76840076f6e02aebe77ffb59b052974badb8747c7b435fd77351fcfbee95e[ALL]", + "hex": "473044022006449e2f324ba8c262ca73eea4642f77ccf906fee5bab4fdc85bcc8c350ce81b022047d76840076f6e02aebe77ffb59b052974badb8747c7b435fd77351fcfbee95e01" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 1.0, + "valueZat": 100000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802092392e766d63f73dd7c68ff9eaf9f009f13b17c4167472e8aebb00d96be66aa68103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RTk2Tgp1iAcxxSeuXYDREmtfydMvNkCmq8"] + } + }, + { + "value": 0.0001, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "0203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d OP_CHECKSIG", + "hex": "210203921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70dac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RGEug5JPPkERBpqsGSgw6GQPYTB9v9i4Fj"] + } + }, + { + "value": 199.02620391, + "valueZat": 19902620391, + "n": 2, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN ec5303921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b500e1f50500000000", + "hex": "6a4c4cec5303921d76b33363fb05b0fe68e2cf179f73584517bbd4ab08ba8df044d8c4f70d2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b500e1f50500000000", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + +export const title = "Payments: Configurable Multi-Recipient Payments"; +export const description = "The Payments Module allows a payment to be distributed between multiple recipients in a pre-defined proportion."; + +# Payments + +## Introduction + +The Payments Module allows a payment to be distributed between multiple recipients in a pre-defined proportion. + +### Payments Module Flow + +* Use [paymentstxidopret](/antara/api/payments/#paymentstxidopret) to create as many transactions as there are recipients + * Each recipient must have the following data in the associated transaction's opreturn. This step makes the data available on the blockchain so that the data can be used by a later method + * Weight (also called "share") + * Recipient + * Destopret (optional) + * This data is stored in the OP\_RETURN of the subsequent payment transaction + * The transaction id is called `paytxnid` and it is used as a reference to the data +* Use [paymentscreate](/antara/api/payments/#paymentscreate) to create a new Payment plan + * The arguments passed include the following + * The number of blocks to lock the funds after funding + * The minimum release amount + * The `paytxnids` + * These contains data about the recipients and their corresponding shares + * The returned transaction id is called `createtxid` and it will be the reference for this payment plan used by other methods +* Use [paymentsfund](/antara/api/payments/#paymentsfund) to fund any existing Payments plan +* Use [paymentsrelease](/antara/api/payments/#paymentsrelease) to release payments of a Payments plan + +## paymentscreate + +**paymentscreate '\[lockedblocks,minamount,"paytxid",...,"paytxidN"]'** + +Use the `paymentscreate` method after receiving the `paytxids` from all the recipients to create a new instance of the Payments plan. + +#### Arguments + +| Name | Type | Description | +| ------------ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| lockedblocks | (number) | the number of confirmations the "Payments create transaction" of a plan must receive on the network before the plan's funds can be released | +| minamount | (number) | the minimum amount of funds that can be released | +| "paytxid" | (string, accepts multiple) | the transaction ids of all transactions created using the preceding `paymentstxidopret` method | + +#### Response + +| Name | Type | Description | +| ------ | -------- | ------------------------------------------------------------------------------- | +| hex | (string) | the transaction in raw format, provided in hexadecimal | +| txid | (string) | the transaction id of the `paymentscreate` transaction, called the `createtxid` | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=HELLOWORLD paymentscreate '[0,0,"9c731f6bbdaa6159b7c0955f3d1e1df72a64a38cd20198d59cd11f0fc506e00e","3398899808706726bf04c815ca994f616768a1d4ad2546f14246bef3a926117d"]' +``` + + + ```json + { + "hex": "0400008085202f8901002a73fb5f67f406f4686cd3124f38bf1ecbc9b997adc548914c2bc344453f700000000048473044022034b381a812ad57e5a726319f47db4e59666b65dc1eb7ab3e8eb32f7a3637624b02203ca606a74c18389f7ba20ab09086db66a4d21826673e9970ceb3d6f2c4bfea0501ffffffff031027000000000000302ea22c8020f7d6c2e6ca04be384f425a199bc2ad90dcc3e13effe6822b29598f47e2795da781031210008203000401cce092f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000566a4c53f04300000000000000000a00000000000000020ee006c50f1fd19cd59801d28ca3642af71d1e3d5f95c0b75961aabd6b1f739c7d1126a9f3be4642f14625add4a16867614f99ca15c804bf266770089889983300000000860a00000000000000000000000000", + "txid": "c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837", + "result": "success" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"paymentscreate", "params":[0,0,"9c731f6bbdaa6159b7c0955f3d1e1df72a64a38cd20198d59cd11f0fc506e00e","3398899808706726bf04c815ca994f616768a1d4ad2546f14246bef3a926117d"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "hex": "0400008085202f8901002a73fb5f67f406f4686cd3124f38bf1ecbc9b997adc548914c2bc344453f700000000048473044022034b381a812ad57e5a726319f47db4e59666b65dc1eb7ab3e8eb32f7a3637624b02203ca606a74c18389f7ba20ab09086db66a4d21826673e9970ceb3d6f2c4bfea0501ffffffff031027000000000000302ea22c8020f7d6c2e6ca04be384f425a199bc2ad90dcc3e13effe6822b29598f47e2795da781031210008203000401cce092f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000566a4c53f04300000000000000000a00000000000000020ee006c50f1fd19cd59801d28ca3642af71d1e3d5f95c0b75961aabd6b1f739c7d1126a9f3be4642f14625add4a16867614f99ca15c804bf266770089889983300000000860a00000000000000000000000000", + "txid": "c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837", + "result": "success" + }, + "error": null, + "id": "curltest" + } + ``` + + +###### Broadcast the transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f8901002a73fb5f67f406f4686cd3124f38bf1ecbc9b997adc548914c2bc344453f700000000048473044022034b381a812ad57e5a726319f47db4e59666b65dc1eb7ab3e8eb32f7a3637624b02203ca606a74c18389f7ba20ab09086db66a4d21826673e9970ceb3d6f2c4bfea0501ffffffff031027000000000000302ea22c8020f7d6c2e6ca04be384f425a199bc2ad90dcc3e13effe6822b29598f47e2795da781031210008203000401cce092f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000566a4c53f04300000000000000000a00000000000000020ee006c50f1fd19cd59801d28ca3642af71d1e3d5f95c0b75961aabd6b1f739c7d1126a9f3be4642f14625add4a16867614f99ca15c804bf266770089889983300000000860a00000000000000000000000000 +``` + + + ```bash + c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["0400008085202f8901002a73fb5f67f406f4686cd3124f38bf1ecbc9b997adc548914c2bc344453f700000000048473044022034b381a812ad57e5a726319f47db4e59666b65dc1eb7ab3e8eb32f7a3637624b02203ca606a74c18389f7ba20ab09086db66a4d21826673e9970ceb3d6f2c4bfea0501ffffffff031027000000000000302ea22c8020f7d6c2e6ca04be384f425a199bc2ad90dcc3e13effe6822b29598f47e2795da781031210008203000401cce092f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000566a4c53f04300000000000000000a00000000000000020ee006c50f1fd19cd59801d28ca3642af71d1e3d5f95c0b75961aabd6b1f739c7d1126a9f3be4642f14625add4a16867614f99ca15c804bf266770089889983300000000860a00000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837", + "error": null, + "id": "curltest" + } + ``` + + +## paymentsfund + +**paymentsfund '\[“createtxid", amount(, useopret)]'** + +The `paymentsfund` method is used to add funds to a Payments plan that has been created. + +#### Arguments + +| Name | Type | Description | +| ---------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| createtxid | (string) | The transaction id of the specific Payments plan the user desires to fund | +| amount | (number) | The amount of funds to send | +| useopret | (number) | A flag that instructs the Payments Module on where to send the funds. If `0` (default), funds are sent to the `1of2` address corresponding to the specific Payments plan. If `1`, funds are sent to the Payments Module's Global address | + +#### Response + +| Name | Type | Description | +| ------ | -------- | ------------------------------------------------------ | +| hex | (string) | the transaction in raw format, provided in hexadecimal | +| txid | (string) | the transaction id of the `paymentsfund` transaction | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=HELLOWORLD paymentsfund '["c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837",7,1]' +``` + + + ```json + { + "hex": "0400008085202f8908001efc1fdeee5ff6f02669c3b0dc44328a0ab3d164099be60bb752cd00a9474c000000004847304402200995f3ffcbf22ff71e4cd34f004f57faf0a63b02580ee703c3c7af8dbfad4db502203ff43305875d26a01c551dde40db13098c229eb35d0a17842bf49463d310676b01ffffffff0076f017cf49a7b952163e0f6e92898795197741e54c7975f2d3af1e49fe7e760000000048473044022063e5e1a7b3fdec6e19143817e208411656bae613f259bf51ecb27e4d2586134602204ede23fe353dc87bfd4b9e154b576812fd7e4e9232e8906ec3535fa8519956c001ffffffff00621604313b81ed8556ceaf29fe93b55d419de53e3947c48cb6f77cd852eefb00000000484730440220154b9727e0f377ce141f63845b729fc392096a5d04c966368fad4d077e1255a30220708f7bd907e180cf819e4fc3bec12f168fcdbbb8570cb919cade2cd84c159b1401ffffffff0060083ce708e81c46b2e12e87051a87817d072be85ba5dd55c728348c0dd6560000000048473044022010ee0f67a08c1d7d4939629e7a8786cb1b8b1ad4c8d0e0acb72fb33bfadcabe702204cd5a11c838917677c10d81105f19620649ba1ddb82677c384434ec38995397001ffffffff0055e6ca9fd40a82d4db0c626eb8e0aa6376d45ae9bd55ae5995e145a0095161000000004847304402200c4c94a85ba91417ad66ced737efbabdaa80fa78727b510a4b052b53307ac46702200c5895f74526cb6fc930568f2ae23638d7af37735e15b1c46f2bfb83ae0bb4cc01ffffffff003ffe904cdc927be067b21d19f0c57b2bfbc7f669c1f176134c24eee038d1760000000049483045022100b440206ef0613c5abc15803b047d1b73d024f2e3c33dce5db7633629c169847502206786c8cd7f29e2bc42559d42b441a812bf4a6604e0244c474e94a1e080b3657001ffffffff003c5c30c4107b975ca2bd4165940b432b1dae92110f0adb4540d84c42a7adf6000000004847304402205c994a23360b7d7147debc2c91300575b466c5b3862ca4d6c42bb2d0421539a7022031ed30cb9e667d30ee399d38899ad24aecd44e5545d2ce9357fc4192b41098e701ffffffff00339f6cb6e5b158a156b88e2b99d5bd08612000aa35e2e57fd54fc13145a69a0000000049483045022100db64b42398ff454c4370f90c903a2d9b1485f75dff8ee7f7b5285b531aee75fc02207d2162f469122af6d0c7edb622dd7dd4aef551b22ae1ea3c77320c12095a5cf401ffffffff020027b929000000005c2ea22c8020987fad30df055db6fd922c3a57e55d76601229ed3da3b31340112e773df3d0d28103120c008203000401cc2a0401f00101246a22f04637383c2bde377a8caafc73cba2f16671d0617f59fe5e64d00a1dd255ec51dec475f0b9f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac00000000420f00000000000000000000000000", + "txid": "4c04f2d75ece337c7b4f86eb3962b37b97f8af8b261fe68abb49815524e8be50", + "result": "success" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"paymentsfund", "params":["c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837",7,1]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "hex": "0400008085202f8908001efc1fdeee5ff6f02669c3b0dc44328a0ab3d164099be60bb752cd00a9474c000000004847304402200995f3ffcbf22ff71e4cd34f004f57faf0a63b02580ee703c3c7af8dbfad4db502203ff43305875d26a01c551dde40db13098c229eb35d0a17842bf49463d310676b01ffffffff0076f017cf49a7b952163e0f6e92898795197741e54c7975f2d3af1e49fe7e760000000048473044022063e5e1a7b3fdec6e19143817e208411656bae613f259bf51ecb27e4d2586134602204ede23fe353dc87bfd4b9e154b576812fd7e4e9232e8906ec3535fa8519956c001ffffffff00621604313b81ed8556ceaf29fe93b55d419de53e3947c48cb6f77cd852eefb00000000484730440220154b9727e0f377ce141f63845b729fc392096a5d04c966368fad4d077e1255a30220708f7bd907e180cf819e4fc3bec12f168fcdbbb8570cb919cade2cd84c159b1401ffffffff0060083ce708e81c46b2e12e87051a87817d072be85ba5dd55c728348c0dd6560000000048473044022010ee0f67a08c1d7d4939629e7a8786cb1b8b1ad4c8d0e0acb72fb33bfadcabe702204cd5a11c838917677c10d81105f19620649ba1ddb82677c384434ec38995397001ffffffff0055e6ca9fd40a82d4db0c626eb8e0aa6376d45ae9bd55ae5995e145a0095161000000004847304402200c4c94a85ba91417ad66ced737efbabdaa80fa78727b510a4b052b53307ac46702200c5895f74526cb6fc930568f2ae23638d7af37735e15b1c46f2bfb83ae0bb4cc01ffffffff003ffe904cdc927be067b21d19f0c57b2bfbc7f669c1f176134c24eee038d1760000000049483045022100b440206ef0613c5abc15803b047d1b73d024f2e3c33dce5db7633629c169847502206786c8cd7f29e2bc42559d42b441a812bf4a6604e0244c474e94a1e080b3657001ffffffff003c5c30c4107b975ca2bd4165940b432b1dae92110f0adb4540d84c42a7adf6000000004847304402205c994a23360b7d7147debc2c91300575b466c5b3862ca4d6c42bb2d0421539a7022031ed30cb9e667d30ee399d38899ad24aecd44e5545d2ce9357fc4192b41098e701ffffffff00339f6cb6e5b158a156b88e2b99d5bd08612000aa35e2e57fd54fc13145a69a0000000049483045022100db64b42398ff454c4370f90c903a2d9b1485f75dff8ee7f7b5285b531aee75fc02207d2162f469122af6d0c7edb622dd7dd4aef551b22ae1ea3c77320c12095a5cf401ffffffff020027b929000000005c2ea22c8020987fad30df055db6fd922c3a57e55d76601229ed3da3b31340112e773df3d0d28103120c008203000401cc2a0401f00101246a22f04637383c2bde377a8caafc73cba2f16671d0617f59fe5e64d00a1dd255ec51dec475f0b9f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac00000000420f00000000000000000000000000", + "txid": "4c04f2d75ece337c7b4f86eb3962b37b97f8af8b261fe68abb49815524e8be50", + "result": "success" + }, + "error": null, + "id": "curltest" + } + ``` + + +###### Broadcast the transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f8908001efc1fdeee5ff6f02669c3b0dc44328a0ab3d164099be60bb752cd00a9474c000000004847304402200995f3ffcbf22ff71e4cd34f004f57faf0a63b02580ee703c3c7af8dbfad4db502203ff43305875d26a01c551dde40db13098c229eb35d0a17842bf49463d310676b01ffffffff0076f017cf49a7b952163e0f6e92898795197741e54c7975f2d3af1e49fe7e760000000048473044022063e5e1a7b3fdec6e19143817e208411656bae613f259bf51ecb27e4d2586134602204ede23fe353dc87bfd4b9e154b576812fd7e4e9232e8906ec3535fa8519956c001ffffffff00621604313b81ed8556ceaf29fe93b55d419de53e3947c48cb6f77cd852eefb00000000484730440220154b9727e0f377ce141f63845b729fc392096a5d04c966368fad4d077e1255a30220708f7bd907e180cf819e4fc3bec12f168fcdbbb8570cb919cade2cd84c159b1401ffffffff0060083ce708e81c46b2e12e87051a87817d072be85ba5dd55c728348c0dd6560000000048473044022010ee0f67a08c1d7d4939629e7a8786cb1b8b1ad4c8d0e0acb72fb33bfadcabe702204cd5a11c838917677c10d81105f19620649ba1ddb82677c384434ec38995397001ffffffff0055e6ca9fd40a82d4db0c626eb8e0aa6376d45ae9bd55ae5995e145a0095161000000004847304402200c4c94a85ba91417ad66ced737efbabdaa80fa78727b510a4b052b53307ac46702200c5895f74526cb6fc930568f2ae23638d7af37735e15b1c46f2bfb83ae0bb4cc01ffffffff003ffe904cdc927be067b21d19f0c57b2bfbc7f669c1f176134c24eee038d1760000000049483045022100b440206ef0613c5abc15803b047d1b73d024f2e3c33dce5db7633629c169847502206786c8cd7f29e2bc42559d42b441a812bf4a6604e0244c474e94a1e080b3657001ffffffff003c5c30c4107b975ca2bd4165940b432b1dae92110f0adb4540d84c42a7adf6000000004847304402205c994a23360b7d7147debc2c91300575b466c5b3862ca4d6c42bb2d0421539a7022031ed30cb9e667d30ee399d38899ad24aecd44e5545d2ce9357fc4192b41098e701ffffffff00339f6cb6e5b158a156b88e2b99d5bd08612000aa35e2e57fd54fc13145a69a0000000049483045022100db64b42398ff454c4370f90c903a2d9b1485f75dff8ee7f7b5285b531aee75fc02207d2162f469122af6d0c7edb622dd7dd4aef551b22ae1ea3c77320c12095a5cf401ffffffff020027b929000000005c2ea22c8020987fad30df055db6fd922c3a57e55d76601229ed3da3b31340112e773df3d0d28103120c008203000401cc2a0401f00101246a22f04637383c2bde377a8caafc73cba2f16671d0617f59fe5e64d00a1dd255ec51dec475f0b9f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac00000000420f00000000000000000000000000 +``` + + + ```bash + 4c04f2d75ece337c7b4f86eb3962b37b97f8af8b261fe68abb49815524e8be50 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["0400008085202f8908001efc1fdeee5ff6f02669c3b0dc44328a0ab3d164099be60bb752cd00a9474c000000004847304402200995f3ffcbf22ff71e4cd34f004f57faf0a63b02580ee703c3c7af8dbfad4db502203ff43305875d26a01c551dde40db13098c229eb35d0a17842bf49463d310676b01ffffffff0076f017cf49a7b952163e0f6e92898795197741e54c7975f2d3af1e49fe7e760000000048473044022063e5e1a7b3fdec6e19143817e208411656bae613f259bf51ecb27e4d2586134602204ede23fe353dc87bfd4b9e154b576812fd7e4e9232e8906ec3535fa8519956c001ffffffff00621604313b81ed8556ceaf29fe93b55d419de53e3947c48cb6f77cd852eefb00000000484730440220154b9727e0f377ce141f63845b729fc392096a5d04c966368fad4d077e1255a30220708f7bd907e180cf819e4fc3bec12f168fcdbbb8570cb919cade2cd84c159b1401ffffffff0060083ce708e81c46b2e12e87051a87817d072be85ba5dd55c728348c0dd6560000000048473044022010ee0f67a08c1d7d4939629e7a8786cb1b8b1ad4c8d0e0acb72fb33bfadcabe702204cd5a11c838917677c10d81105f19620649ba1ddb82677c384434ec38995397001ffffffff0055e6ca9fd40a82d4db0c626eb8e0aa6376d45ae9bd55ae5995e145a0095161000000004847304402200c4c94a85ba91417ad66ced737efbabdaa80fa78727b510a4b052b53307ac46702200c5895f74526cb6fc930568f2ae23638d7af37735e15b1c46f2bfb83ae0bb4cc01ffffffff003ffe904cdc927be067b21d19f0c57b2bfbc7f669c1f176134c24eee038d1760000000049483045022100b440206ef0613c5abc15803b047d1b73d024f2e3c33dce5db7633629c169847502206786c8cd7f29e2bc42559d42b441a812bf4a6604e0244c474e94a1e080b3657001ffffffff003c5c30c4107b975ca2bd4165940b432b1dae92110f0adb4540d84c42a7adf6000000004847304402205c994a23360b7d7147debc2c91300575b466c5b3862ca4d6c42bb2d0421539a7022031ed30cb9e667d30ee399d38899ad24aecd44e5545d2ce9357fc4192b41098e701ffffffff00339f6cb6e5b158a156b88e2b99d5bd08612000aa35e2e57fd54fc13145a69a0000000049483045022100db64b42398ff454c4370f90c903a2d9b1485f75dff8ee7f7b5285b531aee75fc02207d2162f469122af6d0c7edb622dd7dd4aef551b22ae1ea3c77320c12095a5cf401ffffffff020027b929000000005c2ea22c8020987fad30df055db6fd922c3a57e55d76601229ed3da3b31340112e773df3d0d28103120c008203000401cc2a0401f00101246a22f04637383c2bde377a8caafc73cba2f16671d0617f59fe5e64d00a1dd255ec51dec475f0b9f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac00000000420f00000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "4c04f2d75ece337c7b4f86eb3962b37b97f8af8b261fe68abb49815524e8be50", + "error": null, + "id": "curltest" + } + ``` + + +##### destopret (optional) + +Data provided in `destopret` is stored in the opreturn of the transaction that sends funds to the `scriptPubkey`. + +If the `scriptPubkey` belongs to an Antara Module that expects opreturn data, this data must be provided using `destopret`. + +For example, if a Payments plan sends a portion of funds to an instance of the Rewards Antara Module, the Payments transaction must add data to the `destopret` to specify the specific instance of the Rewards plan. + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=HELLOWORLD paymentstxidopret '[9,"222102d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388dac"]' +``` + + + ```json + { + "hex": "0400008085202f89010012d25c46d1f831d74c7c3e71fd32343f53ead192cc70e9e8edf7586571759a0000000048473044022004f5a7e3eb7f5010953c2bca7af2113ee3559b5f7adc86ad09b872526e3b36f6022040b6409eb612c847185b274eb76a3ff60f0e970e5e78d3eee9269b5f0661611001ffffffff02f0b9f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000326a30f054090000000000000024222102d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388dac00000000000b0400000000000000000000000000", + "txid": "9c731f6bbdaa6159b7c0955f3d1e1df72a64a38cd20198d59cd11f0fc506e00e", + "result": "success" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"paymentstxidopret", "params":[9,"222102d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388dac"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "hex": "0400008085202f89010012d25c46d1f831d74c7c3e71fd32343f53ead192cc70e9e8edf7586571759a0000000048473044022004f5a7e3eb7f5010953c2bca7af2113ee3559b5f7adc86ad09b872526e3b36f6022040b6409eb612c847185b274eb76a3ff60f0e970e5e78d3eee9269b5f0661611001ffffffff02f0b9f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000326a30f054090000000000000024222102d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388dac00000000000b0400000000000000000000000000", + "txid": "9c731f6bbdaa6159b7c0955f3d1e1df72a64a38cd20198d59cd11f0fc506e00e", + "result": "success" + }, + "error": null, + "id": "curltest" + } + ``` + + +###### Broadcast the transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f89010012d25c46d1f831d74c7c3e71fd32343f53ead192cc70e9e8edf7586571759a0000000048473044022004f5a7e3eb7f5010953c2bca7af2113ee3559b5f7adc86ad09b872526e3b36f6022040b6409eb612c847185b274eb76a3ff60f0e970e5e78d3eee9269b5f0661611001ffffffff02f0b9f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000326a30f054090000000000000024222102d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388dac00000000000b0400000000000000000000000000 +``` + + + ```bash + 9c731f6bbdaa6159b7c0955f3d1e1df72a64a38cd20198d59cd11f0fc506e00e + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["0400008085202f89010012d25c46d1f831d74c7c3e71fd32343f53ead192cc70e9e8edf7586571759a0000000048473044022004f5a7e3eb7f5010953c2bca7af2113ee3559b5f7adc86ad09b872526e3b36f6022040b6409eb612c847185b274eb76a3ff60f0e970e5e78d3eee9269b5f0661611001ffffffff02f0b9f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000326a30f054090000000000000024222102d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388dac00000000000b0400000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "9c731f6bbdaa6159b7c0955f3d1e1df72a64a38cd20198d59cd11f0fc506e00e", + "error": null, + "id": "curltest" + } + ``` + + +## paymentsinfo + +**paymentsinfo '\["createtxid"]'** + +The `paymentsinfo` method returns relevant information about the Payments plan referred by the provided `createtxid` . + +#### Arguments + +| Name | Type | Description | +| ---------- | -------- | ---------------------------------------------------------------------------- | +| createtxid | (string) | the transaction id of the specific Payments plan the user desires to inspect | + +#### Response + +| Name | Type | Description | +| ---------------------------------- | ---------------- | ----------------------------------------------------------------------------------- | +| plan\_type | (string) | the type of the plan | +| lockedblocks | (number) | the number of blocks the funding to this Payment plan is locked | +| totalallocations | (number) | sum of the allocation numbers of all the `paytxnids` | +| minrelease | (number) | the miminum amount of funds locked that can be released | +| numoprets | (number) | number of `OP_RETURN`s (can be `0`/`1`) | +| txidoprets | (array of jsons) | an array containing `paytxnids` and their `scriptPubkeys` | +| txid | (string) | the `paytxnid` of one of the recipients | +| scriptPubKey | (string) | the `scriptPubkey` corresponding to the above `paytxnid` | +| RDjEATVvJm8ff2rEYq6yRmzQEuL4mZtF2r | (number) | the amount of funds stored in the `1of2` address corresponding to this Payment plan | +| utxos | (number) | the number of utxos belonging to the above address | +| REpyKi7avsVduqZ3eimncK4uKqSArLTGGK | (number) | the amount of funds stored in the Payments modules's Global address | +| utxos | (number) | the number of utxos belonging to the above address | +| totalfunds | (number) | the total amount of funds available | +| elegiblefunds | (number) | the total amount of funds eleigible to be released | +| min\_release\_height | (number) | the block height after which atleast some of the funds can be released | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=HELLOWORLD paymentsinfo '["c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837"]' +``` + + + ```json + { + "plan_type": "payments", + "lockedblocks": 0, + "totalallocations": 10, + "minrelease": 0, + "numoprets": 0, + "txidoprets": [ + { + "txid": "9c731f6bbdaa6159b7c0955f3d1e1df72a64a38cd20198d59cd11f0fc506e00e", + "scriptPubKey": "222102d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388dac" + }, + { + "txid": "3398899808706726bf04c815ca994f616768a1d4ad2546f14246bef3a926117d", + "scriptPubKey": "2221039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775ac" + } + ], + "RDjEATVvJm8ff2rEYq6yRmzQEuL4mZtF2r": 800.0, + "utxos": 1, + "REpyKi7avsVduqZ3eimncK4uKqSArLTGGK": 777.0, + "utxos": 1, + "totalfunds": 1577.0, + "elegiblefunds": 1577.0, + "min_release_height": 3683, + "result": "success" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"paymentsinfo", "params":["c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "plan_type": "payments", + "lockedblocks": 0, + "totalallocations": 10, + "minrelease": 0, + "numoprets": 0, + "txidoprets": [ + { + "txid": "9c731f6bbdaa6159b7c0955f3d1e1df72a64a38cd20198d59cd11f0fc506e00e", + "scriptPubKey": "222102d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388dac" + }, + { + "txid": "3398899808706726bf04c815ca994f616768a1d4ad2546f14246bef3a926117d", + "scriptPubKey": "2221039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775ac" + } + ], + "RDjEATVvJm8ff2rEYq6yRmzQEuL4mZtF2r": 800.0, + "utxos": 1, + "REpyKi7avsVduqZ3eimncK4uKqSArLTGGK": 777.0, + "utxos": 1, + "totalfunds": 1577.0, + "elegiblefunds": 1577.0, + "min_release_height": 3683, + "result": "success" + }, + "error": null, + "id": "curltest" + } + ``` + + +## paymentslist + +**paymentslist** + +The `paymentslist` method lists all Payment plan `createtxids` that are active on the Smart Chain. + +#### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +#### Response + +| Name | Type | Description | +| ----------- | -------- | -------------------------------------------------------------- | +| result | (string) | whether the call executed successfully | +| createtxids | (array) | the txids of all the Payments plans created on the Smart chain | + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=HELLOWORLD paymentslist +``` + + + ```json + { + "result": "success", + "createtxids": [ + "c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837" + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"paymentslist", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "createtxids": [ + "c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837" + ] + }, + "error": null, + "id": "curltest" + } + ``` + + +## paymentsmerge + +**paymentsmerge '\[“createtxid"]'** + +The `paymentsmerge` method merges funds into a single [utxo.](/start-here/core-technology-discussions/miscellaneous/#the-utxo-an-elusive-yet-fundamental-concept) + +The funds merged can be either the funds currently in the `1of2` address, or the funds can be the funds in the Payments Module's Global Address. + +Merged funds cannot be merged again for a period of time after the merger. The time required depends on the value set in the `lockedblocks` argument when the `paymentscreate` method was executed. The period of time in which the funds cannot be merged is `lockedblocks + 100`. This prevents the user from merging the funds a second time before the funds can be released from the first merger. + +The size of a `paymentsrelease` transaction is bound by the normal rules of consensus, and therefore the number of inputs that can be provided as arguments is limited. If the number of inputs is too high, the consensus mechanism will reject the transaction when it is broadcast to the network. In this event, simply split the inputs between multiple `paymentsrelease` transactions as necessary. + +#### Arguments + +| Name | Type | Description | +| ---------- | -------- | --------------------------------------------------------------------------------------- | +| createtxid | (string) | the transaction id of the specific Payments plan whose inputs the user desires to merge | + +#### Response + +| Name | Type | Description | +| ------ | -------- | ------------------------------------------------------ | +| hex | (string) | the transaction in raw format, provided in hexadecimal | +| txid | (string) | the transaction id of the `paymentsmerge` transaction | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=HELLOWORLD paymentsmerge '["c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837"]' +``` + + + ```json + { + "hex": "0400008085202f890a0724d77b165969158bd68d6502bf40ceff93f1c9fc5be0421eda9859488d21b900000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140b0d0df465b818c4b29871433f7913e80d8d27114283ba6ef1b7b91280c189aa829e29946a75d925410dc3087dcd482bed3f98149275e902c0e6bd4e338066e41a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff18a003bf4399b2cbcecbf6fd494eec9c80996603dad5e4ce300c9bc4b1a4cd5400000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140f725750c29f92e401033a6334016bb224aa4cf26064c28e0c39a0bc126cf2d5767af46207abc6662f084e3c257e30b6939acdc194f36624d9f8b4288626faaf6a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff199096b27c33b86f7bab650a2188e82a865e737913546108615ac7d77a1c540300000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814008a1b9d33980f42027cb680923e8e9ef03ed6df7ba32676acd134ca551260b1f5ccd82b52b47945f19523b3dcab456937ef4efa954df1adc5d77d1c974db4f41a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff1c48e0c48972da890aa32f2932f60ed00c270d0168108895ab6f5b88ac765f6600000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814049c690811754dc2242bf56c7fa538154274fc56ed4fcedc09f5cc2febb09bdcd3964644b8724f4118b269b80c9cb5147eb6ea627a6b72bae8be7c92205837d6fa129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff5241478ba2dad22756b37c0e5d9fd0101ab1fa791f78b26b8ee8b7a4b6b7849b00000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814014217e878c17c15d169d8d16cfdb87338993c711157a6f2d0e3dea2a57c80742740c2763267d9056f3004e10c451dd39651f4895f829e8b6a6f81432f2aef534a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff76a5e60ef27316f9c1876f2c5a83114ac26aa977bad655e24c735158025e770800000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b4685681400d1d01976f725fe7274e70261de970a34acfd1819a454b6e0c5e89395306dbd437d34152a1d06d3809395bf9de0928e03049a596b7e168d0d0c085bc8d5b45e7a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff80e0f4be24118fbe0e486535aa5d3076b1d8991e84907fc5bd08524694e1396300000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140582979c51f5c151f438fbafdbdd2a65cb2e79fa13bdeb92b197723d16508f35741c1cbc60f8e5b48f7e934a10bedc80e190d7fc95c26327ee0b4f5887fce2726a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffb3442651af7f068feee52924827ea32cec67cfd3b4302e227289cce5d16cf3b600000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140aa44e1f346bd3a6bfa851769671f0d7b9d6d904946e922d9394135cb8eb633d041448d488bfd3ed09bc31a09da1e4057a4f74280224516296181422263b925bba129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffbff13f72b030df0284a912169d194bf1f8af1f327e9f34cefc4a410e694d356d00000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140c9dfd6d9a487df51fc7d1c063c2b4df331d6b5145e451d9bf925870664aefb513906d90b2e178cadf0d1fae689df7f14cdaaebe51c1899ce6f792063aa1fb504a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffe1dc8bd536f3687ecd56b2238aa31c874331f217e304b97377c1e9d1484e723900000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140fcda699e4cc5fec0a9239e4f0d98f25cb4cf012cc8b0f5505ca97945ecde11c5687cd8baa43e780078f2e061a9e2595c1c0ef78733cbb78d0d0948c9ac627cfaa129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff01e0b589fe0e0000005c2ea22c8020c657913e6b261b70e17c7724f33dea97bd7ba3fb91e0af9dde23eb63146f9a6681031210008203000401cc2a0401f00102246a22f04d37383c2bde377a8caafc73cba2f16671d0617f59fe5e64d00a1dd255ec51dec47500000000b70f00000000000000000000000000", + "txid": "62382ecc0dd14773ce5dd278d08cb98d45168c0f375379eebd6df471111db8f6", + "result": "success" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"paymentsmerge", "params":["c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "hex": "0400008085202f890a0724d77b165969158bd68d6502bf40ceff93f1c9fc5be0421eda9859488d21b900000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140b0d0df465b818c4b29871433f7913e80d8d27114283ba6ef1b7b91280c189aa829e29946a75d925410dc3087dcd482bed3f98149275e902c0e6bd4e338066e41a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff18a003bf4399b2cbcecbf6fd494eec9c80996603dad5e4ce300c9bc4b1a4cd5400000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140f725750c29f92e401033a6334016bb224aa4cf26064c28e0c39a0bc126cf2d5767af46207abc6662f084e3c257e30b6939acdc194f36624d9f8b4288626faaf6a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff199096b27c33b86f7bab650a2188e82a865e737913546108615ac7d77a1c540300000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814008a1b9d33980f42027cb680923e8e9ef03ed6df7ba32676acd134ca551260b1f5ccd82b52b47945f19523b3dcab456937ef4efa954df1adc5d77d1c974db4f41a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff1c48e0c48972da890aa32f2932f60ed00c270d0168108895ab6f5b88ac765f6600000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814049c690811754dc2242bf56c7fa538154274fc56ed4fcedc09f5cc2febb09bdcd3964644b8724f4118b269b80c9cb5147eb6ea627a6b72bae8be7c92205837d6fa129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff5241478ba2dad22756b37c0e5d9fd0101ab1fa791f78b26b8ee8b7a4b6b7849b00000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814014217e878c17c15d169d8d16cfdb87338993c711157a6f2d0e3dea2a57c80742740c2763267d9056f3004e10c451dd39651f4895f829e8b6a6f81432f2aef534a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff76a5e60ef27316f9c1876f2c5a83114ac26aa977bad655e24c735158025e770800000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b4685681400d1d01976f725fe7274e70261de970a34acfd1819a454b6e0c5e89395306dbd437d34152a1d06d3809395bf9de0928e03049a596b7e168d0d0c085bc8d5b45e7a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff80e0f4be24118fbe0e486535aa5d3076b1d8991e84907fc5bd08524694e1396300000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140582979c51f5c151f438fbafdbdd2a65cb2e79fa13bdeb92b197723d16508f35741c1cbc60f8e5b48f7e934a10bedc80e190d7fc95c26327ee0b4f5887fce2726a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffb3442651af7f068feee52924827ea32cec67cfd3b4302e227289cce5d16cf3b600000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140aa44e1f346bd3a6bfa851769671f0d7b9d6d904946e922d9394135cb8eb633d041448d488bfd3ed09bc31a09da1e4057a4f74280224516296181422263b925bba129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffbff13f72b030df0284a912169d194bf1f8af1f327e9f34cefc4a410e694d356d00000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140c9dfd6d9a487df51fc7d1c063c2b4df331d6b5145e451d9bf925870664aefb513906d90b2e178cadf0d1fae689df7f14cdaaebe51c1899ce6f792063aa1fb504a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffe1dc8bd536f3687ecd56b2238aa31c874331f217e304b97377c1e9d1484e723900000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140fcda699e4cc5fec0a9239e4f0d98f25cb4cf012cc8b0f5505ca97945ecde11c5687cd8baa43e780078f2e061a9e2595c1c0ef78733cbb78d0d0948c9ac627cfaa129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff01e0b589fe0e0000005c2ea22c8020c657913e6b261b70e17c7724f33dea97bd7ba3fb91e0af9dde23eb63146f9a6681031210008203000401cc2a0401f00102246a22f04d37383c2bde377a8caafc73cba2f16671d0617f59fe5e64d00a1dd255ec51dec47500000000b70f00000000000000000000000000", + "txid": "62382ecc0dd14773ce5dd278d08cb98d45168c0f375379eebd6df471111db8f6", + "result": "success" + }, + "error": null, + "id": "curltest" + } + ``` + + +###### Broadcast the transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f890a0724d77b165969158bd68d6502bf40ceff93f1c9fc5be0421eda9859488d21b900000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140b0d0df465b818c4b29871433f7913e80d8d27114283ba6ef1b7b91280c189aa829e29946a75d925410dc3087dcd482bed3f98149275e902c0e6bd4e338066e41a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff18a003bf4399b2cbcecbf6fd494eec9c80996603dad5e4ce300c9bc4b1a4cd5400000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140f725750c29f92e401033a6334016bb224aa4cf26064c28e0c39a0bc126cf2d5767af46207abc6662f084e3c257e30b6939acdc194f36624d9f8b4288626faaf6a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff199096b27c33b86f7bab650a2188e82a865e737913546108615ac7d77a1c540300000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814008a1b9d33980f42027cb680923e8e9ef03ed6df7ba32676acd134ca551260b1f5ccd82b52b47945f19523b3dcab456937ef4efa954df1adc5d77d1c974db4f41a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff1c48e0c48972da890aa32f2932f60ed00c270d0168108895ab6f5b88ac765f6600000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814049c690811754dc2242bf56c7fa538154274fc56ed4fcedc09f5cc2febb09bdcd3964644b8724f4118b269b80c9cb5147eb6ea627a6b72bae8be7c92205837d6fa129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff5241478ba2dad22756b37c0e5d9fd0101ab1fa791f78b26b8ee8b7a4b6b7849b00000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814014217e878c17c15d169d8d16cfdb87338993c711157a6f2d0e3dea2a57c80742740c2763267d9056f3004e10c451dd39651f4895f829e8b6a6f81432f2aef534a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff76a5e60ef27316f9c1876f2c5a83114ac26aa977bad655e24c735158025e770800000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b4685681400d1d01976f725fe7274e70261de970a34acfd1819a454b6e0c5e89395306dbd437d34152a1d06d3809395bf9de0928e03049a596b7e168d0d0c085bc8d5b45e7a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff80e0f4be24118fbe0e486535aa5d3076b1d8991e84907fc5bd08524694e1396300000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140582979c51f5c151f438fbafdbdd2a65cb2e79fa13bdeb92b197723d16508f35741c1cbc60f8e5b48f7e934a10bedc80e190d7fc95c26327ee0b4f5887fce2726a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffb3442651af7f068feee52924827ea32cec67cfd3b4302e227289cce5d16cf3b600000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140aa44e1f346bd3a6bfa851769671f0d7b9d6d904946e922d9394135cb8eb633d041448d488bfd3ed09bc31a09da1e4057a4f74280224516296181422263b925bba129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffbff13f72b030df0284a912169d194bf1f8af1f327e9f34cefc4a410e694d356d00000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140c9dfd6d9a487df51fc7d1c063c2b4df331d6b5145e451d9bf925870664aefb513906d90b2e178cadf0d1fae689df7f14cdaaebe51c1899ce6f792063aa1fb504a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffe1dc8bd536f3687ecd56b2238aa31c874331f217e304b97377c1e9d1484e723900000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140fcda699e4cc5fec0a9239e4f0d98f25cb4cf012cc8b0f5505ca97945ecde11c5687cd8baa43e780078f2e061a9e2595c1c0ef78733cbb78d0d0948c9ac627cfaa129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff01e0b589fe0e0000005c2ea22c8020c657913e6b261b70e17c7724f33dea97bd7ba3fb91e0af9dde23eb63146f9a6681031210008203000401cc2a0401f00102246a22f04d37383c2bde377a8caafc73cba2f16671d0617f59fe5e64d00a1dd255ec51dec47500000000b70f00000000000000000000000000 +``` + + + ```bash + 62382ecc0dd14773ce5dd278d08cb98d45168c0f375379eebd6df471111db8f6 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["0400008085202f890a0724d77b165969158bd68d6502bf40ceff93f1c9fc5be0421eda9859488d21b900000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140b0d0df465b818c4b29871433f7913e80d8d27114283ba6ef1b7b91280c189aa829e29946a75d925410dc3087dcd482bed3f98149275e902c0e6bd4e338066e41a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff18a003bf4399b2cbcecbf6fd494eec9c80996603dad5e4ce300c9bc4b1a4cd5400000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140f725750c29f92e401033a6334016bb224aa4cf26064c28e0c39a0bc126cf2d5767af46207abc6662f084e3c257e30b6939acdc194f36624d9f8b4288626faaf6a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff199096b27c33b86f7bab650a2188e82a865e737913546108615ac7d77a1c540300000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814008a1b9d33980f42027cb680923e8e9ef03ed6df7ba32676acd134ca551260b1f5ccd82b52b47945f19523b3dcab456937ef4efa954df1adc5d77d1c974db4f41a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff1c48e0c48972da890aa32f2932f60ed00c270d0168108895ab6f5b88ac765f6600000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814049c690811754dc2242bf56c7fa538154274fc56ed4fcedc09f5cc2febb09bdcd3964644b8724f4118b269b80c9cb5147eb6ea627a6b72bae8be7c92205837d6fa129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff5241478ba2dad22756b37c0e5d9fd0101ab1fa791f78b26b8ee8b7a4b6b7849b00000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814014217e878c17c15d169d8d16cfdb87338993c711157a6f2d0e3dea2a57c80742740c2763267d9056f3004e10c451dd39651f4895f829e8b6a6f81432f2aef534a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff76a5e60ef27316f9c1876f2c5a83114ac26aa977bad655e24c735158025e770800000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b4685681400d1d01976f725fe7274e70261de970a34acfd1819a454b6e0c5e89395306dbd437d34152a1d06d3809395bf9de0928e03049a596b7e168d0d0c085bc8d5b45e7a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff80e0f4be24118fbe0e486535aa5d3076b1d8991e84907fc5bd08524694e1396300000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140582979c51f5c151f438fbafdbdd2a65cb2e79fa13bdeb92b197723d16508f35741c1cbc60f8e5b48f7e934a10bedc80e190d7fc95c26327ee0b4f5887fce2726a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffb3442651af7f068feee52924827ea32cec67cfd3b4302e227289cce5d16cf3b600000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140aa44e1f346bd3a6bfa851769671f0d7b9d6d904946e922d9394135cb8eb633d041448d488bfd3ed09bc31a09da1e4057a4f74280224516296181422263b925bba129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffbff13f72b030df0284a912169d194bf1f8af1f327e9f34cefc4a410e694d356d00000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140c9dfd6d9a487df51fc7d1c063c2b4df331d6b5145e451d9bf925870664aefb513906d90b2e178cadf0d1fae689df7f14cdaaebe51c1899ce6f792063aa1fb504a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffe1dc8bd536f3687ecd56b2238aa31c874331f217e304b97377c1e9d1484e723900000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140fcda699e4cc5fec0a9239e4f0d98f25cb4cf012cc8b0f5505ca97945ecde11c5687cd8baa43e780078f2e061a9e2595c1c0ef78733cbb78d0d0948c9ac627cfaa129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff01e0b589fe0e0000005c2ea22c8020c657913e6b261b70e17c7724f33dea97bd7ba3fb91e0af9dde23eb63146f9a6681031210008203000401cc2a0401f00102246a22f04d37383c2bde377a8caafc73cba2f16671d0617f59fe5e64d00a1dd255ec51dec47500000000b70f00000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "62382ecc0dd14773ce5dd278d08cb98d45168c0f375379eebd6df471111db8f6", + "error": null, + "id": "curltest" + } + ``` + + +## paymentsrelease + +**paymentsrelease '\[“createtxid",amount,(skipminimum)]'** + +The `paymentsrelease` method can be executed by anyone to release the **eligible** payments of the given `createtxid` Payments plan. The funds specified by `amount` are distributed among all the recipients of the Payments plan in predefined proportions. + +#### Arguments + +| Name | Type | Description | +| ----------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| createtxid | (string) | the transaction id of the specific Payments plan whose payments the user desires to release | +| amount | (number) | the amount of funds to release; this value must be higher than the minimum-amount requirement originally set in the plan | +| skipminimum | (number) | a flag; if there are recipients whose share is below the dust threshold (`10,000 sats`), setting this flag to `1` will skip payments to them. In the case of a plan created using [paymentsairdrop](/antara/api/payments/#paymentsairdrop), the threshold is `mintoaddress` if it is greated than `10,000 sats` | + +#### Response + +| Name | Type | Description | +| --------- | -------- | ----------------------------------------------------------------------- | +| numoprets | (number) | number of `OP_RETURN`s (can be `0`/`1`) | +| amount | (number) | the amount that is being released | +| newamount | (number) | the amount that is being released; corrected in case of rounding errors | +| hex | (string) | the transaction in raw format, provided in hexadecimal | +| txid | (string) | the transaction id of the `paymentsrelease` transaction | +| result | (string) | whether the call executed successfully | + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=HELLOWORLD paymentsrelease '["c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837",1000]' +``` + + + ```json + { + "numoprets": 0, + "amount": 1000.0, + "newamount": 1000.0, + "hex": "0400008085202f890450bee824558149bb8ae61f268baff8977bb36239eb864f7b7c33ce5ed7f2044c000000007b4c79a276a072a26ba067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814094c2b993048178521b2e139a8df680182b955bf41f0d2e129fcfa2222f350eff165cadf54eeb517453a91c4a286b372d5cbb2d4d3ecd4a2a2d718b354164bd88a100af038001f0a10001ffffffffc7a5b6eb4f534ff1c429487de3e43a23dfe8fdbfb5df10477a2c5788afce954d000000007b4c79a276a072a26ba067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140655cd777ef96ce0001fcbe9a96b457ed9354a019996173975716b0801738cc070e9b51654caedaba2d1826a7f876ff7ee37b6b54860f5f35d0019d65f51620d9a100af038001f0a10001ffffffff25496b4c2566cd3efc581797dd0dacf60f6e904418891059c343e84ba707a75600000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814065f5e4c8397b0cd58fd6f93b6a45e34d21e5a89124912f338bc0fabc79d89d4108b6541852935aecd95226c106765c89475d01d3d10f966cd6aa9bb85fa683e6a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffc167bdc7aafdb9d648327bb3a1bd8334b9d3204295a540e96a6ee737b463a1b100000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140cedf8fbe886a8ac8c0b59a6c28d44604f53803b1072fcd5364cdb67f5d3ef148062920230101dcf2977f384e5d90d98665fecefee0bdda0fc5e81a8dc492a0eaa129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff03f066acbc0d000000642ea22c8020c657913e6b261b70e17c7724f33dea97bd7ba3fb91e0af9dde23eb63146f9a6681031210008203000401cc320401f001022c6a2af05237383c2bde377a8caafc73cba2f16671d0617f59fe5e64d00a1dd255ec51dec400e87648170000007500046bf41400000024222102d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388dac00e40b5402000000242221039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775ac000000005a0f00000000000000000000000000", + "txid": "665f76ac885b6fab95881068010d270cd00ef632292fa30a89da7289c4e0481c", + "result": "success" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"paymentsrelease", "params":["c4de51ec55d21d0ad0645efe597f61d07166f1a2cb73fcaa8c7a37de2b3c3837",1000]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "numoprets": 0, + "amount": 1000.0, + "newamount": 1000.0, + "hex": "0400008085202f890450bee824558149bb8ae61f268baff8977bb36239eb864f7b7c33ce5ed7f2044c000000007b4c79a276a072a26ba067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814094c2b993048178521b2e139a8df680182b955bf41f0d2e129fcfa2222f350eff165cadf54eeb517453a91c4a286b372d5cbb2d4d3ecd4a2a2d718b354164bd88a100af038001f0a10001ffffffffc7a5b6eb4f534ff1c429487de3e43a23dfe8fdbfb5df10477a2c5788afce954d000000007b4c79a276a072a26ba067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140655cd777ef96ce0001fcbe9a96b457ed9354a019996173975716b0801738cc070e9b51654caedaba2d1826a7f876ff7ee37b6b54860f5f35d0019d65f51620d9a100af038001f0a10001ffffffff25496b4c2566cd3efc581797dd0dacf60f6e904418891059c343e84ba707a75600000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814065f5e4c8397b0cd58fd6f93b6a45e34d21e5a89124912f338bc0fabc79d89d4108b6541852935aecd95226c106765c89475d01d3d10f966cd6aa9bb85fa683e6a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffc167bdc7aafdb9d648327bb3a1bd8334b9d3204295a540e96a6ee737b463a1b100000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140cedf8fbe886a8ac8c0b59a6c28d44604f53803b1072fcd5364cdb67f5d3ef148062920230101dcf2977f384e5d90d98665fecefee0bdda0fc5e81a8dc492a0eaa129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff03f066acbc0d000000642ea22c8020c657913e6b261b70e17c7724f33dea97bd7ba3fb91e0af9dde23eb63146f9a6681031210008203000401cc320401f001022c6a2af05237383c2bde377a8caafc73cba2f16671d0617f59fe5e64d00a1dd255ec51dec400e87648170000007500046bf41400000024222102d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388dac00e40b5402000000242221039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775ac000000005a0f00000000000000000000000000", + "txid": "665f76ac885b6fab95881068010d270cd00ef632292fa30a89da7289c4e0481c", + "result": "success" + }, + "error": null, + "id": "curltest" + } + ``` + + +###### Broadcast the transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f890450bee824558149bb8ae61f268baff8977bb36239eb864f7b7c33ce5ed7f2044c000000007b4c79a276a072a26ba067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814094c2b993048178521b2e139a8df680182b955bf41f0d2e129fcfa2222f350eff165cadf54eeb517453a91c4a286b372d5cbb2d4d3ecd4a2a2d718b354164bd88a100af038001f0a10001ffffffffc7a5b6eb4f534ff1c429487de3e43a23dfe8fdbfb5df10477a2c5788afce954d000000007b4c79a276a072a26ba067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140655cd777ef96ce0001fcbe9a96b457ed9354a019996173975716b0801738cc070e9b51654caedaba2d1826a7f876ff7ee37b6b54860f5f35d0019d65f51620d9a100af038001f0a10001ffffffff25496b4c2566cd3efc581797dd0dacf60f6e904418891059c343e84ba707a75600000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814065f5e4c8397b0cd58fd6f93b6a45e34d21e5a89124912f338bc0fabc79d89d4108b6541852935aecd95226c106765c89475d01d3d10f966cd6aa9bb85fa683e6a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffc167bdc7aafdb9d648327bb3a1bd8334b9d3204295a540e96a6ee737b463a1b100000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140cedf8fbe886a8ac8c0b59a6c28d44604f53803b1072fcd5364cdb67f5d3ef148062920230101dcf2977f384e5d90d98665fecefee0bdda0fc5e81a8dc492a0eaa129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff03f066acbc0d000000642ea22c8020c657913e6b261b70e17c7724f33dea97bd7ba3fb91e0af9dde23eb63146f9a6681031210008203000401cc320401f001022c6a2af05237383c2bde377a8caafc73cba2f16671d0617f59fe5e64d00a1dd255ec51dec400e87648170000007500046bf41400000024222102d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388dac00e40b5402000000242221039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775ac000000005a0f00000000000000000000000000 +``` + + + ```bash + 665f76ac885b6fab95881068010d270cd00ef632292fa30a89da7289c4e0481c + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["0400008085202f890450bee824558149bb8ae61f268baff8977bb36239eb864f7b7c33ce5ed7f2044c000000007b4c79a276a072a26ba067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814094c2b993048178521b2e139a8df680182b955bf41f0d2e129fcfa2222f350eff165cadf54eeb517453a91c4a286b372d5cbb2d4d3ecd4a2a2d718b354164bd88a100af038001f0a10001ffffffffc7a5b6eb4f534ff1c429487de3e43a23dfe8fdbfb5df10477a2c5788afce954d000000007b4c79a276a072a26ba067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140655cd777ef96ce0001fcbe9a96b457ed9354a019996173975716b0801738cc070e9b51654caedaba2d1826a7f876ff7ee37b6b54860f5f35d0019d65f51620d9a100af038001f0a10001ffffffff25496b4c2566cd3efc581797dd0dacf60f6e904418891059c343e84ba707a75600000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b46856814065f5e4c8397b0cd58fd6f93b6a45e34d21e5a89124912f338bc0fabc79d89d4108b6541852935aecd95226c106765c89475d01d3d10f966cd6aa9bb85fa683e6a129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffffc167bdc7aafdb9d648327bb3a1bd8334b9d3204295a540e96a6ee737b463a1b100000000a74ca5a281a1a0819ca28194a067a56580210358f1764f82c63abc7c7455555fd1d3184905e30e819e97667e247e5792b468568140cedf8fbe886a8ac8c0b59a6c28d44604f53803b1072fcd5364cdb67f5d3ef148062920230101dcf2977f384e5d90d98665fecefee0bdda0fc5e81a8dc492a0eaa129a5278020f0347bcbbb602b48197a8d6e291ec47bf5f549dc9ca6a778a2d050c7a6dccf638103020000af038001f0a10001ffffffff03f066acbc0d000000642ea22c8020c657913e6b261b70e17c7724f33dea97bd7ba3fb91e0af9dde23eb63146f9a6681031210008203000401cc320401f001022c6a2af05237383c2bde377a8caafc73cba2f16671d0617f59fe5e64d00a1dd255ec51dec400e87648170000007500046bf41400000024222102d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388dac00e40b5402000000242221039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775ac000000005a0f00000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "665f76ac885b6fab95881068010d270cd00ef632292fa30a89da7289c4e0481c", + "error": null, + "id": "curltest" + } + ``` + + + + paymentsairdrop and payments\_airdroptokens need review and completion + + +## paymentsairdrop + +**paymentsairdrop '\[lockedblocks, minamount, mintoaddress, top, bottom, fixedFlag, "excludeAddress", ... , "excludeAddressN"]'** + +The `paymentsairdrop` method allows the creation of a special Payments plan that rewards a certain range of addresses on the Smart Chain based on the specific criteria set by the arguments. + + + The paymentsairdrop RPC requires the [-ac\_snapshot](/antara/setup/antara-customizations/#ac-snapshot) to be active. + + +#### Arguments + +| Name | Type | Description | +| ---------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| lockedblocks | (number) | the number of confirmations the "Payments create transaction" of a plan must receive on the network before the plan's funds can be released | +| minamount | (number) | the minimum amount of funds that can be released | +| mintoaddress | (number) | the minimum amount that can be paid to an address setting this value to `0` defaults to `10000` satoshis | +| top | (number) | having sorted into an array all known addresses by their value from least (top) to greatest (bottom), this `top` value sets the index number of the lowest-value address that should receive a portion of the airdrop; this value must not be equal to `0` nor over `3999` | +| bottom | (number) | having sorted into an array all known addresses by their value from least (top) to greatest (bottom), this `bottom` value sets the index number of the highest-value address that should receive a portion of the airdrop; this value is normally set to `0`, unless the airdrop issuer desires to exclude rich members from the airdrop | +| fixedFlag | (string) | set to `0`: all receiving addresses in the rich list are paid based on their balance. Set to `1`: the amount paid is fixed and split evenly over all receiving addresses. Set to `7`: activates a "game mode" that changes the values of the bottom and top index numbers based on the block hash of the block in which the daily airdrop was taken. | +| "excludeAddress" | (string, accepts multiple) | any address included as an excludeAddress is ommitted from the airdrop | + +#### Response + +| Name | Type | Description | +| ---- | ---- | ----------- | +| ( ) | | | + +## payments\_airdroptokens + +**payments\_airdroptokens '\[“tokenid", lockedblocks, minamount, mintoaddress, top, bottom, fixedFlag, "excludePubKey", ... , "excludePubKeyN"]'** + + + The payments\_airdroptokens method is still in development. Please inquire on [Discord](https://komodoplatform.com/discord) for more details. + + +## paymentstxidopret + +**paymentstxidopret '\[allocation, "scriptPubKey", ("destopret")]'** + +Use the `paymentstxidopret` method to create a transaction for each intended recipient of a Payments plan. + +#### Arguments + +| Name | Type | Description | +| ------------ | ------------------ | -------------------------------------------------------------------------------------------- | +| allocation | (number) | defines the share of a payment to the given `scriptPubkey` | +| scriptPubKey | (string) | [scriptPubkey](https://learnmeabitcoin.com/technical/scriptPubKey) of the recipient | +| destopret | (string, optional) | data to be stored in the OP\_RETURN of the transaction that sends funds to the scriptPubkey. | + +#### Response + +| Name | Type | Description | +| ------ | -------- | --------------------------------------------------------- | +| hex | (string) | the transaction in raw format, provided in hexadecimal | +| txid | (string) | the transaction id of the `paymentstxidopret` transaction | +| result | (string) | whether the call executed successfully | + +#### Additional Details + +##### allocation + +Recall that `allocation` is the number that defines the share of a payment to the given `scriptPubkey`. + +For example, if a Payments plan has the allocation to `scriptPubkey_1` as the number `n1` and allocation to `scriptPubkey_2` as the number `n2`, then any funds sent to this payment plan are split between `scriptPubkey_1` and `scriptPubkey_2` in the ratio `n1:n2`. + +If funds sent to the Payments plan has the value N, `scriptPubkey_1` will receive `(N*n1)/(n1+n2)` and `scriptPubkey_1` will receive `(N*n2)/(n1+n2)` + +##### scriptPubkey + +Recall that `scriptPubkey` is the puzzle that locks coins in a transaction. + +###### Pubkey Mutation + +If the recipient is a normal pubkey, the [scriptPubkey](https://learnmeabitcoin.com/technical/scriptPubKey) can be constructed by sandwiching the pubkey between the strings `"21"` and `"ac"`. In this case, the private key corresponding to the pubkey can be used to sign a transaction that unlocks the coins. + +The `scriptPubKey` parameter can belong to any valid type described [in this linked list](https://learnmeabitcoin.com/technical/scriptPubKey). This list is not exhaustive of all types available to a valid `scriptPubkey` parameter; please inquire with our developers for more details, if necessary. + +For example, given the pubkey `02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567`, the `scriptPubkey` will be `2102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac`. + +###### Address Substitution + +The node that executes the `paymentstxidopret` RPC can replace the `scriptPubkey` with a normal base58 encoded address, so long as the node has the address's associated private key in the node's local wallet. + +For example, the address `RN727JeeiZ6NXic7PUKTCiHT1HvuBN4RDa` can be used in place of a `scriptPubkey` without any modifications by a node which has access to the corresponding private key. + +The `validateaddress` RPC can be used to verify that an address belongs to the node. + +The `validateaddress` RPC can also verify that the `pubkey` on which the base58 encoded address is based is also the `pubkey` associated with the relevant `scriptPubkey`. + +Therefore, using either `RN727JeeiZ6NXic7PUKTCiHT1HvuBN4RDa` or `2102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac` as the `scriptPubkey` argument is equivalent. + +###### Command + +```bash +./komdo-cli -ac_name=HELLOWORLD validateaddress RN727JeeiZ6NXic7PUKTCiHT1HvuBN4RDa +``` + + + ```json + { + "isvalid": true, + "address": "RN727JeeiZ6NXic7PUKTCiHT1HvuBN4RDa", + "scriptPubKey": "76a9148cad275b85eb32fff144f3650b74e7c18bdd9b2288ac", + "segid": 51, + "ismine": true, + "iswatchonly": false, + "isscript": false, + "pubkey": "02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567", + "iscompressed": true, + "account": "" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"validateaddress", "params":["RN727JeeiZ6NXic7PUKTCiHT1HvuBN4RDa"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "isvalid": true, + "address": "RN727JeeiZ6NXic7PUKTCiHT1HvuBN4RDa", + "scriptPubKey": "76a9148cad275b85eb32fff144f3650b74e7c18bdd9b2288ac", + "segid": 51, + "ismine": true, + "iswatchonly": false, + "isscript": false, + "pubkey": "02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567", + "iscompressed": true, + "account": "" + }, + "error": null, + "id": "curltest" + } + ``` + + +#### 📌 Examples + +###### Command + +```bash +./komodo-cli -ac_name=HELLOWORLD paymentstxidopret '[9,"2221039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775ac"]' +``` + + + ```json + { + "hex": "0400008085202f89010048372b016ca6d2836a2f66bc24217c6d9a82160031f9027de1b43ea278b1a00000000049483045022100b822b9905f0244a22880f3c957cbe76ea8d5e7e97cddc8a2925b6a415a6e1e87022051b539e766a067113f7931182779a90a0bfd640d5e96f93d2af7f8bb3c4ad8bb01ffffffff02f0b9f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000326a30f0540900000000000000242221039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775ac00000000000a1000000000000000000000000000", + "txid": "717153eef7e22a8c741455a8c888a14c9dbe2702658fc93434e5c43a8c8f4ce4", + "result": "success" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"paymentstxidopret", "params":[9,"2221039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775ac"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "hex": "0400008085202f89010048372b016ca6d2836a2f66bc24217c6d9a82160031f9027de1b43ea278b1a00000000049483045022100b822b9905f0244a22880f3c957cbe76ea8d5e7e97cddc8a2925b6a415a6e1e87022051b539e766a067113f7931182779a90a0bfd640d5e96f93d2af7f8bb3c4ad8bb01ffffffff02f0b9f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000326a30f0540900000000000000242221039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775ac00000000000a1000000000000000000000000000", + "txid": "717153eef7e22a8c741455a8c888a14c9dbe2702658fc93434e5c43a8c8f4ce4", + "result": "success" + }, + "error": null, + "id": "curltest" + } + ``` + + +###### Broadcast the transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f89010048372b016ca6d2836a2f66bc24217c6d9a82160031f9027de1b43ea278b1a00000000049483045022100b822b9905f0244a22880f3c957cbe76ea8d5e7e97cddc8a2925b6a415a6e1e87022051b539e766a067113f7931182779a90a0bfd640d5e96f93d2af7f8bb3c4ad8bb01ffffffff02f0b9f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000326a30f0540900000000000000242221039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775ac00000000000a1000000000000000000000000000 +``` + + + ```bash + 717153eef7e22a8c741455a8c888a14c9dbe2702658fc93434e5c43a8c8f4ce4 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["0400008085202f89010048372b016ca6d2836a2f66bc24217c6d9a82160031f9027de1b43ea278b1a00000000049483045022100b822b9905f0244a22880f3c957cbe76ea8d5e7e97cddc8a2925b6a415a6e1e87022051b539e766a067113f7931182779a90a0bfd640d5e96f93d2af7f8bb3c4ad8bb01ffffffff02f0b9f50500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000326a30f0540900000000000000242221039433dc3749aece1bd568f374a45da3b0bc6856990d7da3cd175399577940a775ac00000000000a1000000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "717153eef7e22a8c741455a8c888a14c9dbe2702658fc93434e5c43a8c8f4ce4", + "error": null, + "id": "curltest" + } + ``` + +export const title = "Pegs: Creating Decentralized Stablecoins"; +export const description = + "The Pegs Antara Module is a mechanism for creating a decentralized stablecoin."; + +# Pegs + + + The Pegs Antara Module is in the final stages of production. The specifics of the implementation are also subject to change. Please reach out to the Komodo team for consultation before attempting to use this module in a production environment. + + +## Introduction + +The Pegs Antara Module is a mechanism for creating a decentralized [stablecoin.](https://en.wikipedia.org/wiki/Stablecoin) + +A stablecoin is a cryptocurrency that has a financial value that is "pegged" to another asset. Stablecoins can be used in a Smart Chain environment to allow users to buy, sell, and trade with on-chain assets that mimic off-chain prices. + +For example, a stablecoin can be pegged to a common fiat currency, such as USD or EUR. The stablecoin can also mimic stocks, external cryptocurrencies, and other assets, so long as reliable price-data can be accessed through an online application programming interface (API). + +#### Module Methodology + +##### Associated Modules + +The Pegs Antara Module requires interactivity with several additional Antara Modules, including the following: + +* The [Gateways](/antara/api/gateways/) Module + * This module acts as a bridge between the Smart Chain where Pegs is active and an external cryptocurrency + * The external cryptocurrency must be based on the Bitcoin protocol + * Typically, this external Smart Chain features a coin, such as KMD, that is tradeable in many venues across the cryptocurrency industry + * On the external cryptocurrency blockchain, a user sends cryptocurrency coins to a multisignature address that is controlled by the Gateways Module, which locks the coins against further spending for the duration of the usage of the Pegs Module + * On the Pegs-related Smart Chain, the Gateways Module then issues to the user [tokens](/antara/api/tokens/) that represent the value of the user's locked funds +* The [Tokens](/antara/api/tokens/) Module + * This module provides the functionality necessary to manage a cryptocurrency-based token system in coordination with the Gateways Module + * These tokens represent the (now locked) value of the external Bitcoin-protocol or Komodo-protocol based cryptocurrency + * These tokens can be spent and traded as actual cryptocurrency; the user who returns them to the Gateways Module at a later time will unlock and receive the associated external funds +* The [Oracles](/antara/api/oracles/) Module + * This module uses an [oraclefeed](https://github.com/KomodoPlatform/komodo/blob/master/src/cc/dapps/oraclefeed.c) app to provide information to the Gateways Module about tokens a user deposits +* The [Prices](/antara/api/prices/) Module + * The Prices Module obtains data from a range of external sources (defined by a developer) and makes this information available on the Pegs Smart Chain + * This module utilizes functionality from the Oracles Module to transfer the obtained data from the real world into the digital world + * The Prices Module is responsible for tracking the value of an external asset (including assets external to the Komodo ecosystem) for on-chain price mimicry + * Data from the Prices module becomes available for Smart Chain activity after a twenty-four hour delay + +##### A Brief Explanation of Pegs Functionality + +There are several technical elements involved in the Pegs Antara Module that collaborate to create a stablecoin. + +###### Creating a Tokenized Cryptocurrency to Back the Stablecoin + +The first aspect relies on three different Antara Modules: [Gateways,](/antara/api/gateways/) [Tokens,](/antara/api/tokens/) and [Oracles.](/antara/api/oracles/) + +On any cryptocurrency blockchain that is built on the Bitcoin protocol, such as `KMD`, users send funds to a multisignature address that is controlled by the Komodo-based Gateways Module that is active on this chain. The Gateways Module locks these funds against further spending at this time. + +Once the funds are locked, the three modules together automatically make available to the user an equivalent number of tokens on the Pegs-related Smart Chain. These tokens represent the locked funds on a `1:1` ratio at the satoshi level (each token represents one satoshi of the external coin). + +As these tokens are `1:1` representations of the locked funds, the value of these tokens does not change in respect to the associated funds. However, the cryptocurrency represented may not have a stable value. + +###### Creating a Reliable Rate of Exchange Between the Stablecoin and the Backing Cryptocurrency + +The second aspect relies on the [Prices](/antara/api/prices/) Antara Module. + +Before the user can exchange their tokens for a stablecoin, the Smart Chain must be able to determine the stablecoin's projected market value (such as the market value of `USD`). + +Using data provided by a wide range of online application programming interfaces (APIs), which can be manually determined by a developer, these two modules create a stable rate of exchange between the user's tokens and the pegged stablecoin. + +###### Offering the Exchange Between Stablecoin and Backing Cryptocurrency + +With these two elements (the user's tokens and a rate of exchange) the Pegs Antara Module is now able to offer a stablecoin. + +The user sends their tokens (such as tokenized `KMD`) to the Pegs Module, which locks the tokens against further spending for the duration of Pegs usage. + +Once the funds are locked, the Pegs Module creates native coins on the Pegs-related Smart Chain and issues these new coins to the user. The exchange rate between the user's deposited tokens and the native Smart Chain coins is determined by the data-driven rate of exchange. + +The user may only withdraw up to `80%` of the current financial value of the locked external cryptocurrency funds. The other `20%` is held as a collateralized loan, available to assist in maintaining the stablecoin's value, if necessary. + +In this manner, the native Smart Chain coins become the intended stablecoin. + +##### Managing Price Volatility + +As time progresses, the difference in price between the user's tokenized cryptocurrency and the stablecoin will change. Consider for example that the user is using `KMD` as the deposited cryptocurrency to access a stablecoin that mimics the `USD` fiat currency. The stablecoin in this example is named `USDK`. + + + The rules of liquidation found below are applicable only when the "global-debt ratio" — the ratio of all user deposits and debts at current prices on the Smart Chain — is higher than `60%`. + + If the global-debt ratio is lower than `60%`, no accounts are in danger of liquidation, regardless of their individual debt ratio. + + +###### Value of Backing Cryptocurrency Increases + +If the value of `KMD` increases relative to `USD`, the user may withdraw additional `USDK` coins from their Pegs account, until the total withdrawn `USDK` amount is again equal to `80%` of the total value of the deposited `KMD` tokens. + +###### Value of Backing Cryptocurrency Decreases + +On the other hand, if the value of `KMD` decreases relative to `USD`, the remaining amount of `KMD` tokens in the user’s account are subject to liquidation. + +There are two stages to account liquidation: "yellow zone" and "red zone." + +###### Yellow Zone + +The yellow zone applies to accounts where the user has withdrawn a value of `USDK` (also called "debt") that, due to price volatility, now exceeds the `80%` withdrawal limit, but is not yet at a level of `90%`. + +In this circumstance, a third-party user on the Pegs-related Smart Chain may deposit `USDK` coins on behalf of the indebted user's acccount, and receive the equivalent value of `KMD` tokens. These tokens are withdrawn from the indebted user's account. + +The `USDK` coins are burned, thus preserving the ratio of withdrawn `USDK` coins in sync with the global total value of `KMD` tokens deposited on the Pegs-related Smart Chain. + +###### Red Zone + +Should the debt of a user's account surpass the `90%` threshold, the account enters the red zone. + +Here, a third-party user can gain an immediate `5%` rate of return by sending `USDK` coins to the Pegs Module to liquidate the indebted user's account. The third-party user must deposit `USDK` to cover the user's whole debt, valued at 90% of the indebted account's `KMD` tokens, according to current prices. + +In return, the liquidating user receives `95%` of the `KMD` tokens in the indebted user's account. These `KMD` tokens can be redeemed on the `KMD` chain and, if sold at the current price, provide a `5%` profit. + +The `USDK` coins sent by the liquidating user are burned. + +The remaining indebted user's `KMD` tokens are donated to the Pegs Antara Module, where they continue to support the maintenance of a healthy backing coin vs stablecoin ratio (`KMD:USDK`). In case the account debt was exactly 90% at the moment of liquidation, the remaining will be `5%`. + +The liquidated user still holds their USDK coins and can exchange them for KMD tokens from another account that is in the yellow zone. + +###### Preventing Account Liquidation + +To prevent account liquiditation, when the user who created the account detects that their account is approaching the `90%` debt-ratio threshold, they have two options available. + +The depositor can return an amount of `USDK` coins that satisfies `100%` of the outstanding balance of their collateralized loan at current prices. + +Alternatively, the depositor can deposit more tokenized `KMD` to their account at current prices until the user's debt/loan ratio is safely below the `80%` threshold. + +## Pegs Antara Module Flow + +* The Smart Chain creator creates an instance of the Pegs Antara Module, called a "Peg", using the [pegscreate](/antara/api/pegs/#pegscreate) API method. + * Once created, the creator adds this new Peg creation's transaction id called the `pegstxid` to the Smart Chain's launch parameters using the `-earlytxid` parameter +* With the Peg active on the Smart Chain, a user locks tokenized external cryptocurrency to the Pegs Module using [pegsfund](/antara/api/pegs/#pegsfund) +* The user can withdraw up to `80%` of the value of their locked tokens in the form of the Smart Chain's coins using [pegsget](/antara/api/pegs/#pegsget) +* At anytime, the user can redeem the locked tokenized external cryptocurrency by repaying the Smart Chain's coins using [pegsredeem](/antara/api/pegs/#pegsredeem) +* A user can retrieve the current information about their Pegs account using [pegsaccountinfo](/antara/api/pegs/#pegsaccountinfo) +* A user can retrieve all past actions related to their Pegs account using [pegsaccounthistory](/antara/api/pegs/#pegsaccounthistory) +* A user can retrieve current information about the Peg using [pegsinfo](/antara/api/pegs/#pegsinfo) +* A user that has not yet created an account can exchange native coins of the Smart Chain for deposited tokens belonging to another user's account where the debt ratio is in the "yellow zone", `80%` to `90%`, using [pegsexchange](/antara/api/pegs/#pegsexchange) +* A user can retrieve information about accounts that have a debt ratio in the "red zone", `+90%`, using [pegsworstaccounts](/antara/api/pegs/#pegsworstaccounts) +* A user can liquidate the "red zone" account of another user, receiving `KMD` tokens in return according to the current price, as well as a `5%` additional profit, using [pegsliquidate](/antara/api/pegs/#pegsliquidate) + +## Tutorial Availability + +The Antara Tutorials section features full walkthroughs for the Pegs Module. + +[Link to the user side of the Pegs Module Tutorial](/antara/tutorials/pegs-module-user-tutorial/) + +[Link to the creator side of the Pegs Module Tutorial](/antara/tutorials/pegs-module-creator-tutorial/) + +## pegsaccounthistory + +**pegsaccounthistory pegstxid** + +The `pegsaccounthistory` method returns all the past actions related to the Pegs account of the user who executes the method. + +The method relies on [the pubkey address provided by the user when launching the daemon](/antara/tutorials/understanding-antara-addresses/#creating-and-launching-with-a-pubkey) to determine the Pegs account for which the method will retrieve data. + +### Arguments + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| pegstxid | (string) | the transaction id returned previously by the [pegscreate](/antara/api/pegs/#pegscreate) method at the creation of the on-chain Peg | + +### Response + +| Name | Type | Description | +| ----------------- | --------------- | ----------------------------------------------------------------------------------------------- | +| "result" | (string) | whether the command executed successfully | +| "name" | (string) | the name of the method | +| "account history" | (array of json) | an array containing json data that describe the past actions related to the user's Pegs account | +| "action" | (string) | the name of the past action | +| "amount" | (number) | the amount of satoshis involved | +| "accounttxid" | (string) | the transaction id of the action | +| "token" | (string) | the name of the token involved | +| "deposit" | (number) | the amount of initial satoshis deposited | +| "debt" | (string) | the total amount of debt after the associated action | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pegsaccounthistory a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 +``` + + + ```json + { + "result": "success", + "name": "pegsaccounthistory", + "account history": [ + { + "action": "fund", + "amount": 1000000, + "accounttxid": "298cfa125e1a38a7aa2a8da8282b017a45cd0c1dc70935712692c00abf48ba3f", + "token": "KMD", + "deposit": 1000000, + "debt": 0 + }, + { + "action": "get", + "amount": 100000, + "accounttxid": "8f18ab623cb91c94ea27b16c455d98df1e057dd120341e54b453090a2c9c9adf", + "token": "KMD", + "deposit": 1000000, + "debt": 100000 + }, + { + "action": "get", + "amount": 600000, + "accounttxid": "8e79ed0a76f359ba048563a0fa2a29ab88ab86b1895e8eff9718f348a04dd1f3", + "token": "KMD", + "deposit": 1000000, + "debt": 700000 + }, + { + "action": "get", + "amount": 30000, + "accounttxid": "9a10581ae047fabe91495cfe558961e3b7362a19b700b2fcea216d06c44d9720", + "token": "KMD", + "deposit": 1000000, + "debt": 730000 + }, + { + "action": "redeem", + "amount": 1000000, + "accounttxid": "ff95e70f0d551748f460e61b7e75b279b8de355cb37df6c5895dfb8a49ee348a", + "token": "KMD", + "deposit": 0, + "debt": 0 + } + ] + } + ``` + + +## pegsaccountinfo + +**pegsaccountinfo pegstxid** + +The `pegsaccountinfo` method returns the current information of the Pegs account belonging to the user who executes the method. + +The method relies on [the pubkey provided by the user when launching the daemon](/antara/tutorials/understanding-antara-addresses/#creating-and-launching-with-a-pubkey) to determine the account for which the method will retrieve data. + +### Arguments + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| pegstxid | (string) | the transaction id returned previously by the [pegscreate](/antara/api/pegs/#pegscreate) method at the creation of the on-chain Peg | + +### Response + +| Name | Type | Description | +| -------------- | --------------- | ------------------------------------------------------------------- | +| "result" | (string) | whether the command executed successfully | +| "name" | (string) | the name of the method | +| "account info" | (array of json) | an array containing json data that describe the user's Pegs account | +| "token" | (string) | the name of the token involved | +| "deposit" | (number) | the amount of initial satoshis deposited | +| "debt" | (string) | the total amount of current debt | +| "ratio" | (string) | the debt ratio based on the current price | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pegsaccountinfo a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 +``` + + + ```json + { + "result": "success", + "name": "pegsaccountinfo", + "account info": [ + { + "token": "KMD", + "deposit": 1000000, + "debt": 0, + "ratio": 0 + } + ] + } + ``` + + +## pegsaddress + +**pegsaddress \[pubkey]** + +The `pegsaddress` method returns information about the Pegs module and associated addresses. + +Optionally, if a pubkey is supplied, this method also returns the corresponding Pegs CC Address and balance. + +### Arguments + +| Name | Type | Description | +| ------ | ------------------ | ----------------------------------------- | +| pubkey | (string, optional) | the pubkey of another user on the network | + +### Response + +| Name | Type | Description | +| ----------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- | +| "result" | (string) | whether the command executed successfully | +| "PegsCCAddress" | (string) | taking the contract's EVAL code as a modifier, this is the public address that corresponds to the contract's privkey | +| "PegsCCBalance" | (number) | the amount of funds in the `PegsCCAddress` | +| "PegsNormalAddress" | (string) | the unmodified public address generated from the contract's privkey | +| "PegsNormalBalance" | (number) | the amount of funds in the `PegsNormalAddress` | +| "PegsCCTokensAddress" | (string) | the public address where Tokens are locked in the Pegs module | +| "PubkeyCCaddress(Pegs)" | (string) | taking the module's EVAL code as a modifier, this is the Antara address from the pubkey supplied as an argument | +| "PubkeyCCbalance(Pegs)" | (number) | the amount of funds in the `PubkeyCCaddress(Pegs)` | +| "myCCAddress(Pegs)" | (string) | taking the module's EVAL code as a modifier, this is the Antara address from the pubkey of the user | +| "myCCbalance(Pegs)" | (number) | the amount of funds in the `myCCAddress(Pegs)` | +| "myaddress" | (string) | the public address of the pubkey used to launch the chain | +| "mybalance" | (number) | the amount of funds in the `myaddress` | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pegsaddress +``` + + + ```json + { + "result": "success", + "PegsCCAddress": "RHnkVb7vHuHnjEjhkCF1bS6xxLLNZPv5fd", + "PegsCCBalance": 999.9993, + "PegsNormalAddress": "RMcCZtX6dHf1fz3gpLQhUEMQ8cVZ6Rzaro", + "PegsNormalBalance": 0.0, + "PegsCCTokensAddress": "RHG4K84bPP9h9KKqvpYbUzocaZ3LSUHxLa", + "myCCAddress(Pegs)": "RBZ4AsnyhD3pZPasDmHXnbwNvQWy1CWK5H", + "myCCbalance(Pegs)": 0.0, + "myaddress": "RFmQiF4Zbzxchv9AG6dw6ZaX8PbrA8FXAb", + "mybalance": 0.1025 + } + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pegsaddress 0257e1074b542c47cd6f603e3d78400045df0781875f698138e92cb03055286634 +``` + + + ```json + { + "result": "success", + "PegsCCAddress": "RHnkVb7vHuHnjEjhkCF1bS6xxLLNZPv5fd", + "PegsCCBalance": 999.9992, + "PegsNormalAddress": "RMcCZtX6dHf1fz3gpLQhUEMQ8cVZ6Rzaro", + "PegsNormalBalance": 0.0, + "PegsCCTokensAddress": "RHG4K84bPP9h9KKqvpYbUzocaZ3LSUHxLa", + "PubkeyCCaddress(Pegs)": "RRvD19SwUo12Wmozrf8UyuewK1v5kNRJfc", + "PubkeyCCbalance(Pegs)": 0.0, + "myCCAddress(Pegs)": "RBZ4AsnyhD3pZPasDmHXnbwNvQWy1CWK5H", + "myCCbalance(Pegs)": 0.0, + "myaddress": "RFmQiF4Zbzxchv9AG6dw6ZaX8PbrA8FXAb", + "mybalance": 0.226 + } + ``` + + +## pegscreate + +**pegscreate amount N bindtxid1 \[bindtxid2 ...]** + +The `pegscreate` method creates an on-chain Peg, associating the value of the Smart Chain's pegged stablecoin with the value of a foreign asset. + +The creation of this peg requires a tokenized backing cryptocurrency. Any cryptocurrency that is based on the Bitcoin protocol can fulfill this role, including `BTC` and `KMD`. There can be more than one such supporting cryptocurrency on any stablecoin Smart Chain. + +The `amount` parameter is the number of coins to be added to the Pegs Module from the available balance in the wallet of the user who is creating the peg. Often, this is the same user who created the Smart Chain, and therefore this balance can be extracted from the Smart Chain's premined coins. The coins will be used for the transaction fees that the Pegs Module performs through automated behavior. The coins are also used for markers, which are transactions that send a very small amount of funds to a global address on the Pegs Module for record keeping purposes. + +The `N` parameter is the number of gateways to associate with the Pegs module. Each cryptocurrency asset that backs the Peg's stablecoin needs a unique gateway. + +The `bindtxidN` parameter is the `bindtxid` of a gateway used to tokenize external cryptocurrencies. + +The transction id of the `pegscreate` transaction is called the `pegstxid`. + +Once the `pegstxid` transaction is confirmed, the Smart Chain daemon should be stopped and started again with the parameter `-earlytxid=pegstxid` added to the launch command. This ensures that it is the only Peg active on the Smart Chain. + +The `-earlytxid` parameter can be added to the launch parameters only before the 100th block. + +For more information, see the following linked tutorial. + +[Link to the creator side of the Pegs Module Tutorial](/antara/tutorials/pegs-module-creator-tutorial/) + +### Arguments + +| Name | Type | Description | +| ---------------- | ------------------- | ---------------------------------------------------------------------------- | +| amount | (number) | the number of coins to be added | +| N | (number) | the number of gateways to associate with the Pegs module | +| bindtxid1 | (string) | the `bindtxid` of a gateway used to tokenize external cryptocurrencies | +| \[bindtxid2 ...] | (strings, optional) | same as above; used when more than one external cryptocurrency backs the Peg | + +### Response + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------- | +| "hex" | (string) | the hex value to be broadcast | +| "result" | (string) | whether the command executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pegscreate 100000 1 0b5716554e523aa4678112a8ac3d15039e0aae6f4812b9d4c631cc9cfbf48786 +``` + + + ```json + { + "hex": "0400008085202f890197c74ae1999260bb3c7342dd25f3f68a0991d4b50a40f4a6e37838b6e3ca112e02000000484730440220466a45514b5eb24a3a14886dbca204997db498e1509928700a3e0ac63645be3402204164ce5c8f8eb82785158b1f79000721be4db45bb3726fb8043fb089aa19886601ffffffff669ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc2f96465cc2480000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000256a23ee43018687f4fb9ccc31c6d4b912486fae0a9e03153daca8128167a43a524e5516570b000000005f0100000000000000000000000000", + "result": "success" + } + ``` + + +Broadcast the hex: + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f890197c74ae1999260bb3c7342dd25f3f68a0991d4b50a40f4a6e37838b6e3ca112e02000000484730440220466a45514b5eb24a3a14886dbca204997db498e1509928700a3e0ac63645be3402204164ce5c8f8eb82785158b1f79000721be4db45bb3726fb8043fb089aa19886601ffffffff669ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc9ce7764817000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc2f96465cc2480000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000256a23ee43018687f4fb9ccc31c6d4b912486fae0a9e03153daca8128167a43a524e5516570b000000005f0100000000000000000000000000 +``` + + + ``` + a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 + ``` + + +The above string is the `pegstxid` that represents the Peg. + +## pegsexchange + +**pegsexchange pegstxid tokenid amount** + +The `pegsexchange` method exchanges native coins for deposited tokens. This method is intended for users that do not have a Pegs account associated with the pubkey used to launch their daemon. + +Users that have an account may use the [pegsreedem](/antara/api/pegs/#pegsredeem) method to exchange coins for tokens. + +To supply the user that executes the method with tokens, this method sends the user's coins to pay the debt of another user whose account is in the "yellow zone" (a debt ratio between `80%` and `90%` based on current prices). This improves the debt ratio of the indebted user, thus forestalling liquidation of the indebted user's account. + +### Arguments + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| pegstxid | (string) | the transaction id returned previously by the [pegscreate](/antara/api/pegs/#pegscreate) method at the creation of the on-chain Peg | +| tokenid | (string) | the tokenid of the tokenized cryptocurrency backing the peg | +| amount | (amount) | the amount of coins to exchange | + +### Response + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------- | +| "hex" | (string) | the hex value to be broadcast | +| "result" | (string) | whether the command executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pegsexchange a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1 0.01 +``` + +## pegsfund + +**pegsfund pegstxid tokenid amount** + +The `pegsfund` method allows a user to lock the given `amount` of a tokenized cryptocurrency in the Pegs module. The action of locking the tokenized cryptocurrency creates a Pegs account for this user. + +### Arguments + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| pegstxid | (string) | the transaction id returned previously by the [pegscreate](/antara/api/pegs/#pegscreate) method at the creation of the on-chain Peg | +| tokenid | (string) | the tokenid of the tokenized cryptocurrency backing the peg | +| amount | (amount) | the amount of the tokenized cryptocurrency to be locked in the Pegs account | + +### Response + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------- | +| "hex" | (string) | the hex value to be broadcast | +| "result" | (string) | whether the command executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pegsfund a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1 0.01 +``` + + + ```json + { + "hex": "0400008085202f89024c386ef60103e74f339867bd7c38b7f187ceee842b8e57ab9a42a16b0721be23040000007b4c79a276a072a26ba067a565802103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece8140213fbd380d7905f770709725fe462e5f0a731eca4e56435c4b2f7c96d5b6201433e7c780d313795ddf9ae1d0b689b4f950af6e0e07dd9bcbc293b46f2a349ef4a100af038001eea10001ffffffff9c29a09fb0f1f178ed83e7064297a3d0ba892d9b0eb6b9f0b04c3622203f8be3000000007b4c79a276a072a26ba067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0681409a7fa29976f948038b77573fb1103836340ebbcdfbbba8dc852186be1666811c034adf2ec9d9515eb58f14df81925f46fb152b2964e8f392b70bafdfe3a8af83a100af038001f2a10001ffffffff051027000000000000302ea22c8020e39343ebe1b40dcc747d145f140983b38f230dcf7963f2b58051265c765f2efa81031210008203000401cc1027000000000000302ea22c8020d77058bfd93eebe366e1c82fc1475690fd290214ed43b8c9dd25374077b35cbe81031210008203000401cc40420f0000000000302ea22c802002bc3497bdabeac3d0c40ac845fa105685724d1b70c84bd6c5cef2ff4c353e7881032214008203000401cc3cdf993b00000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc0000000000000000c86a4cc5f2741a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf102210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e062103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece175cee46f7711371604618bcb04458f01c829527a012f459da3c21ff44ee34dbc89e53a9210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0640420f000000000040420f0000000000000000000000000000000000a79900000000000000000000000000", + "result": "success" + } + ``` + + +Broadcast the hex: + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f89024c386ef60103e74f339867bd7c38b7f187ceee842b8e57ab9a42a16b0721be23040000007b4c79a276a072a26ba067a565802103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece8140213fbd380d7905f770709725fe462e5f0a731eca4e56435c4b2f7c96d5b6201433e7c780d313795ddf9ae1d0b689b4f950af6e0e07dd9bcbc293b46f2a349ef4a100af038001eea10001ffffffff9c29a09fb0f1f178ed83e7064297a3d0ba892d9b0eb6b9f0b04c3622203f8be3000000007b4c79a276a072a26ba067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0681409a7fa29976f948038b77573fb1103836340ebbcdfbbba8dc852186be1666811c034adf2ec9d9515eb58f14df81925f46fb152b2964e8f392b70bafdfe3a8af83a100af038001f2a10001ffffffff051027000000000000302ea22c8020e39343ebe1b40dcc747d145f140983b38f230dcf7963f2b58051265c765f2efa81031210008203000401cc1027000000000000302ea22c8020d77058bfd93eebe366e1c82fc1475690fd290214ed43b8c9dd25374077b35cbe81031210008203000401cc40420f0000000000302ea22c802002bc3497bdabeac3d0c40ac845fa105685724d1b70c84bd6c5cef2ff4c353e7881032214008203000401cc3cdf993b00000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc0000000000000000c86a4cc5f2741a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf102210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e062103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece175cee46f7711371604618bcb04458f01c829527a012f459da3c21ff44ee34dbc89e53a9210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0640420f000000000040420f0000000000000000000000000000000000a79900000000000000000000000000 +``` + + + ``` + 298cfa125e1a38a7aa2a8da8282b017a45cd0c1dc70935712692c00abf48ba3f + ``` + + +The above string is the `accounttxid` of the user. + +## pegsget + +**pegsget pegstxid tokenid amount** + +The `pegsget` method allows a user to withdraw (also called "assume a debt") in native coins up to `80%` of the value of the locked tokens (also called "collateral") in their account. + +The exchange of value from tokens to native coins is calculated according to the current price data available on the Smart Chain at the time of the transaction. + +### Arguments + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| pegstxid | (string) | the transaction id returned previously by the [pegscreate](/antara/api/pegs/#pegscreate) method at the creation of the on-chain Peg | +| tokenid | (string) | the tokenid of the tokenized cryptocurrency backing the peg | +| amount | (amount) | the amount of the native coins to receive from the Pegs module | + +### Response + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------- | +| "hex" | (string) | the hex value to be broadcast | +| "result" | (string) | whether the command executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pegsget a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1 0.001 +``` + + + ```json + { + "hex": "0400008085202f8903b68353f713e1d70cf2fe4fa538de32a8723e603d507c8ee2d42277f3fd7334ad00ca9a3b0201e2ffffffff3fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c2900000000a74ca5a281a1a0819ca28194a067a565802103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece81402e06d560cac761ee7d7720f6ed0f307520fda7c66b2ac0d16cd3c34a33f004393f735429a7ad445a1c970723a7a9d173e1fcc62b54ed164dfb40f23542c9627da129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eea10001ffffffff3fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c2901000000a74ca5a281a1a0819ca28194a067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e068140152ff019e1e4346d450ab149f1ef9115ea84c9ff7c3bb60444a7e48eda0784a46ecefbf1a35f0062513033d9c3fce45a083f70b7ccc41103763c267598bcadcca129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eea10001ffffffff041027000000000000302ea22c8020e39343ebe1b40dcc747d145f140983b38f230dcf7963f2b58051265c765f2efa81031210008203000401cc1027000000000000302ea22c8020d77058bfd93eebe366e1c82fc1475690fd290214ed43b8c9dd25374077b35cbe81031210008203000401cca08601000000000023210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06ac0000000000000000fd22016a4d1e01e211b68353f713e1d70cf2fe4fa538de32a8723e603d507c8ee2d42277f3fd7334ad00000400008085202f89013fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c290000000000ffffffff01a086010000000000ab6a4ca8e28efefefe7f065045475343433e140a06d1f028a3abce516bd5d08ebfd860da116dfb0c3a22003b57f0809b5400f7711371604618bcb04458f01c829527a012f459da3c21ff44ee34dbc89e53a9f1eb0ab5bb63b9b36cd1a44d0a30f35d1c113efb5cf5fd4e549ae7f11297451a210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06a08601000000000040420f0000000000a08601000000000000000000b0990000000000000000000000000000000000000000000000000000000000000000", + "result": "success" + } + ``` + + +## pegsinfo + +**pegsinfo pegstxid** + +The `pegsinfo` method returns the current information about the indicated `pegstxid` Peg. + +### Arguments + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| pegstxid | (string) | the transaction id returned previously by the [pegscreate](/antara/api/pegs/#pegscreate) method at the creation of the on-chain Peg | + +### Response + +| Name | Type | Description | +| --------------- | ------------ | --------------------------------------------------------------------------------- | +| "result" | (string) | whether the command executed successfully | +| "name" | (string) | the name of the method | +| "info" | (json array) | the current information about the given Peg | +| "token" | (string) | the name of the token | +| "total deposit" | (amount) | the total number of tokens deposited | +| "total debt" | (amount) | the total number of satoshis of the native coin withdrawn | +| "total ratio" | (string) | the total debt ratio for the above token based on the current price | +| "global ratio" | (string) | the global debt ratio for all tokens backing the Peg, based on the current prices | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pegsinfo a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 +``` + + + ```json + { + "result": "success", + "name": "pegsinfo", + "info": [ + { + "token": "KMD", + "total deposit": 2000000, + "total debt": 300000, + "total ratio": "16.67%" + } + ], + "global ratio": "16.67%" + } + ``` + + +## pegsliquidate + +**pegsliquidate pegstxid tokenid accounttxid** + +The `pegsliquidate` method allows a user to liquidate the account of another user if their debt ratio is in "red zone" (greater than `90%`) for the given `tokenid` token. + +In return, the liquidating user can receive an immediate profit of `5%`, in tokens, taken from the liquidated user's remaining balance. + +Any remaining value in the liquidated user's account is immediately distributed to the Pegs Antara Module for global stablecoin price and supply management. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| pegstxid | (string) | the transaction id returned previously by the [pegscreate](/antara/api/pegs/#pegscreate) method at the creation of the on-chain Peg | +| tokenid | (string) | the tokenid of the tokenized cryptocurrency backing the peg | +| accounttxid | (string) | the `accounttxid` of another user whose account is in the "red zone" | + +### Response + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------- | +| "hex" | (string) | the hex value to be broadcast | +| "result" | (string) | whether the command executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pegsliquidate a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1 298cfa125e1a38a7aa2a8da8282b017a45cd0c1dc70935712692c00abf48ba3f +``` + +## pegsredeem + +**pegsredeem pegstxid tokenid** + +The `pegsredeem` method allows a user to withdraw their deposited tokenized cryptocurrency by repaying their entire debt. + +The user provides payment in the native coin of the Smart Chain. + +### Arguments + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| pegstxid | (string) | the transaction id returned previously by the [pegscreate](/antara/api/pegs/#pegscreate) method at the creation of the on-chain Peg | +| tokenid | (string) | the tokenid of the tokenized cryptocurrency backing the peg | + +### Response + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------- | +| "hex" | (string) | the hex value to be broadcast | +| "result" | (string) | whether the command executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pegsredeem a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1 +``` + + + ```json + { + "hex": "0400008085202f891e045ffbf7d56aba87d1527a8bd50c7cbfb44f376b1c0a6815c741a5f6e107f02d00000000484730440220064f36926ed7d6975ad1ecb358df866897554d29d623447b95d0f9d1f575ff0a02203ca4d9ea407c2310cd49be1315887cde4e54619de93d6882f0c2fe871820ef3201ffffffff3fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c29030000007b4c79a276a072a26ba067a565802103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece81400301711d3ddb1753c3a004c250616ea580f0bf75c1c03f791f76327a6efa69792f19eae5fa3c73ab29a4b6754a91111935a46fa1c28d4cdaacdcb24ec571a45fa100af038001eea10001ffffffff20974dc4066d21eafcb200b7192a36b7e3618955fe5c4991befa47e01a58109a00000000a74ca5a281a1a0819ca28194a067a565802103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece81409ffd2bb29f40dbf7b3e741e00e3a97c7e66f49526ea9dd33ec724eb30a81b21b16cdac1ea840cbf902f36ef17b9ac81014a735e97377d6d5f07a6e8ac04556f8a129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eea10001ffffffff20974dc4066d21eafcb200b7192a36b7e3618955fe5c4991befa47e01a58109a01000000a74ca5a281a1a0819ca28194a067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e068140bbfdfb024c50111ed7184b3fd4c7c462ea5093ab9969bab386d54965e248184a00a5cb2a1f625116d3bd02b470f4b33dab11a38ffd4d050fcdbe01e8ae754e70a129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eea10001ffffffff3fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c2902000000ac4caaa281a6a081a1a28194a067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e068140bfb34bd8abc720bef5c13708ad9280893df2b9fb1e70eb6063c05614245f5d3538d3048b9f6e4fbfc3053e594df7e638dd22e42c833c75aa174edf010fb45419a129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eeaf038001f2a10001ffffffff0dfe7aecdaed2498f6a3c29bcd53f15913ae2b36bf7643efcb8d3eb93354fbad00000000484730440220403e6284a585ed11b58207279786396101ea442d79b9df44688ebdaa7467e04d0220474f38ecc4ff53f9d685538805d0f0b7eaf008c9736ddf677a4bb88919e5680e01ffffffff0491bd559806afc9638763c8fb8e550b5e13df6d18ed0eeb7209f8e7e6ccb90f0000000048473044022078b520bbaa03883e03321a98cfca3282f7f1d70d91a977ed81b50d0f91440b3402205d1f346312ffbe4b76c614fb8d9dfcfd38069eca55a8f7d2ae84d4cae6fb481901ffffffff0d5e3529d01acc37c5cfbac0a3321870a5097134029ed474db42023bcbf18bb50000000049483045022100e6ccd2403781c60d928fa090d78d3f42cfa812dcd37ca5c65c91969a81a6d8ab022067f917bd432c69a44fd338a4897462e294b40304ea44dfe544a826bdb75232b901ffffffff07c9ea3dcb2164a8b5e839b23f39e6d2e0d3b8a7848ea188dca6e61a9833a8d00000000048473044022061ffebbf638055097c9bfaf654135e65925e7107cdd86d553264df3c16eefd3f0220401de8c419a842ad1f72eab0eaeca0f63ff95419e222a94141b04b5eaa3e341701ffffffff0ac35ee065ed0090ef129c389f0b84c91feaf9bf8a4ae6c12480a4d435cd550400000000484730440220710f15cebed5631fdaee51b651456b2b56e1d83968526745241a4920c6719b2b022000abc38a4b9ae4f6a7c53c1e80049c7d9109f97e26daf76a27021ee805a21a1d01ffffffff0aee5de22398ff1a61bca8d95d3304337be9cb00d401afa088cf95d31f121b1d000000004847304402207e4c1793bb91c550e462d38531734dd9fece17bab40ad0d2e8c2e9cd741f342302202c4973b14c9a5768a72aa5a4ab752de8fb388fd208280b6e5ef529e918dcca4101ffffffff0bd4eeed3d68d4f361e4e65a06f1e437739d209c5b593adfb9c908a11e5c4b1e0000000049483045022100a3e1e8f18bdd72f3794d3e2bfef1d807f904c93c511d396d33f66a9a84ea988b02203954987e94629cf77982568f115a148d64b44f1619c285d9ea229ac81268a16c01ffffffff023035ddb47d6d6ba1a1e760a750325f912f66934130059313bd2460dd3626a80000000049483045022100be9bc941d1afcc3e816a70e2e49e0c0b5279d8c704b14e8ea6f0a5b8e644f999022016ac0c28af028149a3026eb3cbe266604809643b303ff3ae4c27f4a11ed7059901ffffffff0d0db11a4bfaeb4293d26d4f540f8ae7b8ac648998d32ee4902eb6445bf3b4f4000000004948304502210093896862f4c679d6db6eb57951b5117a6201eda285b257dd60c57a45a3254cbb02205a7d32b4ffbf0f8d90cf1fca8a0f4f09e36da21c536e32f7002a28d6d56d132b01ffffffff0623be2e2bd36d04b45df4fcb8349f0b10095ec1aac30613fd21ca40054361300000000049483045022100d24bb6d6720e876a57607c8e29348f29357181d4369e41b044be9a4ac699272c022046e536c70a5ae151c99cff8795b9a1a6fbf159cfdac0c36bbceced6f6c7cec6b01ffffffff0cc55d115db43ac735fef6a662896b24f288b2fbb7b793c1f96948f6820338ed00000000494830450221009d6ffacd7e7c167c254ad79e03184d30f3598a75baf5422f62a74fbee20f8d35022029c7348297580926f64d6f3dd69f54aaec45b428594fae57af252ccf2fb804e401ffffffff08230c57a73ae1167c7c99c5e135af4e52b21468c9ef6de6528e51700d611fcd00000000484730440220645c65d17a44532e80bec8c40fd683dfbf614a6d64acec64eb2567788bbf9ea402205976d7399e33d20e588230ff6d65cef4dde327ffbb42a15e2191400896b34a4a01ffffffff083ae311d476e71cbd214e90aa7065bc3f8e3735fccdb951e84be2f35dbe86e90000000049483045022100aedf51f885b813acbce5799f976dff5200658396d3c33dd36f5768d5225215e3022070faaccac58b8aee064a312d6ed01301ac947c9e5cfd6be3d81d5cabb48ddf0901ffffffff012f6500ac7ff9cf0a6a624ca7a49e684fc6d28b5646a47c1f65d693965b1c430000000049483045022100ea4eca020c79db8fe46ae1a970c15deda516180c875bbbdb7c43a73e884a60f202207278af9cd50ee2806f6e4f16a5f2e4454881deacbcade363289239fdd54a982d01ffffffff08359b7d0efb9eede36cf0a5d9fdc5f4a83308c8a11099a3fa4cbb1fadbfcfde0000000049483045022100d1c1ed48608d61ae88cd957281e9320311861dbdc3596136533f058313883b6a02200ba029992e819196fd7c83b51a8d108c1b3c9b1f03a7faf2290acfced66c113a01ffffffff083f857139d0711209eef17e2f6177cb4ed0f68c00f520038a587744262445b90000000049483045022100cd94b3dd563ad7a37bd531a89cb0d988f4ec92949df7302ba43e13bdb88082c1022003be0f619ae4b3de597f8716a9374d63becf81d3d3943b3c741ee636b7e5cd8401ffffffff09cb8b189715b655a0c07456648951c3c178a6c6270c484dd3cfad5b18f859880000000048473044022025b7fc3db1a0b33471e5eccd3cb54a71fec8c5366837388489f3d9c90ad80d070220485c4c79790e2cfac55566869a52dbd86426f4d1db9fa23314d82b26ffc8f06d01ffffffff070d10ba3a3bb2f50fbc88549ab14aea8424bfa5cf4932653a82b2af987a82200000000048473044022047ac9d547dbf96cebd1f6dc29aad99d752c60b316df54987b577b7cc04cb6a9302204ae6a4707e6f270a4bfdc1d55e31bbbaf95e233a6c26ae6823b3f592cb39656301ffffffff0be472c9362d31a026a7f22d0fa14f294c95b0457ae66cd7179bb29a1f30278d0000000049483045022100e54335c0b652f35a3ae2eda351638b3b5d1ff76bf256bfcfe6a3e8810fd131ad02202865894c90cdbea6e1f052a83a085236606da96afc03e47a79159c5f9ee1398401ffffffff051c297d636cc51d90a5996a23ffc7c5374a4e3df397f770b5113585749bb5480000000049483045022100d67d9b0c34aa8f8d6c4ed261af543ce4cd9b95fcae7bbbb94c0f2521982037be02207fa0b75e74f2c2e9a5009d160addb3b191cf751e0887f0186526023f7f79b80401ffffffff0b19234b25da56339d70722c5845e39a56513ce6b70c7c26486e7d3b8c5bd02c000000004948304502210086f6f6dc5005207cc4206ff43d29e1ca42fc6cf5ce30e870d6bfa39002264a9c02200be78b519d6d2f7448ded31e96077b00960532c7d7b1484c37fe6a1d6990237e01ffffffff0d628dfaece395d197c0b810668b7af212d083e5f441a4c729b164ab3df91b510000000049483045022100c6ca324eeaafc9bacae5c260981baf9ae8f5c0eb3f83533c8631ecbe592d470c022014d44bc921909246002d64e4c029af2a4abb26812a6902cf61f69782630ce9c901ffffffff039d71284b8643c45e14b5bfc8c9439a17474376a78cec7be3d6b688a40bc4fc000000004847304402206b8320f3ea3cdd73fa9e4ee43a62144076b6ffc6cf58fdb06233b542d6924db402205a2310f7fc382407c8466b5677691988a6dc2a0fe3f3b4c6bc1f1a01d1820e7901ffffffff02803fb66f0c03fa8211d4086ad2262e50ea5dd99f30603e9999603cdfac367c0000000049483045022100837fec21e7ba574c2283ec160bc418485f2dd6fbb5f5dd575156c41450e7deb6022058aefedcc08274f523c52981b69f124197a431580d5692c2a5f6e8af6bef594801ffffffff0af2f9ced5de00310114f70d6756db7df65205aeac26b5607bd71333812f68e40000000049483045022100d5fdd26ad4682b6aa2d522c1b75097f9cb3df94632e5cfc2454d79b76f9401660220193d741cc875e75cf04ad70de582915b14b41a6283967527e931c50565cdb62f01ffffffff071027000000000000302ea22c8020e39343ebe1b40dcc747d145f140983b38f230dcf7963f2b58051265c765f2efa81031210008203000401cc1027000000000000302ea22c8020d77058bfd93eebe366e1c82fc1475690fd290214ed43b8c9dd25374077b35cbe81031210008203000401cc40420f0000000000302ea22c8020d62369afdb9fbe16bae7a6ac394333e9337ecc0b7671cda491df2fa82e48a20d8103120c008203000401cc90230b0000000000232102f7711371604618bcb04458f01c829527a012f459da3c21ff44ee34dbc89e53a9ac2cb8993b00000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc102700000000000023210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06ac0000000000000000a66a4ca3f2741a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf101210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06175cee52f7711371604618bcb04458f01c829527a012f459da3c21ff44ee34dbc89e53a9210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0640420f00000000000000000000000000000000000000000000000000209d00000000000000000000000000", + "result": "success" + } + ``` + + +## pegsworstaccounts + +**pegsworstaccounts pegstxid** + +The `pegsworstaccounts` method returns the information on the accounts that currently can be liquidated. An account can be liquidated if the account holder's total debt balance exceeds `90%` of the account value. + +### Arguments + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| pegstxid | (string) | the transaction id returned previously by the [pegscreate](/antara/api/pegs/#pegscreate) method at the creation of the on-chain Peg | +export const title = "Prices: Decentralized Margin-Trading Solution"; +export const description = "The Prices Antara Module offers a decentralized and incentivized margin-trading system on a Smart Chain."; + +# Prices + + + Important Notice + + The Prices Antara Module is currently in development. + + The specifics of the implementation are subject to change. + + Please reach out to the Komodo team for more information before attempting to use this module in a production environment. + + +## Introduction + +The Prices Antara Module offers a decentralized and incentivized margin-trading system on a Smart Chain. This allows users to open long and short leveraged positions against the "House" (the module itself). + +A player opens a position with the desired betting amount and leverage. They can close the position anytime and receive the current equity that is in a non-negative state. + +When the debt ratio of a player is close to exceeding the allowed limits, other players on the network can liquidate the indebted player's account. The liquidating players thereby receive as an incentive a small percentage of the indebted player's holdings. + +For a more detailed explanation of the nature of "leveraged positions" and other terms related to margin trading, please read [this explanation section.](/antara/api/prices/#a-brief-explanation-of-margin-trading-leveraged-trading) + +##### The Prices Modules Requires a Separate Technology Called a DTO + +The creation of the Prices Antara Module required the existence of a separate Antara-based module that provides trustless and decentralized price feeds. The Komodo community named this separate type of module a "Decentralized Trustless Oracle," or DTO for brevity. + +In order to create the trustless and decentralized price feeds, Komodo's DTO technology relies on [timestamp consensus rules](https://medium.com/@jameslee777/decentralized-trustless-oracles-dto-by-piggybacking-on-timestamp-consensus-rules-2adce34d67b6). + +The DTO requires the miners of the Smart Chain to include the required off-chain data as a part of the OP\_RETURN in the coinbase transaction (the transaction that pays the block reward to the miner). + +The validation of the off-chain data is part of the consensus rules. If the data is false, the block is rejected by the network, which serves as an incentive for the miner to be truthful. To achieve consensus, all nodes allow for an error margin of approximately `1%` in the reported data. + +##### Manners of Obtaining Data + +The Prices module retrieves prices of stocks and cryptocurrencies through the Antara Customization Parameters [ac\_stocks](/antara/setup/antara-customizations/#ac-stocks) and [ac\_prices](/antara/setup/antara-customizations/#ac-prices), respectively. + +The module can extract data from a web source that can be accessed using the `http/https` protocols and return the data as a json object using the [ac\_feeds](/antara/setup/antara-customizations/#ac-feeds) parameter. + +The module also has a pre-configured feed that always retrieves values for the pairs `BTC_USD`, `BTC_EUR` and `BTC_GBP`. + +The DTO provides the required price feed. For markets, such as `AMZN/KMD`, that do not exist in real life, the DTO offers [synthetic prices](/antara/api/prices/#synthetic-prices-and-their-calculation). + +##### Manner of Preventing Miner Manipulation + +To counter the possibility of manipulation of price data by a miner (for example, a miner could attempt to take advantage of the `1%` error allowed to win an open bet), when a position is opened the price of purchase is not set until a twenty-four hour period has past. During this period, the module tracks the prices of the relevant currencies. At the end of the period, the module automatically sets the price of purchase for the position based on the price averages. + +For long positions, the lock price (also called the "cost basis") is the maximum among averages; for short positions, the lock price is the minimum among averages. + +Players should not expect high-speed trading in this type of system. + +### A Brief Explanation of Margin Trading ("Leveraged Trading") + +Assume Player X has `$100` USD and is certain that Bitcoin (BTC) will soon have a large increase in value relative to USD. + +In this type of scenario, Player X can use margin trading to find a greater profit percentage than he would by simply buying `$100` USD worth of BTC and holding it. + +However, margin trading increases the risk placed on Player X. + +If Player X simply buys his BTC and then sells it after its price increases by `5%`, Player X's profit is `5%`, or `$5` USD. Similarly, the loss is `$5` USD if the price decreases by `5%`. + +In a margin-trading system there are two roles: Lender and Trader. + +In the example here, Player X is the Trader. + +Lender facilitates Trader in borrowing a multiple ("leverage") of the deposited collateral (`$100`). Thereby the Trader can trade using the total amount (deposit + leverage). + +For example, Player X desires to trade with a leverage of `10`. This is `$100 * 10 = $1000` USD. + +Lender gives Player X the remaining `$900` USD. Player X now buys `$1000` USD worth of BTC. + +If the price increases by `5%` and Player X sells their BTC, the profit is `$50` USD. + +Player X returns the loan of `$900` and is left with `$150` USD, which amounts to a profit of `50%`. + +Alternatively, the price can drop and the Trader can lose higher amounts. In this example, the value of BTC relative to USD drops by `5%`. + +Player X now only has `$950` USD worth of BTC. Player X sells and returns the loan amount of `$900` USD, and has `$50` USD remaining. + +This is now a loss of `50%`. + +In many scenarios, a Lender has the ability to liquidate the Trader at any given time, and will force liquidation before the player can lose more than they are able to immediately repay. + +The following stop-loss values are common in margin trading: + +* A `10x` leverage can tolerate up to a `10%` decrease in price before forced liquidation occurs +* A `100x` leverage can tolerate up to a `1%` decrease in price before forced liquidation occurs + +##### Summary of a Brief Explanation to Margin Trading + +Assuming `$0` fees, a player can calculate actual profit or loss percentage by the following formula. + +``` +price change in percent * leverage +``` + +The Trader's "position" is the amount of coins the player places as a bet. + +The Trader's "equity" is the amount of coins the player can withdraw at the current moment. Equity is calculated by the following formula. + +``` +position + (profit or loss) +``` + +"Cost basis" is the price at which the bet is opened. + +### Synthetic Prices and Their Calculation + +The Prices data on a Smart Chain is made available by an active Decentralized Trustless Oracle (DTO), which is comprised of all nodes and miners on the network. + +There are limitations to a DTO. For example, the DTO cannot offer price feeds for all possible markets across the world. Furthermore, users on the network may desire a trading pair that does not yet have a real market. + +In such cases, price data of two or more different pairs can be used to derive the price of a desired pair. The resulting price data is called a "Synthetic Price." + +For example, suppose the DTO for a Smart Chain does not supply the price data for the pair `AMZN/KMD`. However, the chain does supply the price data for the pairs `AMZN/USD`, `USD/BTC` and `BTC/KMD`. + +The synthetic price of `AMZN/KMD` is available through considering the prices of all the three pairs. + +##### A Forth-like Syntax for Synthetic Calculations + +A simple syntax is offered in the Komodo API for calculating synthetic prices and use their value on the Smart Chain. + +This syntax is based on the [Forth](https://en.wikipedia.org/wiki/Forth_\(programming_language\)) programming language. + +In calculating a synthetic price, the Komodo API supports up to three pairs of prices and offers four operations: + +* invert(`!`) +* multiply(`*`) +* divide(`/`) + +These operations can be supplied with positive and negative integers. The integers allow the calculation of synthetic prices for baskets of assets or indexes. The negative integers can be used to short a price. + +For example, the synthetic price of a basket with `3/4` parts BTC and `1/4` parts BCH can be calculated. + +#### Usage + +The data in each price feed of the DTO has a key that appears in the structure of `AAA_BBB`. This is interpreted to mean that the price for the asset `AAA` is provided in the data in terms of another asset `BBB`. + +For example, the price of BTC in terms of USD is denoted by `BTC_USD` + +##### Understanding Stacks + +Understanding the concept of a stack is essential when using the Komodo API's syntax for calculating synthetic prices. + +Stacks are dynamic data structures that follow the **Last In First Out (LIFO)** principle. In other words, the last item to be inserted into a stack is the first one to be deleted from it. + +For example, assume a stack of trays on a table. When a person adds another tray to the stack, they place the tray on top of the stack. When a person removes a tray from the stack, they remove the tray at the top of the stack. Therefore, the last item added to the stack is also the first item removed. + +##### Inserting and Deleting Elements + +Stacks have restrictions on the insertion and deletion of elements. + +Elements can be inserted or deleted only from one end of the stack (the top). The element at the top is called the **top** element. + +The operations of inserting and deleting elements are called **push** and **pop** respectively. + +When the top element of a stack is deleted, if the stack remains non-empty, the element just below the previous top element becomes the new top element of the stack. + +For example, in the stack of trays, if a person takes the tray from the top, the tray just below it automatically becomes the top element. + +[Source: Hackerearth.com](https://www.hackerearth.com/practice/data-structures/stacks/basics-of-stacks/tutorial/) + +##### Komodo Stack API Symbols + +The allowed symbols in the Komodo API's syntax are: + +* prices +* operations: invert(`!`), multiply(`*`), divide(`/`) +* positive and negative integers + +The interpretation of the symbols in all the possible cases is described in the subsequent sections. + +The Komodo API limits the depth of the stack for prices to three, as this appears to be reasonably sufficient data for calculating synthetic prices. + +##### Synthetic Price Weights + +A synthetic price is calculated by summing the computed prices with integers that represent `weights`. + +The `weight` can be any positive or negative integer whose absolute value is less than `2048`. + +After an operator acts on the stack, a weight must be applied to the top element. + +If the synthetic price calculation does not require the inclusion of a weight, set the weight's integer value to `1`. + +With the weights sets, the module automatically calculates the resulting synthetic price. + +###### Example + +"BTC\_USD, 3, KMD\_USD, 1" gives the integer weight of `3` to the price pair of `BTC_USD` and the integer weight of `1` to the price pair of `KMD_USD`. The resulting value is described as `BTC_USD*(3/4) + KMD_USD*(1/4)`. + +A "spread" in trading is a term that describes the amount or distance between the values of the maximum amount at which a buyer is willing to purchase and the minimum amount at which a seller is willing to sell. + +To create a spread, use a negative weight for one of the synthetics. + +For example, "BTC\_USD, -2, KMD\_USD, 1" gives the spread: `KMD_USD - 2 * BTC_USD`. When `KMD_USD` gains 2x more than `BTC_USD`, percentage wise, the spread would essentially disappear. + +##### Operations Involving 1 Price + +| Operator | Function | +| ------------- | -------------------------------------------------------------------------- | +| `!` (inverse) | pops the top stack element, inverts it, and pushes it back on to the stack | + +###### Example + +"BTC\_USD, !, 1" is computed to "USD\_BTC". + +##### Operations Involving 2 Prices + +| Operator | Function | +| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `*` | pops two elements from the top of the stack, multiplies them, and pushes the result back on to the stack | +| `/` | pops two elements from the top of the stack, performs a division with the first element as the denominator and the second element as the numerator, and pushes the result back on to the stack | + +###### Example + +* "BTC\_USD, USD\_JPY, \*, 1" is computed to "BTC\_JPY" +* "BTC\_EUR, BTC\_USD, /, 1" is computed to "USD\_EUR" + +##### Operations involving 3 prices + +Each of these operators act on top of the stack in the order from left to right. It is possible that the value from an earlier computation rests at the top of the stack. + +| Operator | Function | +| -------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| `*//` | pops three elements from the top of the stack, inverts the last two out, multiplies them and pushes the result back on to the stack | +| `**/` | pops three elements from the top of the stack, inverts the last one out, multiplies them and pushes the result back on to the stack | +| `***` | pops three elements from the top of the stack, multiplies them, and pushes the result back on to the stack | +| `///` | pops three elements from the top of the stack, inverts all of them, multiplies them, and pushes the result back on to the stack | + +## mypriceslist + +**mypriceslist \[all|open|closed]** + +The `mypriceslist` method returns the list of transaction ids (txid) of the bets executed on the Smart Chain from the executing user's pubkey. By default, the method returns both open and closed bets. + +### Arguments + +| Name | Type | Description | +| --------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `"all\|open\|closed"` | (string, optional) | the filter to apply to the list

**all** - lists all of the user's bets

**open** - lists the user's bets that are open

**closed** - lists the user's bets that are closed | + +### Response + +| Name | Type | Description | +| ----- | ------------------ | -------------------------------------------------------------------------- | +| Array | (array of strings) | an array containing the txid's of the bets that satisfy the applied filter | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD mypriceslist +``` + + + ```json + ["573d45389ce9394d35f14f04f48b72a2ac639fdecf0afbe11b3d5dbf07e8fce9"] + ``` + + +## prices + +**prices maxsamples** + +The `prices` method returns samples of the data that has successfully been added to the Smart Chain via the price-feed oracles. + +The argument `maxsamples` defines the maximum number of samples to display for each price. + +### Arguments + +| Name | Type | Description | +| ---------- | -------- | ------------------------------------- | +| maxsamples | (number) | the maximum number of samples to list | + +### Response + +| Name | Type | Description | +| --------------- | ------------------------------------ | ------------------------------------------------------------------- | +| "firstheight" | (number) | {/* */} | +| "timestamps" | (array of numbers) | the unix timestamps at which the samples were collected | +| "pricefeeds" | (array of jsons) | the unix timestamps at which the samples were collected | +| "name" | (string) | the name (symbol) of the price | +| "prices" | (array of arrays containing numbers) | the mined (actual received) price; correlated price; smoothed price | +| "result" | (string) | whether the command executed successfully | +| "seed" | (number) | | +| "height" | (number) | | +| "maxsamples" | (number) | the maximum number of samples displayed | +| "width" | (number) | | +| "daywindow" | (number) | | +| "numpricefeeds" | (number) | the total number of price feeds available on the Smart Chain | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD prices 5 +``` + + + ```json + { + "firstheight": 1604, + "timestamps": [ + 1574860856, + 1574860730, + 1574860730, + 1574860605, + 1574860480 + ], + "pricefeeds": [ + { + "name": "BTC_USD", + "prices": [ + [ + 7283.27170000, + 7280.79830000, + 7269.59738571 + ], + [ + 7286.85330000, + 7281.90500000, + 7266.62501428 + ], + [ + 7286.85330000, + 7259.99170000, + 7264.39740000 + ], + [ + 7278.08330000, + 7259.99170000, + 7263.26905714 + ], + [ + 7281.90500000, + 7259.99170000, + 7262.14071428 + ] + ] + }, + + ... omitted for brevity ... + + ], + "result": "success", + "seed": 1045657799360186951, + "height": 1624, + "maxsamples": 5, + "width": 20, + "daywindow": 7, + "numpricefeeds": 36 + } + ``` + + +## pricesaddfunding + +**pricesaddfunding bettxid amount** + +The `pricesaddfunding` method adds the `amount` of funding from the user's wallet to the `bettxid` bet. + +This can reduce the `bettxid` owner's risk of liquidation. + +### Arguments + +| Name | Type | Description | +| ------- | -------- | ----------------------------------------------------------------------------------------------- | +| bettxid | (string) | the transaction id returned previously by the [pricesbet](/antara/api/prices/#pricesbet) method | +| amount | (number) | the amount of funding to be added to the bet | + +### Response + +| Name | Type | Description | +| -------- | -------- | ------------------------------------------------------------------------------------------- | +| "hex" | (string) | the transaction in hex format; broadcast this value using the **sendrawtransaction** method | +| "txid" | (string) | the transaction id | +| "result" | (string) | whether the command executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pricesaddfunding 573d45389ce9394d35f14f04f48b72a2ac639fdecf0afbe11b3d5dbf07e8fce9 2 +``` + + + ```json + { + "hex": "0400008085202f8902001ba9e5249f390cf83f9e066f40a5fa514f9d9effbfa8e1c62893af4a8f2920000000004847304402203e41b90dd37de286dcd1132c7927b83388ccf9b364b958101132df85ee0abf6c022076cd8ebe8070d20b115f106deec8bb802adcb4f4ab00a49ed84e41cf39295a9201ffffffffe9fce807bf5d3d1be1fb0acfde9f63aca2728bf4044ff1354d39e99c38453d57000000007b4c79a276a072a26ba067a565802102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567814042c55e009fa5571262beed60e90a5aaed4d87c03cf4047dc73203d0c26b7ba075a67920cfbb38c560eee029ceebe2f7ef0920d2d4b3d59ef4bcaa9f2f4a24ceba100af038001eda10001ffffffff051027000000000000302ea22c80203f3e915b5ac6710cb47dc1b1fce5efa52cd958ceab630fd9aa52c9274b446b478103120c008203000401ccc07fdc0b00000000302ea22c80203ee64ec5f134da404710d306dcd9ca54a0139b3c4827b43a988fc6316e6c2a688103120c008203000401cc40420f00000000002321037c803ec82d12da939ac04379bbc1130a9065c53d8244a61eece1db942cf0efa7acf074e4a600000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac00000000000000004f6a4c4ced41e9fce807bf5d3d1be1fb0acfde9f63aca2728bf4044ff1354d39e99c38453d572102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756700c2eb0b00000000000000002f0700000000000000000000000000", + "txid": "74dea4695a097facb5a71d1a56799f9caed4bf7461b613ae9c5800b85fb97ded", + "result": "success" + } + ``` + + +## pricesaddress + +**pricesaddress \[pubkey]** + +The `pricesaddress` method returns information about the local instance of the Antara Prices Module on the Smart Chain and about associated addresses. + +Optionally, if a pubkey is supplied, this method also returns the corresponding Prices CC Address and balance. + +### Arguments + +| Name | Type | Description | +| ------ | ------------------ | ----------------------------------------- | +| pubkey | (string, optional) | the pubkey of another user on the network | + +### Response + +| Name | Type | Description | +| ----------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- | +| "result" | (string) | whether the command executed successfully | +| "PricesCCAddress" | (string) | taking the contract's EVAL code as a modifier, this is the public address that corresponds to the contract's privkey | +| "PricesCCBalance" | (number) | the amount of funds in the `PricesCCAddress` | +| "PricesNormalAddress" | (string) | the unmodified public address generated from the contract's privkey | +| "PricesNormalBalance" | (number) | the amount of funds in the `PricesNormalAddress` | +| "PricesCCTokensAddress" | (string) | the public address where Tokens are locked in the Prices module | +| "myCCAddress(Prices)" | (string) | taking the module's EVAL code as a modifier, this is the Antara address from the pubkey of the user | +| "myCCbalance(Prices)" | (number) | the amount of funds in the `myCCAddress(Prices)` | +| "myaddress" | (string) | the public address of the pubkey used to launch the chain | +| "mybalance" | (number) | the amount of funds in the `myaddress` | +| "myaddr" | (string) | | +| "houseaddr" | (string) | the public address of the House | +| "exposureaddr" | (string) | | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pricesaddress +``` + + + ```json + { + "result": "success", + "PricesCCAddress": "RAL5Vh8NXmFqEKJRKrk1KjKaUckK7mM1iS", + "PricesCCBalance": 0.0, + "PricesNormalAddress": "RBunXCsMHk5NPd6q8SQfmpgre3x133rSwZ", + "PricesNormalBalance": 0.0, + "PricesCCTokensAddress": "RTSAiZc1b5H8WKPjqydsNfG11bLjbXZAY5", + "myCCAddress(Prices)": "RDmC5R7MLqBKZxVYKkHvR7Piz73RADhvHm", + "myCCbalance(Prices)": 0.0, + "myaddress": "RGr9gqm88JtTntHJLgRxBjMS25K1w4rCzi", + "mybalance": 0.0, + "myaddr": "RDmC5R7MLqBKZxVYKkHvR7Piz73RADhvHm", + "houseaddr": "RPLU8yLsUS8iN9YUvtw4CbX9oZJmU5Dg5y", + "exposureaddr": "RJuhhPF7s8bR1532NWLnYZeCSs5BY9ZZBC" + } + ``` + + +## pricesbet + +**pricesbet amount leverage "synthetic-expression"** + +The `pricesbet` method is used to open a bet. + +The resulting transaction id is called the `bettxid` of this bet and is used in most of the subsequent RPC calls + +### Arguments + +| Name | Type | Description | +| -------------------- | -------- | ------------------------------------------------------------------------------------------------------ | +| amount | (number) | the amount of the Smart Chain's native coin to bet | +| leverage | (number) | the leverage to be used to open the bet; use positive integers for longs, negative integers for shorts | +| synthetic-expression | (string) | the synthetic expression against which the bet is opened | + +### Response + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------------------------------------------------------- | +| "hex" | (string) | the transaction in hex format; broadcast this value using the `sendrawtransaction` method | +| "txid" | (string) | the transaction id | +| "result" | (string) | whether the command executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pricesbet 1 2 "BTC_USD,1" +``` + + + ```json + { + "hex": "0400008085202f89010019d58a792d663704f6d35a97134bfe24290de126aa220812a05f2a297efbca0000000049483045022100fbac0908eb3431c7781adeea0e2d83f05851ba131def70cb5ab207d5b2a322d102201cda02d44e9254ee26bf9b2aa88adf3b19a49c1fc2258a0ad85cb544585b745f01ffffffff071027000000000000302ea22c80203f3e915b5ac6710cb47dc1b1fce5efa52cd958ceab630fd9aa52c9274b446b478103120c008203000401cc1027000000000000302ea22c80203ee64ec5f134da404710d306dcd9ca54a0139b3c4827b43a988fc6316e6c2a688103120c008203000401cce03fee0500000000302ea22c80203ee64ec5f134da404710d306dcd9ca54a0139b3c4827b43a988fc6316e6c2a688103120c008203000401cc10270000000000002321039894cb054c0032e99e65e715b03799607aa91212a16648d391b6fa2cc52ed0cfac20a10700000000002321037c803ec82d12da939ac04379bbc1130a9065c53d8244a61eece1db942cf0efa7acc0e0d9ac00000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000626a4c5fed422102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475675a06000000e1f50500000000020012db9450a90000000201000108000000000000000000000000000000000000000000000000000000000000000000000000230700000000000000000000000000", + "txid": "90e4e83f750d46f13b2934af77aacc3423031ac520467e4f0b238e9389160c31", + "result": "success" + } + ``` + + +## pricescashout + +**pricescashout bettxid** + +The `pricescashout` method can be used to cash out the `bettxid` bet. At the moment this method is executed, the user's equity must be positive and the bet must be open and not rekt. + +### Arguments + +| Name | Type | Description | +| ------- | -------- | ----------------------------------------------------------------------------------------------- | +| bettxid | (string) | the transaction id returned previously by the [pricesbet](/antara/api/prices/#pricesbet) method | + +### Response + +| Name | Type | Description | +| ----------------- | --------------- | --------------------------------------------------------------------------------------------------------------------- | +| bets | (array of json) | the bets that are open currently | +| positionsize | (number) | the amount of native coin used to open the bet | +| profits | (number) | the profits that can be actualized if the bet is closed at this moment; the value is negative if it is a loss | +| costbasis | (number) | the price that has been locked in as the opening price of the bet | +| firstheight | (number) | | +| leverage | (number) | the leverage used to open the bet | +| TotalPositionSize | (number) | the amount of native coin used to open all the bets | +| TotalProfits | (number) | the total profits that can be actualized if the bets are closed at this moment; the value is negative if it is a loss | +| equity | (number) | the amount of native Smart Chain coin that can be redeemed if the bet is cashed out at this moment | +| LastPrice | (number) | the last known price | +| LastHeight | (number) | the block height at which `LastPrice` was noted | +| "hex" | (string) | the transaction in hex format; broadcast this value using the `sendrawtransaction` method | +| "txid" | (string) | the transaction id | +| "result" | (string) | whether the command executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pricescashout 573d45389ce9394d35f14f04f48b72a2ac639fdecf0afbe11b3d5dbf07e8fce9 +``` + + + ```json + { + "bets": [ + { + "positionsize": 1.0, + "profits": -0.00354064, + "costbasis": 7290.34905714, + "firstheight": 35 + } + ], + "leverage": 2, + "TotalPositionSize": 1.0, + "TotalProfits": -0.00354064, + "equity": 0.99645936, + "LastPrice": 7277.44287142, + "LastHeight": 1637, + "hex": "0400008085202f8903e9fce807bf5d3d1be1fb0acfde9f63aca2728bf4044ff1354d39e99c38453d57010000007b4c79a276a072a26ba067a5658021039894cb054c0032e99e65e715b03799607aa91212a16648d391b6fa2cc52ed0cf81409c7720352bfef193930d6bd18a5ed4178edec85011948fe71ec5d598c5bd51ec44c4bbaa3350250512b538418fbbfe34f2b468ff5c8d16f17c12914faa689d55a100af038001eda10001ffffffff310c1689938e230b4f7e4620c51a032334ccaa77af34293bf1460d753fe8e490020000007b4c79a276a072a26ba067a5658021039894cb054c0032e99e65e715b03799607aa91212a16648d391b6fa2cc52ed0cf814040648b2b6837cefb5ae4592836ee628606a2ab6f2fb33674cebc95aeb04d0c431e19540dfbb054fe55fa45822fa93b0da50808d03680a45deac3d7f03d1e9209a100af038001eda10001ffffffff8e65f2faf9f137dc59c74f5c846c0fcc8a00b331da52639cdfbbd4cf286aaf40000000007b4c79a276a072a26ba067a5658021039894cb054c0032e99e65e715b03799607aa91212a16648d391b6fa2cc52ed0cf814078db50a91159707b5ee2d1e8c7500b60efa85498c13fde53bd86b4d94f77d5610f5dbfe533d08d8dd7fb2eb5b0b5942916f081002220673699baf1e94679563aa100af038001eda10001ffffffff03f079f00500000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567acf065704e18090000302ea22c80203ee64ec5f134da404710d306dcd9ca54a0139b3c4827b43a988fc6316e6c2a688103120c008203000401cc0000000000000000776a4c74ed46e9fce807bf5d3d1be1fb0acfde9f63aca2728bf4044ff1354d39e99c38453d572102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b475676506000072d8ddbda9000000a691f070a9000000ec6e07a356000000f079f00500000000102700000000000000000000000000002e0700000000000000000000000000", + "txid": "84ca754d5e0230c5e2d455900aad3239fc14cc268705c2371db5e5e44bcfc773", + "result": "success" + } + ``` + + +## pricesgetorderbook + +**pricesgetorderbook** + +The `pricesgetorderbook` method shows the currently open bets and their details. The method also shows information about the house wallet's balance and statistics about the bets on the Smart Chain. + +### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +### Response + +| Name | Type | Description | +| --------------------- | --------------- | -------------------------------------------------------------------------------------------------- | +| Symbol of a Price | (string) | whether the command executed successfully | +| positions | (array of json) | whether the command executed successfully | +| isOpen | (number) | whether the bet is open; `0` if false and `1` if true | +| expression | (string) | the synthetic expression supplied by the user | +| positionsize | (number) | the amount of native coin used to open the bet | +| leverage | (number) | the leverage used to open the bet | +| costbasis | (number) | the price that has been locked in as the opening price of the bet | +| lastprice | (number) | the last known price | +| equity | (number) | the amount of native Smart Chain coin that can be redeemed if the bet is cashed out at this moment | +| isUpPosition | (number) | | +| DiffLeveragedPosition | (number) | | +| TotalFund | (number) | the total amount of the Smart Chain's coins available in the House's public address | +| TotalEquity | (number) | the total amount of equity across all the bets | +| TotalRekt | (number) | the total number of bets that are already rekt | +| TotalBets | (number) | the total number of active bets | +| TotalCashoutBets | (number) | the total number of bets that have been cashed out | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pricesgetorderbook +``` + + + ```json + { + "BTC_USD": { + "positions": [ + { + "isOpen": 1, + "expression": "BTC_USD, 1", + "positionsize": 100000000, + "leverage": 2, + "costbasis": 729034905714, + "lastprice": 726786761428, + "equity": 99383254, + "isUpPosition": 1 + }, + { + "isOpen": 1, + "expression": "BTC_USD, 1", + "positionsize": 100000000, + "leverage": 2, + "costbasis": 728389262857, + "lastprice": 726786761428, + "equity": 99559986, + "isUpPosition": 1 + } + ], + "DiffLeveragedPosition": 400000000 + }, + "TotalFund": 100002.0002, + "TotalEquity": 1.9894324, + "TotalRekt": 0.0, + "TotalBets": 2.0, + "TotalCashoutBets": 0.0 + } + ``` + + +## pricesinfo + +**pricesinfo bettxid \[height]** + +The `pricesinfo` method returns information about the bet referred by the `bettxid` bet. + +### Arguments + +| Name | Type | Description | +| ------- | ------------------ | ----------------------------------------------------------------------------------------------- | +| bettxid | (string) | the transaction id returned previously by the [pricesbet](/antara/api/prices/#pricesbet) method | +| height | (number, optional) | the height at which the information about the bet is required | + +### Response + +| Name | Type | Description | +| ----------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------- | +| rekt | (number) | whether the bet is rekt; `0` if false and `1` if true | +| open | (number) | whether the bet is open; `0` if false and `1` if true | +| expression | (string) | the synthetic expression supplied by the user | +| reduced | (string) | the reduced synthetic expression derived from the one supplied by the user | +| costbasis | (number) | the price that has been locked in as the opening price of the bet | +| bets | (array of json) | the bets that are open currently | +| positionsize | (number) | the amount of native coin used to open the bet | +| profits | (number) | the profits that can be actualized if the bet is closed at this moment; the value is negative if the closing amount is a loss | +| costbasis | (number) | the opening price of the bet; this value is locked for the duration of the bet | +| firstheight | (number) | | +| leverage | (number) | the leverage used to open the bet | +| TotalPositionSize | (number) | the amount of native coin used to open all the bets | +| TotalProfits | (number) | the total profits that can be actualized if the bets are closed at this moment; the value is negative if the amount is a loss | +| equity | (number) | the amount of native Smart Chain coin that can be redeemed if the bet is cashed out at this moment | +| LastPrice | (number) | the last known price | +| LastHeight | (number) | the block height at which `LastPrice` was noted | +| LiquidationPrice | (number) | the price at which the bet will be eligible for liquidation | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pricesinfo 573d45389ce9394d35f14f04f48b72a2ac639fdecf0afbe11b3d5dbf07e8fce9 +``` + + + ```json + { + "rekt": 0, + "open": 1, + "expression": "BTC_USD, 1", + "reduced": "BTC_USD, 1", + "costbasis": 7290.34905714, + "bets": [ + { + "positionsize": 1.0, + "profits": -0.00623532, + "costbasis": 7290.34905714, + "firstheight": 35 + } + ], + "leverage": 2, + "TotalPositionSize": 1.0, + "TotalProfits": -0.00623532, + "equity": 0.99376468, + "LastPrice": 7267.62024285, + "LastHeight": 1615, + "LiquidationPrice": 3721.02360812 + } + ``` + + +## priceslist + +**priceslist \[all|open|closed]** + +The `priceslist` method returns the list of transaction id's (txid) of all the bets executed on chain. The method returns both open and closed bets by default. + +### Arguments + +| Name | Type | Description | +| --------------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `"all\|open\|closed"` | (string, optional) | the filter to apply to the list

**all** - lists all of the user's bets

**open** - lists the user's bets that are open

**closed** - lists the user's bets that are closed | + +### Response + +| Name | Type | Description | +| ----- | ------------------ | -------------------------------------------------------------------------- | +| Array | (array of strings) | An array containing the txid's of the bets that satisfy the applied filter | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD priceslist +``` + + + ```json + ["573d45389ce9394d35f14f04f48b72a2ac639fdecf0afbe11b3d5dbf07e8fce9"] + ``` + + +## pricesrefillfund + +**pricesrefillfund amount** + +The `pricesrefillfund` method adds funds to the house (the Global CC address). + +### Arguments + +| Name | Type | Description | +| ------ | -------- | ------------------------------------------------------------- | +| amount | (amount) | the amount of coins to be added to the House's public address | + +### Response + +| Name | Type | Description | +| -------- | -------- | ----------------------------------------------------------------------------------------- | +| "hex" | (string) | the transaction in hex format; broadcast this value using the `sendrawtransaction` method | +| "txid" | (string) | the transaction id | +| "result" | (string) | whether the command executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pricesrefillfund 100000 +``` + + + ```json + { + "hex": "0400008085202f89018e65f2faf9f137dc59c74f5c846c0fcc8a00b331da52639cdfbbd4cf286aaf400100000049483045022100f3929f772182537d30d2f9bfbf9ee77fda8b1cd9222e997916ac63d62ce0976402200c980637650a7d27e8eede43238f5bc9c28f54a7d757e6367dd63d13ec4c782401ffffffff0200a0724e18090000302ea22c80203ee64ec5f134da404710d306dcd9ca54a0139b3c4827b43a988fc6316e6c2a688103120c008203000401cc27a9421dbf8f2a00232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac000000002e0700000000000000000000000000", + "txid": "54098ecb3d5bfdc8ce3a5b0d9f0f08d1dd21af97f714c8068938008543b793d7", + "result": "success" + } + ``` + + +## pricesrekt + +**pricesrekt bettxid height** + +The `pricesrekt` method creates a transaction that liquidates a bet that is "rekt" — a bet where the debt ratio has exceeded maximum limits and is now open to liquidation. + +A bet that is rekt has an `IsRekt: 1` flag in its [pricesinfo](/antara/api/prices/#pricesinfo) call. + +The `pricesrekt` call requires some proof-of-work (PoW) activity from the machine of the executing user. This deters spamming. + +All nodes on the network are incentivised to execute this transaction as it rewards some of the liquidated funds to the node that created the rekt transaction. + +### Arguments + +| Name | Type | Description | +| ------- | ------------------ | ----------------------------------------------------------------------------------------------- | +| bettxid | (string) | the transaction id returned previously by the [pricesbet](/antara/api/prices/#pricesbet) method | +| height | (number, optional) | the height at which the bet is rekt | + +### Response + +| Name | Type | Description | +| ----------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| bets | (array of json) | the bets that are open currently | +| positionsize | (number) | the amount of native coin used to open the bet | +| profits | (number) | the profits that can be actualized if the bet is closed at this moment; the value is negative if the amount is a loss | +| costbasis | (number) | the opening price of the bet | +| firstheight | (number) | | +| leverage | (number) | the leverage used to open the bet | +| TotalPositionSize | (number) | the amount of native coin used to open all the bets | +| TotalProfits | (number) | the total profits that can be actualized if the bets are closed at this moment; the value is negative if this amount is a loss | +| equity | (number) | the amount of native Smart Chain coin that can be redeemed if the bet is cashed out at this moment | +| LastPrice | (number) | the last known price | +| LastHeight | (number) | the block height at which `LastPrice` was noted | +| "result" | (string) | whether the command executed successfully | +| "error" | (string) | the error encountered | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD pricesrekt 573d45389ce9394d35f14f04f48b72a2ac639fdecf0afbe11b3d5dbf07e8fce9 1540 +``` + + + ```json + { + "bets": [ + { + "positionsize": 1.0, + "profits": -0.00612918, + "costbasis": 7290.34905714, + "firstheight": 35 + } + ], + "leverage": 2, + "TotalPositionSize": 1.0, + "TotalProfits": -0.00612918, + "equity": 0.99387082, + "LastPrice": 7268.00712857, + "LastHeight": 1644, + "result": "error", + "error": "position not rekt" + } + ``` + +export const title = "Rewards: Earn by Locking Coins on-chain"; +export const description = "The Rewards Antara Module creates a master-node like rewards program, giving a user the ability to earn rewards by locking coins."; + +# Rewards + +## Introduction + +The Rewards Antara Module creates a master-node like rewards program, giving a user the ability to earn rewards by locking coins. + +It features configurable parameters, such as a customizable monthly reward, minimum deposit, a required holding period,etc. + +There can be many `rewards` plans active at any given time. + +### Rewards Antara Module Flow + +* Anyone can create a new plan using [rewardscreatefunding](/antara/api/rewards/#rewardscreatefunding) +* Anyone can add funding to the plan using [rewardsaddfunding](/antara/api/rewards/#rewardsaddfunding) +* Anyone can query the list of all active plans using [rewardslist](/antara/api/rewards/#rewardslist) +* To get the details of a particular plan, use [rewardsinfo](/antara/api/rewards/#rewardsinfo) +* After finding a suitable plan, any user can lock funds using [rewardslock](/antara/api/rewards/#rewardslock) +* After the minimum lock time is met, the user can use [rewardsunlock](/antara/api/rewards/#rewardsunlock) to unlock their funds and receive their rewards + +## rewardsaddfunding + +**rewardsaddfunding name fundingtxid amount** + +The `rewardsaddfunding` method adds funds to a rewards plan. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | ------------------------------------------------------------- | +| name | (string) | the desired name of your rewards plan | +| fundingtxid | (string) | the txid of the transaction that created and funded this plan | +| amount | (number) | the amount of funds to add to the plan | + +### Response + +| Name | Type | Description | +| ------ | -------- | ---------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command succeeded | +| hex | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Create a raw transaction and get the HEX value + +```bash +./komodo-cli -ac_name=HELLOWORLD rewardsaddfunding FREE e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd 100 +``` + + + ```json + { + "result": "success", + "hex": "0100000001bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e00200000048473044022050ab254c7498e411ab5360551148405c4afff28d68729e2bd00ba2508ab105d402204067ab95020d606c35d3604d4385dcb97c899a06aa8bf8ce30471fb7868ac7a401ffffffff0300e40b5402000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401ccd05eefb1fe080000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae5414652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"rewardsaddfunding", "params":["FREE" ,"e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd" ,"100"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "0100000001bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e00200000048473044022050ab254c7498e411ab5360551148405c4afff28d68729e2bd00ba2508ab105d402204067ab95020d606c35d3604d4385dcb97c899a06aa8bf8ce30471fb7868ac7a401ffffffff0300e40b5402000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401ccd05eefb1fe080000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae5414652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Broadcast raw transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0100000001bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e00200000048473044022050ab254c7498e411ab5360551148405c4afff28d68729e2bd00ba2508ab105d402204067ab95020d606c35d3604d4385dcb97c899a06aa8bf8ce30471fb7868ac7a401ffffffff0300e40b5402000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401ccd05eefb1fe080000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae5414652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000 +``` + + + ```bash + 008ca94eebce8dbfa91491028c8861016ad4c25240f9ddc5616f2fb0853da580 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["0100000001bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e00200000048473044022050ab254c7498e411ab5360551148405c4afff28d68729e2bd00ba2508ab105d402204067ab95020d606c35d3604d4385dcb97c899a06aa8bf8ce30471fb7868ac7a401ffffffff0300e40b5402000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401ccd05eefb1fe080000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae5414652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "008ca94eebce8dbfa91491028c8861016ad4c25240f9ddc5616f2fb0853da580", + "error": null, + "id": "curltest" + } + ``` + + +Step 3: Decode raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=ATEST decoderawtransaction 0100000001bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e00200000048473044022050ab254c7498e411ab5360551148405c4afff28d68729e2bd00ba2508ab105d402204067ab95020d606c35d3604d4385dcb97c899a06aa8bf8ce30471fb7868ac7a401ffffffff0300e40b5402000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401ccd05eefb1fe080000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae5414652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000 +``` + + + ```json + { + "txid": "008ca94eebce8dbfa91491028c8861016ad4c25240f9ddc5616f2fb0853da580", + "size": 277, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd", + "vout": 2, + "scriptSig": { + "asm": "3044022050ab254c7498e411ab5360551148405c4afff28d68729e2bd00ba2508ab105d402204067ab95020d606c35d3604d4385dcb97c899a06aa8bf8ce30471fb7868ac7a401", + "hex": "473044022050ab254c7498e411ab5360551148405c4afff28d68729e2bd00ba2508ab105d402204067ab95020d606c35d3604d4385dcb97c899a06aa8bf8ce30471fb7868ac7a401" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 100.0, + "valueSat": 10000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RTsRBYL1HSvMoE3qtBJkyiswdVaWkm8YTK"] + } + }, + { + "value": 98899.9997, + "valueSat": 9889999970000, + "n": 1, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN e5414652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e0", + "hex": "6a2ae5414652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e0", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["0100000001bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e00200000048473044022050ab254c7498e411ab5360551148405c4afff28d68729e2bd00ba2508ab105d402204067ab95020d606c35d3604d4385dcb97c899a06aa8bf8ce30471fb7868ac7a401ffffffff0300e40b5402000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401ccd05eefb1fe080000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae5414652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "008ca94eebce8dbfa91491028c8861016ad4c25240f9ddc5616f2fb0853da580", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd", + "vout": 2, + "scriptSig": { + "asm": "3044022050ab254c7498e411ab5360551148405c4afff28d68729e2bd00ba2508ab105d402204067ab95020d606c35d3604d4385dcb97c899a06aa8bf8ce30471fb7868ac7a4[ALL]", + "hex": "473044022050ab254c7498e411ab5360551148405c4afff28d68729e2bd00ba2508ab105d402204067ab95020d606c35d3604d4385dcb97c899a06aa8bf8ce30471fb7868ac7a401" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 100.0, + "valueZat": 10000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RTsRBYL1HSvMoE3qtBJkyiswdVaWkm8YTK"] + } + }, + { + "value": 98899.9997, + "valueZat": 9889999970000, + "n": 1, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN e5414652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e0", + "hex": "6a2ae5414652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e0", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## rewardsaddress + +**rewardsaddress (pubkey)** + +The `rewardsaddress` method returns info about the `rewards` plan associated with the given `pubkey`. If no `pubkey` is provided, the `pubkey` used to launch the daemon is used. + +### Arguments + +| Name | Type | Description | +| ------ | ------------------ | -------------------------------------------------------------------------------------- | +| pubkey | (string, optional) | the pubkey of the requested info; by default it is the pubkey used to launch the chain | + +### Response + +| Name | Type | Description | +| ---------------- | -------- | -------------------------------------------------------------------------------------------------------------- | +| result | (string) | whether the method executed successfully | +| RewardsCCaddress | (string) | taking the module's EVAL code as a modifier, this is the public address that corresponds to the plan's privkey | +| Rewardsmarker | (string) | the unmodified public address generated from the plan's privkey | +| GatewaysPubkey | (string) | the pubkey for the Gateways Antara Module | +| RewardsCCassets | (string) | this property is used for development purposes only and can otherwise be ignored | +| CCaddress | (string) | taking the module's EVAL code as a modifier, this is the Antara address from the pubkey of the user | +| myCCaddress | (string) | taking the module's EVAL code as a modifier, this is the Antara address from the pubkey of the user | +| myaddress | (string) | the public address of the pubkey used to launch the chain | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD rewardsaddress 03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 +``` + + + ```json + { + "result": "success", + "RewardsCCAddress": "RTsRBYL1HSvMoE3qtBJkyiswdVaWkm8YTK", + "RewardsCCBalance": 0.0, + "RewardsNormalAddress": "RMgye9jeczNjQx9Uzq8no8pTLiCSwuHwkz", + "RewardsNormalBalance": 0.0, + "RewardsCCTokensAddress": "RUL6YTCQKuoB5AAFfNTxG1655qMuzwM4G9", + "PubkeyCCaddress(Rewards)": "RJdwcBsoWwmt9dtSqyFCULNW2F3zj2mcD3", + "PubkeyCCbalance(Rewards)": 0.0, + "myCCAddress(Rewards)": "RWzkiCssRy3qwevUF1YsMS1QifRncrsWiK", + "myCCbalance(Rewards)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"rewardsaddress", "params":["03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "RewardsCCAddress": "RTsRBYL1HSvMoE3qtBJkyiswdVaWkm8YTK", + "RewardsCCBalance": 0.0, + "RewardsNormalAddress": "RMgye9jeczNjQx9Uzq8no8pTLiCSwuHwkz", + "RewardsNormalBalance": 0.0, + "RewardsCCTokensAddress": "RUL6YTCQKuoB5AAFfNTxG1655qMuzwM4G9", + "PubkeyCCaddress(Rewards)": "RJdwcBsoWwmt9dtSqyFCULNW2F3zj2mcD3", + "PubkeyCCbalance(Rewards)": 0.0, + "myCCAddress(Rewards)": "RWzkiCssRy3qwevUF1YsMS1QifRncrsWiK", + "myCCbalance(Rewards)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + }, + "error": null, + "id": "curltest" + } + ``` + + +## rewardscreatefunding + +**rewardscreatefunding name amount APR mindays maxdays mindeposit** + +The `rewardscreatefunding` method creates a new `rewards` plan. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +The `sendrawtransaction` method will then return a `txid`. This `txid` is the `fundingtxid` that serves to identify the `rewards` plan. + + + If you create a plan with mindeposit: 10000, make sure to also add + 10000 of your coin and the transaction fees using the rewardsaddfunding{" "} + call after creating the plan. The rewards module won't allow locking of funds + greater than the amount already locked in a single transaction as it needs to + assure that it will have the required funds to pay. + + +### Arguments + +| Name | Type | Description | +| ---------- | -------- | ----------------------------------------------------------- | +| name | (string) | the desired name of your rewards plan | +| amount | (number) | the amount of seed funds to withdraw from your wallet | +| APR | (number) | the annual percentage of rewards, given in percentage units | +| mindays | (number) | the minimum number of days the funds will be locked | +| maxdays | (number) | the maximum number of days the funds will be locked | +| mindeposit | (number) | the minimum deposit amount for a user to participate | + +### Response + +| Name | Type | Description | +| ------- | -------- | ---------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Create raw transaction HEX using your own parameter + +```bash +./komodo-cli -ac_name=HELLOWORLD rewardscreatefunding FREE 1000 5 1 10 10 +``` + + + ```json + { + "result": "success", + "hex": "010000000104f2435046f3ad452e76e53ec01429ae4f49d3322e8cc96da96b9e35d6ada70e0000000049483045022100ebd06f60dea0e1fbfc82fdb1f17ca265c63bae51cd2db558946871513f64453902207d4d39b2418a5206bd7ef4efb9130f93f304577e0c84cc79be4e8abe0c8b22fe01ffffffff0400e8764817000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc1027000000000000232103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9ace069fb0501090000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae54646524545000000000065cd1d000000008051010000000000002f0d000000000000ca9a3b0000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"rewardscreatefunding", "params":["FREE" ,"1000" ,"5" ,"1" ,"10" ,"10"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "010000000104f2435046f3ad452e76e53ec01429ae4f49d3322e8cc96da96b9e35d6ada70e0000000049483045022100ebd06f60dea0e1fbfc82fdb1f17ca265c63bae51cd2db558946871513f64453902207d4d39b2418a5206bd7ef4efb9130f93f304577e0c84cc79be4e8abe0c8b22fe01ffffffff0400e8764817000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc1027000000000000232103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9ace069fb0501090000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae54646524545000000000065cd1d000000008051010000000000002f0d000000000000ca9a3b0000000000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Broadcast/send the raw hex/transaction. This will output the txid which is the fundingtxid, also called the rewards plan id. + +```bash +./komodo-cli -ac_name=ATEST sendrawtransaction 010000000104f2435046f3ad452e76e53ec01429ae4f49d3322e8cc96da96b9e35d6ada70e0000000049483045022100ebd06f60dea0e1fbfc82fdb1f17ca265c63bae51cd2db558946871513f64453902207d4d39b2418a5206bd7ef4efb9130f93f304577e0c84cc79be4e8abe0c8b22fe01ffffffff0400e8764817000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc1027000000000000232103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9ace069fb0501090000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae54646524545000000000065cd1d000000008051010000000000002f0d000000000000ca9a3b0000000000000000 +``` + + + ```bash + e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000104f2435046f3ad452e76e53ec01429ae4f49d3322e8cc96da96b9e35d6ada70e0000000049483045022100ebd06f60dea0e1fbfc82fdb1f17ca265c63bae51cd2db558946871513f64453902207d4d39b2418a5206bd7ef4efb9130f93f304577e0c84cc79be4e8abe0c8b22fe01ffffffff0400e8764817000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc1027000000000000232103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9ace069fb0501090000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae54646524545000000000065cd1d000000008051010000000000002f0d000000000000ca9a3b0000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd", + "error": null, + "id": "curltest" + } + ``` + + +Step 3: Decode the raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=ATEST decoderawtransaction 010000000104f2435046f3ad452e76e53ec01429ae4f49d3322e8cc96da96b9e35d6ada70e0000000049483045022100ebd06f60dea0e1fbfc82fdb1f17ca265c63bae51cd2db558946871513f64453902207d4d39b2418a5206bd7ef4efb9130f93f304577e0c84cc79be4e8abe0c8b22fe01ffffffff0400e8764817000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc1027000000000000232103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9ace069fb0501090000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae54646524545000000000065cd1d000000008051010000000000002f0d000000000000ca9a3b0000000000000000 +``` + + + ```json + { + "txid": "e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd", + "size": 322, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "0ea7add6359e6ba96dc98c2e32d3494fae2914c03ee5762e45adf3465043f204", + "vout": 0, + "scriptSig": { + "asm": "3045022100ebd06f60dea0e1fbfc82fdb1f17ca265c63bae51cd2db558946871513f64453902207d4d39b2418a5206bd7ef4efb9130f93f304577e0c84cc79be4e8abe0c8b22fe01", + "hex": "483045022100ebd06f60dea0e1fbfc82fdb1f17ca265c63bae51cd2db558946871513f64453902207d4d39b2418a5206bd7ef4efb9130f93f304577e0c84cc79be4e8abe0c8b22fe01" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 1000.0, + "valueSat": 100000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RTsRBYL1HSvMoE3qtBJkyiswdVaWkm8YTK"] + } + }, + { + "value": 0.0001, + "valueSat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "03da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9 OP_CHECKSIG", + "hex": "2103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RMgye9jeczNjQx9Uzq8no8pTLiCSwuHwkz"] + } + }, + { + "value": 98999.9998, + "valueSat": 9899999980000, + "n": 2, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN e54646524545000000000065cd1d000000008051010000000000002f0d000000000000ca9a3b00000000", + "hex": "6a2ae54646524545000000000065cd1d000000008051010000000000002f0d000000000000ca9a3b00000000", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["010000000104f2435046f3ad452e76e53ec01429ae4f49d3322e8cc96da96b9e35d6ada70e0000000049483045022100ebd06f60dea0e1fbfc82fdb1f17ca265c63bae51cd2db558946871513f64453902207d4d39b2418a5206bd7ef4efb9130f93f304577e0c84cc79be4e8abe0c8b22fe01ffffffff0400e8764817000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc1027000000000000232103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9ace069fb0501090000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae54646524545000000000065cd1d000000008051010000000000002f0d000000000000ca9a3b0000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "0ea7add6359e6ba96dc98c2e32d3494fae2914c03ee5762e45adf3465043f204", + "vout": 0, + "scriptSig": { + "asm": "3045022100ebd06f60dea0e1fbfc82fdb1f17ca265c63bae51cd2db558946871513f64453902207d4d39b2418a5206bd7ef4efb9130f93f304577e0c84cc79be4e8abe0c8b22fe[ALL]", + "hex": "483045022100ebd06f60dea0e1fbfc82fdb1f17ca265c63bae51cd2db558946871513f64453902207d4d39b2418a5206bd7ef4efb9130f93f304577e0c84cc79be4e8abe0c8b22fe01" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 1000.0, + "valueZat": 100000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RTsRBYL1HSvMoE3qtBJkyiswdVaWkm8YTK"] + } + }, + { + "value": 0.0001, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "03da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9 OP_CHECKSIG", + "hex": "2103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RMgye9jeczNjQx9Uzq8no8pTLiCSwuHwkz"] + } + }, + { + "value": 98999.9998, + "valueZat": 9899999980000, + "n": 2, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN e54646524545000000000065cd1d000000008051010000000000002f0d000000000000ca9a3b00000000", + "hex": "6a2ae54646524545000000000065cd1d000000008051010000000000002f0d000000000000ca9a3b00000000", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## rewardsinfo + +**rewardsinfo fundingtxid** + +The `rewardsinfo` method returns information about specific `rewards` plan. + +Use [rewardslist](/antara/api/rewards/#rewardslist) to see a list of all available `fundingtxid`'s. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | -------------------------------------------------- | +| fundingtxid | (string) | the txid given on the creation of the rewards plan | + +### Response + +| Name | Type | Description | +| ---------- | -------- | --------------------------------------------------------------------------- | +| name | (string) | the name of the rewards plan | +| sbits | (number) | a 64-bit int binary encoding of the first 8 characters of the name property | +| APR | (number) | the annual percentage of rewards, given in percentage units | +| minseconds | (number) | the minimum number of seconds the funds will be locked | +| maxseconds | (number) | the maximum number of seconds the funds will be locked | +| mindeposit | (number) | the minimum deposit amount | +| funding | (number) | the total available funds in the rewards plan | +| locked | (number) | the total funds locked in the rewards plan | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD rewardsinfo e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd +``` + + + ```json + { + "result": "success", + "fundingtxid": "e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd", + "name": "FREE", + "sbits": 1162170950, + "APR": "5.00000000", + "minseconds": 86400, + "maxseconds": 864000, + "mindeposit": "10.00000000", + "funding": "1100.00000000", + "locked": "200.00000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"rewardsinfo", "params":["e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "fundingtxid": "e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd", + "name": "FREE", + "sbits": 1162170950, + "APR": "5.00000000", + "minseconds": 86400, + "maxseconds": 864000, + "mindeposit": "10.00000000", + "funding": "1100.00000000", + "locked": "200.00000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +## rewardslist + +**rewardslist** + +The `rewardslist` method lists the `fundingtxid`'s of all the rewards plans available on the Smart Chain. + +### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +### Response + +| Name | Type | Description | +| ----------- | -------- | --------------------------------------------------------------------- | +| fundingtxid | (string) | the txid of the transaction that created and funded the relevant plan | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD rewardslist + +``` + + + ```bash + [ + "e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd" + ] + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"rewardslist", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": [ + "e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd" + ], + "error": null, + "id": "curltest" + } + ``` + + +## rewardslock + +**rewardslock name fundingtxid amount** + +The `rewardslock` method commits your desired amount of funds into the specified rewards plan. They remain locked until the minimum number of seconds/days passes. + +The method returns a `hex` value that must be broadcast using [sendrawtransaction.](/smart-chains/api/rawtransactions/#sendrawtransaction) + +The `sendrawtransaction` method will then return a `txid`, which is later used in the [rewardsunlock](/antara/api/rewards/#rewardsunlock) method. In general, it is best to save this `txid` in a secure location. + +If the final `txid` is lost, it is possible to find it again. See [rewardsunlock](/antara/api/rewards/#rewardsunlock) for more information. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | --------------------------------------------------------------------------- | +| name | (string) | the name of the rewards plan | +| fundingtxid | (string) | the txid that identifies the desired rewards plan | +| amount | (number) | the amount of funds to commit to the plan (must be over the plan's minimum) | + +### Response + +| Name | Type | Description | +| ------- | -------- | ------------------------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the `diceaddfunds` command | + +#### 📌 Examples + +Step 1: Create raw transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD rewardslock FREE e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd 200 +``` + + + ```json + { + "result": "success", + "hex": "010000000180a53d85b02f6f61c5ddf94052c2d46a0161888c029114a9bf8dceeb4ea98c000100000049483045022100cf5581a6729eb0f37d03f0975dd6cfaca79ea08d380dae7df25b2335931bff5d02204feaf188f7f28d90c056a7b2bfa1f8d38fdf242c333470cf1e0cd3534ef1609701ffffffff0400c817a804000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc1027000000000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5acb048d709fa080000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae54c4652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"rewardslock", "params":["FREE" ,"e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd" ,"200"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "010000000180a53d85b02f6f61c5ddf94052c2d46a0161888c029114a9bf8dceeb4ea98c000100000049483045022100cf5581a6729eb0f37d03f0975dd6cfaca79ea08d380dae7df25b2335931bff5d02204feaf188f7f28d90c056a7b2bfa1f8d38fdf242c333470cf1e0cd3534ef1609701ffffffff0400c817a804000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc1027000000000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5acb048d709fa080000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae54c4652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Broadcast raw transaction + +```bash +./komodo-cli -ac_name=ATEST sendrawtransaction 010000000180a53d85b02f6f61c5ddf94052c2d46a0161888c029114a9bf8dceeb4ea98c000100000049483045022100cf5581a6729eb0f37d03f0975dd6cfaca79ea08d380dae7df25b2335931bff5d02204feaf188f7f28d90c056a7b2bfa1f8d38fdf242c333470cf1e0cd3534ef1609701ffffffff0400c817a804000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc1027000000000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5acb048d709fa080000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae54c4652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000 +``` + + + ```bash + 494c4e8ab19ab73db9fde0454762e50ff3621d9708170083ea9d925918ec0263 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000180a53d85b02f6f61c5ddf94052c2d46a0161888c029114a9bf8dceeb4ea98c000100000049483045022100cf5581a6729eb0f37d03f0975dd6cfaca79ea08d380dae7df25b2335931bff5d02204feaf188f7f28d90c056a7b2bfa1f8d38fdf242c333470cf1e0cd3534ef1609701ffffffff0400c817a804000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc1027000000000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5acb048d709fa080000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae54c4652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "494c4e8ab19ab73db9fde0454762e50ff3621d9708170083ea9d925918ec0263", + "error": null, + "id": "curltest" + } + ``` + + +Step 3: Decode raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=ATEST decoderawtransaction 010000000180a53d85b02f6f61c5ddf94052c2d46a0161888c029114a9bf8dceeb4ea98c000100000049483045022100cf5581a6729eb0f37d03f0975dd6cfaca79ea08d380dae7df25b2335931bff5d02204feaf188f7f28d90c056a7b2bfa1f8d38fdf242c333470cf1e0cd3534ef1609701ffffffff0400c817a804000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc1027000000000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5acb048d709fa080000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae54c4652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000 +``` + + + ```json + { + "txid": "494c4e8ab19ab73db9fde0454762e50ff3621d9708170083ea9d925918ec0263", + "size": 322, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "008ca94eebce8dbfa91491028c8861016ad4c25240f9ddc5616f2fb0853da580", + "vout": 1, + "scriptSig": { + "asm": "3045022100cf5581a6729eb0f37d03f0975dd6cfaca79ea08d380dae7df25b2335931bff5d02204feaf188f7f28d90c056a7b2bfa1f8d38fdf242c333470cf1e0cd3534ef1609701", + "hex": "483045022100cf5581a6729eb0f37d03f0975dd6cfaca79ea08d380dae7df25b2335931bff5d02204feaf188f7f28d90c056a7b2bfa1f8d38fdf242c333470cf1e0cd3534ef1609701" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 200.0, + "valueSat": 20000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RTsRBYL1HSvMoE3qtBJkyiswdVaWkm8YTK"] + } + }, + { + "value": 0.0001, + "valueSat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 98699.9995, + "valueSat": 9869999950000, + "n": 2, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN e54c4652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e0", + "hex": "6a2ae54c4652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e0", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["010000000180a53d85b02f6f61c5ddf94052c2d46a0161888c029114a9bf8dceeb4ea98c000100000049483045022100cf5581a6729eb0f37d03f0975dd6cfaca79ea08d380dae7df25b2335931bff5d02204feaf188f7f28d90c056a7b2bfa1f8d38fdf242c333470cf1e0cd3534ef1609701ffffffff0400c817a804000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc1027000000000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5acb048d709fa080000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae54c4652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "494c4e8ab19ab73db9fde0454762e50ff3621d9708170083ea9d925918ec0263", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "008ca94eebce8dbfa91491028c8861016ad4c25240f9ddc5616f2fb0853da580", + "vout": 1, + "scriptSig": { + "asm": "3045022100cf5581a6729eb0f37d03f0975dd6cfaca79ea08d380dae7df25b2335931bff5d02204feaf188f7f28d90c056a7b2bfa1f8d38fdf242c333470cf1e0cd3534ef16097[ALL]", + "hex": "483045022100cf5581a6729eb0f37d03f0975dd6cfaca79ea08d380dae7df25b2335931bff5d02204feaf188f7f28d90c056a7b2bfa1f8d38fdf242c333470cf1e0cd3534ef1609701" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 200.0, + "valueZat": 20000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RTsRBYL1HSvMoE3qtBJkyiswdVaWkm8YTK"] + } + }, + { + "value": 0.0001, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 98699.9995, + "valueZat": 9869999950000, + "n": 2, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN e54c4652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e0", + "hex": "6a2ae54c4652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e0", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## rewardsunlock + +**rewardsunlock name fundingtxid (txid)** + +The `rewardsunlock` method unlocks your funds from a specific rewards plan after the minimum lock time is met. If `txid` is not provided, `rewardsunlock` unlocks all funds in the `fundingtxid` plan. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method to complete the command. + +If you attempt to unlock your funds before the minimum period is met, the daemon returns this error: + +The method requires the `txid` that was returned as a result of the original [rewardslock](/antara/api/rewards/#rewardslock) method. + +If the original `txid` is lost, it is possible to find it again by either rebroadcasting the original `hex` (if it is available), or by scanning through available utxos using the [getaddressutxos](/smart-chains/api/address/#getaddressbalance) method. + + + \{ + "result": "error", + "error": "reward 0 is \<= the transaction fee" + } + + +An error similar to the one below prints in the console: + +``` +APR 5.00000000 minseconds.86400 maxseconds.864000 mindeposit 10.00000000 + +duration 74628 < minseconds 86400 + +reward 0 is <= the transaction fee + +amount 200.00000000 -> reward 0.00000000 +``` + +### Arguments + +| Name | Type | Description | +| ----------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| name | (string) | the name of the rewards plan | +| fundingtxid | (string) | the txid that identifies the desired rewards plan | +| txid | (string, optional) | the txid that was returned as a result of the original rewardslock command; if `txid` is not provided, `rewardsunlock` unlocks all funds in the `fundingtxid` plan | + +### Response + +| Name | Type | Description | +| ------- | -------- | ------------------------------------------------------------------------------------------------------------------- | +| result: | (string) | whether the command succeeded | +| hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the `diceaddfunds` command | + +#### 📌 Examples + +Step 1: Create raw transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD rewardsunlock FREE e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd 494c4e8ab19ab73db9fde0454762e50ff3621d9708170083ea9d925918ec0263 +``` + + + ```json + { + "result": "success", + "hex": "01000000026302ec1859929dea83001708971d62f30fe5624745e0fdb93db79ab18a4e4c49000000007b4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb98140dd5c7a6e8436748501608056b934a6b6cd54122f9451a1ca76f3d41568cb0e7a08e4d4f9045083425f42a4171e42b2d32f5e331f87d5b45298e006b909c706d2a100af038001e5a10001ffffffff45fc2d61dd7bf709409c3e5b9021ebd6191901a2a43fa7ed2704c03aa0d3a682000000007b4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9814011825693143f97dc51d34b47638f314146c20c92b5020673fb7411ab37018c2003870255e17d87d46b7af7d042335579de566ce492fd8c3c4e883253870ba329a100af038001e5a10001ffffffff0349f04c4817000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cca79841a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae5554652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"rewardsunlock", "params":["FREE" ,"e020151cd81647b20aa45a0e6850216ae52d3e895443bbe1ae97dea3ae6767bd" ,"494c4e8ab19ab73db9fde0454762e50ff3621d9708170083ea9d925918ec0263"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "01000000026302ec1859929dea83001708971d62f30fe5624745e0fdb93db79ab18a4e4c49000000007b4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb98140dd5c7a6e8436748501608056b934a6b6cd54122f9451a1ca76f3d41568cb0e7a08e4d4f9045083425f42a4171e42b2d32f5e331f87d5b45298e006b909c706d2a100af038001e5a10001ffffffff45fc2d61dd7bf709409c3e5b9021ebd6191901a2a43fa7ed2704c03aa0d3a682000000007b4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9814011825693143f97dc51d34b47638f314146c20c92b5020673fb7411ab37018c2003870255e17d87d46b7af7d042335579de566ce492fd8c3c4e883253870ba329a100af038001e5a10001ffffffff0349f04c4817000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cca79841a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae5554652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Broadcast raw transaction + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000026302ec1859929dea83001708971d62f30fe5624745e0fdb93db79ab18a4e4c49000000007b4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb98140dd5c7a6e8436748501608056b934a6b6cd54122f9451a1ca76f3d41568cb0e7a08e4d4f9045083425f42a4171e42b2d32f5e331f87d5b45298e006b909c706d2a100af038001e5a10001ffffffff45fc2d61dd7bf709409c3e5b9021ebd6191901a2a43fa7ed2704c03aa0d3a682000000007b4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9814011825693143f97dc51d34b47638f314146c20c92b5020673fb7411ab37018c2003870255e17d87d46b7af7d042335579de566ce492fd8c3c4e883253870ba329a100af038001e5a10001ffffffff0349f04c4817000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cca79841a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae5554652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000 +``` + + + ```bash + 7a69605f5ecfeb0613c8573cbc4ae2471698a65b60c983ec21fb41f09975c000 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["01000000026302ec1859929dea83001708971d62f30fe5624745e0fdb93db79ab18a4e4c49000000007b4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb98140dd5c7a6e8436748501608056b934a6b6cd54122f9451a1ca76f3d41568cb0e7a08e4d4f9045083425f42a4171e42b2d32f5e331f87d5b45298e006b909c706d2a100af038001e5a10001ffffffff45fc2d61dd7bf709409c3e5b9021ebd6191901a2a43fa7ed2704c03aa0d3a682000000007b4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9814011825693143f97dc51d34b47638f314146c20c92b5020673fb7411ab37018c2003870255e17d87d46b7af7d042335579de566ce492fd8c3c4e883253870ba329a100af038001e5a10001ffffffff0349f04c4817000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cca79841a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae5554652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "7a69605f5ecfeb0613c8573cbc4ae2471698a65b60c983ec21fb41f09975c000", + "error": null, + "id": "curltest" + } + ``` + + +Step 3: Decode raw transaction (optional to check if the values are sane) + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 01000000026302ec1859929dea83001708971d62f30fe5624745e0fdb93db79ab18a4e4c49000000007b4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb98140dd5c7a6e8436748501608056b934a6b6cd54122f9451a1ca76f3d41568cb0e7a08e4d4f9045083425f42a4171e42b2d32f5e331f87d5b45298e006b909c706d2a100af038001e5a10001ffffffff45fc2d61dd7bf709409c3e5b9021ebd6191901a2a43fa7ed2704c03aa0d3a682000000007b4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9814011825693143f97dc51d34b47638f314146c20c92b5020673fb7411ab37018c2003870255e17d87d46b7af7d042335579de566ce492fd8c3c4e883253870ba329a100af038001e5a10001ffffffff0349f04c4817000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cca79841a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae5554652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000 +``` + + + ```json + { + "txid": "7a69605f5ecfeb0613c8573cbc4ae2471698a65b60c983ec21fb41f09975c000", + "size": 492, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "494c4e8ab19ab73db9fde0454762e50ff3621d9708170083ea9d925918ec0263", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb98140dd5c7a6e8436748501608056b934a6b6cd54122f9451a1ca76f3d41568cb0e7a08e4d4f9045083425f42a4171e42b2d32f5e331f87d5b45298e006b909c706d2a100af038001e5a10001", + "hex": "4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb98140dd5c7a6e8436748501608056b934a6b6cd54122f9451a1ca76f3d41568cb0e7a08e4d4f9045083425f42a4171e42b2d32f5e331f87d5b45298e006b909c706d2a100af038001e5a10001" + }, + "sequence": 4294967295 + }, + { + "txid": "82a6d3a03ac00427eda73fa4a2011919d6eb21905b3e9c4009f77bdd612dfc45", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9814011825693143f97dc51d34b47638f314146c20c92b5020673fb7411ab37018c2003870255e17d87d46b7af7d042335579de566ce492fd8c3c4e883253870ba329a100af038001e5a10001", + "hex": "4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9814011825693143f97dc51d34b47638f314146c20c92b5020673fb7411ab37018c2003870255e17d87d46b7af7d042335579de566ce492fd8c3c4e883253870ba329a100af038001e5a10001" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 999.97249609, + "valueSat": 99997249609, + "n": 0, + "scriptPubKey": { + "asm": "a22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RTsRBYL1HSvMoE3qtBJkyiswdVaWkm8YTK"] + } + }, + { + "value": 200.02740391, + "valueSat": 20002740391, + "n": 1, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN e5554652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e0", + "hex": "6a2ae5554652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e0", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["01000000026302ec1859929dea83001708971d62f30fe5624745e0fdb93db79ab18a4e4c49000000007b4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb98140dd5c7a6e8436748501608056b934a6b6cd54122f9451a1ca76f3d41568cb0e7a08e4d4f9045083425f42a4171e42b2d32f5e331f87d5b45298e006b909c706d2a100af038001e5a10001ffffffff45fc2d61dd7bf709409c3e5b9021ebd6191901a2a43fa7ed2704c03aa0d3a682000000007b4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9814011825693143f97dc51d34b47638f314146c20c92b5020673fb7411ab37018c2003870255e17d87d46b7af7d042335579de566ce492fd8c3c4e883253870ba329a100af038001e5a10001ffffffff0349f04c4817000000302ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cca79841a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000002c6a2ae5554652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "7a69605f5ecfeb0613c8573cbc4ae2471698a65b60c983ec21fb41f09975c000", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "494c4e8ab19ab73db9fde0454762e50ff3621d9708170083ea9d925918ec0263", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb98140dd5c7a6e8436748501608056b934a6b6cd54122f9451a1ca76f3d41568cb0e7a08e4d4f9045083425f42a4171e42b2d32f5e331f87d5b45298e006b909c706d2a100af038001e5a10001", + "hex": "4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb98140dd5c7a6e8436748501608056b934a6b6cd54122f9451a1ca76f3d41568cb0e7a08e4d4f9045083425f42a4171e42b2d32f5e331f87d5b45298e006b909c706d2a100af038001e5a10001" + }, + "sequence": 4294967295 + }, + { + "txid": "82a6d3a03ac00427eda73fa4a2011919d6eb21905b3e9c4009f77bdd612dfc45", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9814011825693143f97dc51d34b47638f314146c20c92b5020673fb7411ab37018c2003870255e17d87d46b7af7d042335579de566ce492fd8c3c4e883253870ba329a100af038001e5a10001", + "hex": "4c79a276a072a26ba067a565802103da60379d924c2c30ac290d2a86c2ead128cb7bd571f69211cb95356e2dcc5eb9814011825693143f97dc51d34b47638f314146c20c92b5020673fb7411ab37018c2003870255e17d87d46b7af7d042335579de566ce492fd8c3c4e883253870ba329a100af038001e5a10001" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 999.97249609, + "valueZat": 99997249609, + "n": 0, + "scriptPubKey": { + "asm": "a22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802065686d47a4049c2c845a71895a915eb84c04445896eec5dc0be40df0b31372da8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RTsRBYL1HSvMoE3qtBJkyiswdVaWkm8YTK"] + } + }, + { + "value": 200.02740391, + "valueZat": 20002740391, + "n": 1, + "scriptPubKey": { + "asm": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5 OP_CHECKSIG", + "hex": "2103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RVXhz5UCJfSRoTfa4zvBFBrpDBbqMM21He"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN e5554652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e0", + "hex": "6a2ae5554652454500000000bd6767aea3de97aee1bb4354893e2de56a2150680e5aa40ab24716d81c1520e0", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + +export const title = "Rogue: Play the Classic Rogue Game on a Smart Chain"; +export const description = "The Rogue Antara module is an Antara implementation of the classic Unix game, Rogue."; + +# Rogue + +The Rogue Antara module is an Antara implementation of the classic Unix game, Rogue. + +## Tutorial Availability + +An installation, Rogue API, and gameplay walkthrough is available in the [Antara Tutorials section.](/antara/tutorials/rogue-module-tutorial/) + +## bailout + +**cclib bailout 17 '\["gametxid"]'** + +The `bailout` method allows a user to withdraw their character from the game. + +This method is only available when the character is still alive. The character must remain alive until the returned `bailout_txid` is mined. + +Also, the character must have more than `0` gold and must have killed at least `1` monster. Otherwise, the `bailout` method will treat the character as dead, regardless of the character's status. + +When the character successfully bails out from the game, all in-game gold the character has captured is converted into `ROGUE` coins. + +The conversion ratio depends upon the mode of gameplay. + +* Single-player mode: + +``` +ROGUE_satoshis = gold * gold * dungeon_level_on_exit * 10 +``` + +* Multi-player mode: + +``` +ROGUE_satoshis = gold * gold * dungeon_level_on_exit * 20 +``` + +The conversion is facilitated using globally locked `ROGUE` coins. The funds in this global vault automatically accrue through asset-chain activity. In the event that there are not enough globally locked funds at the time the method is executed, the player must simply wait until the funds are generated via automated methods. You can encourage this fund to grow more quickly by encouraging other players and people to transact using ROGUE, as transactions feed the fund. + +The method returns a `hex` value. While most methods in the Komodo API require the user/developer to broadcast the `hex` value using [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction), the Rogue module broadcasts automatically. + +#### Arguments + +| Name | Type | Description | +| -------- | -------- | ---------------------------------------------------------------------------------------------------------------- | +| gametxid | (string) | the `gametxid` transaction id that identifies the game for which the user would like to bail out their character | + +#### Response + +| Name | Type | Description | +| ----------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | (string) | the name of the module | +| method | (string) | the name of the method | +| myrogueaddr | (string) | the address on the Smart Chain for the user's `pubkey` | +| gametxid | (string) | the unique `gametxid` transaction id that identifies this game | +| hex | (string) | a `hex` value containing the relevant game data; this value is broadcast automatically | +| txid | (string) | a `playertxid` transaction id that identifies this unique character; this txid can be used in the future with the `register` method to reuse the character from this game | +| result | (string) | whether the command executed successfully | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=ROGUE cclib bailout 17 '["39b65c12e37f6338b2daf8b7d8d6e1b6c083622590cb7a318daadabc785b73f0"]' +``` + + + ```bash + { + "name": "rogue", + "method": "bailout", + "myrogueaddr": "RVuzXY65FyJiPPWSBc9efATh6nb4M9MceR", + "gametxid": "39b65c12e37f6338b2daf8b7d8d6e1b6c083622590cb7a318daadabc785b73f0", + "hex": "0400008085202f8902261b7562e9ce81a3b666a69cd71c1900bece3e8ca9bb85430076f0de51ef9b8700000000a74ca5a281a1a0819ca28194a067a5658021027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e858140d2f916906d56a615de2c3a04bf7977df9136a7adc793681917bc44656c61c0ef68038ff1072632d5b546b17c9a0f58d5e057c4794f01e54c90a247460d6bd2afa129a5278020446b52761bffb00eaa7a055c9994987ce2120a551fb4dfd01ffae1ffbee6b56b8103020000af03800111a10001fffffffff0735b78bcdaaa8d317acb90256283c0b6e1d6d8b7f8dab238637fe3125cb63902000000a74ca5a281a1a0819ca28194a067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa883058140c08bf9ed2c6ddbe3298fcad23f7397fd17bb76cafada4793acb7a6a4c08908731bdf90ace865fa8111a827d874fbd8f447fecca5982654685365577f1b5e7d36a129a5278020446b52761bffb00eaa7a055c9994987ce2120a551fb4dfd01ffae1ffbee6b56b8103020000af03800111a10001ffffffff0300a60e0000000000302ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc30750000000000002321027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e85ac00000000000000005f6a4c5c1151f0735b78bcdaaa8d317acb90256283c0b6e1d6d8b7f8dab238637fe3125cb63905524f4755450c4c6542726f6e204a616d65730000000021027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e850000000000c04c00000000000000000000000000", + "txid": "194fe36a878fdac853e05c9b48b771a69a9a980c22c803b2ec5c2ceecb719329", + "result": "success" + } + ``` + + +## extract + +**cclib extract 17 '\["gametxid","pubkey"]'** + +The `extract` method allows the user to extract the complete history of a game. This allows the user to view a replay of the game. + +#### Arguments + +| Name | Type | Description | +| -------- | -------- | -------------------------------------------------------------------------------------------------------- | +| gametxid | (string) | the transaction id that was returned after broadcasting the returned hex value from the `newgame` method | +| pubkey | (string) | the `pubkey` of the player for whom the user desires to extract all relevant game data | + +#### Response + +| Name | Type | Description | +| ---------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | (string) | the name of the module | +| method | (string) | the name of the method | +| gametxid | (string) | the transaction id that was returned after broadcasting the returned hex value from the `newgame` method | +| rogueaddr | (string) | the address for the `pubkey` | +| status | (string) | whether the command executed successfully | +| keystrokes | (string) | all keyboard strokes concatenated into a single hex string | +| numkeys | (number) | the total number of keystrokes (ASCII symbols) | +| playertxid | (string) | the `playertxid` transaction id that represents the character belonging to the indicated `pubkey` | +| extracted | (string) | the gameplay progress extracted via the `keystrokes` replay feature | +| seed | (decimal number) | the blockchain-generated random seed. This provides the necessary randomization for players to generate the current game's level design. The `seed` value is revealed at the `start` block height. | +| replay | (string) | the complete terminal command that must be executed to begin this game | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=ROGUE cclib extract 17 '["6bb0efcb14cd5101a4d8d8865c6a93162aa9480c5d3e0ce33902193cebdc4c39","0325151cf0f7321d0cde232898c5adc6b60f32df71b79af3a49d10020d42925ae9"]' +``` + + + ```bash + { + "name": "rogue", + "method": "extract", + "gametxid": "6bb0efcb14cd5101a4d8d8865c6a93162aa9480c5d3e0ce33902193cebdc4c39", + "rogueaddr": "RJHD68KaUg14DaooPz5VFXeTTh8qdpEseb", + "status": "success", + "keystrokes": "772a2064572a20636868686a68686866686868686868686868686868686c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6b6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c686a686a68686c6b6c6c6c6a6c6a6a6a6c6a6a6a6a6a686a6868686868686a6a686a6a6c6c6c6c6c6c6c6c6c6a6a6a6a6a6a6a6a6a6a686b6b6b6c6b6b6b6b6b6b68686868686868686b6b68206b686868686868686868686868686868686868686868686a6a6a6a686868686868686868686b686b686c6c6a6a6a6c6a6c6a6a6a6a6a6a6c6c6c6c6c6c6c6c6c6c6a6a6a686b6c6b6b6b686868686868686868686b6b6b6b68686868686868686868686868686c6c6c6c206c6c686868686868686b6b68686868206868686a6c6c6a6a6a6a6a6a68686868686868686868686a6a6a666a686868686b686c206c6920207170686c6c206a6b206a6920207270686b6c6c6c6c6c6c6c6c6b686b6b6b6c6c6c6c6c6c6c6c6b6b20666b6b6b6b686868686868686868686b6b686b6b6b6b6b6b6b6c6c6c6c6b6b6b6b6c6c6c6c6c6c6c6c6c6c6a6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6a206868686868686868686868666c6c6c6c6c6a6c6c6c6c6c6c6c6c6a6a6a68686868686868686868686868686a6a6a6a6a6a6a6a6c6c6c6c6c6c6c6c6c6a6a6a68686868683e6c686668686b68206c206c6a686a6a6a6a6a6a6a206b6b666a6a6c6c6a6c6c6c6c6868686868686868686868686868686868686868686868686868686868686868686a6a6a686868686868686868686b68686868686868686868206869206868646c6c6c6c6b6b686b6b6b6b6c6c6c6c6b6b6b6868686868686b6b6b6b6b6b6b68686868686868686868686b6b6b6b6b6c6c6c6c6c6c6c6c6c6c6c20686868666c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6a6a6a6c6c6c6c6c6c206868686c6c6c20666b6b6920646a6c64696a686c6c6b206a692071202020726d6b6a6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6a6a6a6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c73736868686868686868686868686868686868686868686868686868686868686868686b6b6b686868686868686868686868686a686a6a6a6a6a6c6c6c6c6c6c6c6c6c6c206c6c6c206c6c6c6c206c6a6a6a6a6a6868686868686868686b6b6b6868686868206a20206c206c6c206c6c206c20", + "numkeys": 884, + "playertxid": "aeea6d8b3f50391a4bd477761e4d15ce3872ca6eccdfdb0fe40dd35868924c48", + "extracted": "$$$gold.288 hp.52 strength.16/16 level.6 exp.271 dl.2", + "seed": 4344864534442616921, + "replay": "cc/rogue/rogue 4344864534442616921" + } + ``` + + +## gameinfo + +**cclib gameinfo 17 '\["gametxid"]'** + +The `gameinfo` method returns relevant information about the indicated `gametxid` game. + +#### Arguments + +| Name | Type | Description | +| -------- | -------- | -------------------------------------------------------------------------------------------------------- | +| gametxid | (string) | the transaction id that was returned after broadcasting the returned hex value from the `newgame` method | + +#### Response + +| Name | Type | Description | +| ---------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | (string) | the name of the module | +| method | (string) | the name of the method | +| gametxid | (decimal number) | the indicated `gametxid` transaction id | +| result | (string) | whether the command executed successfully | +| gameheight | (decimal number) | the block height at which this `gametxid` was created | +| height | (decimal number) | this value is the same as the `gameheight` value above | +| start | (decimal number) | the block height at which the seed will be revealed | +| starthash | (string) | the hash of the `start` block | +| seed | (decimal number) | the blockchain-generated random seed. This provides the necessary entropy for players to generate the current game's level design. The `seed` value is revealed at the `start` block height. | +| run | (string) | the complete terminal command that must be executed to begin this game | +| alive | (decimal number) | the number of players still alive in the game | +| numplayers | (decimal number) | the total number of players that joined the game | +| maxplayers | (decimal number) | the max number of players the game allows | +| buyin | (number) | the amount of `ROGUE` coins required for a player to join | +| players | (array of strings) | an array containing the identifying transaction ids of each player | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=ROGUE cclib gameinfo 17 '["b9ab1c3b9a1dceea75d0d87b927a03d8519743d4d64b9be061c40fdd5e4f5026"]' +``` + + + ```json + { + "name": "rogue", + "method": "gameinfo", + "gametxid": "b9ab1c3b9a1dceea75d0d87b927a03d8519743d4d64b9be061c40fdd5e4f5026", + "result": "success", + "gameheight": 19587, + "height": 19587, + "start": 19587, + "starthash": "0003a5ed4715220a742a6c2381daa5d49d29fa56189c7d676985902734e71e2e", + "seed": 2991956025523248686, + "run": "./komodo-cli -ac_name=ROGUE cclib register 17 '["b9ab1c3b9a1dceea75d0d87b927a03d8519743d4d64b9be061c40fdd5e4f5026"]'", + "alive": 0, + "numplayers": 0, + "maxplayers": 1, + "buyin": 0.0, + "players": [] + } + ``` + + +## games + +**cclib games 17** + +The `games` method displays a list of the user's unfinished and finished games. + +#### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +#### Response + +| Name | Type | Description | +| --------- | ------------------ | --------------------------------------------------------------------------------------------- | +| name | (string) | the name of the module | +| method | (string) | the name of the method | +| pastgames | (array of strings) | an array of `gametxid` transaction ids of finished games, from the user's local wallet file | +| games | (array of strings) | an array of `gametxid` transaction ids of unfinished games, from the user's local wallet file | +| numgames | (decimal number) | the total number of games, from the user's local wallet file | + +#### 📌 Examples + +Command: + +```bash + ./komodo-cli -ac_name=ROGUE cclib games 17 +``` + + + ```json + { + "name": "rogue", + "method": "games", + "pastgames": [ + "2d1010473c9675a3e04e84fe191404926761f324e4053a0f859d4806f68bbf25", + "39b65c12e37f6338b2daf8b7d8d6e1b6c083622590cb7a318daadabc785b73f0", + "790b94addb0c19399a7afedbb7580268f4fc8a3d91a600af6729c4d73fdb6498", + "bbdecbb3b037e299dd5b303a11e4839e5625c94ce4e36acd3b7b549fec342ad3", + ... + ... + ... + "43244d4be57564ef441fe8790bb08e23787244f533c9591ab3adb9cf755e9eed", + "0199a50d45e56060ded6aa30e3ce4ae8ed090c0033c78e3e024aef403277a207", + "a3833e860ff02d178f431032952f947f7e0c485690d9dd7e6e8133813f253a34", + ], + "games": [ + "b94a0c14604df04a994e8fde610af7ddede76a62e1e3d86bbdac18e695662301", + "3443ad3112908b31cab74ec7094c294d337aad5253e4e1af35eaac1f31ed7ab3", + ... + ... + ... + "dd859a7a9c980e7a5018913de98e48515a96b1ac54b39515e2cca3efed9659eb" + ], + "numgames": 140 + } + ``` + + +## highlander + +**cclib highlander 17 '\["gametxid"]'** + +The `highlander` method allows a character to exit the game and claim the `buyin` prize funds. + +In single-player mode, the `highlander` method is available after safely retrieving the `amulet` and exiting the dungeon. + +In multi-player mode, the `highlander` method is available either to the character that is the last man standing, or to any character that successfully retrieves the `amulet` and exits the dungeon. + +### Highlander Rewards + +The character that successfully executes the `highlander` method receives an increased ratio of conversion from in-game gold to `ROGUE` coins. The ratio depends upon the mode of gameplay; see below for further details. + +The conversion is facilitated using globally locked `ROGUE` coins. The funds in this global vault automatically accrue through asset-chain activity. In the event that there are not enough globally locked funds at the time the `highlander` method is executed, the player must wait until the funds are generated via automated methods. You can encourage this fund to grow more quickly by encouraging other players and people to transact using ROGUE, as transactions feed the fund. + +#### Rewards in Single-Player Mode + +``` +ROGUE_satoshis = gold * gold * dungeon_level_on_exit * 10 +``` + +#### Rewards in Multi-Player Mode + +``` +ROGUE_satoshis = gold * gold * dungeon_level_on_exit * 20 +``` + +#### Arguments + +| Name | Type | Description | +| -------- | -------- | ---------------------------------------------------------------------------------------------------------------- | +| gametxid | (string) | the `gametxid` transaction id that identifies the game for which the user would like to bail out their character | + +#### Response + +| Name | Type | Description | +| ----------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | (string) | the name of the module | +| method | (string) | the name of the method | +| myrogueaddr | (string) | the address on the Smart Chain for the user's `pubkey` | +| gametxid | (string) | the unique `gametxid` transaction id that identifies this game | +| txid | (string) | a `playertxid` transaction id that identifies this unique character; this txid can be used in the future with the `register` method to reuse the character from this game | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=ROGUE cclib highlander 17 '["b94a0c14604df04a994e8fde610af7ddede76a62e1e3d86bbdac18e695662301"]' +``` + + + ```bash + { + "name": "rogue", + "method": "highlander", + "myrogueaddr": "RVuzXY65FyJiPPWSBc9efATh6nb4M9MceR", + "gametxid": "b94a0c14604df04a994e8fde610af7ddede76a62e1e3d86bbdac18e695662301", + "result": "success", + "hex": "hex", + "txid": "txid" + } + ``` + + +## keystrokes + +**cclib keystrokes 17 '\["gametxid","keystrokes"]'** + +The `keystrokes` method executes the indicated `keystroke` for the indicated `gametxid`. + +The player's keystrokes on the keyboard are recorded in ASCII format. [See this link](https://theasciicode.com.ar/) for a table of ASCII keyboard translations. + +After a game concludes the complete list of keystrokes can be found in the `~/komodo/src/keystrokes.log` file. + +#### Arguments + +| Name | Type | Description | +| ---------- | -------- | ---------------------------------------------------------------------------------------------------------------- | +| gametxid | (string) | the `gametxid` transaction id that identifies the game for which the user would like to bail out their character | +| keystrokes | (string) | the desired keystrokes, provided in ASCII format and concatenated into a single string | + +#### Response + +| Name | Type | Description | +| ---------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| name | (string) | the name of the module | +| method | (string) | the name of the method | +| gametxid | (string) | the unique `gametxid` transaction id that identifies this game | +| keystrokes | (string) | the desired keystrokes, provided in ASCII format and concatenated into a single string | +| batontxid | (string) | the unique `batontxid` transaction id; this value is useful for tracing the route of a utxo/token through the blockchain database | +| playertxid | (string) | the unique identifying transaction id of this player | +| hex | (string) | a `hex` value containing the relevant game data; this value is broadcast automatically | +| txid | (string) | a unique transaction id for the `keystrokes` transaction | +| result | (string) | whether the command executed successfully | +| error | (string) | error messages are returned here | +| id | (string) | the returned value here, `jl777`, is constant and can be ignored | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=ROGUE cclib keystrokes 17 '["777ba510824b467e9ddfb00a075e9cd5c6f73d1fa6f772b1a22563502def25ee","6a68686868686866686820686868682068686868206868666868686c6c6c6c6a6a6a6a6a6a6a6a6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6a6a6a68666b"]' +``` + + + ```bash + { + "result":{ + "name":"rogue", + "method":"keystrokes", + "gametxid":"777ba510824b467e9ddfb00a075e9cd5c6f73d1fa6f772b1a22563502def25ee", + "keystrokes":"6a68686868686866686820686868682068686868206868666868686c6c6c6c6a6a6a6a6a6a6a6a6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6a6a6a68666b", + "batontxid":"3d9b93fb784852c5899f5cfa11b0c24f185835169781755027cb7e04fe4a7463", + "playertxid":"0000000000000000000000000000000000000000000000000000000000000000", + "hex":"0400008085202f890163744afe047ecb2750758197163558184fc2b011fa5c9f89c5524878fb939b3d00000000a74ca5a281a1a0819ca28194a067a5658021027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e85814086ad1e7babe52189c9201acae2a031284ebba0fa5841f4e35a475c9eb267140d535b96e2379b2c99332c4f5efdbddcb5cd850301b9ffe1ba6de139696cea5439a129a5278020446b52761bffb00eaa7a055c9994987ce2120a551fb4dfd01ffae1ffbee6b56b8103020000af03800111a10001ffffffff029063a70000000000302ea22c80202ba0b269f75c72a0ce23e03812814b1e76a8fd57b3e75fee8b37bfef2b4ebf3581031210008203000401cc0000000000000000ad6a4caa114bee25ef2d506325a2b172f7a61f3df7c6d59c5e070ab0df9d7e464b8210a57b7763744afe047ecb2750758197163558184fc2b011fa5c9f89c5524878fb939b3d21027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e85456a68686868686866686820686868682068686868206868666868686c6c6c6c6a6a6a6a6a6a6a6a6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6a6a6a68666b00000000a6b900000000000000000000000000", + "txid":"1fc6543d4aa577e976f9cb449835fe633510e169e00ceff243ca2791d68aec1c", + "result":"success" + }, + "error":null, + "id":"jl777" + } + ``` + + +## newgame + +**cclib newgame 17 '\[maxplayers, buyin]'** + +The `newgame` method creates a new game. + +The `buyin` argument is required for multi-player games. The coins contributed via `buyin` become a winner-takes-all pot. Either the first player to claim the `amulet` and return from the dungeon, or the last player standing; may claim this prize using the [highlander](/antara/api/rogue/#highlander) method. + +#### Arguments + +| Name | Type | Description | +| ---------- | ---------------------------------------- | ----------------------------------------------------------------------------------- | +| maxplayers | (decimal number) | the max number of players; if set to `1`, the game begins in single-player mode | +| buyin | (number, required if `maxplayers` > `1`) | the required amount to contribute per player; the winner receives all `buyin` coins | + +#### Response + +| Name | Type | Description | +| ---------- | ---------------- | -------------------------------------------------------------------------------------- | +| name | (string) | the name of the module | +| method | (string) | the name of the method | +| maxplayers | (decimal number) | the max number of players for this game | +| buyin | (number) | the required amount to contribute per player; the winner receives all `buyin` coins | +| type | (string) | the level of difficulty for this game | +| hex | (string) | a `hex` value containing the relevant game data; this value is broadcast automatically | +| txid | (string) | a transaction id that represents the `gametxid` | +| result | (string) | whether the command executed successfully | + +#### 📌 Examples + +Command for a single-player training game: + +```bash +./komodo-cli -ac_name=ROGUE cclib newgame 17 "[1]" +``` + + + ```json + { + "name": "rogue", + "method": "newgame", + "maxplayers": 1, + "buyin": 0.0, + "type": "newbie", + "hex": "0400008085202f8901018feb110a6e0d8751a158b3e73dac07383c83766a83908d641f2d4b1db6f704010000007b4c79a276a072a26ba067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa8830581405349ce7a0a3823ca35e3dc30d17c8d8f170bfea89373166f14b8b4f04d36c34a41199ad448074be74b7a6344d0c36b4f68748f976f3f95b7d0c8ec84e54bf773a100af03800111a10001ffffffff061027000000000000302ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc40420f0000000000302ea22c80208958791fdd38bdf532c97f1691fd231a3f1f5c0c3cd28b68d7383c8b1078828e81031210008203000401cc1027000000000000302ea22c80208958791fdd38bdf532c97f1691fd231a3f1f5c0c3cd28b68d7383c8b1078828e81031210008203000401cc00b8880000000000302ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc10270000000000002321027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e85ac0000000000000000106a0e114700000000000000000100000000000000964c00000000000000000000000000", + "txid": "b9ab1c3b9a1dceea75d0d87b927a03d8519743d4d64b9be061c40fdd5e4f5026", + "result": "success" + } + ``` + + +## pending + +**cclib pending 17** + +The `pending` method displays a list of unfinished games on the Smart Chain. + +#### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +#### Response + +| Name | Type | Description | +| ---------- | ------------------ | --------------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| name | (string) | the name of the module | +| method | (string) | the name of the method | +| pending | (array of strings) | an array of `gametxid`'s that represent unfinished games on the Smart Chain | +| numpending | (decimal number) | the total number of unfinished games on the Smart Chain | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=ROGUE cclib pending 17 +``` + + + ```json + { + "result": "success", + "name": "rogue", + "method": "pending", + "pending": [ + "19de2b0f2562ae775ef213d1e396bc741ccc4f32bac32b36e8ee5da25e451801", + "ff5139cfcb47366674f52c550cfb9c11eb298afa1479ce9924d8bac2a407d701", + "8f3e6104ee324bc6a60430ef9485c682ee890cdb0660e9a747599531fecea203", + ... + ... + ... + "ff9d5e111caaa0e84666ce6e0fda66e93e4fb13ca2dd0debbdc82e663b36d9fc" + ], + "numpending": 175 + } + ``` + + +## playerinfo + +**cclib playerinfo 17 '\["playertxid"]'** + +The `playerinfo` method displays information about the currently active character. + +##### Tips on Finding Character Information + +There are occasions where the developer may wish to start with the `tokentxid` of a character(s) and from there find the most up-to-date `playertxid`. + +The following is one solution: + +* If necessary, obtain a list of all `tokens` on the Smart Chain via the [tokenlist](/antara/api/tokens/#tokenlist) method. +* For each item in the response, execute an iterative function that executes the [playerinfo](/antara/api/rogue/#playerinfo) method on the individual `token`. + * If the method responds with an error, this means that the supplied `token` does not represent a character. Rather, it represents another on-chain asset, and therefore the token can be ignored. +* For each response from the `playerinfo` method check two elements: whether the data contains a `batontxid`; whether the character is alive. + * If there is a `batontxid`, the `playertxid` has been used in a game and is no longer valid. Therefore, this `playertxid` can be ignored. + * Likewise, if the character is no longer alive, it can be ignored. +* Each `token` that has a valid response, no `batontxid`, and represents a living character can be considered the correct `tokentxid` for the discovered `playertxid`. + +#### Arguments + +| Name | Type | Description | +| -------- | -------- | ---------------------------------------------------------------------------------------------------------------- | +| gametxid | (string) | the `gametxid` transaction id that identifies the game for which the user would like to bail out their character | + +#### Response + +| Name | Type | Description | +| ------------ | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| name | (string) | the name of the module | +| method | (string) | the name of the method | +| player | (json object) | a json object containing relevant player data | +| playertxid | (string) | the unique identifying transaction id of this player | +| tokenid | (string) | the unique transaction id that represents this character as a non-fungible asset for on-chain trading using the [Tokens CC](/antara/api/tokens/#introduction) module | +| data | (string) | the character-state information in hex form | +| pack | (array of strings) | an array containing the items in the character's pack | +| packsize | (number) | the number of items in the character's pack | +| hitpoints | (number) | see [this linked manual](https://docs-archive.freebsd.org/44doc/usd/30.rogue/paper.pdf) for further information | +| strength | (number) | see [this linked manual](https://docs-archive.freebsd.org/44doc/usd/30.rogue/paper.pdf) for further information | +| level | (number) | see [this linked manual](https://docs-archive.freebsd.org/44doc/usd/30.rogue/paper.pdf) for further information | +| experience | (number) | see [this linked manual](https://docs-archive.freebsd.org/44doc/usd/30.rogue/paper.pdf) for further information | +| dungeonlevel | (number) | see [this linked manual](https://docs-archive.freebsd.org/44doc/usd/30.rogue/paper.pdf) for further information | +| chain | (string) | the name of the Smart Chain on which this game is occurring | +| pname | (string) | the name of the user's currently active character | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=ROGUE cclib playerinfo 17 '["cf2ae0997e24f100aa9da3cda747105e3134a102da69630d6d1683a6f0f7b0ab"]' +``` + + + ```json + "{ + "result": "success", + "name": "rogue", + "method": "playerinfo", + "player": { + "playertxid": "cf2ae0997e24f100aa9da3cda747105e3134a102da69630d6d1683a6f0f7b0ab", + "tokenid": "929ff2101e974111499f37f2af86280f403f9e704c070a9225398aa5ce83c1cf", + "data": "580000000c0000001000000001000000070000000700000001000000000000003a0000000000000003000000000000000000000000000000000000001000000000000000000000000000000000000000000000005d00000000000000010000000100000000000000000000000600000012000000000000000000000000000000000000000000000029000000ffffffff010000000000000001000000010000000000000012000000000000003278340000000000317833000000000029000000ffffffff0100000002000000010000000000000000000000120000000000000031783100000000003178310000000000290000000200000026000000030000000000000000000000000000001e00000000000000317831000000000032783300000000002100000000000000010000000a00000000000000000000000b0000001000000000000000307830000000000030783000000000002100000000000000010000000200000000000000000000000b000000100000000000000030783000000000003078300000000000", + "pack": [ + "3 rations of food", + "+1 ring mail [protection 4]", + "A +1,+1 mace", + "A +1,+0 short bow", + "38 +0,+0 arrows", + "A potion of haste self(topaz)", + "A potion of poison(amber)" + ], + "packsize": 7, + "hitpoints": 12, + "strength": 16, + "level": 1, + "experience": 7, + "dungeonlevel": 1, + "chain": "ROGUE", + "pname": "fred" + } + }" + ``` + + +## players + +**cclib players 17** + +The `players` method displays a list of all `playertxid` transaction ids held in the user's current `pubkey`. + +#### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +#### Response + +| Name | Type | Description | +| ------------- | ------------------ | ------------------------------------------------------------------------------- | +| name | (string) | the name of the module | +| method | (string) | the name of the method | +| playerdata | (array of strings) | an array containing all `playertxid` transaction ids in the user's local wallet | +| numplayerdata | (decimal number) | the number of `playertxid` transaction ids in the `playerdata` array | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=ROGUE cclib players 17 +``` + + + ```json + { + "name": "rogue", + "method": "players", + "playerdata": [ + "cf2ae0997e24f100aa9da3cda747105e3134a102da69630d6d1683a6f0f7b0ab", + "1a705d1e900ac760afd5bb24e0d6c40ce6bf10f42d3344559ad18ddfa6ee08bc", + "5ebd33eb9d62d977bf8d600d84fec1a6a6046a7a171bff64fa9548f05c8caddd" + ], + "numplayerdata": 3 + } + ``` + + +## register + +**cclib register 17 '\["gametxid"(,"playertxid")]'** + +The `register` method registers your character for a game. + +The optional `playertxid` allows the user to reuse a character that survived a previous game. + +For the `playertxid` argument to properly call an existing character, the user's daemon must be set to the `pubkey` that owns the `playertxid`. This can be accomplished either through the [pubkey](/smart-chains/setup/common-runtime-parameters/#pubkey) launch parameter or through the [setpubkey](/smart-chains/api/wallet/#setpubkey) method. + +#### Arguments + +| Name | Type | Description | +| ---------- | ------------------ | ----------------------------------------------------------------------------- | +| gametxid | (string) | the `gametxid` of the game the user desires to join | +| playertxid | (string, optional) | the `playertxid` of an existing character the user owns and would like to use | + +#### Response + +| Name | Type | Description | +| ---------- | ---------------- | ------------------------------------------------------------------------- | +| name | (string) | the name of the module | +| method | (string) | the name of the method | +| maxplayers | (decimal number) | the max number of players allowed in this game | +| buyin | (number) | the required `buyin` amount of `ROGUE` coins to enter the game | +| type | (string) | the level of difficulty for this game | +| hex | (string) | a `hex` value of registration data; this value is broadcast automatically | +| txid | (string) | a transaction id that indicates the `playertxid` for this character | +| result | (string) | whether the command executed successfully | + +#### 📌 Examples + +Command (registration without player): + +```bash +./komodo-cli -ac_name=ROGUE cclib register 17 '["b9ab1c3b9a1dceea75d0d87b927a03d8519743d4d64b9be061c40fdd5e4f5026"]' +``` + + + ```json + { + "name": "rogue", + "method": "register", + "maxplayers": 1, + "buyin": 0.0, + "type": "newbie", + "hex": "0400008085202f890126504f5edd0fc461e09b4bd6d4439751d8037a927bd8d075eace1d9a3b1cabb901000000a74ca5a281a1a0819ca28194a067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa883058140a1f23cbe9d8e7a20306df4c86da47b4ae3b59556742b7fcdf68f6f3549b02d734879b94fd73f5847914d448e4d78e48d415bffe55081a491e242ec6256f02638a129a5278020446b52761bffb00eaa7a055c9994987ce2120a551fb4dfd01ffae1ffbee6b56b8103020000af03800111a10001ffffffff03301b0f0000000000302ea22c80202ba0b269f75c72a0ce23e03812814b1e76a8fd57b3e75fee8b37bfef2b4ebf3581031210008203000401cc0100000000000000302ea22c80207f0205ad6b02be91baf2a56dcc77381e7b0e19cb9a83dfb9530316958f5b706781032210008203000401cc0000000000000000446a42115226504f5edd0fc461e09b4bd6d4439751d8037a927bd8d075eace1d9a3b1cabb9000000000000000000000000000000000000000000000000000000000000000000000000bd4c00000000000000000000000000", + "txid": "855802e2e83d0d4632518959e4ff9e840ed9838f51bd6b3a80dc27b8ea7900ba", + "result": "success" + } + ``` + + +## setname + +**cclib setname 17 '\["pname"]'** + +The `setname` method sets the name of a character. + +A character may receive a `name` at any point, but the character's name may be set only once. It is not possible to rename a character. + +#### Arguments + +| Name | Type | Description | +| ----- | -------- | ---------------------------------------------------------- | +| pname | (string) | the desired name for the user's currently active character | + +#### Response + +| Name | Type | Description | +| ------ | -------- | ---------------------------------------------------------- | +| name | (string) | the name of the module | +| method | (string) | the name of the method | +| result | (string) | whether the command executed successfully | +| pname | (string) | the desired name for the user's currently active character | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=ROGUE cclib setname 17 '["SuperMegaWarrior"]' +``` + + + ```json + { + "name": "rogue", + "method": "setname", + "result": "success", + "pname": "SuperMegaWarrior" + } + ``` + +export const title = "Sudoku: Play Sudoku on a Smart Chain"; +export const description = "The Sudoku Antara Module serves as a proof-of-concept to demonstrate Antara's capabilities as a blockchain-based gaming technology."; + +# Sudoku + +## Introduction + +The Sudoku Antara Module serves as a proof-of-concept to demonstrate Antara's capabilities as a blockchain-based gaming technology. + +The Sudoku Module is based on the classic game, Sudoku. To learn more about how Sudoku is played, read the associated Wikipedia article: + +[Link to Sudoku Wikipedia article](https://en.wikipedia.org/wiki/Sudoku) + +The procedures to launch and finish a game require the execution of various Remote Procedure Calls (RPCs). By design, the Sudoku Module assumes the user relies on the associated Sudoku GUI software. The GUI is required because the UNIX timestamp for each gameplay event must pass trough the Sudoku RPC captcha protection, as this deters bots. + +The following installation and walkthrough tutorials can assist the reader in setting up and playing the Sudoku game. For more information, please reach out to our community on [Discord](https://komodoplatform.com/discord). The #cc-sudoku channel is available for questions and assistance. + +#### Sudoku Module Flow + +* Create a puzzle using the [gen](/antara/api/sudoku/#gen) method + * commit the amount of `SUDOKU` coins that will serve as a bounty for the first node to complete this puzzle +* Find a puzzle to solve using the [pending](/antara/api/sudoku/#pending) method +* Gather additional information about any puzzle using the [txidinfo](/antara/api/sudoku/#txidinfo) method +* Propose a solution for a puzzle using the [solution](/antara/api/sudoku/#solution) method + +## Installation + +### Requirements + +Sudoku is currently playable on Linux machines. + +OSX and Windows compatible bundles will be ready as soon as possible. Please ask on our #cc-sudoku channel on [Discord](https://komodoplatform.com/discord) for updates. + +The Komodo Sudoku software bundle (also called "Komodoku") for Ubunutu Linux comes complete with all necessary software. To download the bundle, please visit the link below: + +[Link to "Komodoku" Software Bundle](https://github.com/tonymorony/Komodoku/releases) + +To manually compile the software, follow the instructions below. + +### Install Dependencies + +#### Linux + +```bash +sudo apt-get update && sudo apt-get upgrade -y +sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libgtest-dev libqt4-dev libqrencode-dev libdb++-dev ntp ntpdate software-properties-common curl libcurl4-gnutls-dev cmake clang libsodium-dev -y +``` + +### Clone & Compile Komodo + +#### Linux + +```bash +cd ~ +git clone https://github.com/jl777/komodo +cd komodo +git checkout FSM +make clean +./zcutil/fetch-params.sh +./zcutil/build.sh -j$(nproc) +``` + +Wait for the build process to finish, and then continue with the following commands: + +```bash +cd src/cc +./makecclib +cp sudokucc.so ../libcc.so +cd ../.. +make -j$(nproc) +``` + +### Update `komodod` + +```bash +cd ~/komodo +git checkout FSM +git pull +make clean +./zcutil/build.sh -j$(nproc) +``` + +Wait for the build process to finish, and then continue with the following commands: + +```bash +cd src/cc +./makecclib +cd ../.. +make -j$(nproc) +``` + +### Set `pubkey` value + +Ensure the working directory is correct: + +```bash +cd ~/komodo/src +``` + +#### Step 1 - Start the chain + +Start the SUDOKU chain with the following command in a terminal window and wait for the daemon to sync. Keep this terminal open and the daemon running for the duration of your Sudoku gameplay. + +```bash +./komodod -ac_name=SUDOKU -ac_supply=1000000 -addnode=5.9.102.210 -gen -genproclimit=1 -ac_cclib=sudoku -ac_perc=10000000 -ac_reward=100000000 -ac_cc=60000 -ac_script=2ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc & +``` + +#### Step 2 + +Open a new terminal. This terminal can be used to execute all remaining installation and gameplay commands. + +```bash +./komodo-cli -ac_name=SUDOKU getnewaddress +``` + +The returned value is a SUDOKU address. We need to find the associated pubkey for this address. + +#### Step 3 + +Use the `validateaddress` method with the address. + +```bash +./komodo-cli -ac_name=SUDOKU validateaddress insert_address_here +``` + +The `validateaddress` method will return information similar to the following: + +```json +{ + "isvalid": true, + "address": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "scriptPubKey": "76a91498b5caa42ffe9868844c51ba6e085e5e7e92fc2588ac", + "segid": 13, + "ismine": true, + "iswatchonly": false, + "isscript": false, + "pubkey": "02f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2", + "iscompressed": true, + "account": "" +} +``` + +Look for the `pubkey` value: + +```bash +"pubkey": "02f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2", +``` + +This is the `pubkey` for our address. + +#### Step 4 + +Set the pubkey for the SUDOKU Smart Chain. + +```bash +./komodo-cli -ac_name=SUDOKU setpubkey 02f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2 +``` + + + ```json + { + "address": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "ismine": true, + "pubkey": "02f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2" + } + ``` + + +The pubkey is now set. + +To reuse this pubkey in the future, include the pubkey as a [pubkey](/smart-chains/setup/common-runtime-parameters/#pubkey) launch parameter. + +For example: + +```bash +./komodod -ac_name=SUDOKU -ac_supply=1000000 -pubkey=02f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2 -addnode=5.9.102.210 -gen -genproclimit=1 -ac_cclib=sudoku -ac_perc=10000000 -ac_reward=100000000 -ac_cc=60000 -ac_script=2ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc & +``` + +### Install Sudoku Graphical User Interface (GUI) + +The Komodo team offers an unofficial graphical user interface (GUI) to assist the user with Sudoku-puzzle solving visualization. By design, the Sudoku module assumes the user relies on the associated Sudoku GUI software. The GUI is required because the UNIX timestamp for each gameplay event must pass trough the Sudoku RPC captcha protection, as this deters bots. + +Download the portable GUI bundle from the following link: + +[Link to GUI Software Bundle](https://github.com/tonymorony/Komodoku/releases) + +To manually compile the GUI from source code, follow the steps below. Please note that the GUI is based on `python2`. + +#### Linux + +##### Install Dependencies + +```bash +sudo apt-get install python-pygame libgnutls28-dev +pip install requests wheel slick-bitcoinrpc pygame +``` + +##### Install the GUI + +```bash +git clone https://github.com/tonymorony/Komodoku +cd Komodoku +``` + +#### Start Sudoku GUI + +```bash +python Sudoku.py +``` + +## gen + +**cclib gen 17** + +The generate method creates a new Sudoku puzzle. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +#### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +#### Response + +Daemon `stdout`: + +| Name | Type | Description | +| ------------------------------------ | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| (solved Sudoku puzzle, visualized) | (string, multi-line) | an ASCII-character representation of the generated Sudoku puzzle, with all solutions in place | +| (unsolved Sudoku puzzle, visualized) | (string, multi-line) | an ASCII-character representation of the generated Sudoku puzzle, with numbers removed for gameplay | +| (numbers remaining) | (string) | a description of how many numbers are remaining to solve in the Sudoku puzzle | +| (Sudoku Puzzle - integer) | (number, multi-line) | a multi-line number-based representation of the solved Sudoku puzzle; no visual embellishments | +| solve | (number) | a number-based concatenated representation of the unsolved Sudoku puzzle; `0`'s represent empty spaces in the puzzle | +| score | (string) | `score` returns three values: the difficulty of the puzzle calculated by the generator, the solution in concatenated format, the number of numbers left to fill | + +json output: + +| Name | Type | Description | +| ------ | -------- | ------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| name | (string) | name of the module | +| method | (string) | name of the method | +| srand | (number) | the seed of the non-blockchain based puzzle that is creating RNG | +| amount | (number) | the reward provided to the first node to submit the correct solution | +| hex | (string) | a `hex` value representing the encoded data; this must be broadcast using `sendrawtransaction` | +| txid | (string) | a transaction id representing the generation of this Sudoku puzzle, also called the `puzzle_txid` | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=SUDOKU cclib gen 17 +``` + + + ```bash + ----------------------------------- + | 2 : 5 : 7 | 1 : 3 : 6 | 9 : 8 : 4 | + |- - - - - -|- - - - - -|- - - - - -| + | 8 : 9 : 1 | 4 : 5 : 7 | 3 : 2 : 6 | + |- - - - - -|- - - - - -|- - - - - -| + | 3 : 6 : 4 | 9 : 2 : 8 | 7 : 1 : 5 | + |-----------+-----------+-----------| + | 6 : 8 : 9 | 5 : 7 : 4 | 2 : 3 : 1 | + |- - - - - -|- - - - - -|- - - - - -| + | 4 : 2 : 3 | 6 : 8 : 1 | 5 : 9 : 7 | + |- - - - - -|- - - - - -|- - - - - -| + | 1 : 7 : 5 | 2 : 9 : 3 | 6 : 4 : 8 | + |-----------+-----------+-----------| + | 7 : 3 : 6 | 8 : 1 : 9 | 4 : 5 : 2 | + |- - - - - -|- - - - - -|- - - - - -| + | 9 : 1 : 2 | 7 : 4 : 5 | 8 : 6 : 3 | + |- - - - - -|- - - - - -|- - - - - -| + | 5 : 4 : 8 | 3 : 6 : 2 | 1 : 7 : 9 | + ----------------------------------- + ----------------------------------- + | 2 : 5 : | 1 : : | : 8 : 4 | + |- - - - - -|- - - - - -|- - - - - -| + | : 9 : | : 5 : | 3 : 2 : | + |- - - - - -|- - - - - -|- - - - - -| + | 3 : : 4 | : 2 : 8 | : 1 : | + |-----------+-----------+-----------| + | : : 9 | : : | : : 1 | + |- - - - - -|- - - - - -|- - - - - -| + | : 2 : | 6 : : | : : 7 | + |- - - - - -|- - - - - -|- - - - - -| + | 1 : : | : : 3 | : 4 : | + |-----------+-----------+-----------| + | : : | : 1 : | : : | + |- - - - - -|- - - - - -|- - - - - -| + | : : | 7 : : | : : | + |- - - - - -|- - - - - -|- - - - - -| + | 5 : : | : : 2 | : : | + ----------------------------------- + *** 26 numbers left *** + 257136984 + 891457326 + 364928715 + 689574231 + 423681597 + 175293648 + 736819452 + 912745863 + 548362179 + solve: 250100084090050320304028010009000001020600007100003040000010000000700000500002000 + 1:1 score: 898 257136984891457326364928715689574231423681597175293648736819452912745863548362179 26 + ``` + + + + ```json + { + "result": "success", + "name": "sudoku", + "method": "gen", + "srand": -678890453, + "amount": 898.0, + "hex": "0400008085202f890159a377ff60f9c0173b2de965fa902608490c339626642e5bcfeea4fd13facbf4010000007b4c79a276a072a26ba067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa883058140460886e61f55924af187b34ed1bffe114bc4af194ab57c9e50301ea9c134135d00dc34c44a42b1ba54390da0b8c2637239a008b6b11fee535be5aecfd73e10b9a100af03800111a10001ffffffff041027000000000000302ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc00427fe814000000302ea22c802033c7f0d5d7327fbe86a1c94d56a6acbc59b2d24e00ed83864bfbf9e9dab41eed8103120c008203000401cc48f28f6002000000302ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc0000000000000000576a4c541147510205000100000008040009000005000302000300040002080001000000090000000000010002000600000000070100000000030004000000000001000000000000000700000000000500000000020000000000000067e300000000000000000000000000", + "txid": "3b00b64e5892987ea2afc1c66384bf304ab2f8ca90d98ebef1d7784ca7347645" + } + ``` + + +## pending + +**cclib pending 17** + +The `pending` method returns a complete list of all unsolved puzzles on the Smart Chain. + +#### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +#### Response + +| Name | Type | Description | +| ---------- | ----------------------- | ------------------------------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| name | (string) | name of the module | +| method | (string) | name of the method | +| pending | (array of json objects) | an array of json objects, each containing information about an unsolved puzzle on the chain | +| height | (number) | the block height at which the puzzle was generated | +| amount | (number) | the reward provided to the first node to submit the correct solution | +| txid | (string) | a transaction id representing the generation of this puzzle, also called the `puzzle_txid` | +| numpending | (number) | the total number of on-chain unsolved puzzles | +| total | (number) | the collective value of all outstanding bounties for unsolved puzzles | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=SUDOKU cclib pending 17 +``` + + + ```bash + { + "result":"success", + "name":"sudoku", + "method":"pending", + "pending":[ + { + "height":665, + "amount":10000.00000000, + "txid":"2944aa188737301bb863ea926dd9cca3ec55331c56339dba9ed0ec7fb09a1600" + }, + + ... (omitted for brevity) ... + + { + "height":766, + "amount":10.00000000, + "txid":"0aaa8fdc83aa9111b1f1d143ca7baf5730cd68c02f1422b3f8cf4186959db6ff" + } + ], + "numpending":3290, + "total":3504801.00000000 + } + ``` + + +## solution + +**cclib solution 17 '\["puzzle\_txid","solution",t0,t1,t2,...]'** + +The `solution` method submits the proposed `solution` to the blockchain for the indicated `puzzle_txid` puzzle. + +The `t0...` values represent the timestamp at which the solution was found for each number. Pre-filled cells have an automated timestamp of `tX=0`, where `X` is the index of the puzzle number. + +The method returns a hex value which must then be broadcast using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method. + +#### Arguments + +| Name | Type | Description | +| -------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| txid | (string) | a transaction id representing the generation of this puzzle, also called the `puzzle_txid` | +| solution | (numeric string) | the proposed solution, provided in a concatenated format | +| tX... | (81 UNIX timestamps separated by comma) | there are `81` total `t...` arguments. `X` is the index of the indicated argument. The argument is a timestamp representing the time at which `X` number was input. Timestamp value should be 0 for numbers which were already known | + +#### Response + +json output: + +| Name | Type | Description | +| ---------- | -------- | ------------------------------------------------------------------------------------------------- | +| name | (string) | name of the module | +| hex | (string) | a `hex` value representing the encoded data; this must be broadcast using `sendrawtransaction` | +| txid | (string) | a transaction id representing the generation of this Sudoku puzzle, also called the `puzzle_txid` | +| amount | (number) | the reward provided to the first node to submit the correct solution | +| result | (string) | whether the command executed successfully | +| sudokuaddr | (string) | the Antara address that owns this puzzle reward and will distribute the reward | +| method | (string) | name of the method | + +Daemon `stdout`: + +| Name | Type | Description | +| ---------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| solved | (string) | this returns three values: the block height at which the puzzle was solved, the amount of coins rewarded, the solution txid | +| solution | (number) | this contains three values: a number-based concatenated representation of the solved puzzle; a string representing the concatenated unsolved puzzle; the total score for solving this puzzle | +| statistics | (string) | information which helps this module developer to detect was puzzle solved by robot or human | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=ROGUE cclib solution 17 [%22b5d7e2b50ace182e0ab7b5a18875818fa8e56b937689376bc5bdc8727b78ad52%22,%22157392864829461357436587129795634218381279645642815973978146532563728491214953786%22,1552297383,1552297384,1552297386,0,1552297387,0,0,1552297389,1552297389,1552297391,0,1552297392,1552297394,1552297396,1552297396,1552297397,1552297398,1552297399,1552297401,1552297402,1552297403,1552297404,1552297405,1552297407,1552297408,1552297409,1552297410,1552297412,1552297413,0,1552297415,1552297416,1552297417,0,0,1552297419,0,1552297422,1552297423,1552297424,1552297429,0,1552297431,0,1552297432,1552297435,1552297436,1552297437,1552297439,0,1552297440,1552297441,1552297443,0,1552297445,0,0,1552297446,1552297447,0,1552297449,0,1552297451,0,1552297453,0,1552297455,0,0,0,1552297457,0,1552297458,1552297459,0,0,1552297460,0,1552297462,1552297462,0] +``` + + + ```bash + { + 'name':'sudok', + 'hex':'0400008085202f890252ad787b72c8bdc56b378976936be5a88f817588a1b5b70a2e18ce0ab5e2d7b5000000007b4c79a276a072a26ba067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa883058140f6e597c2b4454dd6c2203744bcdf133e98b4330d0df27933d6db8fb5ccc443d919a04d072b35f6660ca80e647485b8c7f5bee08a56e47e636db67232ebf36fbfa100af03800111a10001ffffffff52ad787b72c8bdc56b378976936be5a88f817588a1b5b70a2e18ce0ab5e2d7b5010000007b4c79a276a072a26ba067a5658021027e0bf5ddd579d858b7997a60f3cd91c1cd99ed78df1753464cb12685251d5bf181401be4b2e389756a56e544e53cc9755ab737d1cd1cec180c2f5993b0a49d3787686d32dbb0364aaf1a8bd17c49e8ede3c4ea05d4705c33b65f16df131ef2a46f16a100af03800111a10001ffffffff0200e40b5402000000232102c4d7a2001384c7c2b95eb3927f6b1cec0c6fc29c35d9b17dc7a012d02203a17cac0000000000000000fd9f016a4d9b01115351313537333932383634383239343631333537343336353837313239373935363334323138333831323739363435363432383135393733393738313436353332353633373238343931323134393533373836fd44015c862da75c862da85c862daa000000005c862dab00000000000000005c862dad5c862dad5c862daf000000005c862db05c862db25c862db45c862db45c862db55c862db65c862db75c862db95c862dba5c862dbb5c862dbc5c862dbd5c862dbf5c862dc05c862dc15c862dc25c862dc45c862dc5000000005c862dc75c862dc85c862dc900000000000000005c862dcb000000005c862dce5c862dcf5c862dd05c862dd5000000005c862dd7000000005c862dd85c862ddb5c862ddc5c862ddd5c862ddf000000005c862de05c862de15c862de3000000005c862de500000000000000005c862de65c862de7000000005c862e5a000000005c862deb000000005c862ded000000005c862def0000000000000000000000005c862df1000000005c862df25c862df300000000000000005c862df4000000005c862df65c862df60000000000000000ade400000000000000000000000000', + 'txid':'b5d7e2b50ace182e0ab7b5a18875818fa8e56b937689376bc5bdc8727b78ad52', + 'amount':100.0, + 'result':'success', + 'sudokuaddr':'RWXsjC1zc7zGqsxa2YdL9zS7G3PwN5xc9m', + 'method':'solution' + } + ``` + + + + ```bash + SOLVED ht.58521 100.00000000 4c3fb21e60ef0af863da43c5ebbdf38651f080a3fff1c04855fc42857479f9e5 + 157392864829461357436587129795634218381279645642815973978146532563728491214953786 score.55 ---3-28---2------------------5---21-3----9-4-----1---3-78--6-3-5-3-284-1--49-3--6 + 1 2 1 2 0 2 1 2 2 0 1 1 1 2 1 1 1 1 2 1 1 1 2 1 2 1 1 2 3 1 1 5 2 1 3 1 1 2 1 1 2 2 1 1 4 2 2 2 1 1 1 2 0 100 solvetime.179 n.55 avetime.3 variance.177 vs ave2 9 + ``` + + +## txidinfo + +**cclib txidinfo 17 '\["puzzle\_txid"]'** + +The `txidinfo` method returns information about the indicated `puzzle_txid` puzzle. + +#### Arguments + +| Name | Type | Description | +| ------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| puzzle\_txid | (string) | the unique transaction id of the requested puzzle, as returned from the broadcast hex of the [gen](/antara/api/sudoku/#gen) method | + +#### Response + +| Name | Type | Description | +| ---------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| txid | (string) | a transaction id representing the generation of this Sudoku puzzle, also called the `puzzle_txid` | +| result | (string) | whether the command executed successfully | +| height | (number) | the block height at which the puzzle was generated | +| sudokuaddr | (string) | the Antara address that owns this puzzle funds and will distribute the reward | +| amount | (number) | the reward provided to the first node to submit the correct solution | +| unsolved | (string) | the unsolved puzzle, provided in concatenated form, filling playing field from left to right horizontally, and from top to bottom vertically | +| name | (string) | name of the module | +| method | (string) | name of the method | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=SUDOKU cclib txidinfo 17 \%220aaa8fdc83aa9111b1f1d143ca7baf5730cd68c02f1422b3f8cf4186959db6ff%22\" +``` + + + ```json + { + "result": "success", + "txid": "0aaa8fdc83aa9111b1f1d143ca7baf5730cd68c02f1422b3f8cf4186959db6ff", + "result": "success", + "height": 766, + "sudokuaddr": "RAFVbQbZ5esSkktLQq9mdQWrvi7UBnzqwE", + "amount": 10.0, + "unsolved": "4--13--6---89--2--37-2--541--5-8-1-66---4-----1-7------8-------------3---------9-", + "name": "sudoku", + "method": "txidinfo" + } + ``` + +export const title = "Tokens: Creating & Managing On-Chain Colored Coins"; +export const description = "The Tokens Module enables support for the on-chain creation of colored coins."; + +# Tokens + +## Introduction + +The Tokens Module enables support for the on-chain creation of colored coins, also called tokens. The created tokens are typically used with another module that supports operations on tokens. For example, the [Assets Module](/antara/api/assets/#introduction) provides buy/sell operations for `tokens`. + +Tokens can be generated on any chain where the [ac\_cc](/antara/setup/antara-customizations/#ac-cc) parameter is enabled. + +The `tokens` module requires locking a proportional amount of the native coins. Each [satoshi](/start-here/learning-launchpad/common-terminology-and-concepts/#satoshi) of the native coin is equal to one token within the total supply. + +## tokenaddress + +**tokenaddress (pubkey)** + +The `tokenaddress` method returns information about a token address according to a specific `pubkey`. If no `pubkey` is provided, the `pubkey` used to launch the daemon is the default. + +### Arguments + +| Name | Type | Description | +| ------ | ------------------ | --------------------------------- | +| pubkey | (string, optional) | the pubkey of the desired address | + +### Response + +| Name | Type | Description | +| --------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| TokensCCaddress | (string) | taking the token contract's EVAL code as a modifier, this is the public address that corresponds to the token contract's privkey, also known as Tokens CC's global address | +| myCCaddress | (string) | taking the token contract's EVAL code as a modifier, this is the Tokens Antara address from the pubkey of the user | +| myaddress | (string) | the normal public address of the pubkey used to launch the chain | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD tokenaddress 028702e30d8465d6aa85f35d2f58c06a6ee17f23f376b56044dadf7b793f2c12b9 +``` + + + ```json + { + "result": "success", + "TokensCCAddress": "RAMvUfoyURBRxAdVeTMHxn3giJZCFWeha2", + "TokensCCBalance": 0.0, + "TokensNormalAddress": "RCNgAngYAdrfzujYyPgfbjCGNVQZzCgTad", + "TokensNormalBalance": 0.0, + "PubkeyCCaddress(Tokens)": "RDu9bgyqWmzbvrgUsqpArkuzRSjAtibxrk", + "PubkeyCCbalance(Tokens)": 0.0, + "myCCAddress(Tokens)": "RASCvtFq6DZ3yFknHNq8R8uQ7rnFaCqPZe", + "myCCbalance(Tokens)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokenaddress", "params":["028702e30d8465d6aa85f35d2f58c06a6ee17f23f376b56044dadf7b793f2c12b9"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "TokensCCAddress": "RAMvUfoyURBRxAdVeTMHxn3giJZCFWeha2", + "TokensCCBalance": 0.0, + "TokensNormalAddress": "RCNgAngYAdrfzujYyPgfbjCGNVQZzCgTad", + "TokensNormalBalance": 0.0, + "PubkeyCCaddress(Tokens)": "RDu9bgyqWmzbvrgUsqpArkuzRSjAtibxrk", + "PubkeyCCbalance(Tokens)": 0.0, + "myCCAddress(Tokens)": "RASCvtFq6DZ3yFknHNq8R8uQ7rnFaCqPZe", + "myCCbalance(Tokens)": 0.0, + "myaddress": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "mybalance": 0.0 + }, + "error": null, + "id": "curltest" + } + ``` + + +## tokenbalance + +**tokenbalance tokenid (pubkey)** + +The `tokenbalance` method checks the token balance according to a provided `pubkey`. If no `pubkey` is provided, the `pubkey` used to launch the daemon is the default. + +### Arguments + +| Name | Type | Description | +| ------- | -------- | -------------------------------------------------------------------------------------------------------------------------- | +| tokenid | (string) | the txid that identifies the token | +| pubkey | (string) | the pubkey for which to examine the balance; if no pubkey is provided, the pubkey used to launch the daemon is the default | + +### Response + +| Name | Type | Description | +| --------- | -------- | ------------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command executed succesfully | +| CCaddress | (string) | taking the token contract's EVAL code as a modifier, this is the CC address from the pubkey of the user | +| tokenid | (string) | the txid that identifies the token | +| balance | (number) | the balance of the address that corresponds to the pubkey | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD tokenbalance c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59 +``` + + + ```json + { + "result": "success", + "CCaddress": "RRPpWbVdxcxmhx4xnWnVZFDfGc9p1177ti", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "balance": 99989 + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokenbalance", "params":["c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "CCaddress": "RRPpWbVdxcxmhx4xnWnVZFDfGc9p1177ti", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "balance": 99989 + }, + "error": null, + "id": "curltest" + } + ``` + + +Check the token balance of a specific pubkey + +```bash +./komodo-cli -ac_name=HELLOWORLD tokenbalance c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59 028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e27 +``` + + + ```json + { + "result": "success", + "CCaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "balance": 999900011 + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokenbalance", "params":["c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59" ,"028bb4ae66aa4f1960a4aa822907e800eb688d9ab2605c8067a34b421748c67e27"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "CCaddress": "RQymbXA8FfWw2AaHv7oC8JRKo9W5HkFVMm", + "tokenid": "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "balance": 999900011 + }, + "error": null, + "id": "curltest" + } + ``` + + +## tokencreate + +**tokencreate name supply description** + +The `tokencreate` method creates a new token. + +For every token created, the method requires one satoshi of the parent blockchain's coins. For example, `1 COIN` of the blockchain provides `100000000` tokens. + +The method returns a hex-encoded transaction which should then be broadcast using `sendrawtransaction`. + +`sendrawtransaction` then returns a `txid`, which is your `tokenid`. + +#### Non-Fungible Tokens + +A non-fungible token contains an additional array of data describing its corresponding asset. The data has an eval code which binds this non-fungible token to an Antara Module responsible for validation. + +To create a non-fungible token, use only 1 satoshi. + +#### Fractional Tokens + +To create a token that can be divided and transferred in fractional amounts, this must be handled on the application side of development. + +To create a token that is divisible to one decimal place, for example, consider 10 tokens as a single unit. Sending one satoshi's worth of the token is the equivalent of sending one decimal point of the actual token. + +### Arguments + +| Name | Type | Description | +| ----------- | -------- | --------------------------------------------- | +| name | (string) | the proposed name of the token | +| supply | (number) | the amount of coins used to create the tokens | +| description | (string) | the description of the token | + +### Response + +| Name | Type | Description | +| ------ | -------- | ---------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command succeeded | +| hex | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD tokencreate TOK 0.00000100 "creating a TOK token" +``` + + + ```json + { + "result": "success", + "hex": "0400008085202f8901065bc4522b82396e01b03ecf30abe9b7599621d861ad844818c87ac691005e18000000004847304402201f162ee2f8dac7382ff871d2aa7eb304d315eeb352c3d3464c36af8c9453273c0220074ae39178df09c13836ef1f8b647ffe3db4e7e1b428cc734a05e53707541db801ffffffff041027000000000000302ea22c8020432de388aabcb6b4e3326351d1d815cee8be9a8d37b055cd1c0cf8782e5c50c08103120c008203000401cc6400000000000000302ea22c80205dcc33b0b3f0573b306ab85ffa9ce8622fbcb81cb6ad8ec00f366935bbf500f78103120c008203000401cc7c950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac00000000000000003f6a3df2632102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756703544f4b146372656174696e67206120544f4b20746f6b656e00000000370100000000000000000000000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokencreate", "params":["TOK" ,"0.00000100" ,"creating a TOK token"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "0400008085202f8901065bc4522b82396e01b03ecf30abe9b7599621d861ad844818c87ac691005e18000000004847304402201f162ee2f8dac7382ff871d2aa7eb304d315eeb352c3d3464c36af8c9453273c0220074ae39178df09c13836ef1f8b647ffe3db4e7e1b428cc734a05e53707541db801ffffffff041027000000000000302ea22c8020432de388aabcb6b4e3326351d1d815cee8be9a8d37b055cd1c0cf8782e5c50c08103120c008203000401cc6400000000000000302ea22c80205dcc33b0b3f0573b306ab85ffa9ce8622fbcb81cb6ad8ec00f366935bbf500f78103120c008203000401cc7c950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac00000000000000003f6a3df2632102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756703544f4b146372656174696e67206120544f4b20746f6b656e00000000370100000000000000000000000000" + }, + "error": null, + "id": null + } + ``` + + +Step 2: Broadcast the raw transaction hex + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f8901065bc4522b82396e01b03ecf30abe9b7599621d861ad844818c87ac691005e18000000004847304402201f162ee2f8dac7382ff871d2aa7eb304d315eeb352c3d3464c36af8c9453273c0220074ae39178df09c13836ef1f8b647ffe3db4e7e1b428cc734a05e53707541db801ffffffff041027000000000000302ea22c8020432de388aabcb6b4e3326351d1d815cee8be9a8d37b055cd1c0cf8782e5c50c08103120c008203000401cc6400000000000000302ea22c80205dcc33b0b3f0573b306ab85ffa9ce8622fbcb81cb6ad8ec00f366935bbf500f78103120c008203000401cc7c950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac00000000000000003f6a3df2632102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756703544f4b146372656174696e67206120544f4b20746f6b656e00000000370100000000000000000000000000 +``` + + + ```bash + 916a6907e39cec679a6c832255c71b74e4941895d2d8775a6d2a0e8a322401ed + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["0400008085202f8901065bc4522b82396e01b03ecf30abe9b7599621d861ad844818c87ac691005e18000000004847304402201f162ee2f8dac7382ff871d2aa7eb304d315eeb352c3d3464c36af8c9453273c0220074ae39178df09c13836ef1f8b647ffe3db4e7e1b428cc734a05e53707541db801ffffffff041027000000000000302ea22c8020432de388aabcb6b4e3326351d1d815cee8be9a8d37b055cd1c0cf8782e5c50c08103120c008203000401cc6400000000000000302ea22c80205dcc33b0b3f0573b306ab85ffa9ce8622fbcb81cb6ad8ec00f366935bbf500f78103120c008203000401cc7c950b5402000000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac00000000000000003f6a3df2632102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756703544f4b146372656174696e67206120544f4b20746f6b656e00000000370100000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "916a6907e39cec679a6c832255c71b74e4941895d2d8775a6d2a0e8a322401ed", + "error": null, + "id": "curltest" + } + ``` + + +Step 3 (Optional): Use decoderawtransaction to verify the output is sane + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 01000000012c223cfc9c3349aed24ca89e44af6fcdb030150443bd6ac55e2080ce4b097c300200000049483045022100dc83b88f5ed1f01aab7dee8bd8f2b3c0bf83537c9b3cbb0c6ea78ebafdf4c6f60220518440e7f43d24c5733531a8d5a825dbb90e716f7ba20c0d469e7004c1fcc5aa01ffffffff0400ca9a3b00000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc1027000000000000232102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702acc055cbbe15090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000396a37e3632103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc0354414b0e54657374696e672070686173652e00000000 +``` + + + ```json + { + "txid": "e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc66", + "size": 335, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "307c094bce80205ec56abd43041530b0cd6faf449ea84cd2ae49339cfc3c222c", + "vout": 2, + "scriptSig": { + "asm": "3045022100dc83b88f5ed1f01aab7dee8bd8f2b3c0bf83537c9b3cbb0c6ea78ebafdf4c6f60220518440e7f43d24c5733531a8d5a825dbb90e716f7ba20c0d469e7004c1fcc5aa01", + "hex": "483045022100dc83b88f5ed1f01aab7dee8bd8f2b3c0bf83537c9b3cbb0c6ea78ebafdf4c6f60220518440e7f43d24c5733531a8d5a825dbb90e716f7ba20c0d469e7004c1fcc5aa01" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 10.0, + "valueSat": 1000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RRPpWbVdxcxmhx4xnWnVZFDfGc9p1177ti"] + } + }, + { + "value": 0.0001, + "valueSat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "02adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702 OP_CHECKSIG", + "hex": "2102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RFYE2yL3KknWdHK6uNhvWacYsCUtwzjY3u"] + } + }, + { + "value": 99889.9996, + "valueSat": 9988999960000, + "n": 2, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN e3632103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc0354414b0e54657374696e672070686173652e", + "hex": "6a37e3632103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc0354414b0e54657374696e672070686173652e", + "type": "nulldata" + } + } + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["01000000012c223cfc9c3349aed24ca89e44af6fcdb030150443bd6ac55e2080ce4b097c300200000049483045022100dc83b88f5ed1f01aab7dee8bd8f2b3c0bf83537c9b3cbb0c6ea78ebafdf4c6f60220518440e7f43d24c5733531a8d5a825dbb90e716f7ba20c0d469e7004c1fcc5aa01ffffffff0400ca9a3b00000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc1027000000000000232102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702acc055cbbe15090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000396a37e3632103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc0354414b0e54657374696e672070686173652e00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc66", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "307c094bce80205ec56abd43041530b0cd6faf449ea84cd2ae49339cfc3c222c", + "vout": 2, + "scriptSig": { + "asm": "3045022100dc83b88f5ed1f01aab7dee8bd8f2b3c0bf83537c9b3cbb0c6ea78ebafdf4c6f60220518440e7f43d24c5733531a8d5a825dbb90e716f7ba20c0d469e7004c1fcc5aa[ALL]", + "hex": "483045022100dc83b88f5ed1f01aab7dee8bd8f2b3c0bf83537c9b3cbb0c6ea78ebafdf4c6f60220518440e7f43d24c5733531a8d5a825dbb90e716f7ba20c0d469e7004c1fcc5aa01" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 10.0, + "valueZat": 1000000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RRPpWbVdxcxmhx4xnWnVZFDfGc9p1177ti"] + } + }, + { + "value": 0.0001, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "02adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702 OP_CHECKSIG", + "hex": "2102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RFYE2yL3KknWdHK6uNhvWacYsCUtwzjY3u"] + } + }, + { + "value": 99889.9996, + "valueZat": 9988999960000, + "n": 2, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN e3632103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc0354414b0e54657374696e672070686173652e", + "hex": "6a37e3632103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc0354414b0e54657374696e672070686173652e", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + + +## tokeninfo + +**tokeninfo tokenid** + +The `tokeninfo` method reveals information about any token. + +### Arguments + +| Name | Type | Description | +| ------- | -------- | ---------------------------------- | +| tokenid | (string) | the txid that identifies the token | + +### Response + +| Name | Type | Description | +| ------------- | ----------------- | ---------------------------------------------------------------------------- | +| result | (string) | whether the command executed successfully | +| tokenid | (string) | the identifying txid for the token id | +| owner | (string) | the identifying pubkey of the token creator | +| name | (string) | the name of the token | +| supply | (number) | the total supply of the token | +| description | (string) | the token description provided by the owner at token creation | +| data | (string,optional) | the data related to the non-fungible token, in hex | +| IsImported | (string,optional) | if 'yes' this token was imported from another chain | +| sourceChain | (string,optional) | the name of the imported token's source chain | +| sourceTokenId | (string,optional) | for an imported token, the `tokenid` of the source token on the source chain | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD tokeninfo 43850dfce744581ef44775086625745adecd628993c5ff4c1c786cfd21009add +``` + + + ```json + { + "result": "success", + "tokenid": "43850dfce744581ef44775086625745adecd628993c5ff4c1c786cfd21009add", + "owner": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc", + "name": "TAKA", + "supply": "100000.00000000", + "description": "Testing phase 3." + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokeninfo", "params":["43850dfce744581ef44775086625745adecd628993c5ff4c1c786cfd21009add"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "tokenid": "43850dfce744581ef44775086625745adecd628993c5ff4c1c786cfd21009add", + "owner": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc", + "name": "TAKA", + "supply": "100000.00000000", + "description": "Testing phase 3." + }, + "error": null, + "id": "curltest" + } + ``` + + +## tokenlist + +**tokenlist** + +The `tokenlist` method lists all available tokens on the asset chain. + +### Arguments + +| Name | Type | Description | +| ------ | ---- | ----------- | +| (none) | | | + +### Response + +| Name | Type | Description | +| ------- | ------------------ | ------------------------------------- | +| tokenid | (array of strings) | the identifying txid for the token id | + +#### 📌 Examples + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD tokenlist +``` + + + ```bash + [ + "307c094bce80205ec56abd43041530b0cd6faf449ea84cd2ae49339cfc3c222c", + "e7d034fb7dbad561c9a86dcbcc64aa89e1d311891b4e7c744280b7de13b1186f", + "21020a609c162fa2d0bc223acfff14bb0b886743303f5e4a661dade7a69b24a5", + "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc66", + "045a31b7e38b1538d111ea87ad9ec53952a70e9a5e8d076f7ed7923d8723f02d", + "f4131ee56a47273195a899f60a187862aa8e39a974b5a19d860e2fe69f60242f", + "9217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e", + "9eec77a3e02dec0ca60ead7e8cfb6cb6809c40fe54b804e51d5c6c2a445ffbf3", + "43850dfce744581ef44775086625745adecd628993c5ff4c1c786cfd21009add" + ] + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokenlist", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": [ + "307c094bce80205ec56abd43041530b0cd6faf449ea84cd2ae49339cfc3c222c", + "e7d034fb7dbad561c9a86dcbcc64aa89e1d311891b4e7c744280b7de13b1186f", + "21020a609c162fa2d0bc223acfff14bb0b886743303f5e4a661dade7a69b24a5", + "c5bbc34e6517c483afc910a3b0585c40da5c09b7c5d2d9757c5c5075e2d41b59", + "e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc66", + "045a31b7e38b1538d111ea87ad9ec53952a70e9a5e8d076f7ed7923d8723f02d", + "f4131ee56a47273195a899f60a187862aa8e39a974b5a19d860e2fe69f60242f", + "9217014eae0a83a0b64632f379c1b474859794f9eaf1cf1eecf5804ed6124a5e", + "9eec77a3e02dec0ca60ead7e8cfb6cb6809c40fe54b804e51d5c6c2a445ffbf3", + "43850dfce744581ef44775086625745adecd628993c5ff4c1c786cfd21009add" + ], + "error": null, + "id": "curltest" + } + ``` + + +## tokentransfer + +**tokentransfer tokenid destpubkey amount** + +The `tokentransfer` method transfers tokens from one Antara Address to another. + +It is similar to the [sendmany](/smart-chains/api/wallet/#sendmany) method used to send coins on the parent chain. + +The method returns a raw hex, which must be broadcast using [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) to complete the command. + + + The source `txid/vout` needs to be specified as it is critical to match + outputs with inputs. + + + + A token may be burned by using `tokentransfer` to send to a burn address. + + +### Arguments + +| Name | Type | Description | +| ---------- | ------------------ | ------------------------------------------ | +| tokenid | (string, optional) | the identifying txid for the token id | +| destpubkey | (string) | the pubkey where the tokens should be sent | +| amount | (number) | the number of tokens to send | + +### Response + +| Name | Type | Description | +| ------ | -------- | ---------------------------------------------------------------------------------------------------- | +| result | (string) | whether the command succeeded | +| hex | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command | + +#### 📌 Examples + +Step 1: Create the rawtransaction + +```bash +./komodo-cli -ac_name=HELLOWORLD tokentransfer e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc66 02ebc786cb83de8dc3922ab83c21f3f8a2f3216940c3bf9da43ce39e2a3a882c92 500000 +``` + + + ```json + { + "result": "success", + "hex": "01000000023b61e44ce3cedf536b52d8da11faacd041494a078e971551ed4e2bd496bc8da1000000006a4730440220111c67172740c0c2556979fdf84639ba299ff22586ebd220f25aa301f029003f02203da97a2575c0ed1b309774309f5dc952ee305a46cd83e95eae99e3564a1772f6012103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcffffffff66cc65f38d7e878d312386777c4f049f738b8894353c30108f7fe4ca515489e4000000007b4c79a276a072a26ba067a565802103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc8140c875a14edcbece61a6c18721398c927dc1e4509863e075b3922a8e3a2da6848e037142436e9102b529ee93a9ec618a4c67b63c52790d71812bb94179056913bba100af038001e3a10001ffffffff0420a1070000000000302ea22c8020541be9f843b476373fc18d8c8fab59c98c2c009f49c07fa66b7b431e4142feae8103120c008203000401cce028933b00000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc28b9486cb2430000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e374e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc6600000000" + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"tokentransfer", "params":["e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc66" ,"02ebc786cb83de8dc3922ab83c21f3f8a2f3216940c3bf9da43ce39e2a3a882c92" ,"500000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "result": "success", + "hex": "01000000023b61e44ce3cedf536b52d8da11faacd041494a078e971551ed4e2bd496bc8da1000000006a4730440220111c67172740c0c2556979fdf84639ba299ff22586ebd220f25aa301f029003f02203da97a2575c0ed1b309774309f5dc952ee305a46cd83e95eae99e3564a1772f6012103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcffffffff66cc65f38d7e878d312386777c4f049f738b8894353c30108f7fe4ca515489e4000000007b4c79a276a072a26ba067a565802103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc8140c875a14edcbece61a6c18721398c927dc1e4509863e075b3922a8e3a2da6848e037142436e9102b529ee93a9ec618a4c67b63c52790d71812bb94179056913bba100af038001e3a10001ffffffff0420a1070000000000302ea22c8020541be9f843b476373fc18d8c8fab59c98c2c009f49c07fa66b7b431e4142feae8103120c008203000401cce028933b00000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc28b9486cb2430000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e374e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc6600000000" + }, + "error": null, + "id": "curltest" + } + ``` + + +Step 2: Broadcast using `sendrawtransaction` + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000023b61e44ce3cedf536b52d8da11faacd041494a078e971551ed4e2bd496bc8da1000000006a4730440220111c67172740c0c2556979fdf84639ba299ff22586ebd220f25aa301f029003f02203da97a2575c0ed1b309774309f5dc952ee305a46cd83e95eae99e3564a1772f6012103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcffffffff66cc65f38d7e878d312386777c4f049f738b8894353c30108f7fe4ca515489e4000000007b4c79a276a072a26ba067a565802103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc8140c875a14edcbece61a6c18721398c927dc1e4509863e075b3922a8e3a2da6848e037142436e9102b529ee93a9ec618a4c67b63c52790d71812bb94179056913bba100af038001e3a10001ffffffff0420a1070000000000302ea22c8020541be9f843b476373fc18d8c8fab59c98c2c009f49c07fa66b7b431e4142feae8103120c008203000401cce028933b00000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc28b9486cb2430000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e374e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc6600000000 +``` + + + ```bash + ProcessAssets + AssetValidate (t) + vin1 1000000000, vout0 500000, vout1 999500000, transfer validated 10.00000000 -> 10.00000000 + AssetValidate.(t) passed + 88ac2d4d27654e9d8ac195d5ab482ee9895303902eaacfbb687b1e736bb06fb4 + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["01000000023b61e44ce3cedf536b52d8da11faacd041494a078e971551ed4e2bd496bc8da1000000006a4730440220111c67172740c0c2556979fdf84639ba299ff22586ebd220f25aa301f029003f02203da97a2575c0ed1b309774309f5dc952ee305a46cd83e95eae99e3564a1772f6012103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcffffffff66cc65f38d7e878d312386777c4f049f738b8894353c30108f7fe4ca515489e4000000007b4c79a276a072a26ba067a565802103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc8140c875a14edcbece61a6c18721398c927dc1e4509863e075b3922a8e3a2da6848e037142436e9102b529ee93a9ec618a4c67b63c52790d71812bb94179056913bba100af038001e3a10001ffffffff0420a1070000000000302ea22c8020541be9f843b476373fc18d8c8fab59c98c2c009f49c07fa66b7b431e4142feae8103120c008203000401cce028933b00000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc28b9486cb2430000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e374e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc6600000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": "88ac2d4d27654e9d8ac195d5ab482ee9895303902eaacfbb687b1e736bb06fb4", + "error": null, + "id": "curltest" + } + ``` + + +Step 3: Decode the raw transaction and check against the following if the data is sane + +```bash +./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 01000000023b61e44ce3cedf536b52d8da11faacd041494a078e971551ed4e2bd496bc8da1000000006a4730440220111c67172740c0c2556979fdf84639ba299ff22586ebd220f25aa301f029003f02203da97a2575c0ed1b309774309f5dc952ee305a46cd83e95eae99e3564a1772f6012103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcffffffff66cc65f38d7e878d312386777c4f049f738b8894353c30108f7fe4ca515489e4000000007b4c79a276a072a26ba067a565802103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc8140c875a14edcbece61a6c18721398c927dc1e4509863e075b3922a8e3a2da6848e037142436e9102b529ee93a9ec618a4c67b63c52790d71812bb94179056913bba100af038001e3a10001ffffffff0420a1070000000000302ea22c8020541be9f843b476373fc18d8c8fab59c98c2c009f49c07fa66b7b431e4142feae8103120c008203000401cce028933b00000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc28b9486cb2430000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e374e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc6600000000 +``` + + + ```json + { + "txid": "88ac2d4d27654e9d8ac195d5ab482ee9895303902eaacfbb687b1e736bb06fb4", + "size": 524, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "a18dbc96d42b4eed5115978e074a4941d0acfa11dad8526b53dfcee34ce4613b", + "vout": 0, + "scriptSig": { + "asm": "30440220111c67172740c0c2556979fdf84639ba299ff22586ebd220f25aa301f029003f02203da97a2575c0ed1b309774309f5dc952ee305a46cd83e95eae99e3564a1772f601 03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc", + "hex": "4730440220111c67172740c0c2556979fdf84639ba299ff22586ebd220f25aa301f029003f02203da97a2575c0ed1b309774309f5dc952ee305a46cd83e95eae99e3564a1772f6012103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc" + }, + "sequence": 4294967295 + }, + { + "txid": "e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc66", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc8140c875a14edcbece61a6c18721398c927dc1e4509863e075b3922a8e3a2da6848e037142436e9102b529ee93a9ec618a4c67b63c52790d71812bb94179056913bba100af038001e3a10001", + "hex": "4c79a276a072a26ba067a565802103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc8140c875a14edcbece61a6c18721398c927dc1e4509863e075b3922a8e3a2da6848e037142436e9102b529ee93a9ec618a4c67b63c52790d71812bb94179056913bba100af038001e3a10001" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.005, + "valueSat": 500000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020541be9f843b476373fc18d8c8fab59c98c2c009f49c07fa66b7b431e4142feae8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020541be9f843b476373fc18d8c8fab59c98c2c009f49c07fa66b7b431e4142feae8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RLB1YWh4N115NFh8tbArCBGaTQ3F43Yg1F"] + } + }, + { + "value": 9.995, + "valueSat": 999500000, + "n": 1, + "scriptPubKey": { + "asm": "a22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RRPpWbVdxcxmhx4xnWnVZFDfGc9p1177ti"] + } + }, + { + "value": 744335.99945, + "valueSat": 74433599945000, + "n": 2, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN e374e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc66", + "hex": "6a22e374e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc66", + "type": "nulldata" + } + } + ] + } + ``` + + +You can find your `rpcuser`, `rpcpassword`, and `rpcport` in the coin's .conf file. + +Command: + +```bash +curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["01000000023b61e44ce3cedf536b52d8da11faacd041494a078e971551ed4e2bd496bc8da1000000006a4730440220111c67172740c0c2556979fdf84639ba299ff22586ebd220f25aa301f029003f02203da97a2575c0ed1b309774309f5dc952ee305a46cd83e95eae99e3564a1772f6012103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcffffffff66cc65f38d7e878d312386777c4f049f738b8894353c30108f7fe4ca515489e4000000007b4c79a276a072a26ba067a565802103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc8140c875a14edcbece61a6c18721398c927dc1e4509863e075b3922a8e3a2da6848e037142436e9102b529ee93a9ec618a4c67b63c52790d71812bb94179056913bba100af038001e3a10001ffffffff0420a1070000000000302ea22c8020541be9f843b476373fc18d8c8fab59c98c2c009f49c07fa66b7b431e4142feae8103120c008203000401cce028933b00000000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc28b9486cb2430000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000246a22e374e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc6600000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/ +``` + + + ```json + { + "result": { + "txid": "88ac2d4d27654e9d8ac195d5ab482ee9895303902eaacfbb687b1e736bb06fb4", + "overwintered": false, + "version": 1, + "locktime": 0, + "vin": [ + { + "txid": "a18dbc96d42b4eed5115978e074a4941d0acfa11dad8526b53dfcee34ce4613b", + "vout": 0, + "scriptSig": { + "asm": "30440220111c67172740c0c2556979fdf84639ba299ff22586ebd220f25aa301f029003f02203da97a2575c0ed1b309774309f5dc952ee305a46cd83e95eae99e3564a1772f6[ALL] 03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc", + "hex": "4730440220111c67172740c0c2556979fdf84639ba299ff22586ebd220f25aa301f029003f02203da97a2575c0ed1b309774309f5dc952ee305a46cd83e95eae99e3564a1772f6012103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc" + }, + "sequence": 4294967295 + }, + { + "txid": "e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc66", + "vout": 0, + "scriptSig": { + "asm": "a276a072a26ba067a565802103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc8140c875a14edcbece61a6c18721398c927dc1e4509863e075b3922a8e3a2da6848e037142436e9102b529ee93a9ec618a4c67b63c52790d71812bb94179056913bba100af038001e3a10001", + "hex": "4c79a276a072a26ba067a565802103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc8140c875a14edcbece61a6c18721398c927dc1e4509863e075b3922a8e3a2da6848e037142436e9102b529ee93a9ec618a4c67b63c52790d71812bb94179056913bba100af038001e3a10001" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.005, + "valueZat": 500000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020541be9f843b476373fc18d8c8fab59c98c2c009f49c07fa66b7b431e4142feae8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020541be9f843b476373fc18d8c8fab59c98c2c009f49c07fa66b7b431e4142feae8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RLB1YWh4N115NFh8tbArCBGaTQ3F43Yg1F"] + } + }, + { + "value": 9.995, + "valueZat": 999500000, + "n": 1, + "scriptPubKey": { + "asm": "a22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RRPpWbVdxcxmhx4xnWnVZFDfGc9p1177ti"] + } + }, + { + "value": 744335.99945, + "valueZat": 74433599945000, + "n": 2, + "scriptPubKey": { + "asm": "03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc OP_CHECKSIG", + "hex": "2103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RANyPgfZZLhSjQB9jrzztSw66zMMYDZuxQ"] + } + }, + { + "value": 0.0, + "valueZat": 0, + "n": 3, + "scriptPubKey": { + "asm": "OP_RETURN e374e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc66", + "hex": "6a22e374e4895451cae47f8f10303c3594888b739f044f7c778623318d877e8df365cc66", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + }, + "error": null, + "id": "curltest" + } + ``` + +export const title = "Introduction to Antara Framework"; +export const description = "This guide is intended for developers learning about, building, and interacting with the Antara framework."; + +# Introduction to Antara + +Welcome to the Antara technical documentation. + +## About the Antara Section + +This documentation is intended for developers learning about, building, and interacting with the Antara framework. + +Users who are not interested in these activities, but are searching for documentation assistance, can find support in the Komodo Support Center. + +[Link to Komodo Support Center](https://support.komodoplatform.com/support/home) + +#### Conceptual Overview + +A brief conceptual overview of the Antara framework can be found in the Start Here > Product Introductions > Smart Chains & Antara section. + +[Link to "Smart Chains & Antara" Introduction](/start-here/about-komodo-platform/product-introductions/#antara-smart-chains) + +The [Antara Tutorials](/antara/tutorials/introduction-to-antara-tutorials/) section contains more thorough conceptual explanations of Antara. + +Please consult our [Learning Path Outlines](/start-here/learning-launchpad/) section for more details on approaches to learning Antara from both a conceptual and technical perspective. + +#### About Antara Setup + +The Antara Setup section contains basic information about setting up and using an Antara-enabled environment. Example topics include: + +* [Understanding Antara Addresses](/antara/tutorials/understanding-antara-addresses/) +* [Antara Customizations Available for Smart Chains During Creation and Hard Forks ](/antara/setup/antara-customizations/) + +#### About Antara Tutorials + +The Antara Tutorials section contains various tutorials that provide instruction for Antara usage and creation. + +For a walkthrough covering multiple tutorials in a targeted fashion, please see the [Learning Launchpad](/start-here/learning-launchpad/) section. + +#### About Antara API + +The Antara API section contains all available API commands for all default Antara modules. + +These API commands can also be called Remote Procedure Calls, or RPCs. +export const title = + "Antara Customizations: Parameters to Customize your Smart Chain"; +export const description = + "The Antara Framework offers various default customizations such as Smart Chain's name blocktime, blockreward value, blockreward reduction etc.,"; + +# Antara Customizations + +The Antara Framework offers various default Antara Customizations. + +The desired combination of parameters should be included with the `komodod` execution every time the Smart Chain daemon is launched. + +Changing these customizations at a later time is possible, but this typically requires a hard-fork of your Smart Chain. In general, the best practice for a developer is have all Smart Chain's parameters finalized before decentralizing the ownership of your coin. Should you discover a need to change these parameters after the fact, please reach out to our development team for assistance. + +## ac\_adaptivepow + + + This parameter is in its final testing stages. + + +#### Understanding Difficulty Stranding + +The `ac_adaptivepow` parameter solves a vulnerability known as "Difficulty Stranding." Low-hashrate blockchains are particularly susceptible to this vulnerability. + +When a blockchain's hashrate is much lower than that of another blockchain with the same mining algorithm, miners from the higher-powered chain can move to the lower-powered chain and mine a large number of blocks in a short amount of time. + +In so doing, the rapid influx of new miners causes a part of the lower-powered chain's consensus mechanism called the Difficulty Adjustment Algorithm (DAA) to drastically increase the difficulty of finding a block. When the higher-powered group of miners leave, the difficulty level remains. + +The smaller group of miners now may not be able to provide enough hash power to overcome the new difficulty level, and therefore this chain can be frozen. + +This type of behavior is called "difficulty stranding,” and can be used as a method of malicious attack. This is a threat that is faced by all pure PoW chains that have a minor hashrate. + +#### ac\_adaptivepow Adjusts the Difficulty Level + +The `ac_adaptivepow` parameter changes the Difficulty Adjustment Algorithm (DAA) of a Smart Chain to alleviate the potential effects of a "difficulty stranding" attack. + +One method by which `ac_adaptivepow` alleviates the vulnerability is the changing of the time at which the difficulty level is set. Normally, the difficulty level is adjusted at the conclusion of finding a new block. With `ac_adaptivepow`, the difficulty target is adjusted as a part of the process of finding a new block. + +This makes the process of lowering the difficulty easier and faster, as the DAA can take into account the amount of time the miners on the network are consuming to find a new block. If the amount of time is too high, the DAA can lower the difficulty as needed. More details on the implementation and rationale can be found in this [blog post.](https://medium.com/@jameslee777/adaptivepow-the-solution-to-diff-stranding-of-smaller-blockchains-425609df5563) + +Adding the parameter `-ac_adaptivepow=1` enables AdaptivePoW for a newly created Smart Chain. + +## ac\_algo + + + This parameter is in its final testing stages. Please reach out to us if you would like to use it on a production chain. + + +The `ac_algo` parameter changes the chain's mining algorithm from the default equihash to the verushash. + +To enable this feature, set `-ac_algo=verushash`. + +This activates verushash1.0. More recent versions of verushash are not yet supported. + +The verushash feature serves as a proof of concept for adding support for additional mining algorithms. + +The Komodo team is currently testing methods to support compatibility for `ac_staked`, but this feature is not yet recommended for external testing. + +## ac\_blocktime + +This parameter sets the average time (in seconds) by which a new block should be mined. + +If this parameter is not included, the default value is `ac_blocktime=60`. + +When the value of `ac_blocktime` is less than `60`, the Smart Chain's block time will stabilize within less than twelve hours after launch. If the Smart Chain's `ac_blocktime` value is greater than `60`, the Smart Chain's block time can require several days to stabilize. + +When the value of `ac_blocktime` is less than `12` seconds (a high speed Smart Chain), the variances in network quality between consensus nodes (miners and stakers) can create difficulties in achieving a stable blockchain consensus. High-speed Smart Chains may function effectively on a LAN or other stable network, but Komodo recommends caution when attempting to manage a high-speed Smart Chain on the public Internet. + +#### 📌 Examples + + + A 777777 coin pre-mine with a 1-coin block reward and a block speed of 20 seconds. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=100000000 -ac_blocktime=20 & + ``` + + +## ac\_cbmaturity + +The `ac_cbmaturity` parameter allows the `COINBASE_MATURITY` value to be changed. + +The `COINBASE_MATURITY` value is the number of blocks that must be confirmed between the creation of a coin (in a coinbase transaction) and the moment the coin can be spent. + +This allows the developers of a Smart Chain to require that miners and stakers on a blockchain network wait for an arbitrary amount of time after mining new coins to spend them.. + +For example, if a Smart Chain is set to `ac_cbmaturity=10`, newly mined coins must wait for 10 confirmations on the network before they can be spent. + +By default, this value is set to `1` on Smart Chains without [ac\_eras](/antara/setup/antara-customizations/#ac-eras) and set to `100` on Smart Chains with [ac\_eras](/antara/setup/antara-customizations/#ac-eras). + +## ac\_cbopret + +(In Development) + +The `ac_cbopret` parameter allows the Decentralised Trustless Oracle mechanism to be enabled on a Smart Chain. + + + The [Prices Antara module](/antara/api/prices/) required the existence of a completely trustless and decentralized price feed Oracle (a DTO). The DTO was implemented by [piggybacking on the timestamp consensus rules](https://medium.com/@jameslee777/decentralized-trustless-oracles-dto-by-piggybacking-on-timestamp-consensus-rules-2adce34d67b6). It works by requiring the miners of the Smart Chain to include the required off-chain data as a part of OP\_RETURN of the coinbase transaction (The transaction that pays the block reward to the miner). The validation of the off-chain data is part of the consensus rules and if the data is false, the block will be rejected by the network, which incentivizes the miner to be truthful. To achieve consensus, all nodes allow an error of about 1% in the reported data. + + +The value of the parameter is a 4 bit binary number converted to decimal. Each bit of the binary number has a specific meaning as explained below: + +Let the 4 bit binary number be `wxyz` + +w,x,y,z are bit4, bit3, bit2 and bit1 respectively + +* if z = 1 : DTO is enabled and miners are required to add some data to the coinbase transaction's [OP\_RETURN](/antara/tutorials/advanced-series-3/#response-annotated) +* if y = 1 : the data miners will write is prices of BTC vs fiat pairs viz., BTC\_USD, BTC\_GBP, BTC\_EUR and Major fiat vs USD pairs +* if x = 1 : the data miners will write is prices of Cryptocurrencies included in the [-ac\_prices](/antara/setup/antara-customizations/#ac-prices) parameter +* if w = 1 : the data miners will write is prices of Stocks included in the [-ac\_stocks](/antara/setup/antara-customizations/#ac-stocks) parameter + +### Examples + +* If we only want the prices for BTC vs fiat pairs and fiat vs USD pairs, we have (w=0,x=0,y=1,z=1) i.e., `0011` -> converted to decimal is `3`; the value for the `ac_cbopret` parameter is `3` +* If we want the pairs from the above example and prices of the Cryptocurrencies included in the [-ac\_prices](/antara/setup/antara-customizations/#ac-prices) parameter, we have (w=0,x=1,y=1,z=1) i.e., `0111` -> converted to decimal is `7`; the value for the `ac_cbopret` parameter is `7` +* If we just want the prices of the Stocks included in the [-ac\_stocks](/antara/setup/antara-customizations/#ac-stocks) parameter, we have (w=1,x=0,y=0,z=1) i.e., `1001` -> converted to decimal is `9`; the value for the `ac_cbopret` parameter is `9` + +## ac\_cc + +This parameter is still in testing. + +The `ac_cc` parameter sets the network cluster on which the chain can interact with other chains via Antara modules and MoMoM technology. + +Once activated, the `ac_cc` parameter can allow features such as cross-chain fungibility -- coins on one Smart Chain can be directly transferred to any other Smart Chain that has the same `ac_cc` setting and the same set of notary nodes (same set of `notary pubkeys`) . + +Most functionalities enabled by `ac_cc` can function with or without Komodo's notarization service. However, cross-chain transaction validation and its dependent features, including cross-chain fungibility, require notarization. + +If the `ac_cc` parameter is set to a value greater than `0` (i.e. Antara is permitted on the Smart Chain) users should include the [-pubkey](/smart-chains/setup/common-runtime-parameters/#pubkey) parameter when launching the daemon of this Smart Chain. + +### ac\_cc=0 + +Setting `ac_cc=0` disables Antara on the Smart Chain entirely. + + + It is better to NOT use `ac_cc=0` for a Smart Chain where Antara should + not be enabled. Omitting the `ac_cc` parameter altogether will achieve the + same result. + + +### ac\_cc=1 + +Setting `ac_cc=1` permits Antara on the Smart Chain, but will not allow the Smart Chain to interact in cross-chain Antara functionality with other Smart Chains. + +### ac\_cc=2 to 99 + +The values of `2` through `99` (inclusive) indicate Smart Chains that can validate transactions that occur on other Smart Chains on the same cluster (i.e. the same `ac_cc` value), but their coins are not fungible and therefore cannot be transferred between blockchains. + +### ac\_cc=100 to 9999 + +Setting the value of `ac_cc` to any value greater than or equal to `100` will permit cross-chain interaction with any Smart Chain that has the same `ac_cc` value and is secured by notary nodes with the same `pubkey`. + +All Smart Chains that have the same `ac_cc (>= 100)` value form a cluster, where the base tokens of all the chains in the cluster are fungible via the [burn protocol](/smart-chains/api/crosschain/). + +For example, a Smart Chain set to `ac_cc=201` in its parameters can interact with other Smart Chains with `ac_cc=201` on the same notary-node network, but cannot interact with a Smart Chain set to `ac_cc=301`. + +### Summary of `ac_cc` + + + Consider a chain with -ac\_cc=N + + * If **N = 0**, Antara is disabled + * If **N > 0**, Antara is enabled + * If **N = 1**, on-chain Antara is active, cross-chain validation is disabled + * If **N {'>='} 2 and {'<='} 99**, the chain allows for cross-chain contracts between all other chains bearing the same N value. The base coins in each Smart Chain are non-fungible across chains. + * If **N {'>='} 100**, the chain can form a cluster with all other chains with the same N value and on the same dPoW notarization network. The base coins of all chains in the cluster are fungible via the [burn protocol](/smart-chains/api/crosschain/). + + +#### 📌 Examples + + + A 777777 pre-mined chain with no Antara modules enabled. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 & + ``` + + A 777777 pre-mined chain with Antara modules on-chain only; no cross-chain Antara modules. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_cc=1 & + ``` + + A 777777 pre-mined chain where Antara modules are allowed between all fellow Smart Chains that have -ac\_cc=2 in their launch parameters. However, the cross-chain burn protocol is not active, and therefore coins cannot be transferred between chains. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_cc=2 & + ``` + + A 777777 pre-mined chain. Antara modules are allowed between all fellow Smart Chains that have -ac\_cc=102 in their launch parameters. Also, all -ac\_cc=102 chains can use the cross-chain burn protocol to transfer coins from one chain to another. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_cc=102 & + ``` + + +## ac\_ccactivate + +**-ac\_ccactivate=block\_height** + +The `ac_ccactivate` launch parameter allows for the activation of Antara on an existing Komodo-based Smart Chain wherein Antara was not originally enabled. + +Add the `ac_ccactivate` parameter to the existing launch command for the Smart Chain and set the value equal to a future block height. When this block height is reached, Antara will be available on the Smart Chain. + +This change requires a hard fork of the Smart Chain. If the Smart Chain is receiving Komodo's dPoW security service, the notary nodes must relaunch their Smart Chain daemons with the new launch parameter. All nodes must also update their daemons in the same manner. + +By default, `ac_ccactivate` uses the default `ac_cc` value of `ac_cc=2`. It is not necessary to further specify `ac_cc` in the launch parameters, unless a value other than `2` is required. + +#### 📌 Examples + + + ##### Before Using `ac_ccactivate` + + ```bash + ./komodod -ac_name=EXAMPLE -ac_supply=72000000 -addnode=24.54.206.138 & + ``` + + ##### After Using `ac_ccactivate` + + ```bash + ./komodod -ac_name=EXAMPLE -ac_supply=72000000 -ac_ccactivate=140 -addnode=24.54.206.138 & + ``` + + In this example, Antara will be available at blockheight `140`. All nodes, include the notary nodes, must relaunch the daemon with the new parameters before blockheight `140`. + + +## ac\_ccenable + + + This parameter is at the end of the beta development phase and is prepared for + public testing. If you are interested in adopting this feature for a + production Smart Chain, please reach out to us so that we can assist you. + + +The `ac_ccenable` parameter restricts the Smart Chain so that only indicated Antara modules can be enabled. `ac_ccenable` requires [ac\_cc](/antara/setup/antara-customizations/#ac-cc) to be active. + +To indicate which Antara modules should be available, insert each module's eval code in decimal and separated by commas. + +The following table presents an abbreviated list of EVAL codes. For more information, please see [this linked content](https://github.com/jl777/komodo/blob/master/src/cc/eval.h). + +| Name of the module | EvalCode | +| ------------------ | -------- | +| IMPORTPAYOUT | 225 | +| IMPORTCOIN | 226 | +| ASSETS | 227 | +| FAUCET | 228 | +| REWARDS | 229 | +| DICE | 230 | +| FSM | 231 | +| AUCTION | 232 | +| LOTTO | 233 | +| HEIR | 234 | +| CHANNELS | 235 | +| ORACLES | 236 | +| PRICES | 237 | +| PEGS | 238 | +| TRIGGERS | 239 | +| PAYMENTS | 240 | +| GATEWAYS | 241 | +| TOKENS | 242 | +| IMPORTGATEWAYS | 243 | + +For example, the following parameters create a Smart Chain where only the `faucet` and `rewards` modules are active: + +```bash +./komodod -ac_name=EXAMPLE -ac_supply=0 -ac_reward=100000000 -ac_cc=2 -ac_ccenable=228,229 +``` + +When `-ac_cc` is set, but `-ac_ccenable` is not, all Antara modules are enabled. + + + `ac_ccenable` disables spending utxos that are created under a non-enabled + Antara module. We have also implemented additional functionality that disables + API functions. This prevents the user from creating a utxo that `ac_ccenable` + would render unspendable. It is still possible to create raw transactions that + bypass this security feature, and thus create utxos that are unspendable. A + normal user or developer relying on our API functionality should not be + concerned with this. However, those who experiment with raw transactions + should be cautious. + + + + If the developer is also using a new feature that has yet to be documented + here, `ac_cclib`, the eval codes in the `libcc.so` will not disable Antara API + calls. Therefore, there remains a risk that a disabled API call can still be + used to create a utxo, which will then be non-spendable. + + +## ac\_cclib + +The `ac_cclib` parameter is used in conjunction with various Antara modules. + +Typically, the Smart Chain that uses the `ac_cclib` parameter will have a unique build process. This is described as a part of each Antara module in question. Once the Smart Chain is properly built, the terminal command to launch the chain will include the `ac_cclib` parameter in a manner similar to the following: + +```bash +-ac_cclib=desired_CC_module +``` + +Each Antara module uses the `ac_cclib` parameter differently, and therefore the reader should refer to the desired Antara module for further instructions. + +## ac\_decay + +This is the percentage which determines the block reward decrease on each block-reward "halving". + +This parameter will have no effect if [ac\_reward](/antara/setup/antara-customizations/#ac-reward) is not set. + +This is the formula that `ac_decay` follows: + +```bash +block_reward_after = block_reward_before * ac_decay / 100000000; +``` + +For example, if this parameter is set to `75000000`, at each "halving" the block reward will drop to 75% of its previous value. + +#### 📌 Examples + + + A 777777-coin pre-mine, with a 10-coin block reward, and the block reward decreases by 25% every 2000 blocks. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=1000000000 -ac_halving=2000 -ac_decay=75000000 & + ``` + + +## ac\_end + +This is the block height at which block rewards will end. Every block after this height will have 0 block reward (this means that, assuming all other settings are default, the only incentive to mine a new block will be transaction fees). + +#### 📌 Examples + + + A 777777-coin pre-mine, with a block reward of 0.0005 coin. The block reward ends at block 25000. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=50000 -ac_end=25000 & + ``` + + A 777777-coin pre-mine, with a 5-coin block reward, and the block reward ends at block 200. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=500000000 -ac_end=200 & + ``` + + A 777777-coin pre-mine, with a 5-coin block reward, the block reward decreases by 50% every 2000 blocks, and the block reward ends at block 10000. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=500000000 -ac_halving=2000 -ac_end=10000 & + ``` + + +## ac\_eras + +The `ac_eras` parameter allows the value of a chain's block reward to vary over time. + +Each different time interval is called an "era" and a chain can have at most seven eras. + +#### ac\_eras Combined With ac\_cbmaturity + +When active, `ac_eras` changes the behavior of coinbase coins (i.e., the coins that are created as a result of mining). `ac_eras` forces the `COINBASE_MATURITY` value of coinbase coins to be `100` instead of the normal value of `1`. Therefore, coinbase coins become spendable after `100` confirmations. + +This `COINBASE_MATURITY` value can be explicitly changed using the [ac\_cbmaturity](/antara/setup/antara-customizations/#ac-cbmaturity) parameter. Changing this `COINBASE_MATURITY` value to `1` is recommended if a chain uses `ac_eras` in conjunction with [ac\_staked](/antara/setup/antara-customizations/#ac-staked). + +#### ac\_eras Instructions + +The `ac_eras` parameter accepts only one value. The value must be between `2` and `7`, inclusive. When activated, `ac_eras` allows certain other Smart Chain parameters to accept multiple values. + +The principle parameter that is affected by `ac_eras` is [ac\_reward](/antara/setup/antara-customizations/#ac-reward). The `ac_reward` parameter must receive at least one value. + +Also, [ac\_decay](/antara/setup/antara-customizations/#ac-decay), [ac\_halving](/antara/setup/antara-customizations/#ac-halving), [ac\_end](/antara/setup/antara-customizations/#ac-end), and [ac\_notarypay](/antara/setup/antara-customizations/#ac-notarypay) can each receive multiple values and thereby affect reward functionality. + +For every era, there must be a corresponding value in `ac_end` that indicates the block height at which this era ends. To set the final era to last indefinitely, set the `ac_end` value of that era to `0`; the `0` setting should only be used for the last era. If the last era's `ac_end` value is not `0`, the chain's block rewards will stop after the final `ac_end` value, and every block after the final `ac_end` value will have no block reward. + +In all parameters receiving multiple values, the values must be preceded by a comma. + +For example: + +```bash +./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_eras=3 -ac_reward=5000000000,7000000000,4000000000 -ac_end=1000,10000,0 +``` + +In this Smart Chain, the first era will have a reward of 5000000000, the second will have 7000000000, and the third will have 4000000000. The reward for the first era ends at block 1000, for the second era at block 10000, and the third era lasts indefinitely. + +If any of the relevant parameters has fewer distinct values than eras, the parameter's final value will carry through the remaining eras. + +For example: + +```bash +-ac_eras=2 -ac_reward=100000000,200000000 -ac_halving=100 -ac_end=10000,0 +``` + +In this Smart Chain, the `ac_halving` value for both eras is `100`. + +One more feature of `ac_eras` is the ability to transition from one era to the next with a linear progression, rather than a direct switch. To achieve this effect, in the initial era (the point at which the linear progression should begin) set the `ac_decay` value to `100000000` and the `ac_halving` value to `1`. + +For example, the following parameters create a Smart Chain with a "slow start" reward: + +```bash +./komodod -ac_name=HELLOWORLD -ac_reward=0,10000000000 -ac_eras=2 -ac_end=1000,0 -ac_decay=100000000,100000000 -ac_halving=1 +``` + +This chain's block reward will grow linearly from 0 to 100 over 1000 blocks, then stay at 100 indefinitely. + + + Use the [getblocksubsidy](/smart-chains/api/mining/#getblocksubsidy) API method to verify your Smart Chain will work as expected at each relevant height: `./komodo-cli -ac_name=HELLOWORLD getblocksubsidy ` + + +## ac\_feeds + + + The ac\_feeds customization is in development. Please reach out to the Komodo team for more information or to use this customization in a production environment. + + + + The ac\_feeds parameter is directly relevant to the [Prices Antara module](/antara/api/prices/). The Prices module also requires the inclusion of the following parameters in the launch command of a Smart Chain: [-ac\_cbopret](/antara/setup/antara-customizations/#ac-cbopret), [-ac\_cc=n (where n >=2)](/antara/setup/antara-customizations/#ac-cc). + + +The `ac_feeds` parameter supports the retrieval of data from sources accessed using the `http/https` protocols and which return data as a json object. + +The [Antara Prices Module](/antara/api/prices/) has an internal parser that processes the json object using the [RFC 6901 'Json Pointer' addressing](https://datatracker.ietf.org/doc/html/rfc6901). The internal parser extracts the value specified by the json pointer or calculates the average value for the specified value paths, as explained below. + +This parameter also allows the addition of a custom shared object library (a `.so` file) that has the necessary parsing function to retrieve values from the json object returned by a web api. This feature can be used when the json object returned is non-standard and the internal parser's features are not sufficient. In this event, the parsing function takes the json object and several configuration options, such as `customdata`, as arguments and returns the price. The configuration options inform the function about the location of the price data within the json object. + +The value of this parameter is a quoted string that contains a json array of feed-configuration options. + +### Basic Usage + +```bash +-ac_feeds='[{"name":"stocks", "url":"https://api.iextrading.com/1.0/tops/last?symbols=AAPL,ADBE", "results":[{"symbol":"AAPL","valuepath":"/0/price"}, {"symbol":"ADBE","valuepath":"/1/price"}], "multiplier":1000000, "interval":120 }, {configuration object for another feed ...}]' +``` + +Each json object in the above json array defines a unique Feed. The json array includes details such as the Feed's name, the web api's url, the symbol for each of the items in the feed, and the path to acquire the price data for an item from the json returned from the web api. + +##### ac\_feeds Example + +```json +{ + "name": "stocks", + "url": "https://api.iextrading.com/1.0/tops/last?symbols=AAPL,ADBE", + "results": [ + { "symbol": "AAPL", "valuepath": "/0/price" }, + { "symbol": "ADBE", "valuepath": "/1/price" } + ], + "multiplier": 1000000, + "interval": 120 +} +``` + +The above configuration object defines a single feed named "stocks" that contains prices of the symbols `AAPL` and `ADBE` retreived from the web api with the "url": `https://api.iextrading.com/1.0/tops/last?symbols=AAPL,ADBE`. + +The returned data is a json array and is processed by ac\_feeds's internal parser to set the prices of the symbols `AAPL` and `ADBE` based on the data in the json array. This data is found in the `results` key. + +```json +{ "symbol": "AAPL", "valuepath": "/0/price" } +``` + +The value of the key named `symbol` sets the symbol for the item in the price feed. + +The value of the key named `valuepath` is a json "pointer" that indicates the method to extract the value of the price matching the symbol in the response. For example, when the parser encounters the value `"/0/price"`, the parser selects the `0th` element of the json array and reads the value of the key named `price`. + +The value of the key named `multiplier` is the number by which the value extracted should be multiplied before being added to the feed. This convers numbers with decimal paces into integers. + +The value of the key named `interval` is the time in seconds between each refresh of the data from the web api. The minimum value is `120`. + +#### Polling the Same url Multiple Times + +The following example can be useful when polling the same url multiple times with a fixed subset of changing. + +```bash +-ac_feeds='[{"name":"metals", "url":"https://forex-data-feed.swissquote.com/public-quotes/bboquotes/instrument/%s/USD", "substitutes":["XAU","XPT"], "quote":"USD", "results":{"averagevaluepaths":["/*/spreadProfilePrices/*/ask","/*/spreadProfilePrices/*/bid"] }, "multiplier":10000, "interval":120 }]' +``` + +The above example has the configuration for a single feed named "metals" that allows for the retrieval of the prices `XAU/USD` (`XAU_USD`) and `XPT/USD` (`XPT_USD`) symbols from the web api hosted by `forex-data-feed.swissquote.com`. + +The key `url` has the actual address of the web api, with `%s` included to denote "substitute". All the urls formed by the substitution `%s` and with elements of the array stored in the key named `substitues` are polled. Their responses are processed and added to the feed. As before, the key named "results" holds the data that indicates the method for processing the responses. + +```json +{ + "averagevaluepaths": [ + "/*/spreadProfilePrices/*/ask", + "/*/spreadProfilePrices/*/bid" + ] +} +``` + +In this case, the `results` object indicates that the price value to be added to the feed is the average of all values retrived from the responses based on the json pointers `"/*/spreadProfilePrices/*/ask"` and `"/*/spreadProfilePrices/*/bid"`. + +Note the '\*' symbols in the json pointers. These indicate that the response is an array and all the elements of the array will be used in the calculation of the average. When the key `substitutes` is used in the configuration, the `result` parameter is a json object and is applied to the resulting json response from polling each url formed by using each substitute. + +There is also an optional parameter named `quote` which is added to the symbol of the price in the feed. For example, using the values `"quote":"USD"` displays the prices as `XAU_USD` and `XPT_USD` in the feed. The `quote` value can also be empty if the strings in the array `substitutes` are complete symbols. + +#### Method of Handling when the Internal Parser is Inadequate + +When the internal parser of the `ac_feeds` customization is inadequate for parsing responses from a web API, the following example can be of assistance. + +```bash +-ac_feeds='[{"name":"metals", "url":"https://forex-data-feed.swissquote.com/public-quotes/bboquotes/instrument/%s/USD", "substitutes":["XAU","XPT"], "quote":"USD", "customlib":"libpricessampleparser.so", "results":{"customdata":"/0/spreadProfilePrices/0/ask"}, "multiplier":10000, "interval":120 }]' +``` + +This feed configuration has a custom parser. + +The feed is differentiated from the previous feed by the `customlib` key, which contains the name of a shared library that contains the custom parser, and the `customdata` key, which is arbitraty data passed to the custom parser function in the shared library. + +#### -ac\_feed Parameters + +| Parameter | Type | Description | Example | +| ------------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| "name" | (mandatory, string) | the name of the configuration item | `"name":"stocks"` | +| "url" | (mandatory, string) | the url of the web api to be polled; if the url contains `%s`, the configuration must also contain the `substitutes` parameter | with no `%s` - "url": `https://api.trade.com/1.0/`
with `%s`: "url" - `https://api.fin.com/api/?symbol=%sBTC` | +| "substitutes" | (optional, array of strings) | a list of strings to substitute '%s' symbols in the `url` parameter to create requests; this supposes that each request returns a single value. If there is no `substitutes` key array in the configuration, then a poll may return many values | `"substitutes":["XAU","XPT"]` | +| "quote" | (optional, string) | the string to be added to each string in the `substitutes` parameter to form a symbol of a currency pair, such as \`\`"USD\_BTC"\`, to represent the price data retreived from the feed | `"quote":"BTC"` | +| "customlib" | (optional, string) | the name of the custom-parser library | `"customlib": "libmyparser.so"` | +| "results" | (mandatory, json object or json array) | contains parameters to parse the json response from the web api; this is an **object** if the parameter`substitutes`is present (in this case, the substitute is applied to the response from each poll, thus making the response arrive at one value ). Otherwise, the value is an **array** (this event allows for the retrieval of several values from the response). | see the structure and examples in the succeeding tables | +| "multiplier" | (optional, number) | an integer multiplier that indicates the value by which the result(s) should be multiplied to create an integer; the default value is`1` | for forex prices,`"multiplier":10000`
for cryptocurrencies,`"multiplier":100000000` | +| "interval" | (optional, number) | the poll interval, given in seconds; this value should be greater than or equal to`120`; the default value is `120` | `"interval":180\` | + +{/* Sidd: i'm not sure I understood all of this re: results parameter */} + +#### Results Array Members + +| Name | Type | Description | Example | +| -------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | +| "symbol" | (optional, string) | the symbol to be displayed in the feed for the value retrieved | `"symbol":"USD_BTC"` | +| "valuepath" | (optional, string) | a json pointer to the value | `"valuepath":"/BTC/price"` | +| "averagepaths" | (optional, array of strings) | a list of json pointers to values. If present, the average is calculated. In the position where an array index is expected in the json pointer, the value can be '\*' -- this instructs the parser to use all available array elements | `"averagepaths":["/prices/*/bid", /prices/*/ask"]` | +| "customdata" | (optional, string) | arbitrary data passed to the custom lib function | `"customlib":"/price"` | + + + * The "results" array must be comprised of objects if the "substitutes" parameter is NOT used + * If no custom library (customlib) is used, the "symbol" property should be set + * If no custom library (customlib) is used, either the "valuepath" or the "averagepaths" property should be set + + +#### Results Object Members + +| Name | Type | Description | Example | +| -------------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | +| "valuepath" | (optional, string) | the json pointer to the value | `"valuepath":"/BTC/price"` | +| "averagepaths" | (optional, array of strings) | a list of json pointers that point to values. If present, the average is calculated. In the position where an array index is expected in the json pointer, the value can be '\*' -- this denotes that the parser must use all the available array elements | `"averagepaths":["/prices/*/bid", /prices/*/ask"]` | +| "customdata" | (optional, string) | arbitrary data passed to the customlib function | `"customlib":"/price"` | + + + * "results" must be an object if the "substitutes" parameter is used + * The "symbol" parameter is not used in the "results" object as the symbol names are constructed from the strings in the "substitutes" array and in the optional "quote" property + * If no custom library (customlib) is used, then either the "valuepath" or the "averagepaths" property should be set in each array item + + +#### Specification for the Custom Parser Library + +The custom json parser is a shared library that should be placed along with the Komodo source code with building instructions in the `src/cc/priceslibs` directory. + +The custom library should implement a single function written in the C-language with its declaration specified in the file `pricesfeeds.h` as follows: + +```cpp +extern "C" { + int pricesJsonParser(const char *sjson /*in*/, const char *symbol /*in*/, const char *customdata, uint32_t multiplier /*in*/, uint32_t *value /*out*/); +} +``` + +On each call, the function should retrieve a single value and place it in the '\*value' variable. + +The function receives the following parameters: + +* A string with the json returned by web api +* The symbol to retrieve +* Custom data from the configuration + * The custom data might contain hints on how to find the value in the json object +* A multiplier used to convert the price value to integer + +The function should return `1` for the `success` scenario and `0` if the function could not extract the value. + +For an example implementation, see the custom parser lib example in the file named `PricesResultParserSample.cpp` in the directory `src/cc/priceslibs` in the Komodo source code. + +#### Initializing Price Feed Configuration + +The configuration object is named `feedconfig` and is found in the file `src/cc/pricesfeeds.cpp`. + +Use an existing configuration (config) item with `name="basic"` as an example. + +## ac\_founders + +The `ac_founders` parameter creates a "founder's reward." + +This parameter requires [ac\_perc](/antara/setup/antara-customizations/#ac-perc). If the `ac_perc` value is not declared, the `ac_founders` value defaults to `35%`. Also, either [ac\_pubkey](/antara/setup/antara-customizations/#ac-pubkey) OR [ac\_script](/antara/setup/antara-customizations/#ac-script) must be set. + +The `ac_perc` value determines the percentage of block rewards paid to the founder. These rewards are not paid out immediately, but rather according to the `ac_founders` setting. + +`ac_founders` determines the frequency at which the founder's reward is paid. + +For example: + +```bash +-ac_reward=100000000 -ac_perc=10000000 -ac_founders=100 +``` + +The above parameters result in mining rewards of 100000000 satoshis (1 coin) per block, with a difference on every 100th block. On the 100th block exception, 1000000000 additional satoshis (10 coins) are paid to the founder's address. + +The coins rewarded to the founder are created at the moment of payment, thus increasing the overall coin supply. See [ac\_perc](/antara/setup/antara-customizations/#ac-perc) for more details. + +Use `ac_pubkey` to send the founder's reward to a normal address. + +Use `ac_script` to send the founder's reward to a multi-signature address. + +Set `ac_founders=1` to stay compatible with most stratum implementations. Any other value requires team member `Blackjok3r`'s modifications to knomp using the [disable-cb feature](https://github.com/webworker01/knomp#disable-coinbase-mode). Please reach out to our team on [discord](https://komodoplatform.com/discord) if you have further questions about how to set up a stratum. + +## ac\_founders\_reward + +The `ac_founders_reward` parameter functions in a manner that is similar to a combination of the `ac_perc` and `ac_founders` parameters. + +However, the value specified in the `ac_founders_reward` parameter is given in satoshis, as opposed to a percentage of the block reward. Also, the founder's reward does not accumulate over several blocks. + +The `ac_founders_reward` parameter can be used in place of `ac_perc`. + +The `ac_founders_reward` parameter must be used in combation with `ac_founders` and either `ac_script` or `ac_pubkey`. + +The `ac_founders_rewards` value is entirely independent of the `ac_reward` value. + +Consider the following combination of parameters, for example. + +```bash +-ac_reward=1000000000 -ac_perc=10000000 -ac_founders=10 -ac_pubkey=034916536402c0c4cf53b05e3b5d948aacafede47df640b33cb89bd28179cd2d3f +``` + +This combination pays the pubkey address 10 coins every 10 blocks. + +Compare the above to the following combination. + +```bash +ac_reward=1000000000 -ac_founders_reward=100000000 -ac_founders=10 -ac_pubkey=034916536402c0c4cf53b05e3b5d948aacafede47df640b33cb89bd28179cd2d3f +``` + +This combination pays the pubkey address 1 coin every 10 blocks. + +The `ac_founders_reward` parameter is not compatible with the [ac\_eras](/antara/setup/antara-customizations/#ac-eras) parameter. + +#### 📌 Examples + + + A 777777-coin pre-mine, with a 5-coin block reward, and founder's reward of 10 coins sent to `034916536402c0c4cf53b05e3b5d948aacafede47df640b33cb89bd28179cd2d3f` every 10 blocks. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=500000000 -ac_founders_reward=1000000000 -ac_founders=10 -ac_pubkey=034916536402c0c4cf53b05e3b5d948aacafede47df640b33cb89bd28179cd2d3f & + ``` + + +## ac\_halving + +This is the number of blocks between each block reward halving. This parameter will have no effect if [ac\_reward](/antara/setup/antara-customizations/#ac-reward) is not set. The lowest possible value is `1440` (\~1 day). If this parameter is set, but [ac\_decay](/antara/setup/antara-customizations/#ac-decay) is not, the reward will decrease by 50% each halving. + +#### 📌 Examples + + + A 777777-coin pre-mine, with a 5-coin block reward, and the block reward decreases by 50% every 2000 blocks. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=500000000 -ac_halving=2000 & + ``` + + +## ac\_name + +All Smart Chains are required to set ac\_name. + +This is the ticker symbol for the coin you wish to create. We recommended it consist only of numbers and uppercase letters. + +#### 📌 Examples + + + A simple Smart Chain + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 & + ``` + + +## ac\_notarypay + +The `ac_notarypay` parameter rewards the notary nodes each time they participate in a notarization. + +This value should be set to the total amount of satoshis rewarded to all participating notaries in a notarization. The reward is then divided evenly between all participating notaries. + +On the KMD dPoW network the amount of notaries in a notarization is 13. Therefore, if the `ac_notarypay` value is set to `1300000000`, each notary receives 1 coin for each notarization they perform. + +Notarizations happen on average every 10 blocks by default. + +This parameter is compatible with the [ac\_eras](/antara/setup/antara-customizations/#ac-eras) parameter. + +#### 📌 Examples + + + A Smart Chain with 777777 pre-mined coins, a 5 coin block reward in the first era, a 10 coin block reward in the second era, paying 1 coin per notarization in the first era and paying 2 coins per notarization in the second era. The first era ends at block 10000. The second era ends at block 20000. After block 20000, there will be no block reward and no `ac_notarypay` reward. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=500000000,1000000000 -ac_notarypay=1300000000,2600000000 -ac_eras=2 -ac_end=10000,20000 & + ``` + + +## ac\_perc + +The `ac_perc` parameter has two different functionalities depending on the configuration of the chain parameters. + +#### ac\_perc without ac\_founders + +When `ac_perc` is used without [-ac\_founders](/antara/setup/antara-customizations/#ac-founders) the chain will follow an inflation-tax model. In this model, the `-ac_perc` parameter is the percentage added to the block reward, and the transactions that allocate these rewards are sent to the `-ac_pubkey` address. Naturally, for this configuration to function the `-ac_pubkey` parameter must be included. + +For example, if `-ac_reward=100000000` and `-ac_perc=10000000`, for each block mined the miner receives 100000000 satoshis (1 coin), and the owner of the `-ac_pubkey` address receives 10000000 satoshis (0.1 coin, which is 10% of the miner's reward). The amount sent to the pubkey is not taken from the user, rather it is created at this point. Therefore, each transaction inflates the overall coin supply. + +The maximum amount of coins created via this method across all transactions per block is capped at `(1000000 * )`. + + + Vout 1 of each coinbase transaction must be the correct amount sent to the + corresponding pubkey. This only affects a miner trying to use a stratum. Team + member, `Blackjok3r`, developed a coinbase-override method for this purpose. + Please see [this + repo](https://github.com/webworker01/knomp/#disable-coinbase-mode) for + details. + + +#### ac\_perc with ac\_founders + +Please see the [-ac\_founders](/antara/setup/antara-customizations/#ac-founders) documentation for this functionality. + +#### 📌 Examples + + + This example coin combines both `ac_staked` and `ac_perc`. As described in the section, ["Notes on How ac\_staked Functions"](/antara/setup/antara-customizations/#ac-staked), the method of rewards for the coin will vary over time. The coins used to stake will be included in the `ac_perc` calculations until block height `100000`. Therefore, the `pubkey` that receives `ac_perc` block rewards will receive more for the first `100000` blocks. + + Other coin details include that it is a 777777-coin pre-mine, with a 10-coin block reward, and the chain adjusts difficulty so that 50% of the blocks are mined via PoS, and 50% via PoW. + + For the first `100000` blocks, the `pubkey` address receives at least 1 coin for every mined block (an additional 10% above the block reward). The pubkey address also receives at least an additional 10% for every transaction made on the chain. For example, if a transaction sends 100 coins, an additional 10 coins are created and sent to the pubkey address. This includes the additional verification transaction in PoS blocks, meaning the pubkey address receives more coins for every PoS block. The extra amount sent to the `pubkey` address derives from blocks that are mined via `ac_staked`, the rewards of which are calculated into `ac_perc`. + + After the first `100000` blocks, the rewards from `ac_staked` are no longer included in the `ac_perc` rewards sent to the `pubkey`. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=1000000000 -ac_perc=10000000 -ac_pubkey=DO_NOT_USE_5efca96674b45e9fda18df069d040b9fd9ff32c35df56005e330392 -ac_staked=50 & + ``` + + +## ac\_prices + +(In Development) + +The `ac_prices` parameter has to be used along with the [ac\_cbopret](/antara/setup/antara-customizations/#ac-cbopret) parameter to supply TICKERS of the Cryptocurrencies whose BTC prices are to be included in the DTO. + +#### 📌 Examples + + + A Smart Chain with a DTO that brings prices of various Cryptocurrencies vs BTC on-chain. + + ```bash + ./komodod -ac_cbopret=5 -ac_name=HELLOWORLD -ac_cbopret=5 -ac_prices="ETH, LTC, BNB, NEO, LRC, QTUM, OMG, ZRX, STRAT, IOTA, XVG, KMD, EOS, ZEC, DASH, XRP, STORJ, XMR, BAT, BTS, LSK, ADA, WAVES, STEEM, RVN, DCR, XEM, ICX, HOT, ENJ" -ac_cc=10797 -ac_reward=3000000000 -ac_supply=120000000 -ac_pubkey=02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567 -ac_perc=77777 -ac_blocktime=120 & + ``` + + +## ac\_pubkey + +The `ac_pubkey` parameter designates a pubkey for receiving payments from the network. These payments can come in the genesis block, in all blocks mined thereafter, and from every transaction on the network. + +This parameter is not intended for isolated use. It should only be activated on chains that also use at least one of the following parameters: `ac_perc`, `ac_founders`, or `ac_import=PUBKEY`. + +The `pubkey` must be a 66 character string (a compressed pubkey). You can find this pubkey for any address by using the [validateaddress](/smart-chains/api/util/#validateaddress) command, and searching for the returned `pubkey` property. The first two digits of a compressed `pubkey` are only either `02` or `03`. (The corresponding `private key` must be present/imported to the wallet before using `validateaddress`.) + +#### 📌 Examples + + + This example coin combines both `ac_staked` and `ac_perc`. As described in the section, ["Notes on How ac\_staked Functions"](/antara/setup/antara-customizations/#ac-staked), the method of rewards for the coin will vary over time. The coins used to stake will be included in the `ac_perc` calculations until block height `100000`. Therefore, the `pubkey` that receives `ac_perc` block rewards will receive more for the first `100000` blocks. + + Other coin details include that it is a 777777-coin pre-mine, with a 10-coin block reward, and the chain adjusts difficulty so that 50% of the blocks are mined via PoS, and 50% via PoW. + + For the first `100000` blocks, the `pubkey` address receives at least 1 coin for every mined block (an additional 10% above the block reward). The pubkey address also receives at least an additional 10% for every transaction made on the chain. For example, if a transaction sends 100 coins, an additional 10 coins are created and sent to the pubkey address. This includes the additional verification transaction in PoS blocks, meaning the pubkey address receives more coins for every PoS block. The extra amount sent to the `pubkey` address derives from blocks that are mined via `ac_staked`, the rewards of which are calculated into `ac_perc`. + + After the first `100000` blocks, the rewards from `ac_staked` are no longer included in the `ac_perc` rewards sent to the `pubkey`. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=1000000000 -ac_perc=10000000 -ac_pubkey=DO_NOT_USE_5efca96674b45e9fda18df069d040b9fd9ff32c35df56005e330392 -ac_staked=50 + ``` + + +## ac\_public + +If `ac_public` is set to `1`, zk-SNARKs are disabled, and all z address functionality is disabled. Therefore, all transactions on the blockchain are public. + +#### 📌 Examples + + + A public-only Smart Chain. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_public=1 & + ``` + + +## ac\_reward + + + Komodo recommends that this parameter be included on all Smart Chains. Please + see below for additional notes. + + +This is the block reward for each mined block, given in satoshis. + +If both `ac_reward` and `ac_staked` are not set, the default block reward will be `10000` satoshis and blocks will be on-demand after block `127` (a new block will not be mined unless there is a transaction in the mempool). + +Komodo recommends that `ac_reward` be included in all Smart Chains. This prevents the Smart Chain from becoming an on-demand blockchain, and therefore this increases the Smart Chain's security. + +To make a Smart Chain that has no block reward and is not on-demand, include the parameters: `-ac_reward=1 -ac_end=1`. The Smart Chain's first block will reward only the `-ac_supply` value, after which the `ac_reward` value will be `0`. + +#### 📌 Examples + + + A 777777 coin pre-mine, with a 1 coin block reward that does not end. (Note that ac\_supply is given in coins, while ac\_reward is given in satoshis.) + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=100000000 & + ``` + + A 0 coin pre-mine with a 1-coin block reward that does not end. This is an example of a pure PoW Smart Chain that has no pre-mined coins. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=0 -ac_reward=100000000 & + ``` + + A 777777-coin pre-mine, with a 10-coin block reward, and the block reward decreases by 25% every 2000 blocks. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=1000000000 -ac_halving=2000 -ac_decay=75000000 & + ``` + + +## ac\_sapling + +The `ac_sapling` parameter adjusts the block height of a Smart Chain's default sapling activation. (Sapling is an upstream privacy technology provided by [Zcash](https://z.cash/), of which Komodo is a fork.) + +By default, sapling will activate at block 61 on a newly created Smart Chain. + +This can also be used to activate sapling prior to block 61. (Activating sapling prior to block 61 should not be done on a chain intended for production use.) + +To delay sapling activation, set `ac_sapling` to a block height far in the future. For example, `-ac_sapling=5000000` will delay sapling activation to block `5000000`. At block `5000000` sapling will be activated. + +## ac\_script + +The `ac_script` parameter enables the `ac_founders` reward to be sent to a multi-signature address or any p2sh address. If this parameter is used, block 1 (the "premine") will be mined to the `ac_script` address. + +This parameter requires that `ac_founders` also be active. If `ac_script` is set, `ac_pubkey` must not be. + +`ac_script` should be set to the `"hex"` value of `"scriptPubKey"`. + +#### Finding the scriptPubKey + +To find the `"scriptPubKey"` value, first create a multi-signature address with the [createmultisig](/smart-chains/api/util/#createmultisig) command. + +##### Command + +```bash +./komodo-cli -ac_name=EXAMPLE createmultisig 2 "[\"RMnZJpfLbFHUxMS3HM5gkvtFKeduhr96Ec\",\"RW2Yx4Tk9WGfUvhbJTXGFiRhr7PKcVtrm5\",\"RQ1uqBj9yk94BcxEZodbeNqb3jWv8pLeA4\"]" +``` + +##### Response + +```json +{ + "address": "bGHcUFb7KsVbSFiwcBxRufkFiSuhqTnAaV", + "redeemScript": "522102040ce30d52ff1faae7a673c2994ed0a2c4115a40fa220ce055d9b85e8f9311ef2102a2ba4606206c032914dd48390c15f5bf996d91bf9dbd07614d972f39d93a511321026014ef4194f6c7406a475a605d6a393ae2d7a2b12a6964587299bae84172fff053ae" +} +``` + +On a test chain, send coins to the `bGHcUFb7KsVbSFiwcBxRufkFiSuhqTnAaV` address. + +##### Command + +```bash +./komodo-cli -ac_name=EXAMPLE sendtoaddress bGHcUFb7KsVbSFiwcBxRufkFiSuhqTnAaV 10 +``` + +##### Response (txid) + +```bash +ef0d05f14ea2a5bfa1c99142c2e3d78c851223d7476ed2e57b61b6e07f741f0f +``` + +Observe the resulting transaction with `getrawtransaction 1`. + +##### Command + +```bash +./komodo-cli -ac_name=EXAMPLE getrawtransaction ef0d05f14ea2a5bfa1c99142c2e3d78c851223d7476ed2e57b61b6e07f741f0f 1 +``` + +##### Response + +```json +{ + "value": 10.0, + "valueSat": 1000000000, + "n": 1, + "scriptPubKey": { + "asm": "OP_HASH160 2706324daaac92c93420e985f55d88ea20e22ae1 OP_EQUAL", + "hex": "a9142706324daaac92c93420e985f55d88ea20e22ae187", + "reqSigs": 1, + "type": "scripthash", + "addresses": ["bGHcUFb7KsVbSFiwcBxRufkFiSuhqTnAaV"] + } +} +``` + +Set `ac_script` to the `"hex"` value from the returned json object. + +##### Command + +```bash +-ac_script=a9142706324daaac92c93420e985f55d88ea20e22ae187 +``` + +## ac\_staked + +`ac_staked` indicates the percentage of blocks the chain will aim to mine via Proof of Stake (PoS), with the remainder via Proof of Work (PoW). For example, an `ac_staked=90` chain will have \~90% PoS blocks and \~10% PoW blocks. + +Measurements of the `PoS:PoW` ratio are approximate; the PoW difficulty will automatically adjust based on the overall percentage of PoW-mined blocks to adhere to the approximate `PoS` value. + +When creating a chain with the `ac_staked` parameter, the creation process is slightly different. + +* Start both the first and second nodes **without** `-gen -genproclimit=0`. +* Once both are connected, execute `setgenerate true 1` on the node that should receive the pre-mine. +* Observe the debug.log by executing `tail -f ~/.komodo//debug.log` +* Wait for the Smart Chain to mine two blocks +* Execute `setgenerate false` to stop mining +* All of the coins (including the pre-mine) are now located on the node that mined two blocks. Do not split them with a normal transaction. Rather, split them using this tool: [link](https://github.com/KMDLabs/pos64staker). +* On the first node use 'setgenerate true 0' to enable staking. +* On the second node use 'setgenerate true 1' (or use a desired processor number instead '1') to enable mining. +* Use the [getbalance64](/smart-chains/api/wallet/#getbalance64) method to ensure that there are coins staking in all 64 segids before block 10. The utxos may appear on any list, including both staking and nonstaking. + +Following the above instructions will ensure that the Smart Chain is stable. + + + On a chain using a high percentage for PoS, it's vital to have coins staking by block 100. If too many PoW blocks are mined consecutively at the start of the chain, the PoW difficulty may increase enough to stop the chain entirely. This can prevent users from sending transactions to staking nodes. + + + + The Smart Chain developer must give the [ac\_reward](/antara/setup/antara-customizations/#ac-reward) parameter a value for staking to function properly. + + + + It is vital to stake coins in all 64 segids. You can use the genaddresses.py script in [this repository](https://github.com/KMDLabs/pos64staker) to generate an address for each segid. This functionality will soon be integrated directly into the daemon. + + + + The first 100 blocks will allow PoW regardless of the ac\_staked value. + + + + It is not possible to both PoW mine and stake on the same node. Therefore, + when the chain's consensus mechanism allows both PoS and PoW, the chain + creator needs a minimum of two nodes mining/staking to keep the blockchain + moving. + + +### Notes on How ac\_staked Functions + +Once staking is active, utxos available in the `wallet.dat` file will stake automatically. + +On an `ac_staked` Smart Chain there are 64 global segments (`segid`'s) to which all addresses and the corresponding utxos belong. These 64 `segid`'s become eligible to stake blocks in turns. The segment a utxo belongs to is determined automatically, according to the address in which the utxo resides. + +You can see which segment an address belongs to by using the [validateaddress](/smart-chains/api/util/#validateaddress) API command. You can use the [getbalance64](/smart-chains/api/wallet/#getbalance64) API command to observe how your staked coins are distributed across the separate segids. + +Each staked block will have an additional transaction added to the end of the block in which the coins that staked the block are sent back to the same address. This is used to verify which coins staked the block, and this allows for compatibility with existing Komodo infrastructure. + +There are additional considerations when `ac_staked` is used in conjunction with [ac\_perc](/antara/setup/antara-customizations/#ac-perc) and [ac\_pubkey](/antara/setup/antara-customizations/#ac-pubkey). The coins used to stake will be included in the `ac_perc` calculations until the Smart Chain reaches block height `1000000`. Therefore, the [ac\_pubkey](/antara/setup/antara-customizations/#ac-pubkey) address will receive more coins for each staked block compared to a mined block. After block `1000000`, `ac_perc` will no longer include the coins used for staking, and therefore the amount of coins sent to the `ac_pubkey` address will normalize. + +### Rules for Staking a Block + +The following are the (current) rules for staking a block: + +* Block timestamps are used as the monotonically increasing on-chain clock. It is important to have a synced system clock. Use the following sequence to sync your clock:`sudo apt-get install chrony`, `sudo systemctl restart chrony.service`, then check `timedatectl` for `NTP syncronized: Yes` + +* A utxo is not eligible for staking until a certain amount of time has passed after its creation. By default, between blocks `1` and `2000` the amount of time required for a utxo to be eligibile is `blockheight * 3 seconds`. After block `2000`, the required amount of time is 6000 seconds. More precisely, after block `2000` a utxo is not eligible for staking until `100 * the expected blocktime (i.e. 1 minute)`. For example, utxos on a one-minute block-time Smart Chain would be eligible for staking one-hundred minutes after their creation. + +* The `segid`s rotate through a queue to determine which `segid` has the most likely chance to stake a new block. The formula that determines this is based on the block height: `(height % 64) = the segid0 for this height`. For each block, the eligibility to stake a new block begins with `segid[0]`, and then the eligibility expands to the next segment in queue at every two-second interval until the block is staked. For example, if `segid[0]` has not mined a new block within two seconds, the consensus mechanism opens up the priority to include the second, `segid[1]`. This continues either until the block is staked, or all 64 `segid`'s are eligible to stake a new block. Once a block is staked, the `height` of the blockchain changes, pushing the `segid[0]` segment to the end of the queue, etc. + +* By internal design, a utxo is more likely to win a block within a `segid` based on age of the utxo and amount of coins. Regarding the age eligibiility, the maximum maturity level is one month (e.g. after reaching one month of age, a utxo's likelihood of staking a coin does not further increase). The age of the utxo is set by the `nlocktime` property of the utxo, or if `nlocktime` is not set, the age is determined by the utxo's `blocktime` property. + +#### 📌 Examples + + + A 777777-coin pre-mine with a 1-coin block reward. The chain adjusts difficulty to keep 90% of blocks mined via PoS, and 10% mined via PoW. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=100000000 -ac_staked=90 & + ``` + + A 777777 coin pre-mine with a 10-coin block reward. The chain adjusts difficulty so 2% of blocks are mined via PoS, 98% via PoW. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=1000000000 -ac_staked=2 & + ``` + + A 777777-coin pre-mine, with a 1-coin block reward, block reward decreases by 50% every 2000 blocks, and the chain adjusts difficulty so 10% of blocks are mined via PoS, 90% via PoW. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=100000000 -ac_havling=2000 -ac_staked=10 & + ``` + + A 777777-coin pre-mine, a 10000-coin block reward, the block reward decreases by 40% every 2000 blocks, and the chain adjusts difficulty so 50% of blocks are mined via PoS, 50% via PoW. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=1000000000000 -ac_halving=2000 -ac_decay=60000000 -ac_staked=50 & + ``` + + A 777777-coin pre-mine, a 1000-coin block reward, the block reward decreases by 25% every 100000 blocks, the block reward ends at block 1000000, and the chain adjusts difficulty so 1% of blocks are mined via PoS, 99% via PoW. The pubkey address receives an additional 0.5% above the block reward for each mined block. For example, before the first halving, the pubkey address will receive 5 coins (0.5% of 1000 coin block reward) for every mined block. After the first halving, the pubkey address will receive 3.75 coins for every mined block (0.5% of 750-block reward). The pubkey address receives an additional 0.5% for every transaction made on the chain. For example, if a transaction sends 100 coins, an additional 0.5 coins are created and sent to the pubkey address. This includes the additional verification transaction in PoS blocks, meaning the pubkey address receives more coins for every PoS block. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=100000000000 -ac_halving=100000 -ac_decay=75000000 -ac_end=1000000 -ac_perc=500000 -ac_pubkey=DO_NOT_USE_5efca96674b45e9fda18df069d040b9fd9ff32c35df56005e330392 -ac_staked=1 & + ``` + + +## ac\_stocks + +(In development) + +The `ac_stocks` parameter has to be used along with the [ac\_cbopret](/antara/setup/antara-customizations/#ac-cbopret) parameter to supply TICKERS of the Stocks (available at [https://api.iextrading.com/1.0/tops/last](https://api.iextrading.com/1.0/tops/last)) whose USD prices are to be included in the DTO. + +#### 📌 Examples + + + A Smart Chain with a DTO that brings prices of various Stocks vs USD on-chain. + + ```bash + ./komodod -ac_cbopret=9 -ac_name=HELLOWORLD -ac_cbopret=9 -ac_stocks="AAPL,ADBE,ADSK,AKAM,AMD,AMZN,ATVI,BB,CDW,CRM,CSCO,CYBR,DBX,EA,FB,GDDY,GOOG,GRMN,GSAT,HPQ,IBM,INFY,INTC,INTU,JNPR,MSFT,MSI,MU,MXL,NATI,NCR,NFLX,NTAP,NVDA,ORCL,PANW,PYPL,QCOM,RHT,S,SHOP,SNAP,SPOT,SYMC,SYNA,T,TRIP,TWTR,TXN,VMW,VOD,VRSN,VZ,WDC,XRX,YELP,YNDX,ZEN,BRK.A" -ac_cc=10797 -ac_reward=3000000000 -ac_supply=120000000 -ac_pubkey=02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567 -ac_perc=77777 -ac_blocktime=120 & + ``` + + +## ac\_supply + +This is the amount of pre-mined coins you would like the chain to have. + +The node that sets [gen](/smart-chains/setup/common-runtime-parameters/#gen) during the creation process will mine these coins in the genesis block. + +If `ac_supply` is not set, [ac\_reward](/antara/setup/antara-customizations/#ac-reward) must be set, and a default value of 10 coins will be used in the genesis block. If [ac\_founders](/antara/setup/antara-customizations/#ac-founders) is set, the pre-mined coins will be mined to the founder's reward address. + +The `ac_supply` parameter should be set to a whole number without any decimals places. It should also be set to less than `2000000000` to avoid 64-bit overflows. + + + An additional fraction of a coin will be added to the initial supply based on + the Smart Chain's parameters. This is used by nodes to verify the genesis + block. For example, the DEX chain's `ac_supply` parameter is set to `999999`, + but in reality the genesis block was `999999.13521376`. When using + `ac_staked`, the additional amount may be more than a full coin, and can add + up to two digits left of the decimal point. + + +#### 📌 Examples + + + A simple Smart Chain with pre-mined coins and a block reward of 0.0005. + + ```bash + ./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_reward=50000 & + ``` + + +## ac\_snapshot + +The `ac_snapshot` parameter defines the frequency with which a Smart Chain creates snapshots of the `address - balance` data. + +###### Example + +The following example instructs the Smart Chain to execute a snapshot once every `1440` blocks. (Approximately one snapshot per day.) + +``` +-ac_snapshot=1440 +``` + +##### Payments Module Functionality + +The `ac_snapshot` parameter is required by the [paymentsairdrop](/antara/api/payments/) method of the Payments Antara Module. + +The user first executes the [paymentsairdrop](/antara/api/payments/) method to create a Payments plan that is designed to distribute airdrops to addresses on the chain. + +The user then executes the [paymentsrelease](/antara/api/payments/#paymentsrelease) method to release payments based on the amounts in the addresses in the most recent snapshot, as recorded by the `ac_snapshot` customization. + +The Payments Module features several customizations to control the nature of these automated airdrops. + +## ac\_timelock... + +**-ac\_timeunlockgte=satoshis -ac\_timelockfrom=height -ac\_timelockto=height** + +The `ac_timelock...` parameters enforce "coinbase locking". + +In coinbase locking, the Smart Chain's block-reward feature behaves in a different manner compared to a default Smart Chain. Any block reward that is greater than or equal to the `ac_timeunlockgte` satoshi amount is temporarily locked. It will be unlocked (and therefore spendable) on a random block between the `ac_timelockfrom` and `ac_timelockto` heights. + +The random unlock time for each reward is independent of the unlock time of other rewards. + +For example: + +```bash +./komodod -ac_name=HELLOWORLD -ac_supply=0 -ac_reward=10000000000 -ac_halving=10000 -ac_timelockgte=10000000000 -ac_timeunlockfrom=10000 -ac_timeunlockto=100000 +``` + +For the first 10000 blocks, any rewards that are greater than or equal to 10000000000 are locked until a random block between 10000 and 100000. + +## ac\_txpow + + + This parameter is in its final testing stages. Please reach out to us if you + would like to use it on a production chain. + + +Setting `-ac_txpow=1` enforces a transaction-rate limiter. This can help to prevent spam transactions on a Smart Chain. + +`ac_txpow` forces all transactions (other than coinbase transactions) to have a txid starting and ending with `00`. + +This parameter is currently a proof of concept. Many of the traditional API commands, such as `sendtoaddress` or `sendmany`, are not currently supported. Instead, use [createrawtransaction](/smart-chains/api/rawtransactions/#createrawtransaction) and [signrawtransaction](/smart-chains/api/rawtransactions/#signrawtransaction). + +## ac\_veruspos + + + This parameter is in its final testing stages. Please reach out to us if you + would like to use it on a production chain. + + +The `ac_veruspos` parameter is an alternative to [ac\_staked](/antara/setup/antara-customizations/#ac-staked). + +When activated, the chain uses [Verus](https://verus.io/)'s proof of stake implementation instead. + +The only valid value for this parameter is `-ac_veruspos=50`. (`ac_veruspos` does not have the same segid mechanism as `-ac_staked`.) +export const title = "Antara Setup" +export const description = "This section contains information required to Setup Antara based Smart Chains" + +# Antara Setup + +This section of the documentation contains information required to Setup Antara based Smart Chains. +export const title = "Advanced Tutorials: Creating Antara Modules for Komodo"; +export const description = + "This tutorial series is intended for advanced Komodo developers who intend to manipulate the default software setup."; + +# An Advanced Approach to Komodo's Antara Framework + +## Introduction + +The following content is provided for the experienced C/C++ developer who desires to create new Antara Modules for Komodo Smart Chains. + +The content herein provides introductory instruction that can allow the developer to more easily read existing Antara-related code and follow advanced tutorials that examine specific Antara Modules. + +## Link to Learning Path Outline + +The following tutorial series is intended for advanced Komodo developers who intend to manipulate the default software setup. Please review the placement of this tutorial in [the Learning Path Outline section.](/start-here/learning-launchpad/#step-15-begin-the-advanced-development-tutorial) + +## Antara Encompasses Several Technologies + +The Antara Framework greatly enhances blockchain functionality. Antara allows a developer to use their Smart Chain's consensus mechanism to enforce arbitrary code. Antara even allows clusters of Smart Chains to work together in this effort. + +The level of freedom this grants to the blockchain developer is sometimes difficult to comprehend until one has either seen the technology in action or engaged with the technology directly. + +The Antara Framework takes into account several different advanced technologies. To limit the scope of our introduction, for now we focus only on one crucial aspect: "CryptoConditions," or "CC" for brevity. + +## A Less Conceptual Discussion of CryptoConditions + +#### CryptoConditions in Brief + +CryptoConditions is a technology that allows for logical conditions and fulfillments to be evaluated as a part of consensus. + +##### CryptoConditions is Based on an Industry-Wide Proposed Standard + +CryptoConditions technology is not a new concept. The [Interledger](https://interledger.org/) team originally proposed this technology in 2016. + +The [original proposal](https://datatracker.ietf.org/doc/html/draft-thomas-crypto-conditions-01) was that it would be an open-source industry-wide standard format. The Interledger team does not seem to have continued exploring the technology beyond the original proposal. + +Komodo, on the other hand, found the CryptoConditions concept to be intriguing. In 2018, Komodo adopted this open-source technology into the suite of offerings in our Antara Framework. + +Our implementation uses many of the key ideas put forth by the Interledger team, and at the same time we depart in several significant ways. Those who are curious for specific details on this topic can explore the open-source code in the respective repositories. + +##### A Brief Description of Komodo Enhancements + +At the simplest level, CryptoConditions operates with electronic signatures and hashes. The Komodo team enhanced CryptoCondition technology beyond the original specifications. Our implementation allows for a Smart Chain's consensus mechanism to evaluate the results of arbitrary code and to update state in the blockchain's data in a decentralized and secure fashion. + +The important takeaway is that the Antara Framework encompasses several underlying technologies, one of which is CryptoConditions (CC). This technology allows a developer to add several enhancements to their Smart Chain. These enhancements include complex logical conditions and fulfillments, and arbitrary code. The enhancements rely on the consensus mechanism to ensure state integrity in a decentralized environment. + +#### CryptoConditions Depends Upon Transactions and Booleans + +At the most fundamental level, blockchain data is advanced only through transactions. A blockchain itself is nothing but a list of transactions, bound into blocks. By design, each transaction must be confirmed by the consensus mechanism. + +Therefore, all decentralized data that a developer wishes to create or use with their arbitrary code must first be added to a transaction. This transaction is then passed through the consensus mechanism. Transactions that are successfully confirmed are finally added to the blockchain, and therefore the data is also added. + +To take advantage of this functionality, a developer adds customized source code to the Antara Framework to form a new module. Whenever a relevant transaction occurs on the blockchain, the consensus mechanism calls the developer's module, validates the logical conditions and fulfillments as put forth by the arbitrary code, and either confirms or denies the transaction. + +To simplify this process, Antara requires that the developer build their module such that each CryptoConditions (CC) transaction returns a boolean value as a part of the final results. If the returned boolean value is `true`, the transaction is approved. + +With this framework in place, the developer can also add any other data to be saved as a part of the transaction. This data is included in a special part of the transaction called an [OP\_RETURN](https://en.bitcoin.it/wiki/OP_RETURN), or opreturn for brevity. We will discuss opreturns in greater detail further on. + +Through Antara, the developer receives a powerful tool for creating and executing decentralized arbitrary code. A developer can also add data to any transaction, and their Smart Chain can utilize this data in future executions of arbitrary code. The primary requirement is that the arbitrary code return a meaningful boolean value as a part of the final result. + +#### Building an Antara Module is Harder Than Creating a Balance-Based Smart Contract + +Antara Modules are fundamentally different than the "smart contracts" that are familiar on other blockchain platforms. The key difference is that Antara Modules directly rely on ["unspent transactions,"](/start-here/core-technology-discussions/miscellaneous/#the-utxo-an-elusive-yet-fundamental-concept) which are called "utxos" for brevity. Balance-based smart contracts, on the other hand, rely on the total balance of funds held within an address. + +Utxo-based modules are harder to create than balance-based smart contracts. However, because utxo-based modules leverage the existing Bitcoin-utxo system, they result in more powerful functionality that can even be more secure than a smart contract. + +For example, within balance-based smart contracts transactions do not have to pass a full review by the consensus mechanism of the underlying blockchain. Instead, most of the transaction verification happens within [a decentralized virtual machine](https://bitcoin.eu/top-8-blockchain-virtual-machines-for-decentralized-applications/) that executes code written by a developer. + +In this situation, all developers involved in a smart contract must maintain a high level of programming awareness to avoid disasters, such as those seen in [the Parity Attack.](https://hackingdistributed.com/2017/07/22/deep-dive-parity-bug/) Furthermore, a typical smart contract has access to the full balance held in the wallets of all users who are actively engaged with the contract. If a developer makes a mistake in their code, the full balance associated with the smart contract is vulnerable. + +In a utxo-based module these risks are reduced. One reason utxo-based modules are more secure is that every update of the blockchain's state must be executed as a Bitcoin-protocol based transaction — as opposed to using a virtual-machine with a developer-created transaction. Creating a transaction that passes the Bitcoin protocol's security checks, while more challenging, grants a higher level of security to the final code. + +Furthermore, any mistakes that a developer does make in a utxo-based module risk only those funds that are held in utxos that are committed to the Antara Module — as opposed to the entire balance of the wallet associated with a smart contract. + +Balance-based smart contracts that use the popular virtual-machine model cannot compare to the security measures offered by the Bitcoin-protocol's consensus mechanism that is featured in a Komodo Smart Chain. + +As the developer engages with Antara Module development, they can learn how utxo-based modules allow for increased speed in achieving consensus, greater simplicity in software architecture, more flexible functionality between Smart Chains, and many more superior features. + +#### A Brief Look at an Antara Module Template + +The following file, `customcc.cpp`, is a blank template a developer can use when beginning the creation of a new Antara Module. Take a brief look to familiarize yourself with the essential layout. + +[Link to customcc.cpp file](https://github.com/jl777/komodo/blob/dev/src/cc/customcc.cpp) + +The key takeaway is that the entrypoints to Antara's CryptoConditions technology are broken down into a few functions and tables. Once the developer grasps the nature of working with these entry points, building Antara Modules becomes a simple exercise in the common aspects of software development. + +Komodo already offers many SDK functions, tutorials, and best practices to simplify the learning curve and development process, and we continue to develop more of these sources of assistance. + +Before the developer can begin creating new Antara Modules, there are several key concepts to understand in the Bitcoin Protocol. + +*** + +[Link to Next Tutorial in the Advanced Series](/antara/tutorials/advanced-series-1/) +export const title = "Advanced Tutorial: Part-1"; +export const description = "We discuss the importance of unspent transactions, various transaction types and their associated operational codes (op_codes) in Antara Modules."; + +# Advanced Series — Smart Chain Development Basics + +## Understanding Utxos is Important in Antara Modules + +In the [Learning Launchpad Outline](/start-here/learning-launchpad/) the reader received encouragement to understand the basics of blockchain technology in preparation for this tutorial. The [Core Technology Discussions section](/start-here/core-technology-discussions/) provides a useful introduction to most concepts that are necessary for blockchain engineers. + +A key basic concept to understand is the unspent transaction, or utxo. For a brief reminder on the nature of a utxo, read [this section in the Core Technology Discussions section.](/start-here/core-technology-discussions/miscellaneous/#the-utxo-an-elusive-yet-fundamental-concept) + +Observe the data structure of a transaction. + + + ```json + { + "hex": "0400008085202f890100277b16c44a997e8224cb1779688caa20f101c534e037054daa77aa6bbff6000100000049483045022100f26e8fa0fe08ad5d97fe4b2e56b409ef1126aed537878801eb1a38eb5152031d02205444da469fb12d9351b35e235e87c91db09fdbf9a7ac21c44c845046b672eac401feffffff02b8374c000000000023210275610ca15c4688cfebef16f84bce3691dc309591e23fc7298cf3683d9c3fd1efac404b4c00000000001976a914f3f476150b5a0f65a0972520653e6523dc2bd5ac88ac8dffff5cb8dd01000000000000000000000000", + "txid": "6d3b67086ef6964e4022654938e71eb5a248aa5a1853b999381126c7d4dd0364", + "overwintered": true, + "version": 4, + "versiongroupid": "892f2085", + "locktime": 1560280973, + "expiryheight": 122296, + "vin": [ + { + "txid": "00f6bf6baa77aa4d0537e034c501f120aa8c687917cb24827e994ac4167b2700", + "vout": 1, + "address": "RMhKqTr1ssari1wFoVFSSjdLsBXPkDdAac", + "scriptSig": { + "asm": "3045022100f26e8fa0fe08ad5d97fe4b2e56b409ef1126aed537878801eb1a38eb5152031d02205444da469fb12d9351b35e235e87c91db09fdbf9a7ac21c44c845046b672eac4[ALL]", + "hex": "483045022100f26e8fa0fe08ad5d97fe4b2e56b409ef1126aed537878801eb1a38eb5152031d02205444da469fb12d9351b35e235e87c91db09fdbf9a7ac21c44c845046b672eac401" + }, + "value": 0.1, + "valueSat": 10000000, + "address": "RMhKqTr1ssari1wFoVFSSjdLsBXPkDdAac", + "sequence": 4294967294 + } + ], + "vout": [ + { + "value": 0.04995, + "valueSat": 4995000, + "n": 0, + "scriptPubKey": { + "asm": "0275610ca15c4688cfebef16f84bce3691dc309591e23fc7298cf3683d9c3fd1ef OP_CHECKSIG", + "hex": "210275610ca15c4688cfebef16f84bce3691dc309591e23fc7298cf3683d9c3fd1efac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RMhKqTr1ssari1wFoVFSSjdLsBXPkDdAac"] + } + }, + { + "value": 0.05, + "valueSat": 5000000, + "n": 1, + "scriptPubKey": { + "asm": "OP_DUP OP_HASH160 f3f476150b5a0f65a0972520653e6523dc2bd5ac OP_EQUALVERIFY OP_CHECKSIG", + "hex": "76a914f3f476150b5a0f65a0972520653e6523dc2bd5ac88ac", + "reqSigs": 1, + "type": "pubkeyhash", + "addresses": ["RXX78ba9g6aXuNLfeHTN24WhPWj3jWqyia"] + } + } + ], + "vjoinsplit": [], + "valueBalance": 0.0, + "vShieldedSpend": [], + "vShieldedOutput": [], + "blockhash": "002536f5e1cb5b9cad3952e45523d64b17bc56808483f7dc6cdfd7882d58d60d", + "height": 122276, + "confirmations": 1, + "rawconfirmations": 1, + "time": 1560281131, + "blocktime": 1560281131 + } + ``` + + +This transaction has an id, which is given as one of the first key-value pairs. + +```json +"txid": "6d3b67086ef6964e4022654938e71eb5a248aa5a1853b999381126c7d4dd0364" +``` + +The term, `txid`, stands for transaction id. + +Within this transaction there are two arrays. One contains the vins and the other contains the vouts. + +A vin and a vout are short for "vector in" and "vector out". + +The vins and vouts can be considered to be sub-transactions that take place within the main transaction. + +##### Observing the vin + +The vins in a transaction consume unspent values from previous transactions. + +Observe the first (and only) vin in this transaction. + +```json + "vin": [ + { + "txid": "00f6bf6baa77aa4d0537e034c501f120aa8c687917cb24827e994ac4167b2700", + "vout": 1, + "address": "RMhKqTr1ssari1wFoVFSSjdLsBXPkDdAac", + "scriptSig": { + "asm": "3045022100f26e8fa0fe08ad5d97fe4b2e56b409ef1126aed537878801eb1a38eb5152031d02205444da469fb12d9351b35e235e87c91db09fdbf9a7ac21c44c845046b672eac4[ALL]", + "hex": "483045022100f26e8fa0fe08ad5d97fe4b2e56b409ef1126aed537878801eb1a38eb5152031d02205444da469fb12d9351b35e235e87c91db09fdbf9a7ac21c44c845046b672eac401" + }, + "value": 0.10000000, + "valueSat": 10000000, + "address": "RMhKqTr1ssari1wFoVFSSjdLsBXPkDdAac", + "sequence": 4294967294 + } + ], +``` + +This vin takes funds from an address, `RMhKqTr1ssari1wFoVFSSjdLsBXPkDdAac`. + +The amount of funds the vin takes from that address is `"value": 0.10000000`. + +##### Observe the vouts + +To spend these funds, the transaction creates the vouts. + +Observe the two vouts of this transaction. + +```json + "vout": [ + { + "value": 0.04995000, + "valueSat": 4995000, + "n": 0, + "scriptPubKey": { + "asm": "0275610ca15c4688cfebef16f84bce3691dc309591e23fc7298cf3683d9c3fd1ef OP_CHECKSIG", + "hex": "210275610ca15c4688cfebef16f84bce3691dc309591e23fc7298cf3683d9c3fd1efac", + "reqSigs": 1, + "type": "pubkey", + "addresses": [ + "RMhKqTr1ssari1wFoVFSSjdLsBXPkDdAac" + ] + } + }, + { + "value": 0.05000000, + "valueSat": 5000000, + "n": 1, + "scriptPubKey": { + "asm": "OP_DUP OP_HASH160 f3f476150b5a0f65a0972520653e6523dc2bd5ac OP_EQUALVERIFY OP_CHECKSIG", + "hex": "76a914f3f476150b5a0f65a0972520653e6523dc2bd5ac88ac", + "reqSigs": 1, + "type": "pubkeyhash", + "addresses": [ + "RXX78ba9g6aXuNLfeHTN24WhPWj3jWqyia" + ] + } + } + ], +``` + +The first vout sends `0.04995000` coins to the same address we saw in `vin0`. + +The second vout sends `0.05000000` coins to a new address. + +If we take the total value of all vins and subtract the total value of all vouts, we see that there is `0.00005000` difference. + +By design, any leftover amount not claimed by a vout is given to the miner that mines the block that contains this transaction. This is the mining fee. + +##### Making Inferences + +To summarize, the utxo takes `0.1` coins from an address, sends `0.04995` back to the same address, and then sends `0.05` coins to a new address. The leftover amount is automatically given to the miner of the block. + +This suggests that the user who created this transaction desired to send `0.05` coins to the new address. The user may have created this transaction using the [sendtoaddress](/smart-chains/api/wallet/#sendtoaddress) API method. + +From here, the software daemon took control. The software found that within the user's wallet was an existing value of `0.1` coins. This became the vin for the transaction. The first vout the software created was sent back to the address in the user's own wallet. This `0.04995000` value is the "change" from the transaction. The second vout contains the `0.05` the user intended to send to the new address. + +#### Utxo is an Unspent Vout + +A vout that can be spent, but has not yet been spent, is a utxo. + +To determine whether a vout is spent, the developer cannot look directly at the data in a transaction. Rather, the developer makes a requst to the software to look at all following transactions on the blockchain. + +If there is a later transaction that has a vin that consumes the `0.05` vout, that would indicate that the vout is spent. If there is no such transaction, then the vout is still a utxo. + +A transaction can have multiple vouts, and therefore each transaction can technically contain multiple utxos. + +Often times, in conversation developers may call a full transaction a "utxo," for simplicity's purposes. Yet, for developers to truly understand the underlying concept, they should understand that "utxo" refers to a vout, not to a txid. + +#### A Utxo is Not Spent Until Confirmation + +A utxo is not considered spent under any circumstances until the transaction that spends it receives confirmation from the Smart Chain's consensus mechanism. Even when the spending transaction is waiting in the mempool, the utxo remains unspent until the spending transaction receives confirmation from the network. + +A useful comparison here can be found by observing people seeking to attend a ticketed event, such as a music concert. To gain acceptance into the music hall, a person must first have a ticket. We compare this to the creation of a txid. The person must wait in line. This is similar to the mempool. The person must have their ticket stamped, and this is akin to the consensus mechanism approving the transaction. Then the person may enter the music hall. This is the transaction becoming a part of the blockchain history. + +The essence of blockchain technology is that a utxo can only be spent once. In building modules for the Antara Framework, we constantly keep this principle in mind, and the consensus mechanism is our guide. + +## Formation of a Transaction + +Contrary to what one may think, a blockchain transaction is not a simple accounting entry that says, "Address X pays Y amount of funds to address Z." Rather, a transaction also contains a Bitcoin script that must be satisfied before the requested funds can be spent. + +The manner in which transactions are created has evolved over time. Originally, the process consisted only of a "Pay to Pubkey" script, or "P2PK" for brevity. + +In a P2PK transaction, the software checks the cryptographic signature of the public key attempting to spend funds and if the signature is correct the transaction is approved. + +These simple transactions are common in coinbase transactions. (Recall that a coinbase transaction is the transaction that mints new coins onto a blockchain. Coinbase transactions are most frequently encountered as block rewards for miners/stakers, and in the Gensis Block of a chain.) + +If the reader would like a more thorough technical explanation of P2PK transactions, tutorials and explanations abound across the web. [Here is one such example.](https://komodoplatform.com/p2pk-pay-to-pubkey/) + +#### Quantum Computers, Cold Addresses, and Change + +As the early Bitcoin community gained experience, Satoshi Nakamoto foresaw a potential danger. Far in the future, a quantum computer will be able to break the encryption protection of any pubkey address and thereby steal funds. + +To solve this problem, Satoshi invented a method to have a "cold address." Cold addresses are based on a pubkey, but there are various cryptographic functions that separate the two. + +A user can send their funds to a cold address without revealing the associated pubkey. This allows the user to keep their pubkey private, and thus protect their funds from being spent even by a quantum computer, so long as the relationship between the cold address and the pubkey remains a secret. + +Naturally, to spend their funds, the user must utilize their pubkey to create the transaction signature, and thus they reveal the relationship between the cold address and the pubkey. Once the secret is revealed, the cold address no longer offers any protection against quantum computers. + +This encouraged Satoshi to redesign the Bitcoin protocol so that, by default, each time a utxo is spent the leftover amount in the utxo is sent to a new cold address. This is the reason for the "change" addresses that a user sees in their wallet each time they send funds on a default Bitcoin-based blockchain. + +#### Smart Chain and CryptoConditions' Pubkey Parameter Disables Change Addresses + +An astute reader may note that in the above example transaction, the "change" did not go to a new address, but rather to the same address from which the `0.1` coins were taken. The reason for this pertains to CryptoConditions (CC), as the transaction was performed on a Smart Chain that utilizes CryptoConditions. + +When using CC technology, the user typically must provide a designated pubkey via the [pubkey](/smart-chains/setup/common-runtime-parameters/#pubkey) launch parameter. The reason for this will be discussed later. + +A side effect of using this pubkey parameter is that once this is set, the software will stop creating new "change" addresses with each transaction. Instead, the software will send the "change" back to the same cold address that is associated with the pubkey. + +If a user wants to keep funds safe from quantum computers, there are separate CC-related modules that provide protection. For example, [the upcoming Dilithium Antara Module.](/antara/api/dilithium/#introduction) + +#### Pay to Pubkey Hash Transactions + +Transactions that send funds to a cold address are called "Pay to Pubkey Hash" transactions, or P2PKH for brevity. + +When performing a P2PKH transaction, the protocol has a few extra steps to perform. The protocol must check that the hash of the pubkey (which is included as a part of the cold address) is appropriately matched to the pubkey itself. The structure of a P2PKH transaction includes opreturns that instruct the daemon to perform these verification steps. + +The Internet contains many thorough explanations of P2PKH transactions. For more information, [here is one such tutorial.](https://komodoplatform.com/p2pkh-pay-to-pubkey-hash/) + +Once a cold address is associated with a pubkey, the Bitcoin protocol no longer attempts to use these quantum-secure P2PKH transactions, as they require an extra 25 bytes of data space. Instead, the protocol reverts to the original P2PK transactions. + +CryptoConditions typically requires the [pubkey](/smart-chains/setup/common-runtime-parameters/#pubkey) Antara Customization parameter to be enabled. One of the effects of this parameter is that each time a user makes a transaction, the "change" is automatically sent back not to a new cold address, but rather to the pubkey included in the `pubkey` parameter. Therefore, as user transactions are already always returning to a default pubkey, the Antara Module developer can simply skip P2PKH transactions altogether and use only P2PK transactions instead. + +#### Pay to Script Hash Payments + +In addition to P2PK transactions, the original Bitcoin protocol allowed for any type of script opcode in transactions. This seemed like a promising idea at first, but developers quickly discovered that this level of freedom also brought instability. Satoshi limited the options available, and P2PK and P2PKH become the overwhelming majority of all transctions. + +The community still desired the freedom to execute scripts as a part of transactions, and this eventually led to the Pay to Script Hash, or P2SH, standard. + +This method allows the user to lock their funds to the hash of a script. The script itself is typically designed to ensure that the funds are spent in a secure manner, and this is often through a P2PK or P2PKH transaction that is included in the script. + +To unlock the funds, a user provides the original script. The blockchain daemon checks that the script matches the hash, executes the script, and the funds are unlocked. + +For more information about P2SH transactions, [a useful tutorial can be found here.](https://komodoplatform.com/p2sh-pay-to-script-hash/) + +#### Understanding Op Codes + +Each of the above transactions relies on an operation code, also called "opcode", to execute. + +For example, the P2PKH transaction relies on the OP\_CHECKSIG opcode `172` to execute. The opcode is included as a part of the transaction data, typically as a header and in hex format. + +When the daemon detects the opcode in the raw data, the daemon understands what is being asked by the developer and performs the appropriate action. + +Originally, Bitcoin had many opcodes available. Satoshi disabled a large number of opcodes for stability reasons. To see a list of current opcodes in Bitcoin, [visit the Bitcoin wiki.](https://en.bitcoin.it/wiki/Script#Opcodes) + +#### A New Op Code: OP\_CheckCryptoCondition + +The CryptoConditions standard itself relies on a new opcode, OP\_CHECKCRYPTOCONDITION, or OP\_CCC for brevity. + +This opcode is not included in the Bitcoin protocol. Rather, the OP\_CCC standard was originally written and designed by the Interledger team. The full, original OP\_CCC specification is a thirty-three page document, [which you can see here.](https://datatracker.ietf.org/doc/html/draft-thomas-crypto-conditions-04) + +There is no need to read and master the entire original proposal, however, as Komodo's Antara Framework automates much of the underlying aspects. The primary takeaway is that the developer uses OP\_CCC to create a "CryptoConditions transaction," also called a "CC transaction" for brevity. + +A CC transaction includes several special features. This can include a logical condition that must be met for the utxo the transaction creates to be spent in the future. A CC transaction can also include a fulfillment of the logical conditions set forth in a previous CC transaction. The binary encodings of these CC transactions can be used in a Smart Chain utxo. These features are the foundation of a CC-related Antara Module. + +OP\_CCC provides many relatively convenient use cases, and the developer can expand on these use cases when necessary. For example, a standard use case of OP\_CCC is a `1of1` CC script. This type of CC transaction requires only 1 signature, and is accompanied by a few custom constraints. Many of the current default Antara Modules rely on the `1of1` script OP\_CCC. + +A more intricate use case of OP\_CCC, on the other hand, can be found in the upcoming Payments Module. This module uses a `1of2` CC script, which allows for one of two signatures to sign a CC transaction, and the script also features several customized constraints. + +*** + +[Link to Next Tutorial in the Advanced Series](/antara/tutorials/advanced-series-2/) +export const title = "Advanced Tutorial: Part-2"; +export const description = "Learn about different Eval Codes and the many Possibilities of OC_CHECKCRYPTOCONDITION."; + +# Advanced Series — Antara Module Development Basics + +## The Eval Code + +In the Komodo source code, each Antara Module has an associated arbitrary number, called an "eval" code. This code can be any digit between `0` and `255`, there can be only one code per module, and each code is currently one byte in size. To add a new Antara Module, the developer begins by adding a new eval code to the table of all active eval codes on their Smart Chain. + +We define all eval codes in the [\~/komodo/src/cc/eval.h](https://github.com/jl777/komodo/blob/jl777/src/cc/eval.h) file. The following eval codes represent the essential, default modules in a Smart Chain. + +```c +#define FOREACH_EVAL(EVAL) \ + EVAL(EVAL_IMPORTPAYOUT, 0xe1) \ + EVAL(EVAL_IMPORTCOIN, 0xe2) \ + EVAL(EVAL_ASSETS, 0xe3) \ + EVAL(EVAL_FAUCET, 0xe4) \ + EVAL(EVAL_REWARDS, 0xe5) \ + EVAL(EVAL_DICE, 0xe6) \ + EVAL(EVAL_FSM, 0xe7) \ + EVAL(EVAL_AUCTION, 0xe8) \ + EVAL(EVAL_LOTTO, 0xe9) \ + EVAL(EVAL_MOFN, 0xea) \ + EVAL(EVAL_CHANNELS, 0xeb) \ + EVAL(EVAL_ORACLES, 0xec) \ + EVAL(EVAL_PRICES, 0xed) \ + EVAL(EVAL_PEGS, 0xee) \ + EVAL(EVAL_TRIGGERS, 0xef) \ + EVAL(EVAL_PAYMENTS, 0xf0) \ + EVAL(EVAL_GATEWAYS, 0xf1) +``` + +As the eval code must range between `0` and `255`, a Smart Chain can have up to 256 total modules. The developer of a Smart Chain can determine which modules to add from the available modules in the ecosystem. At this time, we do not yet have 256 total modules, and therefore there is no need to choose. + +#### Validation Code + +The developer adds validation code that will be executed any time the daemon encounters a transaction bearing the relevant module's eval code. + +This is where the true power of CC begins. When validating a normal transaction, the daemon has access only to information included in the transaction itself. With a CC transaction, however, the daemon is running arbitrary code, and therefore anything is possible. The validation code can look through the blockchain history, observe transactions in the mempool, and even utilize Antara's cross-chain technology. + +Technically, OP\_CCC scripts do not have a required structure. The scripts only need to follow the general structure of the initial layout. The developer may follow the general guideline, as provided in our templates and tutorials. This allows the developer to code and debug their OP\_CCC related modules in an efficient manner. + +#### Flexbile Pubkey Expression + +To understand how CryptoConditions (CC) manages addresses and scripts, the developer should first understand a few basic concepts regarding pubkeys. + +Originally, Bitcoin pubkeys were 64 bytes, as opposed to the 33 byte pubkeys of today. The 64 byte pubkeys had a left half and a right half which were used for internal functions in the daemon. Using cryptographic methods, a developer could derive the left half of the function from the right half, and vice versa. + +Early Bitcoin developers took advantage of the ability to derive one half of the pubkey from the other, and compressed the pubkey to a smaller size. They also instituted prefixes that informed the daemon whether the pubkey was odd, even, or large (`02`, `03`, and `04` respectively). In the end, the developers compressed the 64 byte pubkey into a 33 byte version. + +Today, there are multiple ways to express a pubkey. There are compressed and uncompressed versions of the pubkey, and the pubkey can also be expressed as two different base58 encoded addresses. All of these are associated with the same private key. + +#### Pubkeys and CC Addresses + +When working with software based on the Bitcoin protocol, a common problem a developer encounters is found in creating an address that is associated with a script. A frequent solution is to hash the script and use the hash as the address. Komodo uses this solution in the Antara CC implementation. Using this method, the CC script serves as the CC address. + +With this in mind, the essential structure of a CC script is as follows. (The automatically generated content is handled by the daemon's internal functions and can be ignored.) + +``` +evalcode + pubkey + automatically generated content +``` + +Each CC script utilizes the eval code of the module to which the CC script belongs. Since the CC script includes both the pubkey and the module's unique eval code, a pubkey makes a unique CC address for each module. + +Funds that are sent to a CC address can be spent only by the module with the appropriate eval code, and therefore funds created and associated with an eval code maintain scarcity within this module. + +A common and simple CC script exists in nearly all of the default Antara Modules. The structure of this script consists of a single signature from a pubkey and CC validation. This is essentially the equivalent of a P2PK Bitcoin script; the CC validation returns `true` or `false`, whereas the P2PK Bitcoin script returns `1` or `0`. + +#### Global CC Address + +By convention, each Antara Module has a global CC address where the privkey is publicly available. As usual, spending from this global CC address requires that the spender meet all validation rules set forth by the developer. Therefore, the lack of privacy for the private key is not an issue. + +One purpose for this global CC address is to create a repository that is global (within the module) for information regarding specific instances of this module on the chain. + +For example, typically the design of an Antara Module requires that each time a user initiates an instance of the module, the user also sends a small amount of funds to this global CC address. This transaction contains data about the instance the user desires to create. Other users on the network can retrieve the data in this global CC address, and thereby gain knowledge about the current state of all module instances on the Smart Chain. + +## Vector Inputs and Outputs + +A transaction in the Bitcoin protocol consists of input and output vectors, called "vins" and "vouts" for brevity. The vins take funds from utxos, combine them into one "spend" transaction, and create new vouts. Some of the vouts may be new utxos. + +``` +vin0 + vin1 + ... + vin[n-1] -> vout0 + vout1 + ... vout[n-1] +``` + +Each of the vouts has a spend script that must be satisfied before the vout can be spent. + +Suppose vout0 is a normal utxo with a small amount of funds and the receiver of this utxo desires to spend it. They create a new transaction with a vin that consumes vout0. This vin must satisfy any scripts that are contained in vout0. + +#### CC Enhances the Script Between Vin and Vout to Advanced Levels + +A key power of CryptoConditions (CC) is the ability to enhance the script that must be satisfied between a vin and a vout. In CC, the vout contains the logical condition, and the vin contains the logical fulfillment. + +With access to arbitrary code, CC allows the Bitcoin protocol to rival the "smart contracts" common on other platforms. Yet, CC accomplishes this without requiring the virtual-machine counterpart that other smart-contract platforms require. Instead, the consensus mechanism is directly engaged with the scripts in the vins and vouts of transactions. + +The Bitcoin protocol's consensus mechanism is constantly placed under the most intense of pressure in the industry, and therefore is likely the most reliable consensus mechanism available. The ability to engage the consensus mechanism in arbitrary code while not changing the consensus mechanism itself grants Antara security and stability. The utxo system of the Bitcoin protocol also reduces the likelihood that modules themselves will contain bugs internally. (The reader should note that CC cannot eliminate attack vectors altogether.) + +#### The Many Possibilities of OC\_CHECKCRYPTOCONDITION + +Consider the implications of the combination of possibilities contained in this new opreturn, OP\_CCC. As there can be up to 256 eval codes per Smart Chain, there can be up to 256 different types of CC outputs per chain. Each CC transaction can contain multiple vins and vouts, each of which provides CC related fulfillments and conditions. Also, each module has a globally available CC address to allow for chain-wide functionality, making the possibilities per vin or vout 257. + +Observe the essential structure of a transaction with 3 vins and 2 vouts. + +``` +vin0 + vin1 + vin2 -> vout0 + vout1 +``` + +With the possibilities of OP\_CCC, the combination allows for 1.12e+12 possibile combinations. + +``` +257 * 257 * 257 * 257 * 257 = 1.12e+12 +``` + +This is a dramatic increase in the possibilities over the limits of the original Bitcoin protocol. + +While the possibilities of a transaction are essentially limitless, the developer must create validation code that ensures the module and its transactions function as intended. Therefore, in practice the developer often limits the possibilities to `1` to `3` types per vin or vout. + +## Introduction to the Remote Procedure Call (RPC) + +A Remote Procedure Call (RPC) allows a module developer the ability to offer easy access to their module's functionality. The role of the RPC calls are to create properly signed raw transactions that are ready for broadcasting. + +The developer places the command name of each RPC they desire to create into a table in the CC source code. From this table, the built-in komodo-cli software is able to access and execute the RPC. In this manner, developers of all skills levels can integrate Antara Modules into other software. + +Antara Modules can have any RPCs the developer desires, or even have no RPCs. By convention, each Antara Modules has a few default RPCs: `address`, `list`, and `info`. For example, the Dice module has, `diceaddress`, `dicelist`, and `diceinfo`. Respectively, these RPCs return information about a CC-related address, the list of all instances of this module on the Smart Chain, and information about the chain-wide state of the module. + +## Creating a Global CC Address + +The following code from the Faucet module serves as an example of the manner in which we begin the creation of a global CC address for this module. + +```c +const char *FaucetCCaddr = "R9zHrofhRbub7ER77B7NrVch3A63R39GuC"; +const char *FaucetNormaladdr = "RKQV4oYs4rvxAWx1J43VnT73rSTVtUeckk"; +char FaucetCChexstr[67] = { "03682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe12" }; +uint8_t FaucetCCpriv[32] = { 0xd4, 0x4f, 0xf2, 0x31, 0x71, 0x7d, 0x28, 0x02, 0x4b, 0xc7, 0xdd, 0x71, 0xa0, 0x39, 0xc4, 0xbe, 0x1a, 0xfe, 0xeb, 0xc2, 0x46, 0xda, 0x76, 0xf8, 0x07, 0x53, 0x3d, 0x96, 0xb4, 0xca, 0xa0, 0xe9 }; +``` + +For a template of this logic pattern, view the [CCcustom.cpp](https://github.com/jl777/komodo/blob/jl777/src/cc/CCcustom.cpp) file. + +[Link to CCcustom.cpp file](https://github.com/jl777/komodo/blob/jl777/src/cc/CCcustom.cpp) + +Note that at the bottom of the file there is a switch statement. There, the above values are copied into an in-memory data structure for each CC type. This allows the entire CC codebase to access the global CC addresses in a standard manner. + +To create a global CC address for a new module, follow these steps. + +#### Create a value using getnewaddress + +With the `komodod` daemon running, use the [getnewaddress](/smart-chains/api/wallet/#getnewaddress) RPC with `komodo-cli` to get a new address. (You may use any Komodo Smart Chain, such as the KMD main chain, for this procedure.) + +Copy this value into the first line of the code. For example, in the Faucet code above the result is as follows. + +```c +const char *FaucetNormaladdr = "RKQV4oYs4rvxAWx1J43VnT73rSTVtUeckk"; +``` + +#### Retrieve the pubkey using validateaddress + +Use the [validateaddress](/smart-chains/api/util/#validateaddress) RPC with `komodo-cli` to obtain the pubkey of the new normal address from the previous step. + +Place the returned value into the `[67]` line of code. + +```c +char FaucetCChexstr[67] = { "03682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe12" }; +``` + +#### Restart the Daemon with the pubkey + +Stop the daemon and restart with the [pubkey](/smart-chains/setup/common-runtime-parameters/#pubkey) launch parameter enabled. Use the pubkey from the validateaddress RPC as the pubkey value. + +#### Ensure the Myprivkey Function is Properly Enabled + +Check that the `if ( 0 )` statement is enabled in the `Myprivkey()` function in the `/src/cc/CCutils.cpp` file. + +#### Add the First RPC + +Add a line to the `/src/server.h` file to create the `address` function for the module. + +Update the commands array in the `/src/server.cpp` file. + +Add the code for `address` into the `/src/wallet/rpcwallet.cpp` source file: + +```c +UniValue address(const UniValue& params, bool fHelp) +{ + struct CCcontract_info *cp,C; std::vector pubkey; + cp = CCinit(&C,EVAL_); + if ( fHelp || params.size() > 1 ) + throw runtime_error("address [pubkey]\n"); + if ( ensure_CCrequirements(0) < 0 ) + throw runtime_error(CC_REQUIREMENTS_MSG); + if ( params.size() == 1 ) + pubkey = ParseHex(params[0].get_str().c_str()); + return(CCaddress(cp,(char *)"",pubkey)); +} +``` + +Replace `` with your eval code name. For example, `EVAL_FAUCET` or `EVAL_ASSETS`. + +Replace `` with your module name. For example, `faucetaddress`. + +#### Obtain the CCaddress + +Execute the `address` RPC call and use the returned value to complete the `CCaddr` line of code. + +``` +const char *FaucetCCaddr = "R9zHrofhRbub7ER77B7NrVch3A63R39GuC"; +``` + +#### Obtain the privkey in Hex Format + +From the response returned by the `address` RPC, use the hex value of the private key to complete the appropriate line of code. + +``` +uint8_t FaucetCCpriv[32] = { 0xd4, 0x4f, 0xf2, 0x31, 0x71, 0x7d, 0x28, 0x02, 0x4b, 0xc7, 0xdd, 0x71, 0xa0, 0x39, 0xc4, 0xbe, 0x1a, 0xfe, 0xeb, 0xc2, 0x46, 0xda, 0x76, 0xf8, 0x07, 0x53, 0x3d, 0x96, 0xb4, 0xca, 0xa0, 0xe9 }; +``` + +Stop the daemon and restart it using the new pubkey. + +#### Copy the Existing Default RPCs to the New Module + +From the `/src/wallet/rpcwallet.cpp` file, copy and paste the existing RPC functions to create new versions for the new module. Change the eval code and customize the functions as desired. + +Add an entry into the `/src/cc/eval.h` file. + +## Introduction to Validation + +A large portion of Antara Module customization pertains to the manner in which the validation code constrains CC transaction input. + +The CC validation code is called at the time that the consensus mechanism is validating a CC transaction. The consensus mechanism only calls the CC validation code and waits for a response of `true` or `false`. Whether or not the CC validation code is effective is a matter for the developer to resolve. + +The developer is responsible for properly designing both the validation code and the RPC implementations. Both should work together to ensure that RPCs cannot create transactions that should not exist, and the CC validation code should only validate proper transactions. + +The CC validation code is already locked in the main loop of the Bitcoin protocol at the time the code is called. Care should be taken with the CC validation code to ensure that the code does not cause a deadlock on the chain. + +*** + +[Link to Next Tutorial in Advanced Series](/antara/tutorials/advanced-series-3/) +export const title = "Advanced Tutorial: Part-3"; +export const description = "Explore this advanced tutorial on preparing for Heir Antara Module development, gain insight into Antara framework, and learn to use transactions as data sources."; + +# Advanced Series — Preparing for Heir Development + +This tutorial in the series assists the reader in preparing to later build a full simplified prototype of the default [Heir Antara Module.](/antara/api/heir/#introduction) + +The primary aim for buildling the Heir prototype is to give the developer direct engagement with Antara Module development, with a focus on the CryptoConditions (CC) aspects. This process will give the developer a better grasp of the broad potential of the Antara framework. + +Furthermore, in the process of completing this tutorial the developer will learn how the source code is organized. + +## A Conceptual Understanding of the Intended Product + +To gain an idea of the intended result, read the introduction of the Heir Module API. (Read until the start of the section named Heir Module Flow and then pause.) + +[Link to Introduction to the Heir Antara Module](/antara/api/heir/#introduction) + +The basic concept to understand is that the Heir module allows the owner of a Smart Chain digital asset to designate an inheritor of the asset, should the owner become inactive on the chain. + +In terms of design, this is a relatively straightforward Antara Module, which is one reason we use it here. + +## Complete the Heir Module Flow Section (Optional) + +Before we begin the development process, it may be helpful to first experiment with the flow of RPC commands for the existing Heir module. + +This section is optional, but recommended. + +At this point in the tutorial series, the reader can either create a new default Smart Chain to test the Heir Module, or they may use an existing Smart Chain, such as DOC. + +[Link to instructions to create a new default Smart Chain.](/smart-chains/tutorials/create-a-default-smart-chain/#creating-komodo-smart-chains) + +The reader will need to create a new default Smart Chain either way as a part of the tutorial, but if the reader chooses to use the DOC Smart Chain for this optional step, the reader has the opportunity to observe another Antara Module in action. This presents a learning opportunity. + +The module we refer to here is the [Faucet Antara Module](/antara/api/faucet/) + +#### On the Relevance of the Faucet Module + +The Faucet Module allows a user to tap into existing funds on a public Smart Chain. This module provides a simple example of the nature of an Antara Module for our study. + +Faucet allows a user to lock an arbitrary amount of funds within an Antara address. Other users on the network are able to withdraw funds from this Antara address in small portions. To prevent spam requests, Faucet requires a small amount of proof-of-work from the requesting user's node. + +From this outline, we observe the basic business logic of the Faucet module. The module involves storing funds in a designated address, the creation of a faucet that can disburse funds, and the ability to limit the rate at which funds are withdrawn. + +Compare this to our desired Heir module. The Heir module's business logic must allow a designated address the ability to inherit designated blockchain funds. + +In both cases, the module's business logic is bound to transactions. + +#### Launch the DOC Smart Chain (Optional) + +The live community test chain, DOC, has the Heir Module enabled and can serve the purpose of providing a live demonstration. + +Launch the chain as follows. + +```bash +./komodod -pubkey=$pubkey -ac_name=DOC -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -ac_staked=10 -addnode=65.21.77.109 -addnode=65.21.51.47 & +``` + +#### Create a pubkey + +Use the following guide to create an Antara pubkey and address on the DOC Smart Chain. + +[Link to Antara pubkey creation guide](/antara/tutorials/understanding-antara-addresses/#creating-and-launching-with-a-pubkey) + +#### Retrieve DOC Funds Using the Faucet Module + +To obtain funds on the DOC Smart Chain we utilize the Faucet Antara Module. + +```bash +./komodo-cli -ac_name=DOC faucetget +``` + +This returns a raw transaction that you must now broaadcast using [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) + +Wait a few moments, and then use the [getinfo](/smart-chains/api/control/#getinfo) method to verify that your wallet now contains DOC funds. + +#### Complete Each API Method of the Heir Module + +With funds in your wallet, you are prepared to experiment with the API commands available in the Heir Module Flow section. We recommend experimenting with each command until you have executed each at least once. + +[Link to Heir Module Flow](/antara/api/heir/#introduction) + +## Transactions as a Data Source + +Transactions are a data source for Antara-based software. + +Transactions can store data in multiple forms. In the simplest form, transaction data records the movement of coins from one address to another. However, blockchain transactions are capable of storing additional data beyond simple coin movement. + +When we desire to place additional data into a transaction, we place this data into an OP\_RETURN, or "opreturn" for short. + +Observe the following transaction data structure for the existing Heir module: + +##### Command + +```bash +./komodo-cli -ac_name=HELLOWORLD heirfund 0 5 MyDogHeir 037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f9299 100 'http://billionaire.com/mywill md5=5385639869' +``` + +##### Response (annotated) + + + ```json + { + "txid": "9307989767c1d10b3c97834c7e9f50583387907848bc9776b4b77a705791864c", + "overwintered": false, + "version": 1, + "locktime": 0, + + // List of transaction inputs + // These are the references to the transaction outputs of older transactions + // The transactions of older outputs are spent in this transaction input + + "vin": [ + { + "txid": "e5af0f5993d64e68c655e3ca9309d5fd4f10906032ab587fc2142673a3a73109", + "vout": 0, + "scriptSig": { + "asm": "3045022100bae36ff4c95978379391bf1330d964d9cb6bd767386f427099185838ae30a9660220448463c41fa2a4628bde304c922c6d52618f5c427b243dfb24da9c14590118b7[ALL]", + "hex": "483045022100bae36ff4c95978379391bf1330d964d9cb6bd767386f427099185838ae30a9660220448463c41fa2a4628bde304c922c6d52618f5c427b243dfb24da9c14590118b701" + }, + "sequence": 4294967295 + }, + { + "txid": "0a97509be8c178c5c13903844d187148f0c10d309b7a2e260a629ea724d39395", + "vout": 0, + "scriptSig": { + "asm": "3045022100b931e2928b882ebb6adafb906d3480cc3e8537f92190dd355e548bac7405e9ca022047b2c3fc8fadb8483156d05b1acbba97b4bcb357b47fefb5e3ea602205e38f5c[ALL]", + "hex": "483045022100b931e2928b882ebb6adafb906d3480cc3e8537f92190dd355e548bac7405e9ca022047b2c3fc8fadb8483156d05b1acbba97b4bcb357b47fefb5e3ea602205e38f5c01" + }, + "sequence": 4294967295 + } + ], + + // List of transaction outputs + + "vout": [ + { + "value": 5.0, + "valueZat": 500000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020676da179ba51a7f6398418c272945433aed27c6d255297a4724693abb5adfa2181031210008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020676da179ba51a7f6398418c272945433aed27c6d255297a4724693abb5adfa2181031210008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RDTm14n15gjwcRaj4BD94NTkJdRiRsV7N7"] + } + }, + + // This is a cryptocondition output + // It contains a fingerprinted condition + + { + "value": 0.0001, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "a22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RDVHcSekmXgeYBqRupNTmqo3Rn8QRXNduy"] + } + }, + + // A normal output (i.e. not a cryptocondition) with a standard OP_CHECKSIG script + + { + "value": 999994.06084534, + "valueZat": 99999406084534, + "n": 2, + "scriptPubKey": { + "asm": "02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567 OP_CHECKSIG", + "hex": "2102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RN727JeeiZ6NXic7PUKTCiHT1HvuBN4RDa"] + } + }, + + // Normal output with a standard OP_CHECKSIG script + + { + "value": 0.9998, + "valueZat": 99980000, + "n": 3, + "scriptPubKey": { + "asm": "02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567 OP_CHECKSIG", + "hex": "2102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["RN727JeeiZ6NXic7PUKTCiHT1HvuBN4RDa"] + } + }, + + // At the end of the output array there is an opreturn output with serialized data + // This is created by the Anatara Heir module + + { + "value": 0.0, + "valueZat": 0, + "n": 4, + "scriptPubKey": { + "asm": "OP_RETURN ea462102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756721037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f92996400000000000000094d79446f67486569722c687474703a2f2f62696c6c696f6e616972652e636f6d2f6d7977696c6c206d64353d35333835363339383639", + "hex": "6a4c85ea462102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b4756721037736c263991316c6a23397a982a1f8c18ae8642e944448162a93a824c31f92996400000000000000094d79446f67486569722c687474703a2f2f62696c6c696f6e616972652e636f6d2f6d7977696c6c206d64353d35333835363339383639", + "type": "nulldata" + } + } + ], + "vjoinsplit": [] + } + ``` + + +The opreturn is the last output in a transaction, and this output is never spendable under any circumstances. The opreturn is the location where all Antara Module data is stored. We will demonstrate how this is accomplished further on. + +The opreturn vout contains two key-value pairs that are related to each other, `asm` and `hex`. The first, `asm`, is simply a less encoded version of the `hex` value. + +In the above example data structure, note how the value for the key, `asm`, begins with `OP_RETURN ... `, and is followed by additional hex-encoded data. The additional hex-encoded data is arbitrary, and can be used for any purposes a developer sees fit. + +Taking the value in the fully encoded key-value pair, `hex`, here is an approximate breakdown of the data. + +| Hex Value | Translation | +| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 6a | OP\_RETURN | +| 4c85 | Encoded length of the following data. This value is not a string, the value is encoded in the Smart Bitcoin variable length format, and the value is not directly readable. | +| ea | Stands for "EVAL\_HEIR". The eval code here tells the daemon that this is an Antara Module, and that the specific module is HEIR | +| 46 | Stands for "F", which is a letter marker to indicate that this Heir transaction is a "Funding" transaction | +| 210... | The remaining portion of the hex encoded data is not related to the core software, but rather to the arbitrary data designed by the developer. Maximum data length is 10000 bytes | + +In all modules, some of the hex-encoded data can be decoded using the [decodeccopret](/smart-chains/api/util/#decodeccopret) command on the data contained in the `hex` key-value pair. In our example, the decoded data is as follows. + +```json +{ + "result": "success", + "OpRets": [ + { + "eval_code": "EVAL_HEIR", + "function": "F" + } + ] +} +``` + +When an Antara Module instance begins its life cycle an initial transaction is created. In our example, the transaction we see above is an initial transaction of a full, non-simplified Heir module. + +Note that the transaction takes value from normal inputs and sends it to CC outputs, as indicated in the `type` key-value pair. + +#### Value Taken From Normal vins + + + ```json + "vin": [ + { + "txid": "e5af0f5993d64e68c655e3ca9309d5fd4f10906032ab587fc2142673a3a73109", + "vout": 0, + "scriptSig": { + "asm": "3045022100bae36ff4c95978379391bf1330d964d9cb6bd767386f427099185838ae30a9660220448463c41fa2a4628bde304c922c6d52618f5c427b243dfb24da9c14590118b7[ALL]", + "hex": "483045022100bae36ff4c95978379391bf1330d964d9cb6bd767386f427099185838ae30a9660220448463c41fa2a4628bde304c922c6d52618f5c427b243dfb24da9c14590118b701" + }, + "sequence": 4294967295 + }, + { + "txid": "0a97509be8c178c5c13903844d187148f0c10d309b7a2e260a629ea724d39395", + "vout": 0, + "scriptSig": { + "asm": "3045022100b931e2928b882ebb6adafb906d3480cc3e8537f92190dd355e548bac7405e9ca022047b2c3fc8fadb8483156d05b1acbba97b4bcb357b47fefb5e3ea602205e38f5c[ALL]", + "hex": "483045022100b931e2928b882ebb6adafb906d3480cc3e8537f92190dd355e548bac7405e9ca022047b2c3fc8fadb8483156d05b1acbba97b4bcb357b47fefb5e3ea602205e38f5c01" + }, + "sequence": 4294967295 + } + ], + ``` + + +#### Value Sent to CC vouts + + + ```json + + ... + + { + "value": 5.00000000, + "valueZat": 500000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c8020676da179ba51a7f6398418c272945433aed27c6d255297a4724693abb5adfa2181031210008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020676da179ba51a7f6398418c272945433aed27c6d255297a4724693abb5adfa2181031210008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": [ + "RDTm14n15gjwcRaj4BD94NTkJdRiRsV7N7" + ] + } + }, + { + "value": 0.00010000, + "valueZat": 10000, + "n": 1, + "scriptPubKey": { + "asm": "a22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c8020286b36b233cc03c91652560f4ecf9404bcf10b61033916d67edf4a216c92cf758103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": [ + "RDVHcSekmXgeYBqRupNTmqo3Rn8QRXNduy" + ] + } + }, + + ... + + ``` + + +#### Key Takeaways + +The important aspect to note here is that an initial transaction of a module instance typically takes value from normal inputs and sends it to CC outputs. + +As time progresses, more transactions on the Smart Chain are performed under this module instance. Each of the module instance's transactions spends from the previous transaction outputs associated with the instance and creates new unspent transactions. This process effectively creates a [linked-list data structure.](https://en.wikipedia.org/wiki/Linked_list) + +With each transaction, the opreturn output is never spent, and remains in the blockchain as a source of Antara Module data (read only). + +*** + +[Link to Next Tutorial in Advanced Series](/antara/tutorials/advanced-series-4/) +export const title = "Advanced Tutorial: Part-4"; +export const description = + "Understand CryptoConditions, and learn how Antara Modules serve as the data and logic layer."; + +import veryfyWork from "@/public/images/antara/cc-verify-work-v2.3.png"; +import antaraArch from "@/public/images/antara/CC-Antara-arch-v2.3.png"; +import srtuctureGuide from "@/public/images/antara/cc-tx-structure-for-guide-v3.2.png"; + +# Advanced Series — Final Conceptual Discussion + +Up to this point in the tutorial series we have discussed the general concepts of the Antara Framework and we have discussed initial preparations to build a simplified prototype of the Heir Antara Module. + +This section of the tutorial series reviews many of the conceptual aspects of the Antara Framework while also diving more thoroughly into technical details. + +This is the final conceptual discussion necessary before we begin writing code. + +## Understanding CryptoConditions + +According to the industry-wide CryptoConditions standard, a CryptoCondition is a logical expression evaluated on electronic signatures and hashes of transaction data. + +CryptoConditions are stored in the scripts of transactions and are evaluated by a supporting CryptoCondition C library. + +In a Komodo Smart Chain, the default CC library is included during the installation procedure. + +#### Antara Extensions to CryptoConditions + +In addition to the industry-standard CryptoCondition (CC) library, Komodo's implementation of CC integrates the ability to add arbitrary code into a Smart Chain's consensus mechanism. This allows developers to create essentially an unlimited number of application-specific transaction-validation rules. + +For example, in the Heir Module, if the heir attempts to claim funds, the validation code checks whether the owner of the fund has shown recent activity, according to a specified amount of time. The owner can show activity by either adding to or spending from the fund. If the owner has not shown signs of activity, the validation code allows the heir to claim the funds. + +Through CryptoConditions and Antara's extensions, the consensus mechanism can rule over the outcome of the cryptocondition logic and arbitrary validation code across the Smart Chain's decentralized network of nodes. + +#### Makeup of a CryptoCondition + +A CryptoCondition consists of two parts: + +* Part I: A condition that must be met- This is stored in the transaction + output's `scriptPubKey` +* Part II: A fulfillment- This is stored in the `scriptSig` field of the + input of the transaction that spends the above output + +##### Part I: Logical Condition + +The condition contains data that checks the CryptoCondition in "fingerprinted" form. + +The term ["fingerprinted"](https://en.wikipedia.org/wiki/Fingerprint_\(computing\)) is a common term in the technology industry. To "fingerprint" data means to convert an arbitrary set of data to a fixed-length byte array. In this manner, a fingerprint uniquely identifies the source data. (A fingerprint is similar in nature to a hash.) + +To fingerprint data in the CryptoConditions environment, the CC library acquires the target data, combines it with other data that the developer does not need to manage, and then creates the fingerprint. + +Fingerprints are useful in Antara Module development. For example, a logical condition can be a requirement that only a specific fingerprinted `pubkey` be allowed to spend a transaction output. + +##### Part II: Logical Fulfillment + +The fulfillment contains instructions and data about how the consensus mechanism should evaluate the CryptoCondition. For example, the fulfillment could include an instruction to check a spending-transaction's electronic signature as well as the the `pubkey` associated with this signature. + +To spend a CC output of a transaction, a node on the network sends a spending transaction that contains a CC input that fulfills the CC output's condition. The consensus mechanism of the Smart Chain checks that the fulfillment is correct. For this it uses the C CryptoCondition library to evaluate the fulfillment of the spending transaction. The result of this evaluation is checked against the condition stored in the previous transaction output. + +For our example above of an electronic signature, the consensus mechanism runs the logical conditions and fulfillments of the CryptoCondition to verify the electronic signature with the provided pubkey. Then the validation logic calculates the fingerprint of the pubkey and checks it against the condition. + +In adding CryptoConditions to the Antara framework, Komodo extended the original CC protocol by adding an additional aspect beyond the inputs and outputs. This additional part is called the EVAL CryptoCondition, or eval code. + +Each Antara Module has its own unique eval code. The eval code is a number between 0 and 255, and it identifies the specific Antara Module that is associated with a CC transaction. When the consensus validation logic encounters the Antara Module's eval code in a transaction input, the validation logic calls the module's validation function. + +The process of validation of an Antara Module's transaction is depicted on the diagram below: + + + +#### The Simplest form of a CryptoCondition + +The simplest CryptoCondition evaluates an electronic signature of a spending-transaction's `scriptsig`. Assuming the evaluation is successful, the spending-transaction is then able to spend funds from the output of another transaction. + +At first glance, you may be confused about why a CryptoCondition is useful in this event, as a normal blockchain protocol can already accomplish this task. + +The answer is that there is an important difference in the CryptoCondition implementation. When a CryptoCondition transaction output is spent, the Antara Module's code can enforce additional validation logic. This is accomplished via the eval code that is stored as a part of the CryptoCondition's inputs and outputs. We will describe this further in the Heir Module development section. + +The ability to enforce additional logic is the key difference that illuminates the power of Antara. For example, additional arbitrary validation code can include logic that allows a user to spend the output only at the appropriate time. The transaction output can be spent only via a spending transaction that has the matching fulfillment, and both the CryptoCondition and the Antara Module validation code evaluate to `true`. + +Even the basic CryptoCondition features offer more complex logical expressions than a normal Bitcoin Script. For example, with CC a spending transaction could be required to have signatures from at least `M` of `N` acceptable `pubkeys`. + +As logical conditions and subconditions can be added to a CryptoCondition as desired, the developer can utilize both the CryptoConditions features and customized module's validation code to build complex logic that governs the movement of Smart Chain assets. In this sense, Antara is an advanced evolution of the basic Bitcoin Script security features, such as pubkey or pubkey hash scripts. We will examine validation code in greater detail later in this tutorial. + +In this section, we became acquainted with the concept of logical conditions that are associated with transaction outputs, and logical fulfillments associated with spending-transactions. These two elements make up the rudimentary aspect of a CryptoCondition. + +There are yet other elements of an Antara-based CryptoCondition. One element is called the `EVAL` code, and it is stored in the CryptoCondition's inputs and outputs. We will touch on this topic soon. + +#### Antara Module as Data and Business Logic Layer of Business Application + +An Antara Module can be described as a combination of a data layer and a business-logic layer in an application. The data layer is the collection of transactions related to the Antara Module, and the business-logic layer is the module's arbitrary code. + +These two layers tie in with other layers in an Antara-based software application. For example, the software external to the blockchain could include a presentation layer, consisting of a Graphical User Interface (GUI) and other visual elements. External applications interact with an Antara Module via its RPC calls. + +Also, there can often be an additional oracle layer, wherein oracle software connects nodes to external data sources across the Internet. This can be the case in Antara-based software applications that make use of the [Oracles](/antara/api/oracles/#introduction) Antara Module. + +#### A Global CC Address in the Antara Framework + +Recall that each Antara Module has an associated global CC address. The private key to this global CC address is publicly available. The address can be used for such tasks as sharing funds between users of this module, and anyone can attempt to spend funds from this address. + +The following is an example of a global CC address created and assigned for the Heir module. + +```cpp +const char *HeirCCaddr = "RDVHcSekmXgeYBqRupNTmqo3Rn8QRXNduy"; +const char *HeirNormaladdr = "RTPwUjKYECcGn6Y4KYChLhgaht1RSU4jwf"; +char HeirCChexstr[67] = { "03c91bef3d7cc59c3a89286833a3446b29e52a5e773f738a1ad2b09785e5f4179e" }; +uint8_t HeirCCpriv[32] = { 0x9d, 0xa1, 0xf8, 0xf7, 0xba, 0x0a, 0x91, 0x36, 0x89, 0x9a, 0x86, 0x30, 0x63, 0x20, 0xd7, 0xdf, 0xaa, 0x35, 0xe3, 0x99, 0x32, 0x2b, 0x63, 0xc0, 0x66, 0x9c, 0x93, 0xc4, 0x5e, 0x9d, 0xb9, 0xce }; +``` + +| Function | Description | +| -------------- | ----------------------------------------------------------------------------------------------------------------------- | +| HeirCCaddr | the global CC address itself | +| HeirCChexstr | the pubkey | +| HeirCCpriv | the privkey for the global CC address | +| HeirNormaladdr | The normal address for the same pubkey and privkey. Spending from this address does not validation by the Antara Module | + +In the Antara codebase, the global CC address is sometimes called the "unspendable" address. This is likely a reference to the fact that for any user to spend funds from this address, the spending transaction must pass the module's validation code. + +For example, the global CC address could store funds shared between several users. As a global CC address's privkey is publicly available, anyone might try to spend these funds. This is where the Antara validation code will exercise control over whom is allowed to spend funds, and by which rules. The RPC aspect of the Antara Module must prevent the creation of inappropriate transactions as well. + +A transaction can also send a nominal fee to the global CC address with the intention of turning this transaction's output into a search key (called a marker). To ensure these markers remain publicly visible forever, the module's validation code can disable spending for these markers. With this combination, the developer can use the `SetCCunspents` SDK function to enumerate all transactions in the global CC address, and thus discover the module's transaction history. + +## Antara Development Checklist + +Development requirements for each Antara Module: + +* Allocate a new `EVAL` code for your module +* Assign a global address for the module +* Define the module's transactions + * This includes the structure of their inputs, outputs, and opreturn format +* Implement the common RPC functions that nearly all modules feature + * These are typically functions for retrieving a list of all of the module's initial transactions, and for retrieving user addresses and the global CC address +* Implement the module's specific RPC functions + * These are used to create the module-related transactions and to return relevant information about the module's data and state +* Implement the module's validation code + +## Antara Module Architecture + +From an architectural standpoint, an Antara Module is simply a C/C++ source file. + + + +There are two parts to the module's source file: the implementation of RPC's and the validation code. You also need to inform the basic komodod source code of your new Antara Module through the following steps. + +* Allocate a new eval code for your Antara Module in `src/cc/eval.h` +* add your module's global addresses and the validation code entry function into the registry of Antara Modules in `src/cc/CCcustom.cpp` + +#### RPC Implementations + +The first part of the Antara's module source file consists of the implementation of all Remote Procedure Calls (RPC's) for this module. These typically either perform transactions or query information about state and data. + +The developer must also implement high-level functions for any desired RPC commands that are called by the RPC engine and are responsible for converting the RPC data to native C++ data types. + +These functions should be added into an existing source in the `/src/rpc` directory. Alternatively, the developer might create his own RPC source file. + +A reference to the RPC-command functions should be added to the global RPC command table in the `/src/rpc/server.cpp` source file. + +With this properly completed, the Smart Chain daemon's compiler will automatically make each RPC available at the command line through the `komodo-cli` software and via the `curl` utility. + +Essentially all modules have at least these two RPC's. + +* XXXXlist + * This lists all initial transactions relevant to the module +* XXXXinfo + * This RPC typically also requires an additional input -- a transaction ID for which information is desired + * When called, the method then returns information about this transaction ID + +Include other RPC implementations as desired. + +#### Antara Module Validation Code + +The main purpose of Antara Module validation code is two-fold. First, it ensures that the structure of the sequence of Antara Module related transactions and their data is accurate. Second, the validation code prevents inappropriate Antara-related transactions from entering the chain. In other words, module validation code should protect against malicious transactions, and this is the code's most important task. + +Antara Module Validation code is triggered anytime a node attempts to add a CC spending-transaction to the chain. + +A module's validation code is activated only when a transaction has at least one CC input that bears the module's `EVAL` code inside the scriptSig in the transaction. + +A module's initial transaction may not have a CC input. When this happens, the validation code is not triggered. Therefore, the transaction may be handled by the normal blockchain protocol. + +As an aside, when the developer needs to write code that validates a spending transaction that spends a utxo that has no CC inputs, the code must first validate the utxo as well. If the result of the validation of the utxo is `false`, then the code can also reject the spending transaction. We will delve into this topic in thorough detail further in the tutorial. + +#### The EVAL Code + +A unique 8-bit `EVAL` code is attached to each Antara Module. The `EVAL` code is used by the core Smart Chain daemon's transaction-validation code to route any relevant transactions to the appropriate module's validation code. + +The `EVAL` code itself is actually a simple CryptoCondition. The CryptoCondition tests for the byte value and, if the value is `true`, routes the result according to the core Smart Chain daemon's code. + +### Antara Module Transaction Structure + + + +A CryptoCondition (CC) input is called a "vin" and a CryptoCondition output is called a "vout". + +A CC transaction has one or more vins and one or more vouts. + +When creating a CC transaction, the transaction's vins can consume the vouts of previous transactions that were either related to CC, or not related. + +When they are not related to CC, the vin of the current transaction does not need to include a CC fulfillment. + +However, if the current transaction's vins are consuming vouts from a CC-related transaction, then the current transaction's vins must contain logical fulfillments that meet the requirements of the previous transaction's CC vouts. Also, the current transaction's CC vins contain the transaction id (txid) of the previous transaction. + +A CC transaction typically also has an opreturn vout that contains module data. + +#### Antara Module SDK + +Komodo is building an SDK for Antara Module development. The SDK is still in the early stages. Some of the SDK functions are already available, and can be found in the following source files: + +* CCtx.cpp +* CCutils.cpp +* cc.cpp +* eval.cpp + +We will return to the SDK functions when we discuss the Heir module development process. + +*** + +[Link to Next Tutorial in Advanced Series](/antara/tutorials/advanced-series-5/) +export const title = "Advanced Tutorial: Part-5"; +export const description = + "Explore the process of developing a prototype of the Heir Module."; + +# Advanced Series — Developing the Heir Module Prototype + +## Heir Module Development + +Having finished an overview of the Antara development layout, we are now prepared to create a simplified prototype of the [Heir Module](/antara/api/heir/#introduction). + +#### Links to Heir Source Code and Building Instructions + +A complete working example of this simplified Heir Antara module tutorial can be found at the following link. We invite the reader to download and review the final code while progressing through the tutorial. + +[Link to Simplified Heir Module](https://github.com/gcharang/komodo-example/tree/heir-simple) + +The source files are found in the following directories. + +* src/cc/heir.cpp +* src/cc/CCheir.h +* src/wallet/rpcwallet.cpp +* src/rpc/server.cpp +* src/rpc/server.h + +#### Downloading and Installing From Source + +At this time, the reader will need to have the Komodo Smart Chain source code available. The reader begins with this default source code and adds to it to create a new Antara Module. + +Instructions to download and build Komodo software is found here. + +[Link to Instructions for Building from Source](/smart-chains/setup/installing-from-source/#linux) + +## Begin Development + +Our tasks are the following: + +* Add a new `EVAL` code to represent this module +* Create a global CC address +* Define the Heir Module transactions + * vouts, or logical conditions + * vins, or logical fulfillments +* Implement the RPC interface +* Create the validation code + +## Create the EVAL Code + +In a previous section of this advanced series, we discussed the nature of creating a new EVAL code for an Antara Module. + +[Link to EVAL code instructions here.](/antara/tutorials/advanced-series-2/#the-eval-code) + +Review the above linked section and attempt to create an EVAL code on your own for this simplified Heir Module. + +When you are finished with your attempt, compare your results with the downloadable files for this tutorial. + +[Link to EVAL code source file in simplified Heir Module downloadables.](https://github.com/gcharang/komodo-example/blob/heir-simple/src/cc/eval.h) + +## Global CC Address + +We also recently discussed the method of adding a Global CryptoCondition (CC) Address as a part of initiating a new Antara Module. + +[Link to Global CC Address instructions here.](/antara/tutorials/advanced-series-2/#creating-a-global-cc-address) + +Review the above linked section and attempt to create a Global CC Address on your own. + +When you are finished with your attempt, compare your results with the downloadable files for this tutorial. + +{/* Sidd: Please correct the link below, if needed. */} + +[Link to Global CC Address file in simplified Heir Module downloadables.](https://github.com/gcharang/komodo-example/blob/heir-simple/src/cc/CCcustom.cpp) + +## Heir Module Transactions + +We require three types of module transactions + +* an initial transaction with which a user creates the fund for inheritance +* a transaction for additional funding +* a transaction for spending funds by the owner or heir + +#### The Initial Transaction: Creating a Fund + +| Input/Output | Description | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `vins.*` | Normal input
- The `*` notation implies that this can apply to any number of inputs
- These vins are typical of core blockchain software and not related to CC | +| `vout.0` | The `1of2` CC address that holds the funds that belong to the owner and, once available, to the heir | +| `vout.1` | The transaction fee to account for the `vout.0` amount above
- The amount in `vout.1` is used as a marker. We will discuss markers and their uses cases further on in the tutorial | +| `vout.2` | Normal change
- Recall that `change` is the leftover amount from the original utxo that the user does not intend to send to the destination address, and which the user desires to keep
- Any amount of leftover funds not included in the `change` utxo is forfeited to the miner of the block; this is how miners receive their mining fee | +| `vout.n-1` | OP\_RETURN EVAL\_HEIR 'F' ownerpk heirpk inactivitytime heirname
- This is the is the opreturn vout, and it contains any data relevant to the module
- The 'F' is a flag that indicates that this transaction is a "Funding" CC transaction
- `ownerpk` and `heirpk` respectively represent the pubkeys of the owner and heir
- Concerning `inactivitytime`, the owner should either make a donation to or spend from the `1of2` address within the `inactivitytime` amount of time to prevent opening the `1of2` address to the heir for spending.
- `heirname` is the name of this instance of the Heir Module | + +Through a funding transaction, the owner of the initial funds creates a "plan," which we can also call a "module data instance," and deposits funds for future spending. + +The initial funds are taken from normal utxos. The initial transaction spends these normal utxos and uses them to create an CC-related utxo. Thus, the initial transaction is the beginning of the relationship between the funds and the Heir Antara Module. + +The main funds for the plan are allocated to `vout.0` of our CC transaction. + +By design, and setting aside issues of timing, we desire that either the owner or the inheritor of the funds should be able to spend this utxo. We assume that the owner has one address, and the inheritor has another. To achieve this, we use an advanced CryptoConditions feature that states that either of two addresses can spend the funds. This is called a `1of2` CryptoCondition, and it is placed as a logical condition into `vout.0`. + +A fee is allocated to `vout.1`. This is used as a marker. The marker allows a developer to use a special SDK function, `SetCCunspents()`, to create a list of all initial transactions for the module. + +As usual, out of the remaining amount of our initial utxo, we need to send all that we desire to keep to our `change` address. + +Also, we need to leave an amount as an incentive for the miner. Any remainder beyond the sum total of our new `vout` values will automatically be allocated in this manner. We typically leave `10000` satoshis of our Smart Chain coin, by convention. + +Note the `F` letter in the opreturn structure. The `F` stands for "fund." By convention, the first byte of any opreturn is the `EVAL` code. The second byte is the transaction functional id, we use it to understand the transaction data structure in the opreturn. + +We also stored other relevant data in the opreturn: + +* The owner and inheritor pubkeys +* Inactivity time + * this is the amount of seconds during which the owner must exhibit activity to maintain sole control over the funds + * If the owner does not spend funds during this time period, the inheritor will gain the ability to spend these funds as well +* The descriptive name of this funding plan + +#### The Add Coins Transaction + +| Input/Output | Description | +| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `vins.*` | normal inputs | +| `vout.0` | the funding CC `1of2` address for the owner and heir. This address consists of two parts: the owner and heir pubkeys. Either owner or heir can spend this vout | +| `vout.1` | normal change | +| `vout.n-1` | OP\_RETURN 'A' fundingtxid HasHeirSpendingBegun | + +This transaction serves the purpose of adding more funds to the owner's address. The transaction uses normal coin inputs (non-CC) and sends them to the CC `1of2` address. + +We include the transaction id (txid) of the initial transaction in the opreturn to bind the add transaction to the plan. + +Note the functional id, `A`. This flag indicates that this transaction is an `add` type of funding transaction. + +Note the `HasHeirSpendingBegun` flag as well. This is discussed later in the series, in the module source-code description. + +#### The Claim Coins Transaction + +| input/output | description | +| ------------ | ------------------------------------------------------------- | +| vin.0 | normal input transaction fee | +| vin.1+ | input from CC `1of2` address | +| vout.0 | normal output, sent to the owner or the heir address | +| vout.1 | `change` to CC `1of2` address | +| vout.2 | `change` to user's address from transaction fee input, if any | +| vout.n-1 | OP\_RETURN EVAL\_HEIR 'C' fundingtxid HasHeirSpendingBegun | + +This transaction allows either the owner or the heir to spend funds from this plan instance. + +To pay the transaction fee to the miners, the transaction has a normal input that draws from the wallet of the transaction creator. + +The transaction also has a CC input for spending the claimed value from the `1of2` fund address. + +As for outputs, the claimed value is sent to the claimer's normal address, allowing the claimer to spend funds as usual. Unspent or leftover "change" from the transaction is returned to the `1of2` address. + +We also indicate the normal `change`. + +The functional id, `C`, in the opreturn indicates that this is a "claim" type transaction. + +We also include all the same opreturn data as in the `A` transaction, include the `fundingtxid` and the `HasHeirSpendingBegun` flag. + +## Heir Module RPC Implementations + +#### heirfund + +For a user to call the `heirfund` RPC, the user will need to supply the name of the RPC and its parameters as arguments. + +We model the syntax as follows: + +```bash +./komodo-cli -ac_name=YOURCHAIN heirfund amount name heirpubkey inactivitytime +``` + +##### Descriptions of the heirfund Syntax + +| Argument | Type | Description | +| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| amount | (number) | The initial funding amount, in coins | +| name | (string) | The name of the heir funding plan (arbitrary) | +| heirpubkey | (string) | The heir's public key (in hexademical) | +| inactivitytime | (number) | The time (in seconds) that must pass without the owner executing an `heiradd` or `heirclaim` method, after which the address unlocks to the heir | + +#### Adding the Command to the Source File + +To add a new command to `komodo-cli` we open the `src/server.cpp` source file add a new element to the `vRPCCommands` array. + +```cpp + { "heir", "heirfund", &heirfund, true }, +``` + +| Object | Description | +| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| heir | a common name for all heir module RPC calls | +| heirfund | the name of the new command | +| \&heirfund | the address of the RPC interface function | +| true | indicates that the command description will be shown in the help command output; placing `false` here would hide this RPC from the help output | + +#### Add the RPC Function Declaration + +We add the RPC function declaration in the `rpc/server.h` source file. + +The declaration in this file is essentially the same across all RPC functions. + +```cpp +UniValue heirfund(const UniValue& params, bool fHelp); +``` + +### The Two Levels of an RPC Implementation + +There are two levels to an RPC implementation. + +The first level is a short RPC function that has the same name as the RPC command itself (such as `heirfund`). + +The body of this level is added to a source file in the `rpc/` subdirectory in the source code (for this example, we added the RPC functions for Heir Module in the wallet/rpcwallet.cpp). + +Creating a new RPC source file for each Antara Module's RPC functions is considered a best practice. + +This function checks the RPC parameters and the needed environment, and then forwards the RPC to the second level. + +To begin the RPC command, we declare the `heirfund` function and clear the global error object. + +```cpp +// heirfund command rpc-level implementation, src/wallet/rpcwallet.cpp +UniValue heirfund(const UniValue& params, bool fHelp) + + CCerror.clear(); // clear global error object +``` + +Recall that a Smart Chain must have the [ac\_cc](/antara/setup/antara-customizations/#ac-cc) and [ac\_ccenable](/antara/setup/antara-customizations/#ac-ccenable) customization parameters properly initiated for any Antara Module to function. + +Therefore, we check that the wallet and Heir Module features are available in the Smart Chain. We also check the RPC parameter's required number: + +Ensure that the wallet object is initialized: + +```cpp + if (!EnsureWalletIsAvailable(fHelp)) + return NullUniValue; +``` + +Ensure that the chain parameters needed for Antara Modules are correctly set. For example, [addressindex](/smart-chains/setup/common-runtime-parameters/#addressindex) and [spentindex](/smart-chains/setup/common-runtime-parameters/#spentindex) should both be enabled. Also, ensure that the Heir Module is enabled on this chain. + +```cpp + if (ensure_CCrequirements(EVAL_HEIR) < 0) + throw runtime_error("to use Antara modules, you need to launch daemon with valid -pubkey= for an address in your wallet\n"); + // output help message if asked or params count is incorrect: + if (fHelp || params.size() != 4 ) + throw runtime_error("heirfund funds heirname heirpubkey inactivitytime\n"); +``` + +Lock the user's wallet: + +```cpp + LOCK2(cs_main, pwalletMain->cs_wallet); +``` + +The `UniValue` object is a special type used to pass data in RPC calls. The `UniValue` object is native to all blockchains based on the Bitcoin protocol. For parameters, UniValue requires an array of UniValue objects. + +We must convert these UniValue objects into normal C/C++ language types, and then pass them to the second level of our module implementation. + +Convert the parameters from the UniValue type to their basic C++ types and add checks to ensure that the converted parameter values are correct. + + + This content is abbreviated. For links to the full source code and example + files, click here. + /antara/tutorials/heir-module-tutorial#links-to-heir-source-code-and-building-instructions + + +Note the method for parsing the hex representation of the pubkey parameter and converting it to a `CPubKey` object. + +```cpp + CAmount amount = atof(params[0].get_str().c_str()) * COIN; // Note conversion from satoshis to coins through a multiplication of 10E8 + if( amount < 0 ) + throw runtime_error("amount cant be negative"); + std::string name = params[1].get_str(); + std::vector vheirpubkey = ParseHex(params[2].get_str().c_str()); + CPubKey heirpk = pubkey2pk(vheirpubkey); + int64_t inactivitytime = atoll(params[3].get_str().c_str()); +``` + +Finally, call the Heir Module code, pass our values (now in C++ type format), and set these as the value of the final `result` object. Bear in mind that the returned value from the Heir Module code, `HeirFund`, returns a hexadecimal value. + +```cpp + UniValue result = HeirFund(amount, name, heirpk, inactivitytime); + RETURN_IF_ERROR(CCerror); // use a macro to throw runtime_error if CCerror is set in HeirFund() + return result; +} +``` + +[See the linked source code (line number is approximate.)](https://github.com/gcharang/komodo-example/blob/heir-simple/src/wallet/rpcwallet.cpp#L7740) + +### Second Level Implementation + +The second level of the RPC implementation is the transaction creation code. This resides in the `src/cc/heir.cpp` source file. + +#### Implementing heirfund transaction creation + +The following content displays the skeleton of the heirfund RPC implementation. + + + For links to the full source code and example files, click here. + /antara/tutorials/heir-module-tutorial#links-to-heir-source-code-and-building-instructions + + +```cpp +// heirfund transaction creation code, src/cc/heir.cpp +std::string HeirFund(int64_t amount, std::string heirName, CPubKey heirPubkey, int64_t inactivityTimeSec) +{ +``` + +Create a mutable version of a transaction object. + +```cpp + CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); +``` + +Declare and initialize an `CCcontract_info` object with Heir Module variables, such as our global CC address, our global private key, etc. + +```cpp + struct CCcontract_info *cp, C; + cp = CCinit(&C, EVAL_HEIR); +``` + +#### Adding Inputs to the Transaction + +Add inputs to the transaction that are enough to make a deposit of the requested amount to the Heir fund. Also add one fee to serve as a marker, and another for the miners. + +By tradition, we use a constant fee of `10000` satoshis. + +We use the `pubkey` from the komodod `-pubkey` launch parameter as the destination address for the funds withdrawn from the `1of2` plan address. + +We use a function in the CC SDK, `AddNormalinputs`, to add the normal inputs to the mutable transaction. + +```cpp + const int64_t txfee = 10000; + CPubKey myPubkey = pubkey2pk(Mypubkey()); + if (AddNormalinputs(mtx, myPubkey, amount+2*txfee , 60) > 0) { +``` + +The parameters passed to the `AddNormalinputs()` function are: + +* The transaction itself +* The user's pub +* The total value for the funding amount +* he marker and the miner fees +* The limit on the quantity of utxos the daemon can take from the wallet of the user + * Naturally, only utxos that are available via the wallet's private keys can be used for these inputs + +#### Adding Outputs to the Transaction + +According to our specification, we need two outputs: one for the funding deposit and one for the marker. + +Here, we use two CC SDK functions that are designed to create CC vouts. + +In our first statement we use the `MakeCC1of2vout` function to create a CC vout with a threshold of `2` addresses that can spend from the plan funds. + +We supply as arguments the two potential addresses, represented here as `myPubkey` and `heirPubkey`. Therefore, there are two pubkeys that are able to spend funds in the address. + +The statement of code then adds this vout to the transaction. + +Note the eval code, `EVAL_HEIR`. This triggers the Heir validation code whenever an Heir Module transaction occurs. + +The second statement creates a marker vout with a simple CryptoCondition. + +We always need some kind of marker for any instance of an Antara Module plan for at least the initial transaction. Otherwise, we might lose the instance's data in the blockchain. We call this a marker pattern in Antara development, and we will explore this concept in more detail later in the tutorial. + +For now, we need to obtain the global CC address so that we can both mark the transaction, and to find all Heir funding plans. To obtain the global address we use the `GetUnspendable()` function. + +We use the `MakeCC1vout` function to create a vout with a simple CryptoCondition that sends a transaction fee to the Heir Module global CC address. + +The statement then adds this vout to the transaction. This vout will be used for retrieving the list of all instances of the Heir Module via the heirlist RPC. + +```cpp + mtx.vout.push_back( MakeCC1of2vout(EVAL_HEIR, amount, myPubkey, heirPubkey) ); + mtx.vout.push_back( MakeCC1vout(EVAL_HEIR, txfee, GetUnspendable(cp, NULL)) ); +``` + +Finish the creation of the transaction by calling the `FinalizeCCTx` function along with its parameters from the `cp` object, the `mtx` object itself, the owner's pubkey, and the transaction fee amount. + +Note the cast to `uint8_t` for the constants `EVAL_HEIR` and `F` function id. This is important, as the cast supposes a one-byte size for the serialization of these values. If this size was not inferred, then the type would be an `int`. + +Also, an opreturn object with the data from this module instance is passed. To create the opreturn object, serialize the needed ids and variables to a `CScript` object. + +```cpp + std::string rawhextx = FinalizeCCTx(0, cp, mtx, myPubkey, txfee, + CScript() << OP_RETURN << (uint8_t)EVAL_HEIR << (uint8_t)'F' << myPubkey << heirPubkey << inactivityTimeSec << heirName)); + return rawhextx; + } +``` + +In case the `AddNormalinputs()` function cannot find sufficient owner coins for the requested amount (including the transaction fee), we set the `CCerror` error object. + +```cpp + CCerror = "not enough coins for requested amount and txfee"; + return std::string(""); +} +``` + +Note that we do not need to add the normal change output here because the `FinalizeCCTx` function adds the change output for us. + +`FinalizeCCTx` also builds the transaction input `scriptSigs` (both normal and CC aspects), adds tx signatures to them, and returns a signed transaction in hexadecimal encoding. + +Also note the `E_MARSHAL()` function. This serializes variables of various supported types to a byte array. The byte array is then serialized to a `CScript` object. The object is stored in the `scriptPubKey` transaction field in the last opreturn vout with transaction data. + +There is also the mirror `E_UNMARSHAL()` function. This is used for unpacking opreturn data from a CScript object to C++ variables, and for further processing. + +The returned transaction is ready to be sent to the Smart Chain network using the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) RPC. + +#### Implementing the heirclaim RPC + +As before, this implementation has two levels. The first level checks the required environment and converts the parameters. The second level creates the final transaction. + +##### heirclaim syntax + +```bash +./komodo-cli -ac_name=YOURCHAIN heirclaim fundingtxid amount +``` + +##### Add the RPC command to komodo-cli + +Add a new command to `komodo-cli` by adding a new element into the `vRPCCommands` array in the source file `src/server.cpp`. + +```cpp + { "heir", "heirclaim", &heirclaim, true }, +``` + +Using the previous section of the tutorial as an example, add an `heirclaim` RPC implementation in the `src/rpc/wallet.cpp` source file. + +Add the `heirclaim` declaration in the `src/rpc/server.h` header file. + +```cpp +// heirclaim command rpc-level implementation, src/wallet/rpcwallet.cpp + +UniValue heirclaim(const UniValue& params, bool fHelp) +{ + CCerror.clear(); // clear global error object +``` + +Check that the wallet is available. + +In case the user asks for help via the `--help` parameter, or in case the parameters are not correctly submitted, print a `help` message to the console. + +Also check that Antara requirements are satisfied: + +```cpp + if (!EnsureWalletIsAvailable(fHelp)) + return NullUniValue; + if (fHelp || params.size() != 2) + throw runtime_error("heirclaim txfee funds fundingtxid\n"); + if (ensure_CCrequirements(EVAL_HEIR) < 0) + throw runtime_error("to use Antara modules, you need to launch daemon with valid -pubkey= for an address in your wallet\n"); +``` + +Lock the wallet: + +```cpp + LOCK2(cs_main, pwalletMain->cs_wallet); +``` + +Convert the parameters from `UniValue` to `c++` type: + +```cpp + uint256 fundingtxid = Parseuint256((char*)params[0].get_str().c_str()); + CAmount amount = atof(params[1].get_str().c_str()) * COIN; // Note conversion from satoshis to coins by multiplication by 10E8 +``` + +Call the `HeirClaim` transaction creation function and return the created transaction in hexadecimal. + +```cpp + UniValue result = HeirClaim(fundingtxid, amount); + RETURN_IF_ERROR(CCerror); // use a macro to throw runtime_error if CCerror is set in HeirFund() + return result; +} +``` + +#### Transaction creation code for heirclaim RPC + +Implement the `HeirClaim` transaction creation code in the `src/cc/heir.cpp` source file. + +```cpp +// heirclaim transaction creation function, src/cc/heir.cpp +std::string HeirClaim(uint256 fundingtxid, int64_t amount) +{ +``` + +Start with creating a mutable transaction object: + +```cpp + CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); +``` + +Initialize the `cp` object: + +```cpp + struct CCcontract_info *cp, C; + cp = CCinit(&C, EVAL_HEIR); +``` + +Find the most recent owner transaction to calculate the owner's inactivity time. The helper function, `FindLatestOwnerTx()`, returns the latest transaction id, the `owner` and `heir` public keys, `inactivity time setting` value, and the `hasHeirSpendingBegun` flag value. + +```cpp + const int64_t txfee = 10000; + CPubKey ownerPubkey, heirPubkey; + int64_t inactivityTimeSec; + uint8_t hasHeirSpendingBegun; + uint256 latesttxid = FindLatestOwnerTx(fundingtxid, ownerPubkey, heirPubkey, inactivityTimeSec, hasHeirSpendingBegun); + if( latesttxid.IsNull() ) { + CCerror = "no funding tx found"; + return ""; + } +``` + +Check whether the inactivity time of the owner has surpassed the amount designated in the plan. The `CCduration` CC SDK function returns the time (in seconds) since the confirmation of the block that bears the provided transaction to the chain-tip block. + +If `hasHeirSpendingBegun` is already `true`, there is no need to also check the owner's inactivity time. + +```cpp + int32_t numBlocks; // not used + bool isAllowedToHeir = (hasHeirSpendingBegun || CCduration(numBlocks, latesttxid) > inactivityTimeSec) ? true : false; + CPubKey myPubkey = pubkey2pk(Mypubkey()); // pubkey2pk sdk function converts pubkey from a byte array to CPubKey object + if( myPubkey == heirPubkey && !isAllowedToHeir ) { + CCerror = "spending funds is not allowed for heir yet"; + return ""; + } +``` + +Create the claim transaction inputs and outputs. + +Add normal inputs for the transaction fee: + +```cpp + if (AddNormalinputs(mtx, myPubkey, txfee, 3) <= txfee) { + CCerror = "not enough normal inputs for txfee"; + return ""; + } +``` + +Get the address of the `1of2` threshold CryptoCondition output (where the funds were deposited). Add CC inputs for the requested amount. + +```cpp + char coinaddr[65]; + GetCCaddress1of2(cp, coinaddr, ownerPubkey, heirPubkey); +``` + +Add CC inputs for this address with the use of a custom function: + +```cpp + int64_t inputs; + if( (inputs = Add1of2AddressInputs(mtx, fundingtxid, coinaddr, amount, 64)) < amount ) { + CCerror = "not enough funds claimed"; + return ""; + } +``` + +Add a normal output to receive the claimed funds, and a CC change output for the remaining amount. + +```cpp + mtx.vout.push_back(CTxOut(amount, CScript() << ParseHex(HexStr(myPubkey)) << OP_CHECKSIG)); + if (inputs > amount) + mtx.vout.push_back(MakeCC1of2vout(EVAL_HEIR, inputs - amount, ownerPubkey, heirPubkey)); +``` + +Add normal change (if any), add OP\_RETURN data, and sign the transaction: + +```cpp + return FinalizeCCTx(0, cp, mtx, myPubkey, txfee, CScript() << OP_RETURN << E_MARSHAL(ss << (uint8_t)EVAL_HEIR << (uint8_t)'C' << fundingtxid << (myPubkey == heirPubkey ? (uint8_t)1 : hasHeirSpendingBegun))); +} +``` + +In the opreturn we add a pair of standard ids: the CC `EVAL` code, the functional id, and the `fundingtxid` to serve as the funding plan identifier. + +The `hasHeirSpendingBegun` value is a special flag. When this value is changed to `1`, it indicates that the heir has spent funds in the fund at least once. Therefore, it is no longer necessary to check the inactivity time of the owner. + +Once `hasHeirSpendingBegun` is set to `true`, this flag should also be set to `true` in the following transaction OP\_RETURN values. + +#### Implementations for heiradd, heirlist and heirinfo + +* `heiradd` allows a user to add more funding to a plan. +* `heirlist` is a standard RPC for all CC modules. This RPC outputs a list of all initial transaction IDs, which serve as the identifiers for each plan. +* `heirinfo` provides data about a funding plan. + +The implementation for these RPCs can be found in the github repository with the source code of this contract. + +[RPC implementation can be found here.](https://github.com/gcharang/komodo-example/blob/heir-simple/src/wallet/rpcwallet.cpp) + +[Transaction creation and retrieval code can be found here.](https://github.com/gcharang/komodo-example/blob/heir-simple/src/cc/heir.cpp) + +## Heir Module Helper Functions + +#### Simplified Add1of2AddressInputs() Function Implementation + +```cpp +// add inputs from cc threshold=2 cryptocondition address to transaction object, src/cc/heir.cpp +int64_t Add1of2AddressInputs(CMutableTransaction &mtx, uint256 fundingtxid, char *coinaddr, int64_t amount, int32_t maxinputs) +{ + int64_t totalinputs = 0L; + int32_t count = 0; +``` + +By default, the CC SDK function, `SetCCunspents`, fills the provider vector with a list of unspent cc outputs of the provided `coinaddr` Bitcoin address. + +For our Heir Module, we pass the `1of2` address where the plan's funds are stored. + +```cpp + std::vector> unspentOutputs; + SetCCunspents(unspentOutputs, coinaddr, true); // get a vector of cc uxtos for the address in coinaddr[] +``` + +Iterate through the returned uxtos and add those that are appropriate to the transaction's vin array: + +```cpp + for (std::vector>::const_iterator it = unspentOutputs.begin(); it != unspentOutputs.end(); it++) { + CTransaction tx; + uint256 hashBlock; + std::vector vopret; +``` + +Load the current uxto's transaction and check whether it has an opreturn in the back of the array of outputs. + +```cpp + if (GetTransaction(it->first.txhash, tx, hashBlock, false) && tx.vout.size() > 0 && GetOpReturnData(tx.vout.back().scriptPubKey, vopret) && vopret.size() > 2) + { + uint8_t evalCode, funcId, hasHeirSpendingBegun; + uint256 txid; +``` + +Check that the uxto matches this plan. + +```cpp + if( it->first.txhash == fundingtxid || // if this is our contract instance coins + E_UNMARSHAL(vopret, { ss >> evalCode; ss >> funcId; ss >> txid >> hasHeirSpendingBegun; }) && // unserialize opreturn + fundingtxid == txid ) // it is a tx from this funding plan + { +``` + +To add the utxo to the transaction's vins, set the utxo's vout number and transaction id in the transactions vins. Pass an empty call to the `CScript()` function in the `scriptSig` parameter. This will be filled by the `FinalizeCCtx` function. + +```cpp + mtx.vin.push_back(CTxIn(it->first.txhash, it->first.index, CScript())); + totalinputs += it->second.satoshis; +``` + +Stop once sufficient CC inputs are found. + +In the event that the `amount` parameter is `0`, add all available inputs to calculate all available funds. + +```cpp + if( amount > 0 && totalinputs >= amount || ++count > maxinputs ) + break; + } + } + } +``` + +Return the total amount of inputs added to the transaction's vin array: + +```cpp + return totalinputs; +} +``` + +#### Simplified Implementation of the FindLatestOwnerTx() Function + +To calculate the owner-inactivity time and to enable the heir to claim the funds, we implement the function, `FindLatestOwnerTx()`. + +This function iterates through the transactions of this plan, (which we can also call this instance of the Heir Module) and finds the owner's latest transaction. We pass into this function the initial funding txid of the plan we desire to inspect. + +The function returns the pubkeys of both the owner and the heir, the owner inactivity time, and a flag that indicates whether the heir has already spent funds from the `1of2` address. + +All returned values of the function are retrieved from the transactions' opreturns. + +```cpp +// find the latest owner transaction id +// this function also returns some values from the initial and latest transaction opreturns +// Note: this function is also called from validation code (use non-locking calls) + +uint256 FindLatestOwnerTx(uint256 fundingtxid, CPubKey& ownerPubkey, CPubKey& heirPubkey, int64_t& inactivityTime, uint8_t &hasHeirSpendingBegun) +{ + uint8_t eval, funcId; +``` + +Initialize the flag as though the heir has not yet spent any of their plan's funds. + +```cpp + hasHeirSpendingBegun = 0; +``` + +Initialize the following variables. + +```cpp + CTransaction fundingtx; + uint256 hashBlock; + std::vector vopret; + std::string name; +``` + +Load the initial funding transaction, check whether it has a correct opreturn, and de-serialize it. + +Check the transaction rules. Return an empty id if the funding transaction cannot not be loaded or is incorrect. + +```cpp + if (!myGetTransaction(fundingtxid, fundingtx, hashBlock) || // NOTE: use non-locking version of GetTransaction as we may be called from validation code + fundingtx.vout.size() == 0 || // no vouts, even opreturn + !GetOpReturnData(fundingtx.vout.back().scriptPubKey, vopret) || // could not get opreturn from the last vout + !E_UNMARSHAL(vopret, ss >> eval; ss >> funcId; ss >> ownerPubkey; ss >> heirPubkey; ss >> inactivityTime; ss >> name;) || // could not unmarshal opreturn + eval != EVAL_HEIR || // incorrect eval code in 1st byte + funcId != 'F') // incorrect funcid in the 2nd byte + return zeroid; +``` + +Initialize the CC contract object for the Heir Module's `EVAL` code. + +```cpp + struct CCcontract_info *cp, C; + cp = CCinit(&C, EVAL_HEIR); +``` + +Declare the `coinaddr` array and use the `GetCCaddress1of2` function to pass the array the `1of2` address that holds our funds. + +```cpp + char coinaddr[64]; + GetCCaddress1of2(cp, coinaddr, ownerPubkey, heirPubkey); +``` + +Get the vector with uxtos for the `1of2` address. + +```cpp + std::vector> unspentOutputs; + SetCCunspents(unspentOutputs, coinaddr, true); +``` + +Iterate through the returned uxto's to find the last funding or spending owner transaction: + +```cpp + int32_t maxBlockHeight = 0; + uint256 latesttxid = fundingtxid; // set to initial txid + for (std::vector>::const_iterator it = unspentOutputs.begin(); it != unspentOutputs.end(); it++) + { + CTransaction vintx; + uint256 blockHash; + std::vector vopret; + uint8_t eval, funcId, flagopret; + uint256 txidopret; + + int32_t blockHeight = (int32_t)it->second.blockHeight; +``` + +Retrieve the transaction from the returned array. Check and unmarshal the transaction's opreturn and check whether this transaction is from the relevant Heir plan. + +```cpp + if (myGetTransaction(it->first.txhash, vintx, blockHash) && // NOTE: use non-locking version of GetTransaction as we may be called from validation code + vintx.vout.size() > 0 && + GetOpReturnData(vintx.vout.back().scriptPubKey, vopret) && + E_UNMARSHAL(vopret, ss >> eval; ss >> funcId; ss >> txidopret; ss >> flagopret) && + eval == EVAL_HEIR && + (funcId == 'C' || funcId == 'A') && + fundingtxid == txidopret ) { +``` + +As the `SetCCunspents` function does not return uxtos in chronological order, order them by block height to find the latest utxo. + +```cpp + if (blockHeight > maxBlockHeight) { +``` + +Check whether this transaction indicates owner activity. Use a pair of CC SDK functions, `TotalPubkeyNormalInputs()` and `TotalPubkeyCCInputs()`, that iterate through the vin array to find if the transaction was signed with the owner's pubkey. + +```cpp + if (TotalPubkeyNormalInputs(vintx, ownerPubkey) > 0 || TotalPubkeyCCInputs(vintx, ownerPubkey) > 0) { +``` + +If this transaction represents owner activity, reset the latest txid to this current txid. + +Set the flag for the transaction opreturn. + +```cpp + latesttxid = it->first.txhash; + hasHeirSpendingBegun = flagopret; + maxBlockHeight = blockHeight; + } + } + } + } +``` + +Return the latest owner txid. + +```cpp + return latesttxid; +} +``` + +## Heir Module Validation + +#### Simplified Validation Function Implementation + +Validation provides the logic control of spent Antara-module value, and validation also provides the data added to the Smart Chain. + +Recall that validation code is invoked for a transaction at the time the CC-related value is spent (as opposed to only being invoked at the time the value is added). We trigger the invocation of this validation function when at least one transaction input is a CC input bearing this module's `EVAL` code. + +Validation code typically is not called for the Antara module's initial transaction. Instead, we invoke validatation at the time the initial transaction is spent in a second transaction. + +One way to invoke validation for the first transaction when performing the second transaction is to load the initial transaction and validate it first. If the initial transaction turns out to be invalid, it can remain in the chain and is otherwise ignored. In this case, if a CC marker is used, it can be cleared and the transaction is removed from the initial transaction list RPC output. + +#### Guidelines for Validation + +In our Heir Module prototype, we have three transactions to validate: the initial funding, the adding transaction that adds more funds, and the transaction that claims the funds. The first and second of these transactions do not have any CC vins, and therefore all are validated together with the transaction that claims the funds. + +Here are several common aspects of a module that require validation: + +* The basic transaction structure +* The basic data structure in the OP\_RETURN + * Validation here ensures data integrity in the chain + * All OP\_RETURNs should contain the `EVAL` code and functional id in the first two bytes +* Avoid all foreseeable attack vectors + * Ensure DOS attacks are eliminated, especially in the event of a malformed transaction + * Check the array size before use of any transaction data +* Check the previous Heir Module transactions which this transaction spends and which have no cc inputs. This is accomplished by retrieving the transaction id from the opreturn and loading and validating the previous transaction + +#### Heir Module Validation Rules + +The following are the aspects of validation the Heir Module requires. + +* The initial funding transaction + * Validate that the `1of2` address accurately matches `pubkeys` in the opreturn +* The claiming transaction + * Validate that this transaction spends transactions from the same funding plan. This funding transaction id's values from the opreturn outputs of the previous transactions should match. (the previous transactions are often referred as `vintx` in code) +* Validate whether the heir is allowed to spend the funds + * Check whether the flag indicates that the Heir is already spending the funds + * Check whether enough time has passed since the last time the owner was active on the chain +* When validating, separate the owner's funding transaction from any other contributions to the `1of2` address + * Although the Heir Module is initiated based on the owner's initial transaction, nothing prevents other users on the Smart Chain from contributing funds + * Therefore, when validating, for each utxo contained in the `1of2` address, calculate whether or not the utxo's vins contain the owner's pubkey +* During the course of validation, we fully check opreturn format + +This validation logic is performed in the `HeirValidate()` function. The function is invoked whenever a CC transaction bearing the appropriate eval code occurs on the chain. When this eval code appears, the consensus mechanism calls the `HeirValidate()` function, executes the indicated validation code, and adds the transaction to the chain. + +#### HeirValidate() Implementation + +Explanation of code: + +* Transaction-validation entry function + * (This is actually a callback) +* Parameters + * `cpHeir` - Pointer to the module's variable structure + * `eval` - Pointer to the CC dispatching object + * Used to return invalid state + * `tx` - The transaction itself + * `nIn` - Not used in validation code + +```cpp +bool HeirValidate(struct CCcontract_info* cpHeir, Eval* eval, const CTransaction& tx, uint32_t nIn) +{ +``` + +Check that the basic transaction structure has the opreturn with the correct basic `evalcode` and `funcid`. + + + There is no need to check the function ids of the (`F`) funding transaction or + the (`A`) add transaction, as these transactions have no Heir CC vins. + Therefore, we do not create validation code for them. + + +```cpp + std::vector vopret; + if( tx.vout.size() < 1 || !GetOpReturnData(tx.vout.back().scriptPubKey, vopret) || vopret.size() < 2 || vopret.begin()[0] != EVAL_HEIR || + vopret.begin()[1] != 'C') + + // interrupt the validation and return invalid state: + + return eval->Invalid("incorrect or no opreturn data"); // note that you should not return simply 'false' +``` + +Decode the transaction's opreturn with the `E_UNMARSHAL` function. This function places the opreturn serialized data into several variables. One of them, the `fundingtxid` variable, is the transaction id (txid) of the initial funding transaction. We will use it further to find the latest owner transaction to check when the owner was last active on the chain. + +```cpp + uint8_t evalcode, funcId; + uint256 fundingtxid; //initialized to null + uint8_t hasHeirSpendingBegun; + if (!E_UNMARSHAL(vopret, ss >> evalcode; ss >> funcId; ss >> fundingtxid; ss >> hasHeirSpendingBegun;)) + // return invalid state if unserializing function returned false: + return eval->Invalid("incorrect opreturn data"); +``` + +Check that the `fundingtxid` is a valid txid: + +```cpp + if( fundingtxid.IsNull() ) + return eval->Invalid("incorrect funding plan id in tx opret"); +``` + +Here we come to a good place to load the initial transaction, check whether it exists, and whether it has a correctly formed opreturn. + +Call the `FindLatestOwnerTx()` function. This function obtains the opreturn parameters and the `hasHeirSpendingBegun` flag, and checks the initial transaction. + +```cpp + CPubKey ownerPubkey, heirPubkey; + int64_t inactivityTimeSec; + uint8_t lastHeirSpendingBegun; + uint256 latesttxid = FindLatestOwnerTx(fundingtxid, ownerPubkey, heirPubkey, inactivityTimeSec, lastHeirSpendingBegun); + if (latesttxid.IsNull()) { + return eval->Invalid("no or incorrect funding tx found"); + } +``` + +Print a log message to the console that the daemon process is in the validation code: + +```cpp + std::cerr << "HeirValidate funcid=" << (char)funcId << " evalcode=" << (int)cpHeir->evalcode << std::endl; +``` + +Prepare for validation rules that are specific for each function id (`F`, `A`, and `C`). + +```cpp + switch (funcId) { +``` + +For `F` and `A`, we return an invalid response, as the process should never be able to access these function ids. + +```cpp + case 'F': + case 'A': + return eval->Invalid("unexpected HeirValidate for heirfund"); +``` + +Validation for the claiming transaction. + +* Check whether we are spending the correct funding transactions + * For example, check that the transactions are from the correct module instance, as identified by the `fundingtxid` + * If incorrect, return `false` +* If the heir is claiming the funds, check that he is allowed to do so + * For example, check the inactivity time of the owner and whether the heir has already spent funds from the `1of2` address +* Check whether the new flag, `hasHeirSpendingBegun`, is set correctly + +Both of the following support functions, `CheckSpentTxns` and `CheckInactivityTime`, are in the `heir.cpp` source file. + +[Link to heir.cpp source file](https://github.com/gcharang/komodo-example/blob/heir-simple/src/cc/heir.cpp) + +```cpp + case 'C': + if (!CheckSpentTxns(cpHeir, eval, tx, fundingtxid)) + return false; + if (!CheckInactivityTime(cpHeir, eval, tx, latesttxid, inactivityTimeSec, heirPubkey, lastHeirSpendingBegun, hasHeirSpendingBegun) ) + return false; + break; +``` + +For unsupported function ids, return an invalid state. + +```cpp + default: + std::cerr << "HeirValidate() illegal heir funcid=" << (char)funcId << std::endl; + return eval->Invalid("unexpected HeirValidate funcid"); + } +``` + +If all rules pass, return a valid state. + +```cpp + return eval->Valid(); +} +``` + +#### Validation Code Errors + +During the development of validation code, you will likely receive validation errors when any CC module validation function returns an invalid state. + +For example, when sending a raw transaction, the daemon checks the transaction while adding it to the mempool. + +During this process, if the CC validation code returns an invalid state you will see the following error: + +```cpp +error code: -26 +error message: +16: mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element) +``` + +When this happens, check the server output for a more specific error description. The first line of the output contains the `eval->invalid()` message from your validation code. + +```cpp +CC Eval EVAL_HEIR Invalid: incorrect opreturn data spending tx 4b6e1ed868cf941dabf9edc7f675321bdb4258692ba02f56dc21100f88981ac4 +ERROR: CScriptCheck(): 7961fe4f9f3bdabef154404ea8ec7a11be1546febc34efe67faede8d930c0749:1 VerifySignature failed: Script evaluated without error but finished with a false/empty top stack element +ERROR: AcceptToMemoryPool: BUG! PLEASE REPORT THIS! ConnectInputs failed against MANDATORY but not STANDARD flags 7961fe4f9f3bdabef154404ea8ec7a11be1546febc34efe67faede8d930c0749 +``` + +*** + +[Link to Next Tutorial in Advanced Series](/antara/tutorials/advanced-series-6/) +export const title = "Advanced Tutorial: Part-6"; +export const description = "Developing Antara modules? Learn advanced patterns, tips, and troubleshooting techniques."; + +# Advanced Series — Miscellaneous + +This last tutorial in the Advanced Series provides miscellaneous information that our development team considered to be useful for prospective developers. + +Congratulations on finishing the Advanced Series. Make sure to reach out to the Komodo team to see if there are any bounties that you can fill with your new ability to create Antara Modules. And we welcome you to the Komodo ecosystem as a prepared developer. We look forward to seeing what you create. + +## Terminology + +| Term | Definition | +| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| CryptoCondition, or CC | An encoded expression, coupled with a supporting C library, that allows the Smart Chain's consensus mechanism to check several types of logical conditions based on electronic signatures and hashes | +| Antara module | A collection of customized code that a developer adds into the default daemon to add unique functionality, including customized consensus rules and more | +| CC input | A transaction input, CC encoded. Typically spends value from a CC output | +| CC output | A transaction output, CC encoded | +| funding plan | The txid of an Antara Module's initial transaction, it is the identifier for all of the Antara module's CC transactions, related to this funding plan | +| normal inputs | Inputs spending value from normal transaction outputs (not CC outputs) | +| normal outputs | Not CC outputs, but normal transaction outputs (pubkey, pubkey hash, etc.) | +| OP\_RETURN, opreturn | A special output in a transaction that holds user and module data. The output is prepended by an OP\_RETURN script opcode and therefore spending from this output is impossible | +| tx, txn | Short for "transaction" | +| txid | Transaction id; a hash of a transaction | +| unspendable address | The global cc contract address, for which its public and private key are commonly known. This address is used for conditionally sharing funds between contract users. As the address's private key is not a secret, by default anyone can spend value from this address. However, CC validation code often applies business logic conditions and checks to ensure that only transactions that meet the given criteria are actually able to spend funds in this address | +| vin | An input, or an array of inputs, in a transaction structure (tx.vin) | +| vout | An output, or an array of outputs, in a transaction structure (tx.vout) | + +## CC contract patterns + +The following are useful patterns during Antara module development. + +### Baton Pattern + +The baton pattern allows the developer to organize a single-linked list in a Smart Chain. This list is formed by transactions that spend the baton from previous transactions. + +To traverse a linked list using the baton method, start with the first transaction in any plan instance and iterate through the other transactions to collect properties in their opreturns. + +Example: + +Add a baton to a transaction by sending a small fixed fee to a predefined output: + +```cpp +mtx.vout.push_back(MakeCC1vout(cp->evalcode, 10000, Mypubkey())); // BATON_VOUT +``` + +We use the baton on the pubkey provided by the user in the `-pubkey` daemon parameter. + +Iterate through the transactions marked with the baton: + +```cpp +int64_t EnumerateBatons(uint256 initialtxid) +{ + int64_t total = 0LL; + int32_t vini; + int32_t height; + int32_t retcode; + + uint256 batontxid; + uint256 sourcetxid = initialtxid; + + // iterate through the tx spending the baton, adding up amount from the tx opreturn + + while ((retcode = CCgetspenttxid(batontxid, vini, height, sourcetxid, BATON_VOUT)) == 0) // find a tx which spent the baton vout + { + CTransaction txBaton; + uint256 hashBlock; + uint8_t funcId; + int64_t amount; + + if (GetTransaction(batontxid, txBaton, hashBlock, true) && // load the transaction which spent the baton + !hashBlock.IsNull() && // tx not in mempool + txBaton.vout.size() > BATON_VOUT && + txBaton.vout[BATON_VOUT].nValue == 10000 && // check baton fee + (funcId = DecodeOpReturn(txBaton.vout.back().scriptPubKey, amount)) != 0) // decode opreturn + { + total += amount; + } + else + { + + // some error: + + return -1; + } + sourcetxid = batontxid; + } + return total; +} +``` + +### Marker Pattern + +The marker pattern is used to place a mark on all similar transactions. This is accomplished by sending a small value to a common fixed address. Typically, we use the global CC address. + +You can also create either a normal marker or a CC marker for the purpose of finding transactions related to your module. + +When using normal markers, there is a small problem that is easily solved. The global CC address allows any user to spend its funds, and therefore anyone can spend your marker transaction. To overcome this, use the CC SDK function, `Settxids()`, to retrieve all transactions with markers in the CC contract list function. + +Another method is to create an unspendable CC marker. In this method, send a small value to a CC output with a well-known address. To retrieve the list of CC-marker transactions, use the CC SDK function, `SetCCunspents()`. This returns a list of transactions with unspent outputs for that known address. + +When using the unspendable CC marker method, in the validation code you should disable spending from this address. This prevents a scenario where spending from the address causes you to lose markers. (For example, if you were to allow for spending from this address using a burn transaction, the burn transactions would take the burned markers into a hidden state, thus removing the markers from the list of initial transactions.) + +In all cases, the CC module validation code should disable unauthorized attempts to spend any markers. + +Concerning the method that relies on the CC marker, if the global CC address is used for storing not only the marker value, but also other funds, you need to ensure that marker values are not spent. + +A code example for finding transactions marked with a normal marker: + +```cpp + std::vector > addressIndex; + struct CCcontract_info *cp, C; + cp = CCinit(&C, ); + SetCCtxids(addressIndex, cp->normaladdr, false); + for (std::vector >::const_iterator it = addressIndex.begin(); it != addressIndex.end(); it++) { + CTransaction vintx; + uint256 blockHash; + if( GetTransaction(it->first.txhash, vintx, blockHash, false) ) { + // check tx and add its txid to a list + } + } +``` + +Many other Antara modules contain examples for finding marked transactions in any CC module standard list function. + + + The SetCCtxids() function requires that the Smart Chain [txindex](/smart-chains/setup/common-runtime-parameters/#txindex) launch parameter NOT be adjusted beyond the default and automatic settings. + + +A code example for finding transactions marked with an unspendable CC marker: + +```cpp + std::vector > addressIndex; + struct CCcontract_info *cp, C; + cp = CCinit(&C, ); + SetCCunspents(addressIndexCCMarker, cp->unspendableCCaddr, true); + for (std::vector >::const_iterator it = addressIndexCCMarker.begin(); it != addressIndexCCMarker.end(); it++) { + CTransaction vintx; + uint256 blockHash; + if( GetTransaction(it->first.txhash, vintx, hashBlock, false) ) { + // check tx and add its txid to a list + } + } +``` + + + The CCunspents() function requires the Smart Chain [addressindex](/smart-chains/setup/common-runtime-parameters/#addressindex) and [spentindex](/smart-chains/setup/common-runtime-parameters/#spentindex) launch parameters to be set to `1`. + + +### Txidaddress Pattern + +You can use the txidaddress pattern to send value to an address from which the value should never again be spent. + +The function `CCtxidaddr` is available for creating an address that is not associated with any known private key. This function creates a public key with no private key from a transaction id. + +For example, the [Payments](/antara/api/payments/) Antara Module uses `CCtxidaddr` to create a non-spendable txidpk from the `createtxid`. Furthermore, the module also uses the `GetCCaddress1of2` function to create a `1of2` address from both the Payments module global pubkey and the txid-pubkey. + +This allows the module to collect funds on a special CC address that is intended only for a particular type of creation transaction. Funds are sent to this address via the `MakeCC1of2vout` function. Only the Payments module global pubkey and txid-pubkey can successfully create transactions that can be sent to this special address. + +###### Create an unspendable public key for a transaction id + +```cpp +// use Antara SDK function to create a public key from some transaction id: +CPubKey txidpk = CCtxidaddr(txidaddr, createtxid); +``` + +###### Create a cc vout with 1 of 2 pubkeys, one of which is txid pubkey + +```cpp +// create a cc vout with 1 of 2 pubkeys, one of which is txid pubkey +mtx.vout.push_back(MakeCC1of2vout(EVAL_PAYMENTS, inputsum-PAYMENTS_TXFEE, Paymentspk, txidpk)); +``` + +###### Spend 1 of 2 pubkey outputs with a txid pubkey in a previous transaction + +```cpp + +// function AddPaymentsInputs adds inputs from the address of 1of2 pubkeys (global and txid pk) outputs to the mtx object (the function parameters are not important for now): + +if ( (inputsum= AddPaymentsInputs(true,0,cp,mtx,txidpk,newamount+2*PAYMENTS_TXFEE,CC_MAXVINS/2,createtxid,lockedblocks,minrelease,blocksleft)) >= newamount+2*PAYMENTS_TXFEE ) +{ + + // Get the address for 1 of 2 pubkeys cc output (into `destaddress` variable): + + GetCCaddress1of2(cp, destaddr, Paymentspk, txidpk); + + // Set the pubkeys, address and global private key for spending the 1 of 2 pubkeys address (which also consists of the global and txid pk) in the previous transaction: + + CCaddr1of2set(cp, Paymentspk, txidpk, cp->CCpriv, destaddr); + + // Sign the transaction in the mtx variable: + + std::string rawtx = FinalizeCCTx(0, cp, mtx, mypk, PAYMENTS_TXFEE, CScript()); + + // return `rawtx` to the user... +} +``` + +### Application Data in a CryptoCondition vout ("cc opret") + +With the latest changes to the Antara SDK a developer can now add application data to a CryptoCondition output, also called a "cc opret." + +This allows more flexibility in the creation of Antara Module transactions. As cc-output content is hashed and not directly readable, cc opret creates the possibility to add identification data to a cc output. This allows the developer to distinguish this vout from other vouts. + +The SDK also now opens up the possibility to place any application data in cc vouts, instead of the last vout alone (as was the case previously). This allows a single transaction to have outputs of two or more Antara modules. For example, this can be useful when making swaps of values between modules. + +An example of cc-opret usage can be found in the [Payments Module.](/antara/api/payments/) In this module, the `vData` optional parameter in the `MakeCC1of2vout` function is used to append the opreturn data directly to the `ccvout` itself. This contrasts with the old method of adding the data to an actual opreturn that is the last `vout` in a transaction. + +```cpp +std::vector> opret = EncodePaymentsMergeOpRet(createtxid); // create Antara module opreturn data + +// create a public key from a transaction id as it was made in 'Txidaddress pattern': + +CPubKey txidpk = CCtxidaddr(txidaddr, createtxid); + +// create vData object that will be added to cc vout: + +std::vector> vData = std::vector>(); + +// Put the opreturn into vData object: + +if ( makeCCopret(opret, vData) ) { + + // pass vData object as the last parameter in MakeCC1of2vout: + + mtx.vout.push_back(MakeCC1of2vout(EVAL_PAYMENTS, inputsum-PAYMENTS_TXFEE, Paymentspk, txidpk, &vData)); +} + +// some other stuff to prepare the parameters for signing the transaction: +GetCCaddress1of2(cp, destaddr, Paymentspk, txidpk); +CCaddr1of2set(cp, Paymentspk, txidpk, cp->CCpriv, destaddr); + +// sign the transaction: + +rawtx = FinalizeCCTx(0, cp, mtx, mypk, PAYMENTS_TXFEE, CScript()); // use the empty last vout opreturn, we don't need it any more +``` + +The following content provides an example of using cc opret data for the identification of Antara module cc outputs. (Recall that a cc output's content is hashed, and therefore identifying a cc vout is challenging.) + +Using a modification to the `IsPaymentsvout` function, we spend a `ccvout` in the Payments module back to its own address, without needing a `markervout` or an opreturn. + +```cpp +// function used to check if this is a Payments module vout + +int64_t IsPaymentsvout(struct CCcontract_info *cp, const CTransaction& tx, int32_t v, char *cmpaddr, CScript &ccopret) +{ + char destaddr[64]; + + // use getCCopret instead of the former usage of IsPayToCryptoCondition() function +// retrieve the application data from cc vout script pubkey and return it in the `ccopret` reference variable: + + if ( getCCopret(tx.vout[v].scriptPubKey, ccopret) ) + { + if ( Getscriptaddress(destaddr, tx.vout[v].scriptPubKey) && (cmpaddr[0] == 0 || strcmp(destaddr, cmpaddr) == 0) ) + return(tx.vout[v].nValue); + } + return(0); +} +``` + +Note, that if you need to further differentiate the cc outputs in a transaction (for example, from another Antara module vouts) you may also analyze the ccopret content, specifically the eval code stored in it. + +In place of the `IsPayToCryptoCondition()` function we can use the `getCCopret()` function. This latter function is a lower level of the former call, and will return any `vData` appended to the `ccvout` along with a `true`/`false` value that would otherwise be returned by the `IsPayToCryptoCondition()` function. + +In validation, we now have a totally different transaction type than the types that are normally available. This new type allows us to have different validation paths for different `ccvouts`, and it allows for multiple `ccvouts` of different types per transaction. + +```cpp +if ( tx.vout.size() == 1 ) +{ + + // IsPaymentsvout returns application data in the `ccopret` variable, the returned data is checked immediately: + + if ( IsPaymentsvout(cp, tx, 0, coinaddr, ccopret) != 0 && ccopret.size() > 2 && DecodePaymentsMergeOpRet(ccopret, createtxid) == 'M' ) + { + fIsMerge = true; + } else return(eval->Invalid("not enough vouts")); +} +``` + +## Various Tips and Tricks in Antara Module Development + +#### Test Chain Mining Issue + +On a test chain consisting of two nodes, we do not recommend that you set both nodes to mine. When there are only two nodes, a blockchain struggles more to achieve consensus, and the chain can quickly stop syncing properly. Instead, have only one node mine for the two-node test chain. + +#### Limits on AddNormalInputs() Function Calls per Transaction + +Keep the number of `AddNormalInputs()` function calls to one for each block of code that creates a transaction. + +As an example of why we should not exceed more than one call, we can look at the `FillSell()` function. This function calls `AddNormalInputs()` two times at once. The first time the `AddNormalInputs()` function must add a txfee and the second time it adds coins to pay for tokens. + +Let us suppose we have only two utxos in our wallet, one for `9,000,000` satoshis and another for `10,000` satoshis. In this case, when we execute the `FillSell()` function our large uxto is added during the first call and then we receive an error in the second call, `filltx not enough utxos`. + +Instead, we recommend that the developer place only one I think it is always better to combine these calls into a single call. + +#### Troubleshooting Node Syncing on Test CC Chain + +Sometimes, a developer may find after developing a new CC module that a node cannot sync with other nodes in their test network. Executing the [getpeerinfo](/smart-chains/api/network/#getpeerinfo) shows fewer synced blocks than synced heads. The developer may also see errors in the console log on the malfunctioning node. + +When this happens, the cause is most commonly rooted in the CC module's validation code. For example, the developer may have changed validation rules, and in so doing may have rendered old transactions invalid in the node's state. + +A quick remedy in this situation is to [manually delete the blockchain data on the malfunctioning node and resync the network.](/smart-chains/setup/smart-chain-maintenance/#manually-deleting-blockchain-data) Old transactions should pass validation, assuming the new validation code takes their situation into account. + +When resyncing the node is not a viable solution, another option is to use code logging and the gdb debug software to investigate the cause of failure. + +Yet another solution, if necessary, is to setup the validation code to only be effective after a certain block height. See the following example. + +```cpp +if (strcmp(ASSETCHAINS_SYMBOL, "YOURCHAIN") == 0 && chainActive.Height() <= 501) + return true; +``` + +You may also use the hidden `reconsiderblock` komodo-cli command to restart the malfunctioning node's syncing process at a desired block height. + +#### Deadlocks in Validation Code + +If komodod hangs while executing Antara module validation code, consider that some blockchain functions use locks. The combination of your validation code and the locks could be causing deadlocks in the consensus mechanism. If this is the case, use functions that are non-locking instead. + +For example, the `GetTransaction()` function is a locking function. Instead, use `myGetTransaction()` or `eval->GetConfirmed()`. +export const title = "Beginner Tutorials: Komodo Developer Path"; +export const description = + "Learn the Komodo Developer Path with guided tutorials on creating a development environment and building blockchain applications."; + +import tutorial1 from "@/public/images/antara/2019-06-24-tutorial-1-img-1.png"; +import tutorial2 from "@/public/images/antara/2019-06-24-tutorial-1-img-2.png"; + +# Komodo Developer Path | Preparation + +## Introduction + +The following six guided tutorials cover introductory topics for a new developer in the Komodo ecosystem. This tutorial here guides the reader in creating and installing the necessary environment for the tutorials. + +The tutorials rely extensively on downloadable "docker images" of Komodo software. A downloadable docker image is an entirely self-contained virtual machine that holds installations of the software necessary to complete the tutorials. + +The developer does not need to alter or make any additions to the Komodo source code itself as a part of these tutorials. + +#### Full Overview of Komodo Developer Path Tutorials + +The following is a brief summary of the docker tutorial stages. + +* Install Development Environment +* Create a New Blockchain (10 minutes) +* Integrate the Faucet Module (5 minutes) +* Connect Your Programming Language to the Tutorials (10 minutes) +* Make an NFT (5 minutes) +* Build a Token DEX (30 minutes) +* Sync the community testnet blockchain DOC (or MARTY) +* Retrieve test coins from a website faucet +* Use a mobile wallet to send coins between your dev node and a community blockchain +* Repeat the tutorials and test with colleagues + +#### Menu Options in Docker Images + +The options from the main menu of the docker image are the following. + +* TUTORIALS + * Go through the tutorials, including starting a blockchain, run a faucet, create a token dex, use a MuSig Schnorr Signature +* DOC + * dPoW community testnet blockchain +* MARTY + * dPoW community testnet blockchain +* MAINT + * For basic maintenance of this guided tutorial application +* EXIT + * Return to shell + +## Rapid Summary (TL;DR) + +If the reader is in a hurry and does not have time to follow all of the instructions in Part I, the following three terminal commands accomplish the essential aspects of the full tutorial's objectives. + +```bash +docker pull komodocakeshop/dev-allinone-learn-kmd +``` + +```bash +docker run -it -p 127.0.0.1:9253:9253 komodocakeshop/dev-allinone-learn-kmd +``` + +```bash +learn-kmd +``` + +After the last command, follow the onscreen instructions. + +From here, the reader may optionally skip all of the following content and proceed directly to the next article in this tutorial series. + +## The Unique Nature of the Docker-Image Tutorials + +These guided tutorials are different from many other developer tutorials in the Komodo documentation. + +Normally, a developer builds the Komodo software from source. In the tutorials here, however, the developer downloads a "docker image." + +A docker image can be described as a complete, self-contained virtual machine that already bears all necessary software installed. This includes the Komodo software, the Zcash parameters, and any necessary instances of Smart Chains. + +Once the docker image is downloaded and initiated in the terminal, the developer can utilize all installed software as normal. + +In this tutorial, the docker container contains two starting nodes. + +If the reader is not familiar with docker, do not worry. These tutorials use docker only as a development tool, and not as a complex deployment strategy. + +The tutorial's image uses the default docker network. Advanced docker users are welcome to adjust docker settings as desired. + +#### Sending Commands to the Docker Image's Seed Node + +The developer uses a text console within the docker container to controll the blockchain seed node during the guided tutorials. This text console interfaces with the `127.0.0.1` Remote Procedure Call (RPC) server. + +The guided tutorial features a preset chain called `TUT1`. The parameters of this chain are an initial coin supply of `1000` and an RPC port of `9253`. + +The `docker run` command specifies the RPC port as a passthrough port. This makes the port available outside the docker image, should the developer choose to integrate the docker image's Smart Chain, `TUT1`, with an external programming environment, such as Python or Node.js. + +Supported languages include all languages that can call RPC commands in the terminal, as well as those that can implement tools such as curl, postman, insomnia, and other similar development tools. + +The docker image is suitable for testing only; do not use the image in a production setting. + +The mining node RPC port is not passed through the docker container at runtime because it is randomly generated. The developer can reconfigure this setting, but the tutorials do not cover this topic. + +## Install Docker + +#### Estimated Time: 2 Minutes + +The following instructions are written for an Ubuntu 18.04 (LTS) user with root privileges. + +After completing the following steps, a non-privileged user may continue to use the docker image without further requiring the `sudo` command. + +```bash +sudo apt update +``` + +```bash +sudo apt install apt-transport-https ca-certificates curl software-properties-common +``` + +```bash +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +``` + +```bash +sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" +``` + +```bash +sudo apt update +``` + +```bash +apt-cache policy docker-ce +``` + +```bash +sudo apt install docker-ce +``` + +```bash +sudo systemctl status docker +``` + +```bash +sudo usermod -aG docker ${USER} +``` + +```bash +sudo su - ${USER} +``` + +## Download Komodo Image + +#### Estimated Time: 3 Minutes + +The "all-in-one" Komodo image is available for development only. + +This image includes Komodo software and the Zcash parameters. + +```bash +docker pull komodocakeshop/dev-allinone-learn-kmd +``` + +#### (Optional) Install the Reduced-Size Docker Image + +If the reader already has the Zcash parameters installed, a smaller docker image is available. Use of this image is entirely optional; the only benefit it serves is a reduced storage-space footprint. + +```bash +docker pull komodocakeshop/dev-learn-kmd +``` + +#### Check the Local Image + +Once downloaded, check that the image is in your local docker catalogue using the `docker images` command. + +#### Command + +```bash +$ docker images +``` + +#### Expected Response + +```bash +REPOSITORY TAG IMAGE ID CREATED SIZE +komodocakeshop/dev-learn-kmd latest 3792dab98cce 2 days ago 992MB +``` + +## Start Komodo Development Container + +#### Estimated Time: 10 seconds + +Start the container. + +This drops into a bash prompt that is ready to start the guided tutorials. + +```bash +docker run -it -p 127.0.0.1:9253:9253 komodocakeshop/dev-allinone-learn-kmd +``` + +#### (Optional, for Smaller Docker Image Only) Mount the Local Zcash Parameters + +For users relying on pre-existing Zcash parameters and using the smaller Komodo docker image, mount the parameters as a read-only volume. + +```bash +docker run -it -p 127.0.0.1:9253:9253 -v /home/${USER}/.zcash-params:/root/.zcash-params:ro komodocakeshop/dev-learn-kmd +``` + +## Follow The Guided Tutorial Blockchain Starter Kit + +#### Estimated Time: 4 minutes + +The guided tutorial starts by automatically creating two sets of randomly generated keys that should be used throughout the tutorials. + +Alternatively, run everything from command line using the komodo-cli. + +## Begin Guided Tutorial + +#### Estimated Time: 20 seconds + +Type `learn-kmd` to start the guided tutorials. + +```bash +learn-kmd +``` + + + +The "quick start" menu opens with the following screen. + + + +*** + +[Click here to proceed to the next tutorial in this series](/antara/tutorials/beginner-series-part-1/#create-a-blockchain) +export const title = "Beginner Tutorial: Part-1"; +export const description = "Learn how to Create a Komodo Smart Chain."; + +import tutorial8 from "@/public/images/antara/2019-06-24-tutorial-1-img-8.png"; +import tutorial9 from "@/public/images/antara/2019-06-24-tutorial-1-img-9.png"; +import tutorial10 from "@/public/images/antara/2019-06-24-tutorial-1-img-10.png"; +import tutorial3 from "@/public/images/antara/2019-06-24-tutorial-1-img-3.png"; +import tutorial4 from "@/public/images/antara/2019-06-24-tutorial-1-img-4.png"; +import tutorial11 from "@/public/images/antara/2019-06-24-tutorial-1-img-11.png"; +import tutorial12 from "@/public/images/antara/2019-06-24-tutorial-1-img-12.png"; +import tutorial5 from "@/public/images/antara/2019-06-24-tutorial-1-img-5.png"; +import tutorial6 from "@/public/images/antara/2019-06-24-tutorial-1-img-6.png"; +import tutorial7 from "@/public/images/antara/2019-06-24-tutorial-1-img-7.png"; + +# Komodo Developer Path | Create a Blockchain + +## Create a Blockchain + +#### Estimated Time: 10 minutes + +The following tutorial uses the Komodo tutorial docker image to create a blockchain. This tutorial is part of a series. + +[To return to the previous tutorial, click here.](/antara/tutorials/beginner-series-part-0/) + +#### Select the Appropriate Tutorial from the Menu + +Begin with the first guided tutorial by selecting `TUTORIALS` and then `TUT1` from the menu. The following screen should appear. Note the detailed instructions onscreen. You may follow these through the tutorial. + + + +#### Create a Seed Node + +##### Estimated Time: \< 1 Minute + +The guided tutorial interface follows these screens: + +* From the `SEED-MENU` select `SPINUP-SEEDNODE` + + + +* Enter `1000` coins as the supply when prompted +* Use the `SEED-GETINFO` menu item to query the chain's current state + * At this time, you will notice that although our `TUT1` chain has started, the `GETINFO` menu item replies that the chain has `0` blocks + * This is due to the fact that the chain is still waiting for a mining node to mine blocks + +Return to the main `TUT1` menu. + + + +## Create Mining Node + +##### Estimated Time: \< 1 Minute + +The `TUT1` chain is designed as a blocks-on-demand Smart Chain. This type of chain uses a Proof of Work consensus mechanism for the first 128 blocks, thus forcing the mining of these first blocks, regardless of the number of transactions occurring on the chain. After block 128, the chain stops automatically mining blocks and instead waits until there are a few transactions in the mempool. This style of chain saves computing resources. + +For the `TUT1` chain these settings are managed within the pre-built docker image. Later, you will learn how to adjust these settings manually. + +While the settings of the Smart Chain are set to blocks-on-demand, a node on the network has to indicate a desire to mine for the process to begin. Follow the instructions below to launch a mining node on `TUT1`. + +Go `BACK` in the menu until you see the options for both `SEED-MENU` and `MINING-MENU` + + + +Select `MINING-MENU`, then `SPINUP-MININGNODE`. + +Enter `1000` coins as the supply when prompted (we assume here that you entered 1000 coins earlier). + +Use the `GETINFO` command to query blockchain state. The chain will still have `0` blocks, but should have `1` connection. This is the connection to the seed node. + +## Start Mining + +##### Estimated Time: \< 1 Minute + +* From the `MINING MENU` select `MINING-START` + * The mining process now begins + * Mining the first several blocks requires 30 to 90 seconds +* From the `MINING MENU` select `MINER-GETMININGINFO` + * This queries the mining state of both the network and this node + * You may see approximately 1.0 solutions per second (`localsolps`) + * You should see the number of blocks increase when you repeat the `MINER-GETMININGINFO` menu item + + + +## Validate An Address + +##### Estimated Time: \< 1 Minute + +The guided tutorial in the docker image automatically creates a blockchain address for the user during the startup process. + +Typically, when blockchain software creates an address for a user, the address is automatically imported into the user's wallet so that the user can use it. + +In these tutorials, however, we generate an address that is not automatically imported. This gives you a chance to import the address yourself under the tutorial guidance. + +Make sure that you are still in the `MINING-MENU` menu. + +Enter the `WALLET` section. + + + +* Select `VALIDATE` to call the [validateaddress](/smart-chains/api/util/#validateaddress) Remote Procedure Call (RPC) method. + + + +The results should be similar to the following. + + + +Note the `address` in the response. This is the address that was generated for this tutorial. + +However, note that the `ismine` value is `false`. (`ismine` stands for "is mine".) + +The private key that was automatically generated by the docker image needs to be imported. + +## Import Private Key for the Wallet + +In the guided tutorials, you do not need to manage the private key directly. However, this is a good time to become familiar with the concept. + +A private key could look like the following. + +``` +E9873D79C6D87DC0FB6A5778633389_SAMPLE_PRIVATE_KEY_DO_NOT_IMPORT_F4453213303DA61F20BD67FC233AA33262 +``` + +When you enter a private key such as the above into the blockchain software, the automated encryption will match this address with a public key, also called a "pubkey". + +A pubkey can look like the following. + +``` +04fe53c78e36b86aae8082484a4007b706d5678cabb92d178fc95020d4d8dc41ef44cfbb8dfa7a593c7910a5b6f94d079061a7766cbeed73e24ee4f654f1e51904 +``` + +The public key is the address that receives and holds money. The private key unlocks the address and allows the user to spend money. + +Keep the private key private at all times. Never share it - not even with a member of the Komodo team. + +{/* Sidd: */} + +{/* Mylo, we should simply show the address and the private key as a part of the docker tutorial. */} + +To import the private key that was automatically generated for you, select `WALLET`, then `IMPORT-DEV-WALLET`. + +This automatically executes the [importprivkey](/smart-chains/api/wallet/#importprivkey) RPC method, importing the private key and thus the address. + +Now, when funds are sent to this address, your wallet has the keys necessary to spend them. + +## Check the Wallet Balance + +##### Estimated Time: \< 1 Minute + +From within the `WALLET` menu, select `BALANCE`. + +This automatically executes the [getbalance](/smart-chains/api/wallet/#getbalance) RPC method. + + + +Note that your wallet has the full `1000` coins, and a little extra. + +These `1000` coins were mined into your address as a reward for mining the first block of the blockchain. This is called the Genesis Block. + +The extra fraction of a coin should be of an amount similar to the displayed `.12532156` above. + +This extra fraction of a coin comes in part as a reward for the blocks mined. + +By default, each block mined on a Komodo Smart Chain rewards the miner with `0.001` coins. + +At the time the screenshot above was taken, the mining node had mined approximately `125` blocks, thus accounting for the extra fraction of a coin. + +## List Unspent Transactions (Utxos) + +##### Estimated Time: \< 1 Minute + +The mining node holds the funds. The funds are represented on the blockchain as "unspent transactions," or "utxos." + +Utxos can be difficult for a complete beginner to understand. + +A utxo is similar in nature to a dollar bill in your physical wallet. You can have many bills in your wallet, and the total amount of bills you have determines your total amount in your wallet. + +Likewise, you can have many utxos in your digital wallet, and the total value of all utxos determines the total amount in your digital wallet. + +For a full discussion on utxos, [turn to the Core Technology Discussions section.](/start-here/core-technology-discussions/miscellaneous/#the-utxo-an-elusive-yet-fundamental-concept) + +In this guided tutorial, we will automatically execute a command that allows us to look at the utxos in our wallet. + +Still within the `WALLET` submenu, choose the `LISTUNSPENT` option. This executes the [listunspent](/smart-chains/api/wallet/#listunspent) RPC method. The result should be similar to the following. + + + +The number of utxos here will differ according to the number of blocks your mining node has mined. Each block mined generates a new utxo in your wallet. + +## Stop Mining + +##### Estimated Time: \< 1 Minute + +The [setgenerate](/smart-chains/api/generate/#setgenerate) RPC method tells a node to start and stop mining. + +Within the `MINING` menu, choose the `MINING-STOP` menu item. + +The screen will flash and then return to the `MINING` menu. This indicates that mining is stopped. + +Recall that in this guided tutorial there are only two nodes on the `TUT1` blockchain, and that only one of the nodes is a mining node. + +As we have stopped the mining node, the blockchain itself is stopped. If we were to attempt to use the other node to send a transaction to the blockchain, no node would mine this transaction, and therefore the transaction would wait indefinitely for confirmation. + +## (Optional) Shut Down Both Nodes + +If you would like to exit the tutorial at this time, you may shut down both nodes from within the docker menu. + +* `MINING-MENU` -> `SHUTDOWN-NODE-MINER` +* `SEED-MENU` -> `SHUTDOWN-NODE-SEED` + +Otherwise, you may proceed with the tutorial series by clicking on the link below. + +*** + +[Link to the next tutorial in this series](/antara/tutorials/beginner-series-part-2/) +export const title = "Beginner Tutorial: Part-2"; +export const description = + "Learn how to use a faucet in the Komodo ecosystem to send and receive funds."; + +# Komodo Developer Path | Using a Faucet + +#### Total Estimated Time: 15 minutes + +This tutorial is part of a series. + +[To return to the previous tutorial, click here.](/antara/tutorials/beginner-series-part-1/) + +## Introduction + +In the non-digital world, a faucet is a tap fitting of your regular bathroom or kitchen water supply. Faucets sometimes drip. + +A blockchain faucet is based on this concept. The digital faucet drips small amounts of coins to people that send a request to the faucet. + +In this tutorial, we use a Komodo technology called an Antara Module to create a faucet on our `TUT1` Smart Chain. + +There are many types of Antara Modules, and the [Faucet Antara Module](/antara/api/faucet/#introduction) is but one of them. + +Transferring funds via the faucet will allow us to perform other tasks further in the tutorials. + +#### The Expected Current State of Our TUT1 Smart Chain + +* The mining node has \~1000 coins +* The mining node has several utxos + * One large utxo with approximately 1000 coins + * Many small utxos, each having 0.0001 coins + * These utxos are rewards for mining blocks +* Both the mining node and the seed node should be running + * If you stopped the nodes at the end of the last tutorial, restart them using the `SPINUP` functions found within each node's menu +* The mining node should be set to mine + * To restart the mining node, use the `MINING-START` function in the `MINING-MENU` section + +#### Next Steps in the Tutorial + +* On the mining node we send some of our funds to the chain's built-in faucet + * To accomplish this, in this guided tutorial we use an automated version of the [faucetfund](/antara/api/faucet/#faucetfund) Remote Procedure Call (RPC) +* On the seed node, which currently has 0 coins, we send a request to the faucet for funds + +## Send All Funds to Self + +##### Estimated Time: 2 minutes + +We first consolidate all the utxos in our wallet, both large and small, into a single utxo. We send this consolidated utxo to the Antara Module that acts as a faucet. + +The reason we first consolidate the utxos into one is related to a subtle nuance of Antara Module technology. One requirement of all funds entering an Antara Module is that they must have been spent at least once before. This requirement simplifies some of the underlying code of an Antara Module. + +All the utxos in our current mining wallet were generated either in the first block, or they were generated as a part of a mining reward. Therefore, they have not yet been spent. + +To consolidate them in the guided tutorial, we use an automated version of the [sendtoaddress](/smart-chains/api/wallet/#sendtoaddress) RPC. + +* Enter the `MINING-MENU` +* Enter the `WALLET` submenu and select `SENDALLSELF` + * This tutorial function performs several automated tasks + * First, the function checks our total balance using the getinfo RPC + * The function gathers the address that we saw earlier in the validateaddress RPC + * Finally, the function sends the entire amount to this address using the sendtoaddress RPC + * This sends everything in our wallet in a circular loop back into our wallet + +Wait for this transaction to be mined in a block. (This process is also called "confirming a transaction.") + +One way to check the status of the transaction is to use the `LIST` function from the last tutorial. Right after performing the `SENDALLSELF` function, you will have zero utxos in your wallet. Once a utxo reappears in your wallet, you know that the transaction is successfully mined. + + + When you finally have a utxo in your wallet again, you will notice that you have two utxos instead of one. This may be surprising, but this provides a good opportunity to learn about "dust." + + The mathematics behind blockchain technology are complex, and transactions are rarely able to have perfectly clean total amounts. There is often a remnant of funds in the amount of a tiny fraction of a coin. These leftover funds remain in your wallet as a separate utxo, and as they are typically of such little value, they are effectively useless. This is why they are called "dust." + + +## Send Funds to the Faucet + +##### Estimated Time: 1 minute + +In this guided tutorial, we use an automated version of the [faucetfund](/antara/api/faucet/#faucetfund) RPC. This takes any number of coins we choose from our wallet and sends them to the Faucet Antara Module. + +Once the funds are in the module, other users on the chain can request to have some of the funds. The funds are disbursed in small amounts, and the module has a feature that discourages users from spamming the faucet to drain all of the funds at once. + +* From the `MINING-MENU`, select `FAUCET` +* Select the `FUNDFAUCET` function +* Enter `200` as the amount of coins to send + * (This amount is arbitrary. We choose `200` for simplicity's sake.) + +## Claim a Small Amount of Funds from the Faucet + +##### Estimated Time: 5 Minutes + +Use the `BACK` function on each page until you again reach the option to choose between the `MINING-MENU` and the `SEED-MENU`. + +Choose the `SEED-MENU`. + +#### Validate the Seed Wallet + +Just as before, we want to make sure that we've imported our tutorial private key before we send any funds to any address. + +* Select `WALLET` and then `VALIDATE` +* If the proper `ismine` is `false`, we need to import the private key +* From the `WALLET` submenu, select `IMPORT-DEV-WALLET` + * This automatically performs the importprivkey RPC for us + +#### Claim Funds from the Faucet + +* Return to the `SEED-MENU` section. +* Select `FAUCET` +* Select `GETFUNDS` + +The `GETFUNDS` function in this guided tutorial is yet another automated version of an RPC. This time, the RPC is the [faucetget](/antara/api/faucet/#faucetget) method. + +The faucetget method requests funds from the `TUT1` faucet. + +The Antara Module software automatically checks a few things to make sure that we are not attempting to spam and drain the faucet. One task the Antara Module requires is a small amount of work from our computer. The CPU of our computer will perform a few complicated encryption calculations. This may take a few seconds to perform. + +The time and electricity this consumes from our computer helps to offset any incentive a malicious actor would have when trying to drain the faucet. + +The Antara Module will also check to make sure that our `SEED` node's wallet history is relatively fresh. The `SEED` node is entirely separate from the `MINING` node's data directory, and therefore no issues are detected. + +## Check for the Returned Coins + +##### Estimated Time: 1 minute + +There are many RPCs available to check the balance of a wallet. + +A common RPC is the [getinfo](/smart-chains/api/control/#getinfo). This checks many aspects of the Smart Chain's current state, including the wallet's balance. + +One of the most common RPC's is the [getbalance](/smart-chains/api/wallet/#getbalance) method. This returns only information about the wallet's balance. + +A final example is the [listunspent](/smart-chains/api/wallet/#listunspent) RPC, which returns infromation about all utxos in the user's wallet. + +* In the `SEED-MENU` section, select `SEED-GETINFO` to perform an automated getinfo RPC + * In the response, look for the `balance` property + * There should be at least `0.1` coins in your wallet +* In the `SEED-MENU` section once again, select `WALLET` +* Within the `WALLET` submenu, select the `BALANCE` function to perform an automated getbalance RPC +* Also within the `WALLET` submenu, select `LIST` to perform the automated listunspent RPC + +*** + +[Link to next tutorial section](/antara/tutorials/beginner-series-part-3/#introduction) +export const title = "Beginner Tutorial: Part-3"; +export const description = "Learn how to connect to the Komodo software daemon using the Unix curl command and obtain the necessary credentials."; + +# Komodo Developer Path | Connecting to Another Programming Environment + +## Total Estimated Time: \~10-20 Minutes + +This tutorial is part of a series. + +[To return to the previous tutorial, click here.](/antara/tutorials/beginner-series-part-2/) + +## Introduction + +Until now we have relied on automated functions in the guided tutorials for assistance in executing Remote Procedure Calls (RPC's). Such RPC's include getinfo, listunspent, faucetfund, and more. + +The very purpose of an RPC is to allow another programming environment to access the functionality of the software. For example, an RPC allows Python or JavaScript source code to send a secure call to the Komodo Smart Chain with a request to perform an action, and to return information about the result. + +All RPC's are available in any mainstream programming language, and we are now prepared to experiment with this feature. + +In this tutorial, we focus on the most essential aspect of this process, the Unix `curl` command. Using `curl` to access Komodo software from the source code of another environment is relatively straightforward, depending upon the programming language itself. + +The guided-tutorial software that holds our `TUT1` Smart Chain has an exposed RPC port that we use to connect to our seed node. + +#### Inquiring About Language Wrappers + +Before we continue with the tutorial, there is a tangential point to mention. + +In the Komodo community, for many popular programming languages there are available enhancements beyond the `curl` command. These enhancements allow a developer to more easily integrate with Komodo. + +In these languages, someone from the Komodo community has created a language "wrapper." A wrapper essentially allows a developer to import all the Komodo RPC calls directly into the source files of their chosen language. + +Therefore, the developer can often simply call the Komodo RPC suite into the source file and access each RPC on demand. + +For information regarding availability of language wrappers for your preferred language, please reach out to our team and to the community on [Discord.](https://komodoplatform.com/discord) + +## Obtaining the Necessary Passwords and Credentials + +##### Estimated Time: 1 minute + +The Smart Chain software controls access to all your valuable assets. Allowing other software on your node to access and manipulate these assets is a potential security risk. Therefore, the Smart Chain software requires a password and username from any software that attempts to access the Smart Chain's exposed port. + +These credentials are called the rpcpassword, rpcuser, and rpcport. + +The file that holds these values is typically installed in a `~/komodo/COINNAME/COINNAME.conf` file. You can change the values in this file before launching the Komodo software, and they will be loaded at runtime. + +In our guided tutorial, the name of our coin is `TUT1`, and therefore the name of the credential file is `TUT1.conf`. + +We have placed the `TUT1.conf` file for the `SEED` node in a different location, to allow for the underlying tutorial software to function properly. + +Here is the location: `/root/.komodo/TUT1/TUT1.conf` + +{/* Sidd: The function below doesn't return the RPC port. */} + +{/* Alternatively, the `SEED-MENU` also features a function to display, or "dump," the credentials: `DUMP-RPCCREDENTIALS`. Executing this function will kill the guided-tutorial software. Execute `learn-kmd` at the terminal prompt to re-enter the software. */} + +Obtain your `TUT1` RPC credentials and copy/paste them into a nearby location before continuing with the tutorial. + +## Using curl + +##### Estimated Time: 5 minutes + +#### Conceptualizing the curl Command + +A `curl` command must be sent to the Komodo software daemon through a Unix shell, or terminal. + +When using `curl` from another programming environment, the developer's source code first opens an instance of a Unix terminal. This is typically achieved through some type of environment enhancement. For example, a JavaScript developer might use Node.js to open a Unix terminal instance. The specific Node.js function the developer would use is [child\_process.exec().](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) + +The developer's source file then creates a `curl` command that fulfills the intended purposes of the developer's software, and sends this `curl` command to the Komodo software daemon. + +The `curl` command sends a json reply, which the developer captures in their source code and utilizes in any manner the developer desires. + +#### Installing jq + +The returned json object is provided without human-friendly json formatting. + +To make json responses easier to read, Komodo developers typically make use of a third-party software called "jq". + +[You can download and install jq at this link.](https://stedolan.github.io/jq/) + +Once installed, with each `curl` command simply include a pipe and a call to jq, along with any desired jq optional parameters. Komodo developers typically include the `-r` parameter for raw outputs, to help jq interpret the raw string. + +## The Anatomy of a curl Command + +Observe the anatomy of a sample `curl` command, as executed in the terminal. For this example, we use the getinfo RPC. + +#### Command + +```bash +curl -s --user user3044755432:passd30f503069f140e8e0ffe4d3f1645a8eae8e923b20e6011630cc98880ec5c47320 --data-binary "{\"jsonrpc\": \"1.0\", \"id\": \"curl test\", \"method\": \"getinfo\", \"params\": []}" -H 'content-type: text/plain;' http://127.0.0.1:9253/ | jq -r '.result' +``` + +| Property | Description | | +| ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| curl | the name of the Unix command | | +| -s | the "silent" option; this prevents the shell from returning extraneous information about the command's progress | | +| --user | informs the shell that there will be a username and a password directly following this property | | +| userXXXX:passXXXX | the rpcuser and rpcpassword, as provided in the coin's .conf file | | +| --data-binary | informs the shell that additional data should be included with the curl command, and that the data should be sent exactly as it is provided | | +| "\{ | begin the string that contains the data object; everything within this string is sent directly to the Komodo daemon for processing | | +| "jsonrpc": "1.0" | informs the Komodo daemon that it is receiving a json rpc object, and that the object is formatted according to version 1.0 of the Komodo RPC's source code | | +| "id": "curl test" | informs the daemon that the json object sent is a curl command | | +| "method": "getinfo" | informs the daemon that the developer is using the [getinfo](/smart-chains/api/control/#getinfo) RPC | | +| "params": \[] | provides the required or optional parameters that accompany the Komodo RPC; in this case, the getinfo RPC does not have any parameters, and therefore the array is empty | | +| }" | end of the string that contains the data object | | +| -H | informs the shell that there is an extra http header to include | | +| 'content-type: text/plain;' | the http character set parameter; states that the header is provided in plain-text format | | +| [http://127.0.0.1:9253/](http://127.0.0.1:9253/) | the http destination. The 127.0.0.1 tells the shell to serve the content to the node's localhost server. The :9253 extension is the rpcport, as provided in the coin's .conf file | | +| | jq -r | instructs the shell to pipe the response through the jq software; the -r instruction informs jq that this is a raw object | + +The response to the getinfo RPC `curl` command is as follows. Note that this is a json string and the developer must actively convert the response into a json object. For example, in JavaScript the appropriate function is `JSON.parse()`. + +#### Response + +```json +{ + "version": 2001526, + "protocolversion": 170007, + "KMDversion": "0.4.0a", + "synced": false, + "notarized": 0, + "prevMoMheight": 0, + "notarizedhash": "0000000000000000000000000000000000000000000000000000000000000000", + "notarizedtxid": "0000000000000000000000000000000000000000000000000000000000000000", + "notarizedtxid_height": "mempool", + "KMDnotarized_height": 0, + "notarized_confirms": 0, + "walletversion": 60000, + "balance": 0, + "blocks": 0, + "longestchain": 0, + "timeoffset": 0, + "tiptime": 1231006505, + "connections": 1, + "proxy": "", + "difficulty": 1, + "testnet": false, + "keypoololdest": 1561227622, + "keypoolsize": 101, + "paytxfee": 0, + "relayfee": 1e-6, + "errors": "", + "pubkey": "030746f79b31d1bb46aa10ee8ee72a06eba7375ca0aca411fa684936457363cdad", + "CCid": 2, + "name": "TUT1", + "sapling": -1, + "p2pport": 9252, + "rpcport": 9253, + "magic": 230635964, + "premine": 1000 +} +``` + +## Mine on the Seed Node Using curl + +Use `curl` to tell the `SEED` node to begin mining the `TUT1` Smart Chain. Use the [setgenerate](/smart-chains/api/generate/#setgenerate) RPC for this function. + +Note that this RPC requires parameters in the `curl` command: `\"params\": [true,1]` + +#### Command + +```bash +curl -s --user user3044755432:passd30f503069f140e8e0ffe4d3f1645a8eae8e923b20e6011630cc98880ec5c47320 --data-binary "{\"jsonrpc\": \"1.0\", \"id\": \"curl test\", \"method\": \"setgenerate\", \"params\": [true,1]}" -H 'content-type: text/plain;' http://127.0.0.1:9253/ | jq -r '.result' +``` + +The setgenerate RPC always returns `null` as a response. + +#### Response + +```json +null +``` + +## Discover the State of Mining on the Seed Node + +Use the [getmininginfo](/smart-chains/api/mining/#getmininginfo) RPC to ensure that the command executed successfully. + +#### Command + +```bash +curl -s --user user3044755432:passd30f503069f140e8e0ffe4d3f1645a8eae8e923b20e6011630cc98880ec5c47320 --data-binary "{\"jsonrpc\": \"1.0\", \"id\": \"curl test\", \"method\": \"getmininginfo\", \"params\": []}" -H 'content-type: text/plain;' http://127.0.0.1:9253/ | jq -r '.result'                   +``` + +#### Response + +```json +{ + "blocks": 1, + "currentblocksize": 1000, + "currentblocktx": 0, + "difficulty": 1, + "errors": "", + "genproclimit": 1, + "localsolps": 1.041666666666667, + "networksolps": 0, + "networkhashps": 0, + "pooledtx": 0, + "testnet": false, + "chain": "main", + "staking": false, + "generate": true, + "numthreads": 1 +} +``` + +## Stop Mining on the Seed Node + +To instruct the node to cease mining, we again use the [setgenerate](/smart-chains/api/generate/#setgenerate) RPC, but this time we provide the parameter as `false`. + +```bash +curl -s --user user3044755432:passd30f503069f140e8e0ffe4d3f1645a8eae8e923b20e6011630cc98880ec5c47320 --data-binary "{\"jsonrpc\": \"1.0\", \"id\": \"curl test\", \"method\": \"setgenerate\", \"params\": [false]}" -H 'content-type: text/plain;' http://127.0.0.1:9253/ | jq -r '.result'        +``` + +#### Response + +```bash +null +``` + +*** + +[Proceed to next tutorial article in the series.](/antara/tutorials/beginner-series-part-4/) +export const title = "Beginner Tutorial: Part-4"; +export const description = + "Create fungible and non-fungible tokens on a test Smart Chain with customizable properties and metadata."; + +import tutorial1 from "@/public/images/antara/2019-06-24-tutorial-4-img-1.png"; +import tutorial2 from "@/public/images/antara/2019-06-24-tutorial-4-img-2.png"; +import tutorial3 from "@/public/images/antara/2019-06-24-tutorial-4-img-3.png"; +import tutorial4 from "@/public/images/antara/2019-06-24-tutorial-4-img-4.png"; +import tutorial6 from "@/public/images/antara/2019-06-24-tutorial-4-img-6.png"; +import tutorial7 from "@/public/images/antara/2019-06-24-tutorial-4-img-7.png"; + +# Komodo Developer Path | Understanding Tokens + +## Introduction + +Each Smart Chain in the Komodo ecosystem can act as a fully tokenizable platform. This provides many opportunities to the developer for creating on-chain assets that represent varying types of value for their users. + +For example, tokens can be used to represent real world assets, and users can then trade these tokens using Komodo's [Token DEX](/antara/api/tokens/) and [AtomicDEX](/atomicdex/tutorials/) features. The developer could also create tokens that provide incentives to their audience. Or, tokens can represent collectible assets. These are but a few examples of the usefulness of on-chain tokenization. + +## Conceptualizing Tokens + +#### A Token is a Satoshi + +All Smart Chain coins abide by the Bitcoin-protocol standard wherein 1 coin is divisible for up to eight decimal places: `1.00000000`. The smallest unit of a Smart Coin therefore is `0.00000001` coins. By convention it is called a "satoshi," in honor of the inventor of the Bitcoin protocol. + +On a Smart Chain, each individual token is derived from one individual satoshi. Therefore, each coin can be transformed into 100,000,000 tokens. + +At the time of the creation of these tokens, the creator can define their properties, grant meta data to them, and establish the nature of their scarcity. + +All of this functionality is established and secured through the [Tokens Antara Module](/antara/api/tokens/). + +#### Fungible Token Creation + +With `0.1` of our `TUT1` tutorial coins, we can create `10,000,000` tokens in one creation transaction using the [tokencreate](/antara/api/tokens/#tokencreate) RPC. + +In the process of creation we can choose a name for these tokens. + +All of the tokens created from this single transaction are fungible one with another, and maintain scarcity across the Smart Chain. + +*(It is even possible with Antara technology to maintain token scarcity across multiple chains, but this is an advanced topic that we do not cover here.)* + +#### Non-Fungible Token Creation + +Alternatively, rather than creating a large collective of many fungible tokens, you could instead create non-fungible tokens. To achieve this, use the tokencreate RPC to create one token at a time. Each token requires `1` satoshi, plus transaction fees. + +#### Attaching Data to Tokens + +We can attach meta data to the tokens at their creation. + +The maximum size of data that can fit in a single Komodo transaction is `10000` bytes. This is enough to include all sorts of data, and even simple images. + +The developer is naturally free to use their imagination in the design of this data. For example, you can describe their purpose and add a json data structure that informs other software of the properties of this token. + +Advanced developers can even add functionality to allow the tokens to gain new data over time as they are passed through transactions. + +## Create a Token Set on TUT1 Smart Chain + +In our guided tutorial, we now create `50,000` tokens that we give the name `GOLD`. + +* Enter the `SEED-MENU` +* Select the `TOKENS` submenu +* Select `CREATE` +* Enter the name `GOLD` +* Use `0.0005` tokens +* For the short description `Some GOLD tokens` + +This creates 50,000 GOLD tokens by sending 0.0005 TUT1 coins to the [Tokens Antara Module.](/antara/api/tokens/#introduction) + +Wait a minute or so for the transaction to be mined and then use the `GETINFO` function to check the balance of our wallet. There are now `0.0993` coins remaining from the `0.1` coins we had previously. + +We used `0.0005` coins to create the tokens. + +We had a fee paid to the miners of `0.0001` coins. + +We also had another fee of `0.0001` coins that were sent to a special address in the Tokens Antara Module, called the "global address." The transaction for this fee had a small amount of data that permanently tells the entire `TUT1` Smart Chain community that we created these tokens. Therefore, if other users or developers want to learn about our `GOLD` tokens, they have a starting point in this global address. + +## Seed or Mining Node RPC: tokenlist & tokeninfo to find details of the tokens + +To see our tokens afterwards, we can use the [tokenlist](/antara/api/tokens/#tokenlist) and [tokeninfo](/antara/api/tokens/#tokeninfo) RPC's. + +In our guided tutorial, we have automated functions available to make this simpler. + +* `SEED-MENU` > `TOKENS` > `LIST` +* `SEED-MENU` > `TOKENS` > `INFO` > `GOLD` + +`LIST` calls the tokenlist RPC. This returns an array of token ids. A "token id" is the id of the transaction that created the token. We use this token id nearly every time hereafter when we transact with these tokens. + +`INFO` calls the tokeninfo RPC. This RPC requires the token id of the token we desire to inspect. In our case, we chose the `GOLD` token. + + + +## Create SILVER Tokens + +Repeat the process to create `SILVER` tokens. + +* `SEED-NODE` > `TOKENS` > `CREATE` +* Name: `SILVER` +* Amount: `0.002` +* Description: `Some SILVER tokens` + +Wait for confirmation and then verify that our `0.0993` TUT1 balance is reduced to `0.0971`. + + + +## Create ROCK Tokens + +* `TOKENS` > `CREATE` +* Name: `ROCK` +* Amount: `0.04` +* Description: `Some ROCK Tokens` + +Use the `LIST` function to find the token id for `ROCK`, and then use the `TOKENS` > `ROCK` function to retrieve the token's full information. We see the token id included as a part of the returned data. + + + + + +## Create a Non-Fungible Token + +Switch to the mining node. + +Recall that to create a non-fungible token, we simply use only one satoshi of the coin. + +* `MINING-MENU` > `TOKENS` +* `TOKENS` > `CREATE` +* Name: `NFT1` +* Amount: `0.00000001` +* Description: `First unique token` + +## Compare the Tokens on One Node Against the Other + +Check the balance of the `NFT1` token on both the `SEED` node and the `MINING` node. + +* `TOKENS` > `BALANCE` > `NFT1` + +Note that the balance is different for the two. + + + + + +## Tutorial Series Conclusion + +Thank you for following along on this introductory tutorial. + +We have covered many topics using our guided-tutorial software. + +To learn more about any particular aspect, visit the links below. + +If you are ready to proceed with the next tutorials in our educational series, return to the [Learning Launchpad](/start-here/learning-launchpad/#introduction) section. + +* Create a new Smart Chain + * [Create a Default Smart Chain](/smart-chains/tutorials/create-a-default-smart-chain/#creating-komodo-smart-chains) + * [ac\_name](/antara/setup/antara-customizations/#ac-name) +* Create a coin supply + * [ac\_supply](/antara/setup/antara-customizations/#ac-supply) +* Create and use a faucet + * [Faucet Antara Module](/antara/api/faucet/#introduction) +* Mine transactions + * [setgenerate](/smart-chains/api/generate/#setgenerate) +* Create fungible and non-fungible tokens + * [Tokens Antara Module ](/antara/api/tokens/#introduction) +export const title = "Dilithium Module Tutorial"; +export const description = "Learn how to create a graphical user interface (GUI) for the Dilithium Antara Module."; + +# Dilithium Module Tutorial + +## Introduction + +This tutorial provides a front-end developer all the knowledge necessary to create a graphical user interface (GUI) for the Dilithium Antara Module. The tutorial touches only briefly on the use cases of the Dilithium module. + +This documentation does not discuss the underlying math and principles of quantum-resistant blockchain computing. Please inquire with our team for more details. + +Because quantum computing is not yet realized in the technology industry, Dilithium is listed in the documentation only for display purposes. + +The following tutorial should be considered "Advanced," and we recommend that any user attempting to implement Dilithium skim the [Advanced Tutorial Series](/antara/tutorials/advanced-series-0/#introduction) to obtain a general understanding of the more technical aspects of working with Antara Module technology. + +## Installation + +Please follow the [instructions for installing Komodo software from source.](/smart-chains/setup/installing-from-source/) + +This installs the normal Komodo software. + +#### The MUSIG Test Smart Chain + +In this tutorial we use the test chain `MUSIG` to display the Dilithium Module. + +You may replace the `MUSIG` ticker with the relevant ticker of any Smart Chain in the tutorial `komodo-cli` commands and achieve the same effect. + +To launch the `MUSIG` Smart Chain, enter the command below in the terminal. + +###### Command + +```bash +./komodod -ac_name=MUSIG -ac_supply=100000 -ac_reward=10000000 -ac_cclib=sudoku -ac_cc=2 -addnode=5.9.102.210 -addnode=195.201.20.230 -addnode=195.201.137.5 +``` + +Ensure that the chain is syncing properly by watching the returned values from the [getinfo](/smart-chains/api/control/#getinfo) method. The count of blocks synced should increase. + +#### A Note Regarding the Installation of the Necessary Libraries in the Source Code + +Dilithium is not active on a default Komodo Smart Chain. For the Dilithium Antara Module to function on the `MUSIG` chain, we now add an additional feature to the default installation. + +The user must download an associated C library (also called a cclib module) and include this library in the `src` directory when compiling Komodo from source. (We repeat the compilation process in a moment.) + +{/* For details on how to do this, please see FIXME. */} + +Currently, this Dilithium cclib module is included as a part of the Soduku cclib module. This is a matter of convenience for the developers and testers. + +If a Komodo customer is interested in implementing Dilithium, please inquire with our team. We would be happy to separate Dilithium's cclib module from the Sudoku cclib module, and make Dilithium available in the default Antara Modules. + +#### Stop the Daemon and Install the Appropriate cclib Module + +Stop the `MUSIG` daemon. (If the chain has not finished syncing to the network, that is okay for the moment. We can allow the syncing process to complete later.) + +```bash +./komodo-cli -ac_name=MUSIG stop +``` + +Return to the instructions for compiling Komodo software from source and follow them again until you complete the `./zcutil/build.sh` step, and pause. + +[Instructions for installing Komodo software from source](/smart-chains/setup/installing-from-source/) + +Now execute the following commands. These add the necessary cclib module for Dilithium. + +```bash +cd ~/komodo/src/cc +./makecclib +cp sudokucc.so ../libcc.so +cd ../.. +make +``` + +## Begin Walkthrough + +The Dilithium walkthrough agenda is as follows. + +* Manually create a handle (a handle is a Dilithium address that is human readable) +* Send coins to this handle +* Send coins from this handle +* Show code examples for implementing Dilithium into a user interface (UI) + * A terminal user interface (TUI) with Dilithium functionality can me found [here](https://github.com/KMDLabs/pos64staker/tree/restart/) + +#### Understand the Comparison Between Q Transactions and Z Transactions + +The Dilithium Module's API documentation contains an explanation of the nature of Dilithium transactions. These are called "Q Transactions," and can be compared to the "Z transactions" that are prominently featured in privacy transactions. + +Q Transactions are referenced frequently throughout the tutorial. If necessary, please read the Dilithium Module's API documentation's introduction before continuing. + +[Link to Dilithium Module API Introduction](/antara/api/dilithium/#introduction) + +#### Start the daemon with a `pubkey` and backup its `privkey` + +Initiate komodod with an active [-pubkey](/smart-chains/setup/common-runtime-parameters/#pubkey) launch parameter. + +For instructions on launching with a pubkey, [follow these linked instructions.](/antara/tutorials/understanding-antara-addresses/#creating-and-launching-with-a-pubkey) + +```bash +./komodod -ac_name=MUSIG -ac_supply=100000 -ac_reward=10000000 -ac_cclib=sudoku -ac_cc=2 -addnode=5.9.102.210 -addnode=195.201.20.230 -addnode=195.201.137.5 -pubkey=0377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b +``` + + + If you are using a chain other than MUSIG, and if this chain's launch commands include the [-ac\_pubkey](/antara/setup/antara-customizations/#ac-pubkey) parameter, do not change this ac\_pubkey setting. + + Simply add the -pubkey setting to the launch commands. + + The -pubkey and -ac\_pubkey parameters are entirely separate parameters with different functionality. + + +Once your Smart Chain's daemon finishes loading, check that the `pubkey` is set properly. + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG setpubkey +``` + +###### Response + +```bash +{ + "error": "Can only set pubkey once, to change it you need to restart your daemon.", + "address": "RVXJpc9N4j35psbqmRZzgpKmo98w1CnvHA", + "pubkey": "0377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b" +} +``` + +You should see the correct `pubkey` in the returned json object. + +#### Backup the Private Key to Your Pubkey + +Use the [dumpprivkey](/smart-chains/api/wallet/#dumpprivkey) RPC to export the private key of your pubkey and save this in a safe location. + +Without this private key, any handles created for Dilithium will not be accessible. + +[Link to dumpprivkey RPC](/smart-chains/api/wallet/#dumpprivkey) + +## Create a Dilithium Keypair + +A Dilithium keypair is a matching set of a `pubkey` and `privkey` (private key). + +Use a generated random string to create a keypair. + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib keypair 19 "[%22rand%22]" +``` + + + To understand the need for the `%22` strings in the command, [read this linked CC Lib Formatting documentation.](/smart-chains/api/cclib/#cclib-formatting) + + +###### Response + +```bash +{ + "status": "using random high entropy seed", + "seed": "e580f34e9bdfd23108409e76475c7df3f924d149d494d5cdbc24aeb280237d4a", + "pubkey": "81ac54913ffbe1ce5f7ed5ff3bde2284ea5d4813f422a93e7f9a9e812e19dd6916cb7c2d5446c4635ed6b21d41cfb637534226b51d1298b5880bf7cacce0cea8f7c8d2dc8204bffb7eb163540a231fc2b6db321bf93395e0911f02b30c61e1080c67d555902430166f4eaac0b0eaae63497e976fc86875f1df192a17a180c5ba778ea864a37fc549ef06182bc9d9de06b67428f055df76a9d334f71d3e20352642404aee262c66c1f50aa7e0e4436e8ba2aa2933258e7da6bc28dde2a1ca953c96b9c0dd691665e290abdaabc0b992004a3e6832d89a80523163d48aa020e163d59b5d2be24abe67dca16195b33fe85d3b965db88bc823e96590ab92aa4b320136de92aaa78329da87ec43677abde3c05693985049a22419a719de9c70684d8ed2b5f74719fbfb741c574a12bd983e2d036c26b9d0ad132ca81fa265cea9919fded009ab2447e1f10384998dd199a0803ed2953ca489477a7c96ab4b78aec1ae75aa009f77dd904e440c9696073fb15dbd7d0ae65f53c28c7e1a01e87013e66b53736988be42b07b44082af19d8e9954b24ea8c0e88f33ba5dfe991d1acc4d2ee9b018ef8adf966e351b5c59b7501f7847c61c819efd8fe77cde980a3c2d316476e117eafe93310459325eb3ae80b1044aa9a7b1f29b934159779900d723abd675950bdf8fc8d803aae01e49dc7f716d120911dee86e832b7391db82a5dc4e35d232d918b3cb8a43d8da2f6c6caea42c85e48f2cda5d590f272c1e9f654c6e37403b03095ffefa318a78d3b2094fccf200c3e1b8dc29b58705e0d5608c61c6fa244129287cb00f9da73b9c5a3079b3a06d403eda3b6a162e3040294f06b7ed31ce1365c247cf497a560bfe3aa7d1b7589f9778ec4e321ee445423b2654721d61e36ef89152b6c3a32423f2c755e571a2fe6af296a7567a9823f407f2adb2503a6b7be0d13357e285f675307db6e06eb76e5914e8844a85fae9a845c1a2b5b73a1ccde847780acac512a247e505714b1a2065d96557d444bac6c79ded6ea987123b0209a22186511b8303d1e8a70facacd4fec90b38ff4ef8ab768017914d7f1105a2957ff55bb84593ddf5fdc331f6ecd543b3acbb5a4db355103ed705710bd63646c3913f5d34b23ce29541c10c17d9c2af70d17906a4abd477261e0112503f8bf012efea33d57beec0239a4ec79f9e1ade9fcd5fe0a38ae5fa58de46b298af7260964989a45aa626313d416be8795e2eff1a04e8da09f44986faf31c556d0b116475678cd1da9cd1c8a0f767305db1d4e4ca1637487cf62276ca909c6d7d84fb393c64e3b6681f85e190dca4fc27fa94a4a1248bdb5544dde5ac34546dcd5e47c370ce2f46f32bc5c7b9a82a306f42e6dcc242dfb129ec17723fa6127527fc80ba052cc90fbf21e5028f3d580882ba62445ffc6f505d2e424920ed5afd17170681623660dd180c9a2d99366decc8a92116d45ad9a88442d370b4cd94a9eb4e3db7b6cfdd1cd3b52dce66d1d8f52c167ef10f6cf104ee2fdab965e5776eed2b9e1ef886b0a0fbb6bd6429c910b49672976dc1eea0d48c10de0ae5e3dab6ec51311f0a25428354135ae6accaa31a002746458b3975416abd87ae46ff131abdf3393134ba7c046a05c59fcf246af8919d7608092a5fc6c11e0a30da90786cacef4fe1f156df506b35916bb723c991e4f4feaef0ba8856a99a7c158731f9e09a0714797fbaee34b65ed970692821a1823321162e2cd933d2d00dd75851daa4c4f3efca43f1dcb03350b6ed319273e88a0e16bee534e1b7ed5f2b2a4ea9369312f9d72a15f91e4050c0e36c3022d7065e7078d1fe4699281465abcd9a95a7ebd046c1f8906f26796939335077ae8dcfa6ef38414da9eb00e6a06f2a87f582f530e459737dd2cc17fda6a4081255e7bbff6888c1ac606e2dc28b9865e98d55e2b2be620b24579dd18568b751f9d4eed16a69aac8b0a471ed0f029ab22c2d5e723cb0a916008de0e9854e3bab83fa63cd15df65e093e933a2e0646d42bb1b7d69377e5b9f7e9220d6f041bece11690cbb6b63499e84e3dee3858181e2ee1fd4b36f31d16a0f1f36053d6310ce86570cfc7b7585a0498445fa3688ecee962e8abd608f4b03555700576cdff0c1adba3a8b0019ee478c00f90c828033a046fbd3a73dd84b71c054e8d520bf8796f7e1848bbe6315b37975f804c6a81dcb864654c816be0a6138254408ad670ec52faae1a4d21d8714aa1a5c384b41ae85d24637f9ab5dd97526dccda66a78bba77ce0dde94bf26ebb451689715f852ebb4237c94e361a0e538fbf3a13178adfa26485e0b96e415c2436d20fe8ca9fa4469de427ecb6f8d9e97951a5bcdf89a91d61daee70b1d1e3059c42b64ed2a099af59124ad8c8dfc6f24b9470c2186a03bcbeb8c0416418f68396b25b4b481576f2ec3bfe695ba7d9c77825f8b7e81261730e5f2f5878dc20f2ff265a95f0d0090dd1e9e19c0518", + "privkey": "81ac54913ffbe1ce5f7ed5ff3bde2284ea5d4813f422a93e7f9a9e812e19dd6935a0b972ed823078525bf9ac8a1525f15b446fa627dfbebc9402ac0dc6a9304bf1db44574daaa1fa148e871e6bf3b7ccb7eaf04391382738298a20582144afbef76b861cb183c3ecea0a22cf1ef0c05228458c348d967182c189d3c69d2551a4421555005b055b30465d961e1963f32c16c61c296be54d980d548cd8c4ad8d24ebd0964ea9b8769d88534d845c354726d4a1d008a5254297e1605191b6c85cb199254dd694463575b7c253bdb0f520a1a4548821165b5444d8698dc5226acbc622595d96448db8860c1c561dc7a866d231eb5c0aaaa572ac389665c2098b863696d75011344d1c95613218ca92b8a90a62978959796aac32296d45f40c8c355b0a11a020ac33948893290b358065176eadbc4d18c10ddad4d1159c968b843905081740417945c18c21b041f2b06e09ab02984b44aeada89606c616d74a2657220ebb5a13572b8342aa093908aa2ac375a9702b8589e25a591b912e33a91a28378d2a3783c5d45683069aeb32a7e3dad1de088125ad4d2044501bc3c1c3a4cccc6ac0980254885a219093345387a5466b4c245489091200915023e13807e82c4aca3c90e51038a22dcaac196fcc56a26466395cb00c25ad81d8b82d05378a653355e016b7ad17af68c5a126dbc28b41978b694d0e1d241b525705dacc1d3ca71b83495b5c270b56af66aa05a9143596bc41616d058ba96d90daa5494c380920d5e5e29414897418e7cc16b4709a5d708cb9166638391e85520458b053b99158826a96ac228e508c539d98684b5505b3c6b1e83a00c8ce52052e8d0ad9341172aad1908440cf2826cd23604a72b5389e12259092985442b20a559b22c10d8ae26401498ee6a80a738438a4418b5d844dce20ba09323528d676493ac5668cb8a0eba261d1da1a4bda43ed948d5466b348d951cdd48a1a364aed862365b80e1a34719652e9127963456c22906deae80a9be751194a1264acc96a057934d3b61a44b7e5ca998494b195ad7adbea02313a0f0aab0d66588775d791882d6c31108ee2c60484c4124c082ea3c9998c1a7a5dc5922991ba1082816048909a5b2c0dcab55a444f0a02804eab71ea68234d9cc1b2652e984d21e8160a88608463b3da5b37a22109c0a1a2b9434c0a251d6f76168e300d571e8335569c549562c3694b460b625b9361570acd0c0500c40c26785d104c0c2c579090854b57d14d474e80096331e79455e69242e766198999f0a819c2540d108791cbd8ac5ae3145a20494e19448cba09681573d6d41856074b145b8618621640ad9914c52c9db32adb3c651939c26231d46b083760846d44d7298e4d781b3c67ca682c3006aca562738e87805b092e12d7245453168d408701cd320332152c2576b38964ea56a1d69848348db0069996eb582decd4881b12012d06599c94cc532c7a0aad11999c84abc5768206a94b0c86aca206c49c71a4a0d472a60ce84cd606419bf0b2d484aa54a0cac8705cd628bb68aac770141d571653810ea3c910190d1853a94117776cad5a058c96ee9431f6b8626aed64e2808a1222d9093a011415d39bc0704c6d4910477a096ab6969275b26c0da5246462478c68b97094349976f2149fc4154445f8c9ae9ce52887450833ea4e2b7c02339c1718f96da4d5ffcfd41a89084d5f8ffe6bfbbbeb8429473ce7fbc8cbe7a5bb2a8c8a9f0cfcb9cbd13b5285ed3413f1efe728a07f7f11ab5a9e739d985e3f19ab6344b4e5dd5f017c9252bcbf72e796ed430d521997a28b7051e68256cd438536b2ef747c60b2ee5f63efce8ce273d5d205c0f416b0059a4128d6e8413beef62aca7a21d268902a5238e22a5d15e10bc06f9ba985133ed713c4820d47b63c63e56021f0e0e6962cbc9fef454e3be93eb8646be713ea6447190a9139f9d6063cebfb87b777f01dfa206384c89603a6888c2e0a33de812c8ab6a0dff5647ac01530946497b9fef05dea6ebbae7b63031b88f95d986d709aee6587d0e13ff1678060863f97aae89ecad0f68634e0b65a0189186554a7d1438cb523c38c5af68e3a6531cfcaaca6637ad6e96f4e7c2fadabf057b32ffb9d7f8144facb19804b16b60e09e3bffb418ec2a60bc629f18596f43c6f88fd92777ddf7105be55e58e86e86b07439bce82adba20b6ae0430093793647500428b24828443b9e400c375252734b9518eda23e80bc05df16d905a5c68824b3c5306c3df85ba8906f3c8f789a1ea1f18e7bb8d65c304199399cb98a1664e4a93d788c5f21d301e815328336701beff0f5ad1500406574c7a70cb192e8f220ee2674b142a48213c7a9f72fc9c3419b090f3b256e2879deba5303d2cfa0e64e63a117d70a62eb5d6948bed567eca87a14e44de2c9a911bd19bb2ddff21d4492176c432724e1cb439b26d8877256888c346684f8f871255e61dd74ed3edfce45ec6d7fbb8e005127699e5733d5131f546a176204f980289763c8c527f8f5fd6c4d63eab7e61c84c23d99471bddf6c2cebba5a35c6fe0084a4a562391e5b1c395211b6db700c8da0fba8a61183fdb2f6d535bec64c712b67ce1f8338749a89b44c1bfffe310ecb87af2ca20dee5e0f18e07661b50909bc5ef5bf9d7b3ef0f1173f02fda819fb98993a9ce6a219c772fb1282216f3c81c9cb96f05b770497d6486dcf710b9e40b4b5d84dc2f8490357b3e4fffe80647e0c937c2fb790aa5d4c9bb0d8080c80e24ee384cc5c00954533225eae288369837fa68f3eca289bc51533992f718658c8dbfa48f3bc15f3eb165669fae22c15a3acec1e4ea99aa0a7192dc3697a9f24259351b290c53a32e336e85de760f6793c5c2a6dc2c7944033e9b41b841eb85ae4ae1c76376aa0e901b6cfeb3acaef197f1fb52aa765237acf4b89ff2c09e5e266185427f95a4285c164c3cf20065da2d34d645305565aeabe78502c0812b37b45eb7217ab3fa262f820209d3e1236f7fde74789275d418d90dc011b4a7de983c05822eb43525a38fa36996184027f7121306b381970ea17f72003687353b705f433774b8c1a0a8c5e0526d81a5c3086af3f70060326e0b0627187af84b1f1229c14fd6417e21b2144de6c844359dcaacf6d62dc9e55c423e4147588c347a3cb8a3feabecd39d14011b99fbafdf055014bc264f7483258290370edbd1c2b12577ddbe9486ace97ab93f76a426e7513ce5bb9644a73a95345ac9ccee7fa69d58480f4f636b2d5dabd7acfa2f615b0a9c26a7f4a5020cbd0dad0e4b46561742eba424e687b897104566a3898f6fc2d6d82f0b41feff32ed06847753757a56acdaef5e111b56cee649797e207e02789a2698a4be89567ec9eee54234ab7c8bf9c5da498c00eb91e9f04c5d63dbae096933655c48b74b7111b49f8ddb21860f5addef04657d42748d854801c159c21e4ac177d38e1a9732a1b03863afecb1b01ada6d158b5c01ff01dfb54fcceec9a2fbcc7957f2155a68ff21710f881a38122e1d4c66aa8c9668169efa0b0af314a6fd069a9290cb03a5914226af59e0f8161c762f8ea0adaf7126ba86966f55ad472cb3dbb888f96bf9b4cff9d0b293ff70621e4ae18f94d988c7b49a451541936c7a628968670d032279bb75afd3f26d02c8a7e0a72e220be6ba76685ff5fbc63bc690626bf31d4beb9a17b4c7702c6c2e8e0f4c7ead9dc97fd641a4e7a94a50b4dcf4b0a0a934077d63a43849aba2e66a95d03467f075a40fb9d36aaec2589a25d34e9ea338dfcc2a21d6d69a380638b0a8f302a98b02eec3de9ff4cb0f51b3b3d021f178d6ca3f8d9dbe3669618ad545fd4246c5118ad0264d240615c01b26505d0c67a78cca9f4d34ae57b1b54e581dd97b31bfe2415d466ef1445ac11ca3e94a276b8735cfc5b1a8b806cb157607f0800c258dcfb80d913b86b1ebd18ee72cf687d41a40995b0955e0761cbb5d8ec3192fbf841056e3909152718cace05d8cbc7ae4aebb7f156935b18c86e8b36ff8a60fc75f133bb5166ecf31511c3a3485f15f8cb8484cdf34777e8ffc2b630d9dce678d3818bbf28e77202bddfa3795c01ee27bab59b033e16d9642b2b6bef91de85f3a10ad4a45123f169f636d3cd0063cb3c656d613463a940f6432ef193f465aa01304e9d44ae9ac74b1da50e62a9b04b81539ea1aa24ce9aa371b0f8cfb86ffa53f485a75508f5fa2e6d077f406d9a1772dddbf4fa8bf2049abd6edfbf91ce6b03953480378474b538de11d5fc5d06fb4357d13687dc2290ea5eb84c4c05f556f2b70580e80d01a49a3865673d8c113639870298c8eb4327319d1005311b98e5da34e8fe6724aec3a634889e60fa4588ce03afdbf0a7e3299aee802edfd25f63ec83b21b82e59e4d536e81b25c1365bc8c863cedfc06c36e1200fecb03695c6f9070009edd48f9ebc59cd9ef4ef407ce2223ac7909281b5805e7b09a7ab64b5f6175cc4a221b125c9492ae8e15f8b85de88418c3f865c6af8804ea25b841241e3b4ba4bb2294e98e5a39227d1ea8ad742b9cc02ee9c9f9ffa5686cffa6e23ab22df7b2155ca48254dabaf3e1fca0e5ae9b511cb62fcf0e44d81e4c2ee97f12266e94835ee9da9f29f8d44c39fc4bce820d38b25f8c96478085f8d397566ea6704a51cda1021f1b23a2c7d005180ee7f5cca7b5b283dbf2087bfd30cd114617aacb38dc839306668aad026e50e6a4a73f80975e741be80e22ab8b624e3e77796a6d1b60d9b54ca712bd28bff14540fa73e1c9c0597cc65c35eff3413d917a5058695238dc1d2bcadad850dff0367ebea1525d87c3f7e5afce83b1852d048dd6a07876d472666f750e4d465fcc3eb700e293c50a1ccaf6536ed6fd617e997ab189da03ebb41f890a2ee26dd705b6108272499c6d48285522ab91b3e96fb4abb0e58f734a0f252af8484ab1a40e0523cb44d883e1fd9bd5d2af4e97c53a461682178b40238290b5a6737a228829a1308c3e5a0c311bf2e086e94ce6bbbd6c34b70ec96e4597f208956fd32e2e1fa70aa6d31139f9e4b830d7fe9d08707593bcf356ef036446483957c29349ffd382e290255a3318ccd94e6359087637abf0b8fd070fdbcf6baf151966a7d1dc9bb5e19623fd30e6ff5a8bfb48ebe5d53c2521bae51c15a408be0fd1e617ceebfb01fc0c74647d0f025fd4171abb5e8bfbc9307d39bc8123b8a9c42d4375b65cd4de271bd2cfa67a9bee370c2d8e985adf35e45fa729828747d7714044edca47326d762aef6d36b61f4412e1b12b3fbe5b10c781d8f3d794f9d711ec2da4efa5032d8fd9900753ab15dd8b9864b0f2e099b0eff791149ea86794eafa87b91c5411faa2f195bdd7dcc59dcbae26815962ad3093e16d185ad0e51585f369d084c0d88d50741d2f6059bd55e3f61df367f38805fd2f4cc136946c6203cc7cb7f8fd7fedca7cc6", + "pkaddr": "PMrTr4qgErBbDkwxuSdfRNXkrSMoxbhb2R", + "skaddr": "ScrFviWo9jaJdi7EHz3w2tX1xhvHR8e9Kb", + "result": "success" +} +``` + +| Response Key | Value Description | +| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| status | states that we are using an automated random seed generator | +| seed | this randomly generated seed is the base value on which many private keys can be generated, including the private key below; this seed is sensitive information and should be stored in a safe and secret location | +| privkey | the private key (privkey) is also sensitive information; this privkey is the basis for the pubkey below | +| pubkey | the public key that receives funds; this public key will later be associated with a handle | +| pkaddr | a hashed representation of the Dilithium pubkey and privkey; this value is not necessary for Dilithium functionality, but rather is included as an easy method to compare Dilithium pubkeys and privkeys | +| skaddr | a hashed representation of the Dilithium pubkey and privkey; this value is not necessary for Dilithium functionality, but rather is included as an easy method to compare Dilithium pubkeys and privkeys | +| result | whether the command executed successfully | + +Save the `seed` value in a safe and secret location. Optimally, you may save the response as well. + +#### Check For Handle Availability + +Use the [handleinfo](/antara/api/dilithium/#handleinfo) RPC to check for handle availability. + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib handleinfo 19 "[%22KomodoHaxor%22]" +``` + +###### Response + +```bash +{ + "result": "success", + "handle": "KomodoHaxor", + "status": "available" +} +``` + +#### Register an Available Handle + +Use the `seed` to register the handle. + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib register 19 "[%22KomodoHaxor%22,%22e580f34e9bdfd23108409e76475c7df3f924d149d494d5cdbc24aeb280237d4a%22]" +``` + +###### Response + + + ```bash + { + "handle": "KomodoHaxor", + "pkaddr": "PMrTr4qgErBbDkwxuSdfRNXkrSMoxbhb2R", + "skaddr": "ScrFviWo9jaJdi7EHz3w2tX1xhvHR8e9Kb", + "hex": "0400008085202f890273ccc419787826042c7c7d667325c5222d2d9d4fab1c142264aed0299063ad0a000000007b4c79a276a072a26ba067a565802102f1c7993a9bf3863c77853315af7e37c12008ea1c5c3d8722c91bc3b5a01965268140ea59eb26a237141c38dfdafc61d50acdbdd3a8d33aaae303908aa613422cf7712de50ba7e4070334044789081a71604e671900cc7f0260be3e9a2a09d1f4842aa100af03800113a10001ffffffff0442dedd2673eb3f4cc151b1d9945f3ccc0023ba7422e9f4b6eff1ecca2cf39b010000006a47304402206d9eb56d476364409e2c3a12dcaadcaab0f9b3080cdb5bdcc09601b8b7683019022025bc2db845cdc716f9459d0f32d60e5103c3bb78267ed763733adffaa4d3c46401210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3bffffffff06204e000000000000302ea22c8020979f9b424db4e028cdba433622c6cd17b9193763e68b4572cd7f3727dcd335978103120c008203000401cc1027000000000000302ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc00e1f50500000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc1027000000000000302ea22c8020979f9b424db4e028cdba433622c6cd17b9193763e68b4572cd7f3727dcd335978103120c008203000401ccd08d154e0200000023210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3bac0000000000000000fd17076a4d130713520b4b6f6d6f646f4861786f72210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3bfde00681ac54913ffbe1ce5f7ed5ff3bde2284ea5d4813f422a93e7f9a9e812e19dd6916cb7c2d5446c4635ed6b21d41cfb637534226b51d1298b5880bf7cacce0cea8f7c8d2dc8204bffb7eb163540a231fc2b6db321bf93395e0911f02b30c61e1080c67d555902430166f4eaac0b0eaae63497e976fc86875f1df192a17a180c5ba778ea864a37fc549ef06182bc9d9de06b67428f055df76a9d334f71d3e20352642404aee262c66c1f50aa7e0e4436e8ba2aa2933258e7da6bc28dde2a1ca953c96b9c0dd691665e290abdaabc0b992004a3e6832d89a80523163d48aa020e163d59b5d2be24abe67dca16195b33fe85d3b965db88bc823e96590ab92aa4b320136de92aaa78329da87ec43677abde3c05693985049a22419a719de9c70684d8ed2b5f74719fbfb741c574a12bd983e2d036c26b9d0ad132ca81fa265cea9919fded009ab2447e1f10384998dd199a0803ed2953ca489477a7c96ab4b78aec1ae75aa009f77dd904e440c9696073fb15dbd7d0ae65f53c28c7e1a01e87013e66b53736988be42b07b44082af19d8e9954b24ea8c0e88f33ba5dfe991d1acc4d2ee9b018ef8adf966e351b5c59b7501f7847c61c819efd8fe77cde980a3c2d316476e117eafe93310459325eb3ae80b1044aa9a7b1f29b934159779900d723abd675950bdf8fc8d803aae01e49dc7f716d120911dee86e832b7391db82a5dc4e35d232d918b3cb8a43d8da2f6c6caea42c85e48f2cda5d590f272c1e9f654c6e37403b03095ffefa318a78d3b2094fccf200c3e1b8dc29b58705e0d5608c61c6fa244129287cb00f9da73b9c5a3079b3a06d403eda3b6a162e3040294f06b7ed31ce1365c247cf497a560bfe3aa7d1b7589f9778ec4e321ee445423b2654721d61e36ef89152b6c3a32423f2c755e571a2fe6af296a7567a9823f407f2adb2503a6b7be0d13357e285f675307db6e06eb76e5914e8844a85fae9a845c1a2b5b73a1ccde847780acac512a247e505714b1a2065d96557d444bac6c79ded6ea987123b0209a22186511b8303d1e8a70facacd4fec90b38ff4ef8ab768017914d7f1105a2957ff55bb84593ddf5fdc331f6ecd543b3acbb5a4db355103ed705710bd63646c3913f5d34b23ce29541c10c17d9c2af70d17906a4abd477261e0112503f8bf012efea33d57beec0239a4ec79f9e1ade9fcd5fe0a38ae5fa58de46b298af7260964989a45aa626313d416be8795e2eff1a04e8da09f44986faf31c556d0b116475678cd1da9cd1c8a0f767305db1d4e4ca1637487cf62276ca909c6d7d84fb393c64e3b6681f85e190dca4fc27fa94a4a1248bdb5544dde5ac34546dcd5e47c370ce2f46f32bc5c7b9a82a306f42e6dcc242dfb129ec17723fa6127527fc80ba052cc90fbf21e5028f3d580882ba62445ffc6f505d2e424920ed5afd17170681623660dd180c9a2d99366decc8a92116d45ad9a88442d370b4cd94a9eb4e3db7b6cfdd1cd3b52dce66d1d8f52c167ef10f6cf104ee2fdab965e5776eed2b9e1ef886b0a0fbb6bd6429c910b49672976dc1eea0d48c10de0ae5e3dab6ec51311f0a25428354135ae6accaa31a002746458b3975416abd87ae46ff131abdf3393134ba7c046a05c59fcf246af8919d7608092a5fc6c11e0a30da90786cacef4fe1f156df506b35916bb723c991e4f4feaef0ba8856a99a7c158731f9e09a0714797fbaee34b65ed970692821a1823321162e2cd933d2d00dd75851daa4c4f3efca43f1dcb03350b6ed319273e88a0e16bee534e1b7ed5f2b2a4ea9369312f9d72a15f91e4050c0e36c3022d7065e7078d1fe4699281465abcd9a95a7ebd046c1f8906f26796939335077ae8dcfa6ef38414da9eb00e6a06f2a87f582f530e459737dd2cc17fda6a4081255e7bbff6888c1ac606e2dc28b9865e98d55e2b2be620b24579dd18568b751f9d4eed16a69aac8b0a471ed0f029ab22c2d5e723cb0a916008de0e9854e3bab83fa63cd15df65e093e933a2e0646d42bb1b7d69377e5b9f7e9220d6f041bece11690cbb6b63499e84e3dee3858181e2ee1fd4b36f31d16a0f1f36053d6310ce86570cfc7b7585a0498445fa3688ecee962e8abd608f4b03555700576cdff0c1adba3a8b0019ee478c00f90c828033a046fbd3a73dd84b71c054e8d520bf8796f7e1848bbe6315b37975f804c6a81dcb864654c816be0a6138254408ad670ec52faae1a4d21d8714aa1a5c384b41ae85d24637f9ab5dd97526dccda66a78bba77ce0dde94bf26ebb451689715f852ebb4237c94e361a0e538fbf3a13178adfa26485e0b96e415c2436d20fe8ca9fa4469de427ecb6f8d9e97951a5bcdf89a91d61daee70b1d1e3059c42b64ed2a099af59124ad8c8dfc6f24b9470c2186a03bcbeb8c0416418f68396b25b4b481576f2ec3bfe695ba7d9c77825f8b7e81261730e5f2f5878dc20f2ff265a95f0d0090dd1e9e19c0518000000008d6c00000000000000000000000000", + "txid": "d60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f230940", + "result": "success" + } + ``` + + +The returned `hex` value is a signed raw transaction and must be broadcast using [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction). + +###### Broadcast the Raw Transaction + +```bash +./komodo-cli -ac_name=MUSIG sendrawtransaction 0400008085202f890273ccc419787826042c7c7d667325c5222d2d9d4fab1c142264aed0299063ad0a000000007b4c79a276a072a26ba067a565802102f1c7993a9bf3863c77853315af7e37c12008ea1c5c3d8722c91bc3b5a01965268140ea59eb26a237141c38dfdafc61d50acdbdd3a8d33aaae303908aa613422cf7712de50ba7e4070334044789081a71604e671900cc7f0260be3e9a2a09d1f4842aa100af03800113a10001ffffffff0442dedd2673eb3f4cc151b1d9945f3ccc0023ba7422e9f4b6eff1ecca2cf39b010000006a47304402206d9eb56d476364409e2c3a12dcaadcaab0f9b3080cdb5bdcc09601b8b7683019022025bc2db845cdc716f9459d0f32d60e5103c3bb78267ed763733adffaa4d3c46401210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3bffffffff06204e000000000000302ea22c8020979f9b424db4e028cdba433622c6cd17b9193763e68b4572cd7f3727dcd335978103120c008203000401cc1027000000000000302ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc00e1f50500000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc1027000000000000302ea22c8020979f9b424db4e028cdba433622c6cd17b9193763e68b4572cd7f3727dcd335978103120c008203000401ccd08d154e0200000023210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3bac0000000000000000fd17076a4d130713520b4b6f6d6f646f4861786f72210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3bfde00681ac54913ffbe1ce5f7ed5ff3bde2284ea5d4813f422a93e7f9a9e812e19dd6916cb7c2d5446c4635ed6b21d41cfb637534226b51d1298b5880bf7cacce0cea8f7c8d2dc8204bffb7eb163540a231fc2b6db321bf93395e0911f02b30c61e1080c67d555902430166f4eaac0b0eaae63497e976fc86875f1df192a17a180c5ba778ea864a37fc549ef06182bc9d9de06b67428f055df76a9d334f71d3e20352642404aee262c66c1f50aa7e0e4436e8ba2aa2933258e7da6bc28dde2a1ca953c96b9c0dd691665e290abdaabc0b992004a3e6832d89a80523163d48aa020e163d59b5d2be24abe67dca16195b33fe85d3b965db88bc823e96590ab92aa4b320136de92aaa78329da87ec43677abde3c05693985049a22419a719de9c70684d8ed2b5f74719fbfb741c574a12bd983e2d036c26b9d0ad132ca81fa265cea9919fded009ab2447e1f10384998dd199a0803ed2953ca489477a7c96ab4b78aec1ae75aa009f77dd904e440c9696073fb15dbd7d0ae65f53c28c7e1a01e87013e66b53736988be42b07b44082af19d8e9954b24ea8c0e88f33ba5dfe991d1acc4d2ee9b018ef8adf966e351b5c59b7501f7847c61c819efd8fe77cde980a3c2d316476e117eafe93310459325eb3ae80b1044aa9a7b1f29b934159779900d723abd675950bdf8fc8d803aae01e49dc7f716d120911dee86e832b7391db82a5dc4e35d232d918b3cb8a43d8da2f6c6caea42c85e48f2cda5d590f272c1e9f654c6e37403b03095ffefa318a78d3b2094fccf200c3e1b8dc29b58705e0d5608c61c6fa244129287cb00f9da73b9c5a3079b3a06d403eda3b6a162e3040294f06b7ed31ce1365c247cf497a560bfe3aa7d1b7589f9778ec4e321ee445423b2654721d61e36ef89152b6c3a32423f2c755e571a2fe6af296a7567a9823f407f2adb2503a6b7be0d13357e285f675307db6e06eb76e5914e8844a85fae9a845c1a2b5b73a1ccde847780acac512a247e505714b1a2065d96557d444bac6c79ded6ea987123b0209a22186511b8303d1e8a70facacd4fec90b38ff4ef8ab768017914d7f1105a2957ff55bb84593ddf5fdc331f6ecd543b3acbb5a4db355103ed705710bd63646c3913f5d34b23ce29541c10c17d9c2af70d17906a4abd477261e0112503f8bf012efea33d57beec0239a4ec79f9e1ade9fcd5fe0a38ae5fa58de46b298af7260964989a45aa626313d416be8795e2eff1a04e8da09f44986faf31c556d0b116475678cd1da9cd1c8a0f767305db1d4e4ca1637487cf62276ca909c6d7d84fb393c64e3b6681f85e190dca4fc27fa94a4a1248bdb5544dde5ac34546dcd5e47c370ce2f46f32bc5c7b9a82a306f42e6dcc242dfb129ec17723fa6127527fc80ba052cc90fbf21e5028f3d580882ba62445ffc6f505d2e424920ed5afd17170681623660dd180c9a2d99366decc8a92116d45ad9a88442d370b4cd94a9eb4e3db7b6cfdd1cd3b52dce66d1d8f52c167ef10f6cf104ee2fdab965e5776eed2b9e1ef886b0a0fbb6bd6429c910b49672976dc1eea0d48c10de0ae5e3dab6ec51311f0a25428354135ae6accaa31a002746458b3975416abd87ae46ff131abdf3393134ba7c046a05c59fcf246af8919d7608092a5fc6c11e0a30da90786cacef4fe1f156df506b35916bb723c991e4f4feaef0ba8856a99a7c158731f9e09a0714797fbaee34b65ed970692821a1823321162e2cd933d2d00dd75851daa4c4f3efca43f1dcb03350b6ed319273e88a0e16bee534e1b7ed5f2b2a4ea9369312f9d72a15f91e4050c0e36c3022d7065e7078d1fe4699281465abcd9a95a7ebd046c1f8906f26796939335077ae8dcfa6ef38414da9eb00e6a06f2a87f582f530e459737dd2cc17fda6a4081255e7bbff6888c1ac606e2dc28b9865e98d55e2b2be620b24579dd18568b751f9d4eed16a69aac8b0a471ed0f029ab22c2d5e723cb0a916008de0e9854e3bab83fa63cd15df65e093e933a2e0646d42bb1b7d69377e5b9f7e9220d6f041bece11690cbb6b63499e84e3dee3858181e2ee1fd4b36f31d16a0f1f36053d6310ce86570cfc7b7585a0498445fa3688ecee962e8abd608f4b03555700576cdff0c1adba3a8b0019ee478c00f90c828033a046fbd3a73dd84b71c054e8d520bf8796f7e1848bbe6315b37975f804c6a81dcb864654c816be0a6138254408ad670ec52faae1a4d21d8714aa1a5c384b41ae85d24637f9ab5dd97526dccda66a78bba77ce0dde94bf26ebb451689715f852ebb4237c94e361a0e538fbf3a13178adfa26485e0b96e415c2436d20fe8ca9fa4469de427ecb6f8d9e97951a5bcdf89a91d61daee70b1d1e3059c42b64ed2a099af59124ad8c8dfc6f24b9470c2186a03bcbeb8c0416418f68396b25b4b481576f2ec3bfe695ba7d9c77825f8b7e81261730e5f2f5878dc20f2ff265a95f0d0090dd1e9e19c0518000000008d6c00000000000000000000000000 +``` + +###### Response + + + ```bash + d60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f230940 + ``` + + +Execute the handleinfo RPC again to check that we have successfully registered the handle. + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib handleinfo 19 "[%22KomodoHaxor%22]" +``` + +###### Response + +```bash +{ + "result": "success", + "handle": "KomodoHaxor", + "destpubtxid": "d60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f230940", + "pkaddr": "PMrTr4qgErBbDkwxuSdfRNXkrSMoxbhb2R", + "pubkey": "0377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b" +} +``` + + + The destpubtxid value above can be thought of as the Dilithium address. + + The handle and pubkey used to create the destpubtxid are now tied to the Dilithium pkaddr public key, `PMrTr4qgErBbDkwxuSdfRNXkrSMoxbhb2R`. + + This pkaddr keypair can be changed later. + + However, the pubkey associated with the handle cannot be changed. + + +#### Send Coins to the Handle + +Use the Dilithium [send](/antara/api/dilithium/#send) RPC to send coins from a `t` address to our new `q` address. + +The paramters for this RPC are `handle`, `destpubtxid`, and `amount`. + +###### Response + +```bash +./komodo-cli -ac_name=MUSIG cclib send 19 "[%22KomodoHaxor%22,%22d60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f230940%22,7.77]" +``` + +###### Response + + + ```bash + { + "handle": "KomodoHaxor", + "hex": "0400008085202f89014009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd604000000494830450221008e7c4905498d2cf1597e044dbc79a489ce48c81c5ca421b98e84f4158d876b1c022024901a2862245685fe16ab865a49c9ea939bfed7ea5a9a71d7ac12f84d42be9501ffffffff034014502e00000000302ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc8052c51f0200000023210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3bac0000000000000000246a2213784009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd600000000936c00000000000000000000000000", + "txid": "c314304cecded6cd593daeddf676b2a8c424a604f973e68e6777b84e39ef8548", + "result": "success" + } + ``` + + +###### Broadcast the Returned Hex Value + +```bash +./komodo-cli -ac_name=MUSIG sendrawtransaction 0400008085202f89014009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd604000000494830450221008e7c4905498d2cf1597e044dbc79a489ce48c81c5ca421b98e84f4158d876b1c022024901a2862245685fe16ab865a49c9ea939bfed7ea5a9a71d7ac12f84d42be9501ffffffff034014502e00000000302ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc8052c51f0200000023210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3bac0000000000000000246a2213784009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd600000000936c00000000000000000000000000 +``` + +###### Response + +```bash +c314304cecded6cd593daeddf676b2a8c424a604f973e68e6777b84e39ef8548 +``` + +Our handle, `KomodoHaxor`, has 7.77 coins. + +## Send Coins From One Handle to Another + +You can specify outputs of a Qsend transaction in two ways. + +* the `ScriptPubKey` for a given normal address + * this can also be called an "R address", as all Komodo base58 encoded addresses begin with R +* the `destpubtxid` for a given Dilithium handle + +In this tutorial we send `0.1` coins to the handle `KomodoFan`. + +Assume this handle already exists. + +Because we are sending coins from one Q handle to another, this is a `q` -> `q` transaction, and therefore we use the Qsend RPC + +##### Obtain the destpubtxid From the KomodoFan Handle + +To send funds to the `KomodoFan` handle, we first need the `destpubtxid` associated with this handle. + +Use the handleinfo RPC to this effect. + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclib handleinfo 19 "[%22KomodoFan%22]" +``` + +###### Response + +```bash +{ + "result": "success", + "handle": "KomodoFan", + "destpubtxid": "af710c0fd6aeb54556ee401803bc4cc39ea9002ad5228f308b27eb3af0e4c4b6", + "pkaddr": "PRZniLRiLY5Laoqbg7CjQSktX34x99jdCp", + "pubkey": "03cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61" +} +``` + +##### The Meaning of qUTXO + +In the next step, we encounter the term "qUTXO" or "qutxo" for simplicity. + +A "qutxo" is a utxo that is related to the Dilithium Module. + +For more general information about utxos, please [read the Core Technology Disucssion section here.](/start-here/core-technology-discussions/miscellaneous/#the-utxo-an-elusive-yet-fundamental-concept) + +##### Send Funds Using Qsend + +The first two arguments for the Qsend RPC are the `destpubtxid` and `seed` values of the `handle` that is sending coins. We refer to this `destpubtxid` value as `mypubtxid` in the following examples, for simplicity's sake. + +The remaining arguments in the Qsend RPC specify each output of the transaction. The inputs are chosen automatically. + +The module also automatically creates a Dilithium "change" output from a qutxo. (Recall that "change" is the amount leftover from a utxo that must be returned to the sender.) In the Dilithium module, change is sent to the `"mypubtxid"` address. + +```bash +./komodo-cli -ac_name=MUSIG cclib Qsend 19 "[%22d60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f230940%22,%22e580f34e9bdfd23108409e76475c7df3f924d149d494d5cdbc24aeb280237d4a%22,%22af710c0fd6aeb54556ee401803bc4cc39ea9002ad5228f308b27eb3af0e4c4b6%22,0.1]" +``` + + + ```bash + { + "hex": "0400008085202f89014885ef394eb877678ee673f904a624c4a8b276f6ddae3d59cdd6deec4c3014c3000000007b4c79a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b814057c2e1283008cc9a3b140705c1550be6f691d79cadcb422714b62038ebd1b9682a124ac45c939653c66f83f0ac919deadb390b07964dade6d3b904bcbe27d339a100af03800113a10001ffffffff038096980000000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401ccb056b72d00000000302ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc0000000000000000fdb00d6a4dac0d13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460d27a46ee2b83f54a05dede8982e0b65247365b108e42493ddc6cedb0ad0b73c109451aecdbb5adbfbf887f078bc6f66ef9a323abf440535248e2851ccdcdb732678a10e34a5c01127696d220057227b8b078a99c31b8c51c3695c62ca82630aaba41653d4a3743044056365797ad6fed6ef1aee88e0f7e3a56b6aba07cea2e9f7890808b27f4bb825b3050f2ca526002edac45d5c7b0db51e01d203b25578d311a268766f51f3c9dcf93818f5f7c3b2df5aa66c43bcb5f4f460a1cf17fe8b201459fd6a2aed7c5a368b1ffb13ef407053b9314cdef3012e6a38d12ff43fbd7771eeceb59f0cc37d7614efbf2c3decb515e7dc7b7f7a80d8406a85c7ca088127af72a83577303275ac6a8d3d261780c3e7c4f6419809bd73e90427d89aa51477eda1c4089e6dc9f40e7aa4b22d4ac3156f4ab0d13ea589cf56507177eeac1f33830e67fd359e788e9015b8d7cca0ba6fb4d60c2d6171975965db54e94296d853d495fa3139b8638c7c7758f515e78c598a27996ae86378eff6269aa202660b7194b4784b185a5b9116b837c480d9f2c09c15f663f99d4d9464a94817f9a13e906675a979ba4f08d321a83dbbc849e243db47e903d575b5bbf693ca81ebd2f31edb09b206861dc9a4979214ce0db48c3e1254fbfd3cbc1e23ce715da0070e6126af21bdad5d54d5c7ac6f4a70877b090c9103891726797e3cdf79080eac27875aeacf5c58a3c656f6514951e201ffe97a83fec4ee0ed1b0c19b4ea86f1ffd1461003ad48e783a6e4a4bd8372171e3a8363f92aa800fa0667ce0d0802293996e318e42259d1ca30d219048e09a0ac7ee3bda103d02c9d8b5379b10a226fa4169a51a366a4b8e2c42cb55df56a55cdad844400d64daa3be042b893485010611410fa19b7e4b28d35f2a9a44505dd4b105b92612c7e65b659a18e2459d53749f0d2a08c252978f39526311fcbc13b22c816ca4ab8ea9370161aecda22d6080ab1b0e58ef67740d2ae951ef562ae90652a9260dfa68d40e93796ca1e00d1ea63d45e9e9c384b2c0c7f847c94586ddda9939553574a373d2dd8f309b39b3af5d2962e16d132959b229d590ddc79f0a292db2180712b54a74246cf428d1b1772a89346b824822b0f76290d4d32bc55607ad77b1184fdf16ee23039abf2f64e567e5e9fe97193245562284638290a5b024f170b05dcb9db843350e8c757998f003122f89207e72ada0cefe02d7e42d5aecc9044eee13de5f4282c935f2bfbc8f1e987e01cd5030c39588bcd9d4dd064a9b7e1dbab5914ff1204f2321c4d6e438496f86dc1b5b9556c75fbf3155025679c4f8ad9bc784ea58c8ace5674fc69662da2a76e10d030d3e0af2909dffa005889f01a465bfdd8944cdf4a08432377c9c751f150a430b60a665e8351ca1d708dd7be9637dd0d4deb9c1e402b15c05ffee8a1fc6fe750d5a9f49f8bb13321b30c3d14f859a322595f19800f1da8c84a5a9c036de27b014f8a070d2f2b173c33cf3cc62f799d37f125055446d9d156999e267a2a9299fb95feb99e3da76285580597374c90ac51a858933a85450716842ab56d5fb9e8dd748b04e190b18111de7d9622462fde10a1a524ca886e4f1f7a3ee2cdb590b500033da27dddc5f1879b5031cd7347469a58f0401b600f71c6b59bf9feedd9be50e76b6e7bd69247e0d1ffb75d8099ccfbae3cd86db81b8845ec37f812918bb2f61d1e92fc488ea1e8a2fac18062b8877a8833b4d1823d23792faba5ce210df7cf5b433082b9844de3bbe9552422edd0f07973ee8219512a4050834eedc1be50962565a5d4b7d5b7d05fff4b9144439b3f1d7f5c0930127a418b3298f220737a6232b06042f8058aa9805396feae77e1024c950e4f7b8ba91dcff086e28fd3bfbc0e29683dabe09a80df58d74eeeef7787ce4848b9e62acd87fa6647257f728137326b89c544bfa6b3f38d75ca151e16786e781ee7a6619b70d78f0dd84e71f6314f6d8cda21ac823db28e2303a1b44ecc3f2b5de22deb91942e758da9427452bec2a695fd9b7531cf77bdcf32f9fccd46879b3bfa9b33e4a21b485ad8d04cc6ce89ad45b7d43182975a7c458145598de71c95b803038c315c68ac3927ba6e7c14964176068b0a85bd7b50da987fa0ca2f6fe270decb81be28d54cedbd53adeceaf50cedd1fbe825811838723aa332621b0af0547b1c142e818ed5f200cd88f5d22cc83d276992182928123923a9ee66bcc91fd790bf12e0e116516fcf11137eb7c8fde1ef8269f001ffb2a9b5d12f9f643f3274eed98db6d62db35810521473b4962542706d1ac9740fc9a9fc417e06012c69462e37d724e4e86a1181d254351baf147c10ecf90274416ca86c494c66e7dad4f40d2de90b3055b7dc67c50e33ac2e81bfcf5160d8fc7ba573db2e5ad2ab10708206f59ea65523211456313d44c59b56eaaa576f6973ca1c41afd8ab88d719857c306a77af2a3ff9c37b317e778eb9cf274a920dd030ac407a7a29b57aa849b5aa2bd5416c7b1d6f4e892cdff1a26bf0822cadb4901a9d61c6453dfd419428dce701d2e569ada451cc3fbb1b527731cbd428681c8f3967d59b812d24d3437380294e766a8d74aa9185d17e150d126f4600057794a7e84722aa0fdf990bb9f271935f2c82f957a1af8ba36bdbb592193e358df04d311cd687ab57fef240443f5c0d2e443f9da2e91742d35d7995d648cdcc5961cc176b21ce4c9045a20654741551cb908f4a2237d6e2e38d1254990a60d2e2ec90305f594469a9fe347bbf20f64bcbb0983b1fec37b6c3356e0ffc7bab225249650dff4e7cc403eb2bb900faf96db6eee468cd6bb4ff40663d26c8dfb5f710036a673be8d1f3d14f6e4594771c15269b404c12f4a1a1746e8b70e5b0524515d4ff394386355e0b0df36d7c1d298d3a3757111a6519a7d8503f2efdac07112ed8f127be8d899dc5b3591b20d4305c9e3517a5ffac0b2a68c3079f7bae30fc28a2cb2d68e1d5640be3cd24ef3a7961d1c4325a2562fe412a1096a03c8f62cdd45a6be28df3e812d2c6f9e2b009fc5ec76b34e2a06df5d13a1c19f236a8a37a2303e6a0527909ec120b3f77a5a9ec3c4f3a61de00b1a02b3dcb1a1be67ba3da69a8919a331d343828b013667664e800fbfb3bc69d91e5c426089fc13517216aa6e277562b5800adccb897f096e30a08cd8f2edbc54be3ed6d37b713c789119f0af7eb88b0ca262cc7a84bcf56b4b620a140b284ef2278d05ea9de113b01724331c84f7e8a3d42c421e9856439e2aafa1e50e68104a5a9c54ebf2e8889a20553daece7dc4156324f3400c60e574d0ca4fa627afd60dd3850aa60759733a3ecbb2cb6abe61be7d92120ee2404ad8fa6185c8825b7e325937195c3bf86b5458dd1c946642565b9c7bf9cd1c4e21e9648466a9ec8581ab7644db95dcc2b386afeaeb3b39099ddf0e38a500d6c6ce7a4eb8d4647524f02a4e877cc397138a0856058e6ec0d47f2a6da3746174e56c6107a5f4b67632b3730d467fd14a848f111f09df42e53b3a80260a26fe053527b7ffe830a3399ea8b92f3c13e7b8894688bcf782ab9906c9d4154244cfdadf99043f1d3da7a95f57e07048602640268c4d871b2500e677359bbaf299a80f12d747223b8110ef5af3b29fd2669a0eb5e6dc9ad89d00aaf8588d16607057de76063b9927a6bcba45b9d92f579e232d93e3061ccab36a3ba2cbe183d95c0f28ee132de264f411f712f3fa3c12e520968e70d5635e4756d114ed96407eb4127d1c98e267e54b7d1327b0c11034d27ea761219b2e5cfe9818d86cffe99eef3dc97cc017aee64cd55cc3b73435adf2ab5bcab05a07c353572988a2eafa94df23d9eb316a690ee1fa715322df77c9646eb60615f109808697afd27d2a7a0b47de845eba0989130e198b6554e8142693937e13ee70fed08a46afcd3ed3e488145c984597da6cff5ac9b105df38d2fcdb90ac40c29db5fe5683f360564fdc715e384f9ab30bbeb690b3de0538d3891bd278245e4cbd9f0fb77c1f0c0fd53a10a2676d77ee0d4c2839631dff8e887130787bd74038d1a95159960d7b36415ac2cbc2efebdd4cf914c2fcafc3527c989658c46f71ee3d982ab03c79ea1da0b0d2e34f55753b8c47de372f41d89225374a79511ffcfd23ee5283d7f74d7a5fd1af611092afd9d62eef91a72ae605838329e0d7c5d49a0980a86b08702bd2d427d6b7069b6ae72a1dc9a51371697c0b0099208d68eff71dd4e9279908dde601043a058dfb54985ac486428239c3806da39bd19a7ec87c0ceef07438c54229bee00b16ec8fbc6c6c63e8e2e64af76188e338e72ba671748d089dcf1e59898fa1e3eb5b768f7883d69bbfac5b4ca995b6d86e3b29ba0a611ce171b66e28e2693f544d2aa083748d6682f32bb77b216658cfdf4fdd6dd0b770586f0d41382a5c9d55fcbe2e29026b136ba3b6993da0401291dbca537fa1d776e7edd9c36da8a4e8b0d43b4ff56fc24be4e975ff2aeaae233978e5453151b004242531436378838e96a2b1b2c5050b2123393f43474b546a7274828a9ebecce7f603040d1e626d818cc6d3d6dbe2e3090a1219252a2c3b5a707376787b878ccad6f6242a3943526e709facb1c7ce21294b65676d6f90acbfc7f700000000000000000000000000000000000000000000000000000000000e2230434f5bd900128a030a4584009a2a4880018077042031214040844084041004100482506c8bcaf4ac2d88019870b73ef275bea210fd3d73d32aa9c2b927f074ae1c8293adb13b4bad0c40dc02b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71af4009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd600000000a16c00000000000000000000000000", + "txid": "16f68e6e0d5a93f0f5b9fd336e6bcbfc8ccfc65916278bad5ae0afa44df4216c", + "result": "success" + } + ``` + + +Broadcast this transaction. + +```bash +./komodo-cli -ac_name=MUSIG sendrawtransaction 0400008085202f89014885ef394eb877678ee673f904a624c4a8b276f6ddae3d59cdd6deec4c3014c3000000007b4c79a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b814057c2e1283008cc9a3b140705c1550be6f691d79cadcb422714b62038ebd1b9682a124ac45c939653c66f83f0ac919deadb390b07964dade6d3b904bcbe27d339a100af03800113a10001ffffffff038096980000000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401ccb056b72d00000000302ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc0000000000000000fdb00d6a4dac0d13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460d27a46ee2b83f54a05dede8982e0b65247365b108e42493ddc6cedb0ad0b73c109451aecdbb5adbfbf887f078bc6f66ef9a323abf440535248e2851ccdcdb732678a10e34a5c01127696d220057227b8b078a99c31b8c51c3695c62ca82630aaba41653d4a3743044056365797ad6fed6ef1aee88e0f7e3a56b6aba07cea2e9f7890808b27f4bb825b3050f2ca526002edac45d5c7b0db51e01d203b25578d311a268766f51f3c9dcf93818f5f7c3b2df5aa66c43bcb5f4f460a1cf17fe8b201459fd6a2aed7c5a368b1ffb13ef407053b9314cdef3012e6a38d12ff43fbd7771eeceb59f0cc37d7614efbf2c3decb515e7dc7b7f7a80d8406a85c7ca088127af72a83577303275ac6a8d3d261780c3e7c4f6419809bd73e90427d89aa51477eda1c4089e6dc9f40e7aa4b22d4ac3156f4ab0d13ea589cf56507177eeac1f33830e67fd359e788e9015b8d7cca0ba6fb4d60c2d6171975965db54e94296d853d495fa3139b8638c7c7758f515e78c598a27996ae86378eff6269aa202660b7194b4784b185a5b9116b837c480d9f2c09c15f663f99d4d9464a94817f9a13e906675a979ba4f08d321a83dbbc849e243db47e903d575b5bbf693ca81ebd2f31edb09b206861dc9a4979214ce0db48c3e1254fbfd3cbc1e23ce715da0070e6126af21bdad5d54d5c7ac6f4a70877b090c9103891726797e3cdf79080eac27875aeacf5c58a3c656f6514951e201ffe97a83fec4ee0ed1b0c19b4ea86f1ffd1461003ad48e783a6e4a4bd8372171e3a8363f92aa800fa0667ce0d0802293996e318e42259d1ca30d219048e09a0ac7ee3bda103d02c9d8b5379b10a226fa4169a51a366a4b8e2c42cb55df56a55cdad844400d64daa3be042b893485010611410fa19b7e4b28d35f2a9a44505dd4b105b92612c7e65b659a18e2459d53749f0d2a08c252978f39526311fcbc13b22c816ca4ab8ea9370161aecda22d6080ab1b0e58ef67740d2ae951ef562ae90652a9260dfa68d40e93796ca1e00d1ea63d45e9e9c384b2c0c7f847c94586ddda9939553574a373d2dd8f309b39b3af5d2962e16d132959b229d590ddc79f0a292db2180712b54a74246cf428d1b1772a89346b824822b0f76290d4d32bc55607ad77b1184fdf16ee23039abf2f64e567e5e9fe97193245562284638290a5b024f170b05dcb9db843350e8c757998f003122f89207e72ada0cefe02d7e42d5aecc9044eee13de5f4282c935f2bfbc8f1e987e01cd5030c39588bcd9d4dd064a9b7e1dbab5914ff1204f2321c4d6e438496f86dc1b5b9556c75fbf3155025679c4f8ad9bc784ea58c8ace5674fc69662da2a76e10d030d3e0af2909dffa005889f01a465bfdd8944cdf4a08432377c9c751f150a430b60a665e8351ca1d708dd7be9637dd0d4deb9c1e402b15c05ffee8a1fc6fe750d5a9f49f8bb13321b30c3d14f859a322595f19800f1da8c84a5a9c036de27b014f8a070d2f2b173c33cf3cc62f799d37f125055446d9d156999e267a2a9299fb95feb99e3da76285580597374c90ac51a858933a85450716842ab56d5fb9e8dd748b04e190b18111de7d9622462fde10a1a524ca886e4f1f7a3ee2cdb590b500033da27dddc5f1879b5031cd7347469a58f0401b600f71c6b59bf9feedd9be50e76b6e7bd69247e0d1ffb75d8099ccfbae3cd86db81b8845ec37f812918bb2f61d1e92fc488ea1e8a2fac18062b8877a8833b4d1823d23792faba5ce210df7cf5b433082b9844de3bbe9552422edd0f07973ee8219512a4050834eedc1be50962565a5d4b7d5b7d05fff4b9144439b3f1d7f5c0930127a418b3298f220737a6232b06042f8058aa9805396feae77e1024c950e4f7b8ba91dcff086e28fd3bfbc0e29683dabe09a80df58d74eeeef7787ce4848b9e62acd87fa6647257f728137326b89c544bfa6b3f38d75ca151e16786e781ee7a6619b70d78f0dd84e71f6314f6d8cda21ac823db28e2303a1b44ecc3f2b5de22deb91942e758da9427452bec2a695fd9b7531cf77bdcf32f9fccd46879b3bfa9b33e4a21b485ad8d04cc6ce89ad45b7d43182975a7c458145598de71c95b803038c315c68ac3927ba6e7c14964176068b0a85bd7b50da987fa0ca2f6fe270decb81be28d54cedbd53adeceaf50cedd1fbe825811838723aa332621b0af0547b1c142e818ed5f200cd88f5d22cc83d276992182928123923a9ee66bcc91fd790bf12e0e116516fcf11137eb7c8fde1ef8269f001ffb2a9b5d12f9f643f3274eed98db6d62db35810521473b4962542706d1ac9740fc9a9fc417e06012c69462e37d724e4e86a1181d254351baf147c10ecf90274416ca86c494c66e7dad4f40d2de90b3055b7dc67c50e33ac2e81bfcf5160d8fc7ba573db2e5ad2ab10708206f59ea65523211456313d44c59b56eaaa576f6973ca1c41afd8ab88d719857c306a77af2a3ff9c37b317e778eb9cf274a920dd030ac407a7a29b57aa849b5aa2bd5416c7b1d6f4e892cdff1a26bf0822cadb4901a9d61c6453dfd419428dce701d2e569ada451cc3fbb1b527731cbd428681c8f3967d59b812d24d3437380294e766a8d74aa9185d17e150d126f4600057794a7e84722aa0fdf990bb9f271935f2c82f957a1af8ba36bdbb592193e358df04d311cd687ab57fef240443f5c0d2e443f9da2e91742d35d7995d648cdcc5961cc176b21ce4c9045a20654741551cb908f4a2237d6e2e38d1254990a60d2e2ec90305f594469a9fe347bbf20f64bcbb0983b1fec37b6c3356e0ffc7bab225249650dff4e7cc403eb2bb900faf96db6eee468cd6bb4ff40663d26c8dfb5f710036a673be8d1f3d14f6e4594771c15269b404c12f4a1a1746e8b70e5b0524515d4ff394386355e0b0df36d7c1d298d3a3757111a6519a7d8503f2efdac07112ed8f127be8d899dc5b3591b20d4305c9e3517a5ffac0b2a68c3079f7bae30fc28a2cb2d68e1d5640be3cd24ef3a7961d1c4325a2562fe412a1096a03c8f62cdd45a6be28df3e812d2c6f9e2b009fc5ec76b34e2a06df5d13a1c19f236a8a37a2303e6a0527909ec120b3f77a5a9ec3c4f3a61de00b1a02b3dcb1a1be67ba3da69a8919a331d343828b013667664e800fbfb3bc69d91e5c426089fc13517216aa6e277562b5800adccb897f096e30a08cd8f2edbc54be3ed6d37b713c789119f0af7eb88b0ca262cc7a84bcf56b4b620a140b284ef2278d05ea9de113b01724331c84f7e8a3d42c421e9856439e2aafa1e50e68104a5a9c54ebf2e8889a20553daece7dc4156324f3400c60e574d0ca4fa627afd60dd3850aa60759733a3ecbb2cb6abe61be7d92120ee2404ad8fa6185c8825b7e325937195c3bf86b5458dd1c946642565b9c7bf9cd1c4e21e9648466a9ec8581ab7644db95dcc2b386afeaeb3b39099ddf0e38a500d6c6ce7a4eb8d4647524f02a4e877cc397138a0856058e6ec0d47f2a6da3746174e56c6107a5f4b67632b3730d467fd14a848f111f09df42e53b3a80260a26fe053527b7ffe830a3399ea8b92f3c13e7b8894688bcf782ab9906c9d4154244cfdadf99043f1d3da7a95f57e07048602640268c4d871b2500e677359bbaf299a80f12d747223b8110ef5af3b29fd2669a0eb5e6dc9ad89d00aaf8588d16607057de76063b9927a6bcba45b9d92f579e232d93e3061ccab36a3ba2cbe183d95c0f28ee132de264f411f712f3fa3c12e520968e70d5635e4756d114ed96407eb4127d1c98e267e54b7d1327b0c11034d27ea761219b2e5cfe9818d86cffe99eef3dc97cc017aee64cd55cc3b73435adf2ab5bcab05a07c353572988a2eafa94df23d9eb316a690ee1fa715322df77c9646eb60615f109808697afd27d2a7a0b47de845eba0989130e198b6554e8142693937e13ee70fed08a46afcd3ed3e488145c984597da6cff5ac9b105df38d2fcdb90ac40c29db5fe5683f360564fdc715e384f9ab30bbeb690b3de0538d3891bd278245e4cbd9f0fb77c1f0c0fd53a10a2676d77ee0d4c2839631dff8e887130787bd74038d1a95159960d7b36415ac2cbc2efebdd4cf914c2fcafc3527c989658c46f71ee3d982ab03c79ea1da0b0d2e34f55753b8c47de372f41d89225374a79511ffcfd23ee5283d7f74d7a5fd1af611092afd9d62eef91a72ae605838329e0d7c5d49a0980a86b08702bd2d427d6b7069b6ae72a1dc9a51371697c0b0099208d68eff71dd4e9279908dde601043a058dfb54985ac486428239c3806da39bd19a7ec87c0ceef07438c54229bee00b16ec8fbc6c6c63e8e2e64af76188e338e72ba671748d089dcf1e59898fa1e3eb5b768f7883d69bbfac5b4ca995b6d86e3b29ba0a611ce171b66e28e2693f544d2aa083748d6682f32bb77b216658cfdf4fdd6dd0b770586f0d41382a5c9d55fcbe2e29026b136ba3b6993da0401291dbca537fa1d776e7edd9c36da8a4e8b0d43b4ff56fc24be4e975ff2aeaae233978e5453151b004242531436378838e96a2b1b2c5050b2123393f43474b546a7274828a9ebecce7f603040d1e626d818cc6d3d6dbe2e3090a1219252a2c3b5a707376787b878ccad6f6242a3943526e709facb1c7ce21294b65676d6f90acbfc7f700000000000000000000000000000000000000000000000000000000000e2230434f5bd900128a030a4584009a2a4880018077042031214040844084041004100482506c8bcaf4ac2d88019870b73ef275bea210fd3d73d32aa9c2b927f074ae1c8293adb13b4bad0c40dc02b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71af4009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd600000000a16c00000000000000000000000000 +``` + + + ```bash + 16f68e6e0d5a93f0f5b9fd336e6bcbfc8ccfc65916278bad5ae0afa44df4216c + ``` + + +#### Understanding the Inputs and Outputs of a Q -> Q Transaction + +Use the getrawtransaction RPC to observe the vins and vouts of our qutxos. + +```bash +./komodo-cli -ac_name=MUSIG getrawtransaction 16f68e6e0d5a93f0f5b9fd336e6bcbfc8ccfc65916278bad5ae0afa44df4216c 2 +``` + +##### Click Button Below to View Full Response + + + ```json + { + "hex": "0400008085202f89014885ef394eb877678ee673f904a624c4a8b276f6ddae3d59cdd6deec4c3014c3000000007b4c79a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b814057c2e1283008cc9a3b140705c1550be6f691d79cadcb422714b62038ebd1b9682a124ac45c939653c66f83f0ac919deadb390b07964dade6d3b904bcbe27d339a100af03800113a10001ffffffff038096980000000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401ccb056b72d00000000302ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc0000000000000000fdb00d6a4dac0d13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460d27a46ee2b83f54a05dede8982e0b65247365b108e42493ddc6cedb0ad0b73c109451aecdbb5adbfbf887f078bc6f66ef9a323abf440535248e2851ccdcdb732678a10e34a5c01127696d220057227b8b078a99c31b8c51c3695c62ca82630aaba41653d4a3743044056365797ad6fed6ef1aee88e0f7e3a56b6aba07cea2e9f7890808b27f4bb825b3050f2ca526002edac45d5c7b0db51e01d203b25578d311a268766f51f3c9dcf93818f5f7c3b2df5aa66c43bcb5f4f460a1cf17fe8b201459fd6a2aed7c5a368b1ffb13ef407053b9314cdef3012e6a38d12ff43fbd7771eeceb59f0cc37d7614efbf2c3decb515e7dc7b7f7a80d8406a85c7ca088127af72a83577303275ac6a8d3d261780c3e7c4f6419809bd73e90427d89aa51477eda1c4089e6dc9f40e7aa4b22d4ac3156f4ab0d13ea589cf56507177eeac1f33830e67fd359e788e9015b8d7cca0ba6fb4d60c2d6171975965db54e94296d853d495fa3139b8638c7c7758f515e78c598a27996ae86378eff6269aa202660b7194b4784b185a5b9116b837c480d9f2c09c15f663f99d4d9464a94817f9a13e906675a979ba4f08d321a83dbbc849e243db47e903d575b5bbf693ca81ebd2f31edb09b206861dc9a4979214ce0db48c3e1254fbfd3cbc1e23ce715da0070e6126af21bdad5d54d5c7ac6f4a70877b090c9103891726797e3cdf79080eac27875aeacf5c58a3c656f6514951e201ffe97a83fec4ee0ed1b0c19b4ea86f1ffd1461003ad48e783a6e4a4bd8372171e3a8363f92aa800fa0667ce0d0802293996e318e42259d1ca30d219048e09a0ac7ee3bda103d02c9d8b5379b10a226fa4169a51a366a4b8e2c42cb55df56a55cdad844400d64daa3be042b893485010611410fa19b7e4b28d35f2a9a44505dd4b105b92612c7e65b659a18e2459d53749f0d2a08c252978f39526311fcbc13b22c816ca4ab8ea9370161aecda22d6080ab1b0e58ef67740d2ae951ef562ae90652a9260dfa68d40e93796ca1e00d1ea63d45e9e9c384b2c0c7f847c94586ddda9939553574a373d2dd8f309b39b3af5d2962e16d132959b229d590ddc79f0a292db2180712b54a74246cf428d1b1772a89346b824822b0f76290d4d32bc55607ad77b1184fdf16ee23039abf2f64e567e5e9fe97193245562284638290a5b024f170b05dcb9db843350e8c757998f003122f89207e72ada0cefe02d7e42d5aecc9044eee13de5f4282c935f2bfbc8f1e987e01cd5030c39588bcd9d4dd064a9b7e1dbab5914ff1204f2321c4d6e438496f86dc1b5b9556c75fbf3155025679c4f8ad9bc784ea58c8ace5674fc69662da2a76e10d030d3e0af2909dffa005889f01a465bfdd8944cdf4a08432377c9c751f150a430b60a665e8351ca1d708dd7be9637dd0d4deb9c1e402b15c05ffee8a1fc6fe750d5a9f49f8bb13321b30c3d14f859a322595f19800f1da8c84a5a9c036de27b014f8a070d2f2b173c33cf3cc62f799d37f125055446d9d156999e267a2a9299fb95feb99e3da76285580597374c90ac51a858933a85450716842ab56d5fb9e8dd748b04e190b18111de7d9622462fde10a1a524ca886e4f1f7a3ee2cdb590b500033da27dddc5f1879b5031cd7347469a58f0401b600f71c6b59bf9feedd9be50e76b6e7bd69247e0d1ffb75d8099ccfbae3cd86db81b8845ec37f812918bb2f61d1e92fc488ea1e8a2fac18062b8877a8833b4d1823d23792faba5ce210df7cf5b433082b9844de3bbe9552422edd0f07973ee8219512a4050834eedc1be50962565a5d4b7d5b7d05fff4b9144439b3f1d7f5c0930127a418b3298f220737a6232b06042f8058aa9805396feae77e1024c950e4f7b8ba91dcff086e28fd3bfbc0e29683dabe09a80df58d74eeeef7787ce4848b9e62acd87fa6647257f728137326b89c544bfa6b3f38d75ca151e16786e781ee7a6619b70d78f0dd84e71f6314f6d8cda21ac823db28e2303a1b44ecc3f2b5de22deb91942e758da9427452bec2a695fd9b7531cf77bdcf32f9fccd46879b3bfa9b33e4a21b485ad8d04cc6ce89ad45b7d43182975a7c458145598de71c95b803038c315c68ac3927ba6e7c14964176068b0a85bd7b50da987fa0ca2f6fe270decb81be28d54cedbd53adeceaf50cedd1fbe825811838723aa332621b0af0547b1c142e818ed5f200cd88f5d22cc83d276992182928123923a9ee66bcc91fd790bf12e0e116516fcf11137eb7c8fde1ef8269f001ffb2a9b5d12f9f643f3274eed98db6d62db35810521473b4962542706d1ac9740fc9a9fc417e06012c69462e37d724e4e86a1181d254351baf147c10ecf90274416ca86c494c66e7dad4f40d2de90b3055b7dc67c50e33ac2e81bfcf5160d8fc7ba573db2e5ad2ab10708206f59ea65523211456313d44c59b56eaaa576f6973ca1c41afd8ab88d719857c306a77af2a3ff9c37b317e778eb9cf274a920dd030ac407a7a29b57aa849b5aa2bd5416c7b1d6f4e892cdff1a26bf0822cadb4901a9d61c6453dfd419428dce701d2e569ada451cc3fbb1b527731cbd428681c8f3967d59b812d24d3437380294e766a8d74aa9185d17e150d126f4600057794a7e84722aa0fdf990bb9f271935f2c82f957a1af8ba36bdbb592193e358df04d311cd687ab57fef240443f5c0d2e443f9da2e91742d35d7995d648cdcc5961cc176b21ce4c9045a20654741551cb908f4a2237d6e2e38d1254990a60d2e2ec90305f594469a9fe347bbf20f64bcbb0983b1fec37b6c3356e0ffc7bab225249650dff4e7cc403eb2bb900faf96db6eee468cd6bb4ff40663d26c8dfb5f710036a673be8d1f3d14f6e4594771c15269b404c12f4a1a1746e8b70e5b0524515d4ff394386355e0b0df36d7c1d298d3a3757111a6519a7d8503f2efdac07112ed8f127be8d899dc5b3591b20d4305c9e3517a5ffac0b2a68c3079f7bae30fc28a2cb2d68e1d5640be3cd24ef3a7961d1c4325a2562fe412a1096a03c8f62cdd45a6be28df3e812d2c6f9e2b009fc5ec76b34e2a06df5d13a1c19f236a8a37a2303e6a0527909ec120b3f77a5a9ec3c4f3a61de00b1a02b3dcb1a1be67ba3da69a8919a331d343828b013667664e800fbfb3bc69d91e5c426089fc13517216aa6e277562b5800adccb897f096e30a08cd8f2edbc54be3ed6d37b713c789119f0af7eb88b0ca262cc7a84bcf56b4b620a140b284ef2278d05ea9de113b01724331c84f7e8a3d42c421e9856439e2aafa1e50e68104a5a9c54ebf2e8889a20553daece7dc4156324f3400c60e574d0ca4fa627afd60dd3850aa60759733a3ecbb2cb6abe61be7d92120ee2404ad8fa6185c8825b7e325937195c3bf86b5458dd1c946642565b9c7bf9cd1c4e21e9648466a9ec8581ab7644db95dcc2b386afeaeb3b39099ddf0e38a500d6c6ce7a4eb8d4647524f02a4e877cc397138a0856058e6ec0d47f2a6da3746174e56c6107a5f4b67632b3730d467fd14a848f111f09df42e53b3a80260a26fe053527b7ffe830a3399ea8b92f3c13e7b8894688bcf782ab9906c9d4154244cfdadf99043f1d3da7a95f57e07048602640268c4d871b2500e677359bbaf299a80f12d747223b8110ef5af3b29fd2669a0eb5e6dc9ad89d00aaf8588d16607057de76063b9927a6bcba45b9d92f579e232d93e3061ccab36a3ba2cbe183d95c0f28ee132de264f411f712f3fa3c12e520968e70d5635e4756d114ed96407eb4127d1c98e267e54b7d1327b0c11034d27ea761219b2e5cfe9818d86cffe99eef3dc97cc017aee64cd55cc3b73435adf2ab5bcab05a07c353572988a2eafa94df23d9eb316a690ee1fa715322df77c9646eb60615f109808697afd27d2a7a0b47de845eba0989130e198b6554e8142693937e13ee70fed08a46afcd3ed3e488145c984597da6cff5ac9b105df38d2fcdb90ac40c29db5fe5683f360564fdc715e384f9ab30bbeb690b3de0538d3891bd278245e4cbd9f0fb77c1f0c0fd53a10a2676d77ee0d4c2839631dff8e887130787bd74038d1a95159960d7b36415ac2cbc2efebdd4cf914c2fcafc3527c989658c46f71ee3d982ab03c79ea1da0b0d2e34f55753b8c47de372f41d89225374a79511ffcfd23ee5283d7f74d7a5fd1af611092afd9d62eef91a72ae605838329e0d7c5d49a0980a86b08702bd2d427d6b7069b6ae72a1dc9a51371697c0b0099208d68eff71dd4e9279908dde601043a058dfb54985ac486428239c3806da39bd19a7ec87c0ceef07438c54229bee00b16ec8fbc6c6c63e8e2e64af76188e338e72ba671748d089dcf1e59898fa1e3eb5b768f7883d69bbfac5b4ca995b6d86e3b29ba0a611ce171b66e28e2693f544d2aa083748d6682f32bb77b216658cfdf4fdd6dd0b770586f0d41382a5c9d55fcbe2e29026b136ba3b6993da0401291dbca537fa1d776e7edd9c36da8a4e8b0d43b4ff56fc24be4e975ff2aeaae233978e5453151b004242531436378838e96a2b1b2c5050b2123393f43474b546a7274828a9ebecce7f603040d1e626d818cc6d3d6dbe2e3090a1219252a2c3b5a707376787b878ccad6f6242a3943526e709facb1c7ce21294b65676d6f90acbfc7f700000000000000000000000000000000000000000000000000000000000e2230434f5bd900128a030a4584009a2a4880018077042031214040844084041004100482506c8bcaf4ac2d88019870b73ef275bea210fd3d73d32aa9c2b927f074ae1c8293adb13b4bad0c40dc02b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71af4009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd600000000a16c00000000000000000000000000", + "txid": "16f68e6e0d5a93f0f5b9fd336e6bcbfc8ccfc65916278bad5ae0afa44df4216c", + "overwintered": true, + "version": 4, + "versiongroupid": "892f2085", + "locktime": 0, + "expiryheight": 27809, + "vin": [ + { + "txid": "c314304cecded6cd593daeddf676b2a8c424a604f973e68e6777b84e39ef8548", + "vout": 0, + "address": "RWzd2iZT7rTU91mJVXzXpK8NWseMgZnW74", + "scriptSig": { + "asm": "a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b814057c2e1283008cc9a3b140705c1550be6f691d79cadcb422714b62038ebd1b9682a124ac45c939653c66f83f0ac919deadb390b07964dade6d3b904bcbe27d339a100af03800113a10001", + "hex": "4c79a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b814057c2e1283008cc9a3b140705c1550be6f691d79cadcb422714b62038ebd1b9682a124ac45c939653c66f83f0ac919deadb390b07964dade6d3b904bcbe27d339a100af03800113a10001" + }, + "value": 7.77, + "valueSat": 777000000, + "address": "RWzd2iZT7rTU91mJVXzXpK8NWseMgZnW74", + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.1, + "valueSat": 10000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7"] + }, + "spentTxId": "6638c62562a9a9e5cf78cdcd7c77aa54746822bddce9b318d09f5ede565145f5", + "spentIndex": 0, + "spentHeight": 27853 + }, + { + "value": 7.6699, + "valueSat": 766990000, + "n": 1, + "scriptPubKey": { + "asm": "a22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RWzd2iZT7rTU91mJVXzXpK8NWseMgZnW74"] + }, + "spentTxId": "5aaf4007d6d9af7883da1ad464b63fff9d97453efe0b181d19558cc15f6ff668", + "spentIndex": 0, + "spentHeight": 27878 + }, + { + "value": 0.0, + "valueSat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN 13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460d27a46ee2b83f54a05dede8982e0b65247365b108e42493ddc6cedb0ad0b73c109451aecdbb5adbfbf887f078bc6f66ef9a323abf440535248e2851ccdcdb732678a10e34a5c01127696d220057227b8b078a99c31b8c51c3695c62ca82630aaba41653d4a3743044056365797ad6fed6ef1aee88e0f7e3a56b6aba07cea2e9f7890808b27f4bb825b3050f2ca526002edac45d5c7b0db51e01d203b25578d311a268766f51f3c9dcf93818f5f7c3b2df5aa66c43bcb5f4f460a1cf17fe8b201459fd6a2aed7c5a368b1ffb13ef407053b9314cdef3012e6a38d12ff43fbd7771eeceb59f0cc37d7614efbf2c3decb515e7dc7b7f7a80d8406a85c7ca088127af72a83577303275ac6a8d3d261780c3e7c4f6419809bd73e90427d89aa51477eda1c4089e6dc9f40e7aa4b22d4ac3156f4ab0d13ea589cf56507177eeac1f33830e67fd359e788e9015b8d7cca0ba6fb4d60c2d6171975965db54e94296d853d495fa3139b8638c7c7758f515e78c598a27996ae86378eff6269aa202660b7194b4784b185a5b9116b837c480d9f2c09c15f663f99d4d9464a94817f9a13e906675a979ba4f08d321a83dbbc849e243db47e903d575b5bbf693ca81ebd2f31edb09b206861dc9a4979214ce0db48c3e1254fbfd3cbc1e23ce715da0070e6126af21bdad5d54d5c7ac6f4a70877b090c9103891726797e3cdf79080eac27875aeacf5c58a3c656f6514951e201ffe97a83fec4ee0ed1b0c19b4ea86f1ffd1461003ad48e783a6e4a4bd8372171e3a8363f92aa800fa0667ce0d0802293996e318e42259d1ca30d219048e09a0ac7ee3bda103d02c9d8b5379b10a226fa4169a51a366a4b8e2c42cb55df56a55cdad844400d64daa3be042b893485010611410fa19b7e4b28d35f2a9a44505dd4b105b92612c7e65b659a18e2459d53749f0d2a08c252978f39526311fcbc13b22c816ca4ab8ea9370161aecda22d6080ab1b0e58ef67740d2ae951ef562ae90652a9260dfa68d40e93796ca1e00d1ea63d45e9e9c384b2c0c7f847c94586ddda9939553574a373d2dd8f309b39b3af5d2962e16d132959b229d590ddc79f0a292db2180712b54a74246cf428d1b1772a89346b824822b0f76290d4d32bc55607ad77b1184fdf16ee23039abf2f64e567e5e9fe97193245562284638290a5b024f170b05dcb9db843350e8c757998f003122f89207e72ada0cefe02d7e42d5aecc9044eee13de5f4282c935f2bfbc8f1e987e01cd5030c39588bcd9d4dd064a9b7e1dbab5914ff1204f2321c4d6e438496f86dc1b5b9556c75fbf3155025679c4f8ad9bc784ea58c8ace5674fc69662da2a76e10d030d3e0af2909dffa005889f01a465bfdd8944cdf4a08432377c9c751f150a430b60a665e8351ca1d708dd7be9637dd0d4deb9c1e402b15c05ffee8a1fc6fe750d5a9f49f8bb13321b30c3d14f859a322595f19800f1da8c84a5a9c036de27b014f8a070d2f2b173c33cf3cc62f799d37f125055446d9d156999e267a2a9299fb95feb99e3da76285580597374c90ac51a858933a85450716842ab56d5fb9e8dd748b04e190b18111de7d9622462fde10a1a524ca886e4f1f7a3ee2cdb590b500033da27dddc5f1879b5031cd7347469a58f0401b600f71c6b59bf9feedd9be50e76b6e7bd69247e0d1ffb75d8099ccfbae3cd86db81b8845ec37f812918bb2f61d1e92fc488ea1e8a2fac18062b8877a8833b4d1823d23792faba5ce210df7cf5b433082b9844de3bbe9552422edd0f07973ee8219512a4050834eedc1be50962565a5d4b7d5b7d05fff4b9144439b3f1d7f5c0930127a418b3298f220737a6232b06042f8058aa9805396feae77e1024c950e4f7b8ba91dcff086e28fd3bfbc0e29683dabe09a80df58d74eeeef7787ce4848b9e62acd87fa6647257f728137326b89c544bfa6b3f38d75ca151e16786e781ee7a6619b70d78f0dd84e71f6314f6d8cda21ac823db28e2303a1b44ecc3f2b5de22deb91942e758da9427452bec2a695fd9b7531cf77bdcf32f9fccd46879b3bfa9b33e4a21b485ad8d04cc6ce89ad45b7d43182975a7c458145598de71c95b803038c315c68ac3927ba6e7c14964176068b0a85bd7b50da987fa0ca2f6fe270decb81be28d54cedbd53adeceaf50cedd1fbe825811838723aa332621b0af0547b1c142e818ed5f200cd88f5d22cc83d276992182928123923a9ee66bcc91fd790bf12e0e116516fcf11137eb7c8fde1ef8269f001ffb2a9b5d12f9f643f3274eed98db6d62db35810521473b4962542706d1ac9740fc9a9fc417e06012c69462e37d724e4e86a1181d254351baf147c10ecf90274416ca86c494c66e7dad4f40d2de90b3055b7dc67c50e33ac2e81bfcf5160d8fc7ba573db2e5ad2ab10708206f59ea65523211456313d44c59b56eaaa576f6973ca1c41afd8ab88d719857c306a77af2a3ff9c37b317e778eb9cf274a920dd030ac407a7a29b57aa849b5aa2bd5416c7b1d6f4e892cdff1a26bf0822cadb4901a9d61c6453dfd419428dce701d2e569ada451cc3fbb1b527731cbd428681c8f3967d59b812d24d3437380294e766a8d74aa9185d17e150d126f4600057794a7e84722aa0fdf990bb9f271935f2c82f957a1af8ba36bdbb592193e358df04d311cd687ab57fef240443f5c0d2e443f9da2e91742d35d7995d648cdcc5961cc176b21ce4c9045a20654741551cb908f4a2237d6e2e38d1254990a60d2e2ec90305f594469a9fe347bbf20f64bcbb0983b1fec37b6c3356e0ffc7bab225249650dff4e7cc403eb2bb900faf96db6eee468cd6bb4ff40663d26c8dfb5f710036a673be8d1f3d14f6e4594771c15269b404c12f4a1a1746e8b70e5b0524515d4ff394386355e0b0df36d7c1d298d3a3757111a6519a7d8503f2efdac07112ed8f127be8d899dc5b3591b20d4305c9e3517a5ffac0b2a68c3079f7bae30fc28a2cb2d68e1d5640be3cd24ef3a7961d1c4325a2562fe412a1096a03c8f62cdd45a6be28df3e812d2c6f9e2b009fc5ec76b34e2a06df5d13a1c19f236a8a37a2303e6a0527909ec120b3f77a5a9ec3c4f3a61de00b1a02b3dcb1a1be67ba3da69a8919a331d343828b013667664e800fbfb3bc69d91e5c426089fc13517216aa6e277562b5800adccb897f096e30a08cd8f2edbc54be3ed6d37b713c789119f0af7eb88b0ca262cc7a84bcf56b4b620a140b284ef2278d05ea9de113b01724331c84f7e8a3d42c421e9856439e2aafa1e50e68104a5a9c54ebf2e8889a20553daece7dc4156324f3400c60e574d0ca4fa627afd60dd3850aa60759733a3ecbb2cb6abe61be7d92120ee2404ad8fa6185c8825b7e325937195c3bf86b5458dd1c946642565b9c7bf9cd1c4e21e9648466a9ec8581ab7644db95dcc2b386afeaeb3b39099ddf0e38a500d6c6ce7a4eb8d4647524f02a4e877cc397138a0856058e6ec0d47f2a6da3746174e56c6107a5f4b67632b3730d467fd14a848f111f09df42e53b3a80260a26fe053527b7ffe830a3399ea8b92f3c13e7b8894688bcf782ab9906c9d4154244cfdadf99043f1d3da7a95f57e07048602640268c4d871b2500e677359bbaf299a80f12d747223b8110ef5af3b29fd2669a0eb5e6dc9ad89d00aaf8588d16607057de76063b9927a6bcba45b9d92f579e232d93e3061ccab36a3ba2cbe183d95c0f28ee132de264f411f712f3fa3c12e520968e70d5635e4756d114ed96407eb4127d1c98e267e54b7d1327b0c11034d27ea761219b2e5cfe9818d86cffe99eef3dc97cc017aee64cd55cc3b73435adf2ab5bcab05a07c353572988a2eafa94df23d9eb316a690ee1fa715322df77c9646eb60615f109808697afd27d2a7a0b47de845eba0989130e198b6554e8142693937e13ee70fed08a46afcd3ed3e488145c984597da6cff5ac9b105df38d2fcdb90ac40c29db5fe5683f360564fdc715e384f9ab30bbeb690b3de0538d3891bd278245e4cbd9f0fb77c1f0c0fd53a10a2676d77ee0d4c2839631dff8e887130787bd74038d1a95159960d7b36415ac2cbc2efebdd4cf914c2fcafc3527c989658c46f71ee3d982ab03c79ea1da0b0d2e34f55753b8c47de372f41d89225374a79511ffcfd23ee5283d7f74d7a5fd1af611092afd9d62eef91a72ae605838329e0d7c5d49a0980a86b08702bd2d427d6b7069b6ae72a1dc9a51371697c0b0099208d68eff71dd4e9279908dde601043a058dfb54985ac486428239c3806da39bd19a7ec87c0ceef07438c54229bee00b16ec8fbc6c6c63e8e2e64af76188e338e72ba671748d089dcf1e59898fa1e3eb5b768f7883d69bbfac5b4ca995b6d86e3b29ba0a611ce171b66e28e2693f544d2aa083748d6682f32bb77b216658cfdf4fdd6dd0b770586f0d41382a5c9d55fcbe2e29026b136ba3b6993da0401291dbca537fa1d776e7edd9c36da8a4e8b0d43b4ff56fc24be4e975ff2aeaae233978e5453151b004242531436378838e96a2b1b2c5050b2123393f43474b546a7274828a9ebecce7f603040d1e626d818cc6d3d6dbe2e3090a1219252a2c3b5a707376787b878ccad6f6242a3943526e709facb1c7ce21294b65676d6f90acbfc7f700000000000000000000000000000000000000000000000000000000000e2230434f5bd900128a030a4584009a2a4880018077042031214040844084041004100482506c8bcaf4ac2d88019870b73ef275bea210fd3d73d32aa9c2b927f074ae1c8293adb13b4bad0c40dc02b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71af4009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6", + "hex": "6a4dac0d13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460d27a46ee2b83f54a05dede8982e0b65247365b108e42493ddc6cedb0ad0b73c109451aecdbb5adbfbf887f078bc6f66ef9a323abf440535248e2851ccdcdb732678a10e34a5c01127696d220057227b8b078a99c31b8c51c3695c62ca82630aaba41653d4a3743044056365797ad6fed6ef1aee88e0f7e3a56b6aba07cea2e9f7890808b27f4bb825b3050f2ca526002edac45d5c7b0db51e01d203b25578d311a268766f51f3c9dcf93818f5f7c3b2df5aa66c43bcb5f4f460a1cf17fe8b201459fd6a2aed7c5a368b1ffb13ef407053b9314cdef3012e6a38d12ff43fbd7771eeceb59f0cc37d7614efbf2c3decb515e7dc7b7f7a80d8406a85c7ca088127af72a83577303275ac6a8d3d261780c3e7c4f6419809bd73e90427d89aa51477eda1c4089e6dc9f40e7aa4b22d4ac3156f4ab0d13ea589cf56507177eeac1f33830e67fd359e788e9015b8d7cca0ba6fb4d60c2d6171975965db54e94296d853d495fa3139b8638c7c7758f515e78c598a27996ae86378eff6269aa202660b7194b4784b185a5b9116b837c480d9f2c09c15f663f99d4d9464a94817f9a13e906675a979ba4f08d321a83dbbc849e243db47e903d575b5bbf693ca81ebd2f31edb09b206861dc9a4979214ce0db48c3e1254fbfd3cbc1e23ce715da0070e6126af21bdad5d54d5c7ac6f4a70877b090c9103891726797e3cdf79080eac27875aeacf5c58a3c656f6514951e201ffe97a83fec4ee0ed1b0c19b4ea86f1ffd1461003ad48e783a6e4a4bd8372171e3a8363f92aa800fa0667ce0d0802293996e318e42259d1ca30d219048e09a0ac7ee3bda103d02c9d8b5379b10a226fa4169a51a366a4b8e2c42cb55df56a55cdad844400d64daa3be042b893485010611410fa19b7e4b28d35f2a9a44505dd4b105b92612c7e65b659a18e2459d53749f0d2a08c252978f39526311fcbc13b22c816ca4ab8ea9370161aecda22d6080ab1b0e58ef67740d2ae951ef562ae90652a9260dfa68d40e93796ca1e00d1ea63d45e9e9c384b2c0c7f847c94586ddda9939553574a373d2dd8f309b39b3af5d2962e16d132959b229d590ddc79f0a292db2180712b54a74246cf428d1b1772a89346b824822b0f76290d4d32bc55607ad77b1184fdf16ee23039abf2f64e567e5e9fe97193245562284638290a5b024f170b05dcb9db843350e8c757998f003122f89207e72ada0cefe02d7e42d5aecc9044eee13de5f4282c935f2bfbc8f1e987e01cd5030c39588bcd9d4dd064a9b7e1dbab5914ff1204f2321c4d6e438496f86dc1b5b9556c75fbf3155025679c4f8ad9bc784ea58c8ace5674fc69662da2a76e10d030d3e0af2909dffa005889f01a465bfdd8944cdf4a08432377c9c751f150a430b60a665e8351ca1d708dd7be9637dd0d4deb9c1e402b15c05ffee8a1fc6fe750d5a9f49f8bb13321b30c3d14f859a322595f19800f1da8c84a5a9c036de27b014f8a070d2f2b173c33cf3cc62f799d37f125055446d9d156999e267a2a9299fb95feb99e3da76285580597374c90ac51a858933a85450716842ab56d5fb9e8dd748b04e190b18111de7d9622462fde10a1a524ca886e4f1f7a3ee2cdb590b500033da27dddc5f1879b5031cd7347469a58f0401b600f71c6b59bf9feedd9be50e76b6e7bd69247e0d1ffb75d8099ccfbae3cd86db81b8845ec37f812918bb2f61d1e92fc488ea1e8a2fac18062b8877a8833b4d1823d23792faba5ce210df7cf5b433082b9844de3bbe9552422edd0f07973ee8219512a4050834eedc1be50962565a5d4b7d5b7d05fff4b9144439b3f1d7f5c0930127a418b3298f220737a6232b06042f8058aa9805396feae77e1024c950e4f7b8ba91dcff086e28fd3bfbc0e29683dabe09a80df58d74eeeef7787ce4848b9e62acd87fa6647257f728137326b89c544bfa6b3f38d75ca151e16786e781ee7a6619b70d78f0dd84e71f6314f6d8cda21ac823db28e2303a1b44ecc3f2b5de22deb91942e758da9427452bec2a695fd9b7531cf77bdcf32f9fccd46879b3bfa9b33e4a21b485ad8d04cc6ce89ad45b7d43182975a7c458145598de71c95b803038c315c68ac3927ba6e7c14964176068b0a85bd7b50da987fa0ca2f6fe270decb81be28d54cedbd53adeceaf50cedd1fbe825811838723aa332621b0af0547b1c142e818ed5f200cd88f5d22cc83d276992182928123923a9ee66bcc91fd790bf12e0e116516fcf11137eb7c8fde1ef8269f001ffb2a9b5d12f9f643f3274eed98db6d62db35810521473b4962542706d1ac9740fc9a9fc417e06012c69462e37d724e4e86a1181d254351baf147c10ecf90274416ca86c494c66e7dad4f40d2de90b3055b7dc67c50e33ac2e81bfcf5160d8fc7ba573db2e5ad2ab10708206f59ea65523211456313d44c59b56eaaa576f6973ca1c41afd8ab88d719857c306a77af2a3ff9c37b317e778eb9cf274a920dd030ac407a7a29b57aa849b5aa2bd5416c7b1d6f4e892cdff1a26bf0822cadb4901a9d61c6453dfd419428dce701d2e569ada451cc3fbb1b527731cbd428681c8f3967d59b812d24d3437380294e766a8d74aa9185d17e150d126f4600057794a7e84722aa0fdf990bb9f271935f2c82f957a1af8ba36bdbb592193e358df04d311cd687ab57fef240443f5c0d2e443f9da2e91742d35d7995d648cdcc5961cc176b21ce4c9045a20654741551cb908f4a2237d6e2e38d1254990a60d2e2ec90305f594469a9fe347bbf20f64bcbb0983b1fec37b6c3356e0ffc7bab225249650dff4e7cc403eb2bb900faf96db6eee468cd6bb4ff40663d26c8dfb5f710036a673be8d1f3d14f6e4594771c15269b404c12f4a1a1746e8b70e5b0524515d4ff394386355e0b0df36d7c1d298d3a3757111a6519a7d8503f2efdac07112ed8f127be8d899dc5b3591b20d4305c9e3517a5ffac0b2a68c3079f7bae30fc28a2cb2d68e1d5640be3cd24ef3a7961d1c4325a2562fe412a1096a03c8f62cdd45a6be28df3e812d2c6f9e2b009fc5ec76b34e2a06df5d13a1c19f236a8a37a2303e6a0527909ec120b3f77a5a9ec3c4f3a61de00b1a02b3dcb1a1be67ba3da69a8919a331d343828b013667664e800fbfb3bc69d91e5c426089fc13517216aa6e277562b5800adccb897f096e30a08cd8f2edbc54be3ed6d37b713c789119f0af7eb88b0ca262cc7a84bcf56b4b620a140b284ef2278d05ea9de113b01724331c84f7e8a3d42c421e9856439e2aafa1e50e68104a5a9c54ebf2e8889a20553daece7dc4156324f3400c60e574d0ca4fa627afd60dd3850aa60759733a3ecbb2cb6abe61be7d92120ee2404ad8fa6185c8825b7e325937195c3bf86b5458dd1c946642565b9c7bf9cd1c4e21e9648466a9ec8581ab7644db95dcc2b386afeaeb3b39099ddf0e38a500d6c6ce7a4eb8d4647524f02a4e877cc397138a0856058e6ec0d47f2a6da3746174e56c6107a5f4b67632b3730d467fd14a848f111f09df42e53b3a80260a26fe053527b7ffe830a3399ea8b92f3c13e7b8894688bcf782ab9906c9d4154244cfdadf99043f1d3da7a95f57e07048602640268c4d871b2500e677359bbaf299a80f12d747223b8110ef5af3b29fd2669a0eb5e6dc9ad89d00aaf8588d16607057de76063b9927a6bcba45b9d92f579e232d93e3061ccab36a3ba2cbe183d95c0f28ee132de264f411f712f3fa3c12e520968e70d5635e4756d114ed96407eb4127d1c98e267e54b7d1327b0c11034d27ea761219b2e5cfe9818d86cffe99eef3dc97cc017aee64cd55cc3b73435adf2ab5bcab05a07c353572988a2eafa94df23d9eb316a690ee1fa715322df77c9646eb60615f109808697afd27d2a7a0b47de845eba0989130e198b6554e8142693937e13ee70fed08a46afcd3ed3e488145c984597da6cff5ac9b105df38d2fcdb90ac40c29db5fe5683f360564fdc715e384f9ab30bbeb690b3de0538d3891bd278245e4cbd9f0fb77c1f0c0fd53a10a2676d77ee0d4c2839631dff8e887130787bd74038d1a95159960d7b36415ac2cbc2efebdd4cf914c2fcafc3527c989658c46f71ee3d982ab03c79ea1da0b0d2e34f55753b8c47de372f41d89225374a79511ffcfd23ee5283d7f74d7a5fd1af611092afd9d62eef91a72ae605838329e0d7c5d49a0980a86b08702bd2d427d6b7069b6ae72a1dc9a51371697c0b0099208d68eff71dd4e9279908dde601043a058dfb54985ac486428239c3806da39bd19a7ec87c0ceef07438c54229bee00b16ec8fbc6c6c63e8e2e64af76188e338e72ba671748d089dcf1e59898fa1e3eb5b768f7883d69bbfac5b4ca995b6d86e3b29ba0a611ce171b66e28e2693f544d2aa083748d6682f32bb77b216658cfdf4fdd6dd0b770586f0d41382a5c9d55fcbe2e29026b136ba3b6993da0401291dbca537fa1d776e7edd9c36da8a4e8b0d43b4ff56fc24be4e975ff2aeaae233978e5453151b004242531436378838e96a2b1b2c5050b2123393f43474b546a7274828a9ebecce7f603040d1e626d818cc6d3d6dbe2e3090a1219252a2c3b5a707376787b878ccad6f6242a3943526e709facb1c7ce21294b65676d6f90acbfc7f700000000000000000000000000000000000000000000000000000000000e2230434f5bd900128a030a4584009a2a4880018077042031214040844084041004100482506c8bcaf4ac2d88019870b73ef275bea210fd3d73d32aa9c2b927f074ae1c8293adb13b4bad0c40dc02b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71af4009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6", + "type": "nulldata" + } + } + ], + "vjoinsplit": [], + "valueBalance": 0.0, + "vShieldedSpend": [], + "vShieldedOutput": [], + "blockhash": "008f460bf2f4895a83f7b1b7a862b3533d23d4b47b6c941e82bf6a8e84942a51", + "height": 27789, + "confirmations": 92, + "rawconfirmations": 92, + "time": 1552871050, + "blocktime": 1552871050 + } + ``` + + +#### Breaking Down the Response + +Let's pull this apart piece by piece. We begin with the input. + +###### Transaction Vins (Inputs) + +```json +{ + "vin": [ + { + "txid": "c314304cecded6cd593daeddf676b2a8c424a604f973e68e6777b84e39ef8548", + "vout": 0, + "address": "RWzd2iZT7rTU91mJVXzXpK8NWseMgZnW74", + "scriptSig": { + "asm": "a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b814057c2e1283008cc9a3b140705c1550be6f691d79cadcb422714b62038ebd1b9682a124ac45c939653c66f83f0ac919deadb390b07964dade6d3b904bcbe27d339a100af03800113a10001", + "hex": "4c79a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b814057c2e1283008cc9a3b140705c1550be6f691d79cadcb422714b62038ebd1b9682a124ac45c939653c66f83f0ac919deadb390b07964dade6d3b904bcbe27d339a100af03800113a10001" + }, + "value": 7.77, + "valueSat": 777000000, + "address": "RWzd2iZT7rTU91mJVXzXpK8NWseMgZnW74", + "sequence": 4294967295 + } + ] +} +``` + +We see that this input comes from our transaction created in a previous step. The address `RWzd2iZT7rTU91mJVXzXpK8NWseMgZnW74` is associated with our handle. + +An important rule to point out here is that there can be any number of inputs (technically called "vins"), but they all must come from the same handle. + +###### Observe the Vouts (Outputs) + +```json +{ + "vout": [ + { + "value": 0.1, + "valueSat": 10000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7"] + }, + "spentTxId": "6638c62562a9a9e5cf78cdcd7c77aa54746822bddce9b318d09f5ede565145f5", + "spentIndex": 0, + "spentHeight": 27853 + }, + { + "value": 7.6699, + "valueSat": 766990000, + "n": 1, + "scriptPubKey": { + "asm": "a22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RWzd2iZT7rTU91mJVXzXpK8NWseMgZnW74"] + }, + "spentTxId": "5aaf4007d6d9af7883da1ad464b63fff9d97453efe0b181d19558cc15f6ff668", + "spentIndex": 0, + "spentHeight": 27878 + }, + { + "value": 0.0, + "valueSat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN 13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460d27a46ee2b83f54a05dede8982e0b65247365b108e42493ddc6cedb0ad0b73c109451aecdbb5adbfbf887f078bc6f66ef9a323abf440535248e2851ccdcdb732678a10e34a5c01127696d220057227b8b078a99c31b8c51c3695c62ca82630aaba41653d4a3743044056365797ad6fed6ef1aee88e0f7e3a56b6aba07cea2e9f7890808b27f4bb825b3050f2ca526002edac45d5c7b0db51e01d203b25578d311a268766f51f3c9dcf93818f5f7c3b2df5aa66c43bcb5f4f460a1cf17fe8b201459fd6a2aed7c5a368b1ffb13ef407053b9314cdef3012e6a38d12ff43fbd7771eeceb59f0cc37d7614efbf2c3decb515e7dc7b7f7a80d8406a85c7ca088127af72a83577303275ac6a8d3d261780c3e7c4f6419809bd73e90427d89aa51477eda1c4089e6dc9f40e7aa4b22d4ac3156f4ab0d13ea589cf56507177eeac1f33830e67fd359e788e9015b8d7cca0ba6fb4d60c2d6171975965db54e94296d853d495fa3139b8638c7c7758f515e78c598a27996ae86378eff6269aa202660b7194b4784b185a5b9116b837c480d9f2c09c15f663f99d4d9464a94817f9a13e906675a979ba4f08d321a83dbbc849e243db47e903d575b5bbf693ca81ebd2f31edb09b206861dc9a4979214ce0db48c3e1254fbfd3cbc1e23ce715da0070e6126af21bdad5d54d5c7ac6f4a70877b090c9103891726797e3cdf79080eac27875aeacf5c58a3c656f6514951e201ffe97a83fec4ee0ed1b0c19b4ea86f1ffd1461003ad48e783a6e4a4bd8372171e3a8363f92aa800fa0667ce0d0802293996e318e42259d1ca30d219048e09a0ac7ee3bda103d02c9d8b5379b10a226fa4169a51a366a4b8e2c42cb55df56a55cdad844400d64daa3be042b893485010611410fa19b7e4b28d35f2a9a44505dd4b105b92612c7e65b659a18e2459d53749f0d2a08c252978f39526311fcbc13b22c816ca4ab8ea9370161aecda22d6080ab1b0e58ef67740d2ae951ef562ae90652a9260dfa68d40e93796ca1e00d1ea63d45e9e9c384b2c0c7f847c94586ddda9939553574a373d2dd8f309b39b3af5d2962e16d132959b229d590ddc79f0a292db2180712b54a74246cf428d1b1772a89346b824822b0f76290d4d32bc55607ad77b1184fdf16ee23039abf2f64e567e5e9fe97193245562284638290a5b024f170b05dcb9db843350e8c757998f003122f89207e72ada0cefe02d7e42d5aecc9044eee13de5f4282c935f2bfbc8f1e987e01cd5030c39588bcd9d4dd064a9b7e1dbab5914ff1204f2321c4d6e438496f86dc1b5b9556c75fbf3155025679c4f8ad9bc784ea58c8ace5674fc69662da2a76e10d030d3e0af2909dffa005889f01a465bfdd8944cdf4a08432377c9c751f150a430b60a665e8351ca1d708dd7be9637dd0d4deb9c1e402b15c05ffee8a1fc6fe750d5a9f49f8bb13321b30c3d14f859a322595f19800f1da8c84a5a9c036de27b014f8a070d2f2b173c33cf3cc62f799d37f125055446d9d156999e267a2a9299fb95feb99e3da76285580597374c90ac51a858933a85450716842ab56d5fb9e8dd748b04e190b18111de7d9622462fde10a1a524ca886e4f1f7a3ee2cdb590b500033da27dddc5f1879b5031cd7347469a58f0401b600f71c6b59bf9feedd9be50e76b6e7bd69247e0d1ffb75d8099ccfbae3cd86db81b8845ec37f812918bb2f61d1e92fc488ea1e8a2fac18062b8877a8833b4d1823d23792faba5ce210df7cf5b433082b9844de3bbe9552422edd0f07973ee8219512a4050834eedc1be50962565a5d4b7d5b7d05fff4b9144439b3f1d7f5c0930127a418b3298f220737a6232b06042f8058aa9805396feae77e1024c950e4f7b8ba91dcff086e28fd3bfbc0e29683dabe09a80df58d74eeeef7787ce4848b9e62acd87fa6647257f728137326b89c544bfa6b3f38d75ca151e16786e781ee7a6619b70d78f0dd84e71f6314f6d8cda21ac823db28e2303a1b44ecc3f2b5de22deb91942e758da9427452bec2a695fd9b7531cf77bdcf32f9fccd46879b3bfa9b33e4a21b485ad8d04cc6ce89ad45b7d43182975a7c458145598de71c95b803038c315c68ac3927ba6e7c14964176068b0a85bd7b50da987fa0ca2f6fe270decb81be28d54cedbd53adeceaf50cedd1fbe825811838723aa332621b0af0547b1c142e818ed5f200cd88f5d22cc83d276992182928123923a9ee66bcc91fd790bf12e0e116516fcf11137eb7c8fde1ef8269f001ffb2a9b5d12f9f643f3274eed98db6d62db35810521473b4962542706d1ac9740fc9a9fc417e06012c69462e37d724e4e86a1181d254351baf147c10ecf90274416ca86c494c66e7dad4f40d2de90b3055b7dc67c50e33ac2e81bfcf5160d8fc7ba573db2e5ad2ab10708206f59ea65523211456313d44c59b56eaaa576f6973ca1c41afd8ab88d719857c306a77af2a3ff9c37b317e778eb9cf274a920dd030ac407a7a29b57aa849b5aa2bd5416c7b1d6f4e892cdff1a26bf0822cadb4901a9d61c6453dfd419428dce701d2e569ada451cc3fbb1b527731cbd428681c8f3967d59b812d24d3437380294e766a8d74aa9185d17e150d126f4600057794a7e84722aa0fdf990bb9f271935f2c82f957a1af8ba36bdbb592193e358df04d311cd687ab57fef240443f5c0d2e443f9da2e91742d35d7995d648cdcc5961cc176b21ce4c9045a20654741551cb908f4a2237d6e2e38d1254990a60d2e2ec90305f594469a9fe347bbf20f64bcbb0983b1fec37b6c3356e0ffc7bab225249650dff4e7cc403eb2bb900faf96db6eee468cd6bb4ff40663d26c8dfb5f710036a673be8d1f3d14f6e4594771c15269b404c12f4a1a1746e8b70e5b0524515d4ff394386355e0b0df36d7c1d298d3a3757111a6519a7d8503f2efdac07112ed8f127be8d899dc5b3591b20d4305c9e3517a5ffac0b2a68c3079f7bae30fc28a2cb2d68e1d5640be3cd24ef3a7961d1c4325a2562fe412a1096a03c8f62cdd45a6be28df3e812d2c6f9e2b009fc5ec76b34e2a06df5d13a1c19f236a8a37a2303e6a0527909ec120b3f77a5a9ec3c4f3a61de00b1a02b3dcb1a1be67ba3da69a8919a331d343828b013667664e800fbfb3bc69d91e5c426089fc13517216aa6e277562b5800adccb897f096e30a08cd8f2edbc54be3ed6d37b713c789119f0af7eb88b0ca262cc7a84bcf56b4b620a140b284ef2278d05ea9de113b01724331c84f7e8a3d42c421e9856439e2aafa1e50e68104a5a9c54ebf2e8889a20553daece7dc4156324f3400c60e574d0ca4fa627afd60dd3850aa60759733a3ecbb2cb6abe61be7d92120ee2404ad8fa6185c8825b7e325937195c3bf86b5458dd1c946642565b9c7bf9cd1c4e21e9648466a9ec8581ab7644db95dcc2b386afeaeb3b39099ddf0e38a500d6c6ce7a4eb8d4647524f02a4e877cc397138a0856058e6ec0d47f2a6da3746174e56c6107a5f4b67632b3730d467fd14a848f111f09df42e53b3a80260a26fe053527b7ffe830a3399ea8b92f3c13e7b8894688bcf782ab9906c9d4154244cfdadf99043f1d3da7a95f57e07048602640268c4d871b2500e677359bbaf299a80f12d747223b8110ef5af3b29fd2669a0eb5e6dc9ad89d00aaf8588d16607057de76063b9927a6bcba45b9d92f579e232d93e3061ccab36a3ba2cbe183d95c0f28ee132de264f411f712f3fa3c12e520968e70d5635e4756d114ed96407eb4127d1c98e267e54b7d1327b0c11034d27ea761219b2e5cfe9818d86cffe99eef3dc97cc017aee64cd55cc3b73435adf2ab5bcab05a07c353572988a2eafa94df23d9eb316a690ee1fa715322df77c9646eb60615f109808697afd27d2a7a0b47de845eba0989130e198b6554e8142693937e13ee70fed08a46afcd3ed3e488145c984597da6cff5ac9b105df38d2fcdb90ac40c29db5fe5683f360564fdc715e384f9ab30bbeb690b3de0538d3891bd278245e4cbd9f0fb77c1f0c0fd53a10a2676d77ee0d4c2839631dff8e887130787bd74038d1a95159960d7b36415ac2cbc2efebdd4cf914c2fcafc3527c989658c46f71ee3d982ab03c79ea1da0b0d2e34f55753b8c47de372f41d89225374a79511ffcfd23ee5283d7f74d7a5fd1af611092afd9d62eef91a72ae605838329e0d7c5d49a0980a86b08702bd2d427d6b7069b6ae72a1dc9a51371697c0b0099208d68eff71dd4e9279908dde601043a058dfb54985ac486428239c3806da39bd19a7ec87c0ceef07438c54229bee00b16ec8fbc6c6c63e8e2e64af76188e338e72ba671748d089dcf1e59898fa1e3eb5b768f7883d69bbfac5b4ca995b6d86e3b29ba0a611ce171b66e28e2693f544d2aa083748d6682f32bb77b216658cfdf4fdd6dd0b770586f0d41382a5c9d55fcbe2e29026b136ba3b6993da0401291dbca537fa1d776e7edd9c36da8a4e8b0d43b4ff56fc24be4e975ff2aeaae233978e5453151b004242531436378838e96a2b1b2c5050b2123393f43474b546a7274828a9ebecce7f603040d1e626d818cc6d3d6dbe2e3090a1219252a2c3b5a707376787b878ccad6f6242a3943526e709facb1c7ce21294b65676d6f90acbfc7f700000000000000000000000000000000000000000000000000000000000e2230434f5bd900128a030a4584009a2a4880018077042031214040844084041004100482506c8bcaf4ac2d88019870b73ef275bea210fd3d73d32aa9c2b927f074ae1c8293adb13b4bad0c40dc02b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71af4009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6", + "hex": "6a4dac0d13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460d27a46ee2b83f54a05dede8982e0b65247365b108e42493ddc6cedb0ad0b73c109451aecdbb5adbfbf887f078bc6f66ef9a323abf440535248e2851ccdcdb732678a10e34a5c01127696d220057227b8b078a99c31b8c51c3695c62ca82630aaba41653d4a3743044056365797ad6fed6ef1aee88e0f7e3a56b6aba07cea2e9f7890808b27f4bb825b3050f2ca526002edac45d5c7b0db51e01d203b25578d311a268766f51f3c9dcf93818f5f7c3b2df5aa66c43bcb5f4f460a1cf17fe8b201459fd6a2aed7c5a368b1ffb13ef407053b9314cdef3012e6a38d12ff43fbd7771eeceb59f0cc37d7614efbf2c3decb515e7dc7b7f7a80d8406a85c7ca088127af72a83577303275ac6a8d3d261780c3e7c4f6419809bd73e90427d89aa51477eda1c4089e6dc9f40e7aa4b22d4ac3156f4ab0d13ea589cf56507177eeac1f33830e67fd359e788e9015b8d7cca0ba6fb4d60c2d6171975965db54e94296d853d495fa3139b8638c7c7758f515e78c598a27996ae86378eff6269aa202660b7194b4784b185a5b9116b837c480d9f2c09c15f663f99d4d9464a94817f9a13e906675a979ba4f08d321a83dbbc849e243db47e903d575b5bbf693ca81ebd2f31edb09b206861dc9a4979214ce0db48c3e1254fbfd3cbc1e23ce715da0070e6126af21bdad5d54d5c7ac6f4a70877b090c9103891726797e3cdf79080eac27875aeacf5c58a3c656f6514951e201ffe97a83fec4ee0ed1b0c19b4ea86f1ffd1461003ad48e783a6e4a4bd8372171e3a8363f92aa800fa0667ce0d0802293996e318e42259d1ca30d219048e09a0ac7ee3bda103d02c9d8b5379b10a226fa4169a51a366a4b8e2c42cb55df56a55cdad844400d64daa3be042b893485010611410fa19b7e4b28d35f2a9a44505dd4b105b92612c7e65b659a18e2459d53749f0d2a08c252978f39526311fcbc13b22c816ca4ab8ea9370161aecda22d6080ab1b0e58ef67740d2ae951ef562ae90652a9260dfa68d40e93796ca1e00d1ea63d45e9e9c384b2c0c7f847c94586ddda9939553574a373d2dd8f309b39b3af5d2962e16d132959b229d590ddc79f0a292db2180712b54a74246cf428d1b1772a89346b824822b0f76290d4d32bc55607ad77b1184fdf16ee23039abf2f64e567e5e9fe97193245562284638290a5b024f170b05dcb9db843350e8c757998f003122f89207e72ada0cefe02d7e42d5aecc9044eee13de5f4282c935f2bfbc8f1e987e01cd5030c39588bcd9d4dd064a9b7e1dbab5914ff1204f2321c4d6e438496f86dc1b5b9556c75fbf3155025679c4f8ad9bc784ea58c8ace5674fc69662da2a76e10d030d3e0af2909dffa005889f01a465bfdd8944cdf4a08432377c9c751f150a430b60a665e8351ca1d708dd7be9637dd0d4deb9c1e402b15c05ffee8a1fc6fe750d5a9f49f8bb13321b30c3d14f859a322595f19800f1da8c84a5a9c036de27b014f8a070d2f2b173c33cf3cc62f799d37f125055446d9d156999e267a2a9299fb95feb99e3da76285580597374c90ac51a858933a85450716842ab56d5fb9e8dd748b04e190b18111de7d9622462fde10a1a524ca886e4f1f7a3ee2cdb590b500033da27dddc5f1879b5031cd7347469a58f0401b600f71c6b59bf9feedd9be50e76b6e7bd69247e0d1ffb75d8099ccfbae3cd86db81b8845ec37f812918bb2f61d1e92fc488ea1e8a2fac18062b8877a8833b4d1823d23792faba5ce210df7cf5b433082b9844de3bbe9552422edd0f07973ee8219512a4050834eedc1be50962565a5d4b7d5b7d05fff4b9144439b3f1d7f5c0930127a418b3298f220737a6232b06042f8058aa9805396feae77e1024c950e4f7b8ba91dcff086e28fd3bfbc0e29683dabe09a80df58d74eeeef7787ce4848b9e62acd87fa6647257f728137326b89c544bfa6b3f38d75ca151e16786e781ee7a6619b70d78f0dd84e71f6314f6d8cda21ac823db28e2303a1b44ecc3f2b5de22deb91942e758da9427452bec2a695fd9b7531cf77bdcf32f9fccd46879b3bfa9b33e4a21b485ad8d04cc6ce89ad45b7d43182975a7c458145598de71c95b803038c315c68ac3927ba6e7c14964176068b0a85bd7b50da987fa0ca2f6fe270decb81be28d54cedbd53adeceaf50cedd1fbe825811838723aa332621b0af0547b1c142e818ed5f200cd88f5d22cc83d276992182928123923a9ee66bcc91fd790bf12e0e116516fcf11137eb7c8fde1ef8269f001ffb2a9b5d12f9f643f3274eed98db6d62db35810521473b4962542706d1ac9740fc9a9fc417e06012c69462e37d724e4e86a1181d254351baf147c10ecf90274416ca86c494c66e7dad4f40d2de90b3055b7dc67c50e33ac2e81bfcf5160d8fc7ba573db2e5ad2ab10708206f59ea65523211456313d44c59b56eaaa576f6973ca1c41afd8ab88d719857c306a77af2a3ff9c37b317e778eb9cf274a920dd030ac407a7a29b57aa849b5aa2bd5416c7b1d6f4e892cdff1a26bf0822cadb4901a9d61c6453dfd419428dce701d2e569ada451cc3fbb1b527731cbd428681c8f3967d59b812d24d3437380294e766a8d74aa9185d17e150d126f4600057794a7e84722aa0fdf990bb9f271935f2c82f957a1af8ba36bdbb592193e358df04d311cd687ab57fef240443f5c0d2e443f9da2e91742d35d7995d648cdcc5961cc176b21ce4c9045a20654741551cb908f4a2237d6e2e38d1254990a60d2e2ec90305f594469a9fe347bbf20f64bcbb0983b1fec37b6c3356e0ffc7bab225249650dff4e7cc403eb2bb900faf96db6eee468cd6bb4ff40663d26c8dfb5f710036a673be8d1f3d14f6e4594771c15269b404c12f4a1a1746e8b70e5b0524515d4ff394386355e0b0df36d7c1d298d3a3757111a6519a7d8503f2efdac07112ed8f127be8d899dc5b3591b20d4305c9e3517a5ffac0b2a68c3079f7bae30fc28a2cb2d68e1d5640be3cd24ef3a7961d1c4325a2562fe412a1096a03c8f62cdd45a6be28df3e812d2c6f9e2b009fc5ec76b34e2a06df5d13a1c19f236a8a37a2303e6a0527909ec120b3f77a5a9ec3c4f3a61de00b1a02b3dcb1a1be67ba3da69a8919a331d343828b013667664e800fbfb3bc69d91e5c426089fc13517216aa6e277562b5800adccb897f096e30a08cd8f2edbc54be3ed6d37b713c789119f0af7eb88b0ca262cc7a84bcf56b4b620a140b284ef2278d05ea9de113b01724331c84f7e8a3d42c421e9856439e2aafa1e50e68104a5a9c54ebf2e8889a20553daece7dc4156324f3400c60e574d0ca4fa627afd60dd3850aa60759733a3ecbb2cb6abe61be7d92120ee2404ad8fa6185c8825b7e325937195c3bf86b5458dd1c946642565b9c7bf9cd1c4e21e9648466a9ec8581ab7644db95dcc2b386afeaeb3b39099ddf0e38a500d6c6ce7a4eb8d4647524f02a4e877cc397138a0856058e6ec0d47f2a6da3746174e56c6107a5f4b67632b3730d467fd14a848f111f09df42e53b3a80260a26fe053527b7ffe830a3399ea8b92f3c13e7b8894688bcf782ab9906c9d4154244cfdadf99043f1d3da7a95f57e07048602640268c4d871b2500e677359bbaf299a80f12d747223b8110ef5af3b29fd2669a0eb5e6dc9ad89d00aaf8588d16607057de76063b9927a6bcba45b9d92f579e232d93e3061ccab36a3ba2cbe183d95c0f28ee132de264f411f712f3fa3c12e520968e70d5635e4756d114ed96407eb4127d1c98e267e54b7d1327b0c11034d27ea761219b2e5cfe9818d86cffe99eef3dc97cc017aee64cd55cc3b73435adf2ab5bcab05a07c353572988a2eafa94df23d9eb316a690ee1fa715322df77c9646eb60615f109808697afd27d2a7a0b47de845eba0989130e198b6554e8142693937e13ee70fed08a46afcd3ed3e488145c984597da6cff5ac9b105df38d2fcdb90ac40c29db5fe5683f360564fdc715e384f9ab30bbeb690b3de0538d3891bd278245e4cbd9f0fb77c1f0c0fd53a10a2676d77ee0d4c2839631dff8e887130787bd74038d1a95159960d7b36415ac2cbc2efebdd4cf914c2fcafc3527c989658c46f71ee3d982ab03c79ea1da0b0d2e34f55753b8c47de372f41d89225374a79511ffcfd23ee5283d7f74d7a5fd1af611092afd9d62eef91a72ae605838329e0d7c5d49a0980a86b08702bd2d427d6b7069b6ae72a1dc9a51371697c0b0099208d68eff71dd4e9279908dde601043a058dfb54985ac486428239c3806da39bd19a7ec87c0ceef07438c54229bee00b16ec8fbc6c6c63e8e2e64af76188e338e72ba671748d089dcf1e59898fa1e3eb5b768f7883d69bbfac5b4ca995b6d86e3b29ba0a611ce171b66e28e2693f544d2aa083748d6682f32bb77b216658cfdf4fdd6dd0b770586f0d41382a5c9d55fcbe2e29026b136ba3b6993da0401291dbca537fa1d776e7edd9c36da8a4e8b0d43b4ff56fc24be4e975ff2aeaae233978e5453151b004242531436378838e96a2b1b2c5050b2123393f43474b546a7274828a9ebecce7f603040d1e626d818cc6d3d6dbe2e3090a1219252a2c3b5a707376787b878ccad6f6242a3943526e709facb1c7ce21294b65676d6f90acbfc7f700000000000000000000000000000000000000000000000000000000000e2230434f5bd900128a030a4584009a2a4880018077042031214040844084041004100482506c8bcaf4ac2d88019870b73ef275bea210fd3d73d32aa9c2b927f074ae1c8293adb13b4bad0c40dc02b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71af4009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6", + "type": "nulldata" + } + } + ] +} +``` + +###### The First Output (vout0) + +In the first output (technically called a "vout") we see the address associated with the `KomodoFan` handle: `RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7` + +`0.1` coins are sent to this address. + +The `type` key shows a value of `cryptoconditions`, indicating that this transaction is now associated with the Dilithium Antara Module. + +##### (Optional) Check the Address Belongs to the Handle + +Recall that in the Antara Framework every `pubkey` address has a unique Antara Address for each module. + +All handles created under the same `pubkey` will store their Qutxos in an Antara Address that is unique both to the `pubkey` and to the Dilithium Module. + +Therefore, the Dilithium handle is tied to the associated Dilithium Antara Address and `pubkey` as well. + +Use the [cclibaddress](/smart-chains/api/cclib/#cclibaddress) RPC to verify that we have KomodoFan's Antara Address. + +To achieve this, we use the `pubkey` returned from the `cclib handleinfo 19 "[%22KomodoFan%22]"` command we executed previously. + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclibaddress 19 03cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61 +``` + +```json +{ + "result": "success", + "CClibCCAddress": "RJxChTpGrT8Y64NxTK95TVs3r8wPCwswKF", + "CClibCCBalance": 0.0098, + "CClibNormalAddress": "RCUDfxQCgXpB8bKqkzwBrR4cG8HxjAzJ7Y", + "CClibNormalBalance": 0.0, + "CClibCCTokensAddress": "RJzz5iNW4fa8epQJH81CNK5vqPv8PzGz6A", + "PubkeyCCaddress(CClib)": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "PubkeyCCbalance(CClib)": 5.3996, + "myCCAddress(CClib)": "RWzd2iZT7rTU91mJVXzXpK8NWseMgZnW74", + "myCCbalance(CClib)": 7.67, + "myaddress": "RVXJpc9N4j35psbqmRZzgpKmo98w1CnvHA", + "mybalance": 91.2296 +} +``` + +As shown above, the `"PubkeyCCaddress(CClib)"` provides a matching address for `KomodoFan`. + +###### The Second Output (vout1) + +The second output (also called `vout1`) is the change qutxo that sends our leftover funds back to our `KomodoHaxor` Antara Address. + +To verify that this is the correct Antara address, we can again utlize the cclibaddress RPC. + +###### Command + +```bash +./komodo-cli -ac_name=MUSIG cclibaddress 19 +``` + +###### Response + +```json +{ + "result": "success", + "CClibCCAddress": "RJxChTpGrT8Y64NxTK95TVs3r8wPCwswKF", + "CClibCCBalance": 0.0098, + "CClibNormalAddress": "RCUDfxQCgXpB8bKqkzwBrR4cG8HxjAzJ7Y", + "CClibNormalBalance": 0.0, + "CClibCCTokensAddress": "RJzz5iNW4fa8epQJH81CNK5vqPv8PzGz6A", + "myCCAddress(CClib)": "RWzd2iZT7rTU91mJVXzXpK8NWseMgZnW74", + "myCCbalance(CClib)": 7.67, + "myaddress": "RVXJpc9N4j35psbqmRZzgpKmo98w1CnvHA", + "mybalance": 91.2296 +} +``` + +The value of `"myCCAddress(CClib)"` matches the output. + +###### The Final Output (opreturn vout) + +The final output (which we can also call `vout2` or `opreturn vout`) contains our OP\_RETURN data. + +This `hex` value of this output contains needed information about the `destpubtxid` of the inputs and the `destpubtxids` of the outputs. + +```json +{ + "value": 0.0, + "valueZat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN 13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460d27a46ee2b83f54a05dede8982e0b65247365b108e42493ddc6cedb0ad0b73c109451aecdbb5adbfbf887f078bc6f66ef9a323abf440535248e2851ccdcdb732678a10e34a5c01127696d220057227b8b078a99c31b8c51c3695c62ca82630aaba41653d4a3743044056365797ad6fed6ef1aee88e0f7e3a56b6aba07cea2e9f7890808b27f4bb825b3050f2ca526002edac45d5c7b0db51e01d203b25578d311a268766f51f3c9dcf93818f5f7c3b2df5aa66c43bcb5f4f460a1cf17fe8b201459fd6a2aed7c5a368b1ffb13ef407053b9314cdef3012e6a38d12ff43fbd7771eeceb59f0cc37d7614efbf2c3decb515e7dc7b7f7a80d8406a85c7ca088127af72a83577303275ac6a8d3d261780c3e7c4f6419809bd73e90427d89aa51477eda1c4089e6dc9f40e7aa4b22d4ac3156f4ab0d13ea589cf56507177eeac1f33830e67fd359e788e9015b8d7cca0ba6fb4d60c2d6171975965db54e94296d853d495fa3139b8638c7c7758f515e78c598a27996ae86378eff6269aa202660b7194b4784b185a5b9116b837c480d9f2c09c15f663f99d4d9464a94817f9a13e906675a979ba4f08d321a83dbbc849e243db47e903d575b5bbf693ca81ebd2f31edb09b206861dc9a4979214ce0db48c3e1254fbfd3cbc1e23ce715da0070e6126af21bdad5d54d5c7ac6f4a70877b090c9103891726797e3cdf79080eac27875aeacf5c58a3c656f6514951e201ffe97a83fec4ee0ed1b0c19b4ea86f1ffd1461003ad48e783a6e4a4bd8372171e3a8363f92aa800fa0667ce0d0802293996e318e42259d1ca30d219048e09a0ac7ee3bda103d02c9d8b5379b10a226fa4169a51a366a4b8e2c42cb55df56a55cdad844400d64daa3be042b893485010611410fa19b7e4b28d35f2a9a44505dd4b105b92612c7e65b659a18e2459d53749f0d2a08c252978f39526311fcbc13b22c816ca4ab8ea9370161aecda22d6080ab1b0e58ef67740d2ae951ef562ae90652a9260dfa68d40e93796ca1e00d1ea63d45e9e9c384b2c0c7f847c94586ddda9939553574a373d2dd8f309b39b3af5d2962e16d132959b229d590ddc79f0a292db2180712b54a74246cf428d1b1772a89346b824822b0f76290d4d32bc55607ad77b1184fdf16ee23039abf2f64e567e5e9fe97193245562284638290a5b024f170b05dcb9db843350e8c757998f003122f89207e72ada0cefe02d7e42d5aecc9044eee13de5f4282c935f2bfbc8f1e987e01cd5030c39588bcd9d4dd064a9b7e1dbab5914ff1204f2321c4d6e438496f86dc1b5b9556c75fbf3155025679c4f8ad9bc784ea58c8ace5674fc69662da2a76e10d030d3e0af2909dffa005889f01a465bfdd8944cdf4a08432377c9c751f150a430b60a665e8351ca1d708dd7be9637dd0d4deb9c1e402b15c05ffee8a1fc6fe750d5a9f49f8bb13321b30c3d14f859a322595f19800f1da8c84a5a9c036de27b014f8a070d2f2b173c33cf3cc62f799d37f125055446d9d156999e267a2a9299fb95feb99e3da76285580597374c90ac51a858933a85450716842ab56d5fb9e8dd748b04e190b18111de7d9622462fde10a1a524ca886e4f1f7a3ee2cdb590b500033da27dddc5f1879b5031cd7347469a58f0401b600f71c6b59bf9feedd9be50e76b6e7bd69247e0d1ffb75d8099ccfbae3cd86db81b8845ec37f812918bb2f61d1e92fc488ea1e8a2fac18062b8877a8833b4d1823d23792faba5ce210df7cf5b433082b9844de3bbe9552422edd0f07973ee8219512a4050834eedc1be50962565a5d4b7d5b7d05fff4b9144439b3f1d7f5c0930127a418b3298f220737a6232b06042f8058aa9805396feae77e1024c950e4f7b8ba91dcff086e28fd3bfbc0e29683dabe09a80df58d74eeeef7787ce4848b9e62acd87fa6647257f728137326b89c544bfa6b3f38d75ca151e16786e781ee7a6619b70d78f0dd84e71f6314f6d8cda21ac823db28e2303a1b44ecc3f2b5de22deb91942e758da9427452bec2a695fd9b7531cf77bdcf32f9fccd46879b3bfa9b33e4a21b485ad8d04cc6ce89ad45b7d43182975a7c458145598de71c95b803038c315c68ac3927ba6e7c14964176068b0a85bd7b50da987fa0ca2f6fe270decb81be28d54cedbd53adeceaf50cedd1fbe825811838723aa332621b0af0547b1c142e818ed5f200cd88f5d22cc83d276992182928123923a9ee66bcc91fd790bf12e0e116516fcf11137eb7c8fde1ef8269f001ffb2a9b5d12f9f643f3274eed98db6d62db35810521473b4962542706d1ac9740fc9a9fc417e06012c69462e37d724e4e86a1181d254351baf147c10ecf90274416ca86c494c66e7dad4f40d2de90b3055b7dc67c50e33ac2e81bfcf5160d8fc7ba573db2e5ad2ab10708206f59ea65523211456313d44c59b56eaaa576f6973ca1c41afd8ab88d719857c306a77af2a3ff9c37b317e778eb9cf274a920dd030ac407a7a29b57aa849b5aa2bd5416c7b1d6f4e892cdff1a26bf0822cadb4901a9d61c6453dfd419428dce701d2e569ada451cc3fbb1b527731cbd428681c8f3967d59b812d24d3437380294e766a8d74aa9185d17e150d126f4600057794a7e84722aa0fdf990bb9f271935f2c82f957a1af8ba36bdbb592193e358df04d311cd687ab57fef240443f5c0d2e443f9da2e91742d35d7995d648cdcc5961cc176b21ce4c9045a20654741551cb908f4a2237d6e2e38d1254990a60d2e2ec90305f594469a9fe347bbf20f64bcbb0983b1fec37b6c3356e0ffc7bab225249650dff4e7cc403eb2bb900faf96db6eee468cd6bb4ff40663d26c8dfb5f710036a673be8d1f3d14f6e4594771c15269b404c12f4a1a1746e8b70e5b0524515d4ff394386355e0b0df36d7c1d298d3a3757111a6519a7d8503f2efdac07112ed8f127be8d899dc5b3591b20d4305c9e3517a5ffac0b2a68c3079f7bae30fc28a2cb2d68e1d5640be3cd24ef3a7961d1c4325a2562fe412a1096a03c8f62cdd45a6be28df3e812d2c6f9e2b009fc5ec76b34e2a06df5d13a1c19f236a8a37a2303e6a0527909ec120b3f77a5a9ec3c4f3a61de00b1a02b3dcb1a1be67ba3da69a8919a331d343828b013667664e800fbfb3bc69d91e5c426089fc13517216aa6e277562b5800adccb897f096e30a08cd8f2edbc54be3ed6d37b713c789119f0af7eb88b0ca262cc7a84bcf56b4b620a140b284ef2278d05ea9de113b01724331c84f7e8a3d42c421e9856439e2aafa1e50e68104a5a9c54ebf2e8889a20553daece7dc4156324f3400c60e574d0ca4fa627afd60dd3850aa60759733a3ecbb2cb6abe61be7d92120ee2404ad8fa6185c8825b7e325937195c3bf86b5458dd1c946642565b9c7bf9cd1c4e21e9648466a9ec8581ab7644db95dcc2b386afeaeb3b39099ddf0e38a500d6c6ce7a4eb8d4647524f02a4e877cc397138a0856058e6ec0d47f2a6da3746174e56c6107a5f4b67632b3730d467fd14a848f111f09df42e53b3a80260a26fe053527b7ffe830a3399ea8b92f3c13e7b8894688bcf782ab9906c9d4154244cfdadf99043f1d3da7a95f57e07048602640268c4d871b2500e677359bbaf299a80f12d747223b8110ef5af3b29fd2669a0eb5e6dc9ad89d00aaf8588d16607057de76063b9927a6bcba45b9d92f579e232d93e3061ccab36a3ba2cbe183d95c0f28ee132de264f411f712f3fa3c12e520968e70d5635e4756d114ed96407eb4127d1c98e267e54b7d1327b0c11034d27ea761219b2e5cfe9818d86cffe99eef3dc97cc017aee64cd55cc3b73435adf2ab5bcab05a07c353572988a2eafa94df23d9eb316a690ee1fa715322df77c9646eb60615f109808697afd27d2a7a0b47de845eba0989130e198b6554e8142693937e13ee70fed08a46afcd3ed3e488145c984597da6cff5ac9b105df38d2fcdb90ac40c29db5fe5683f360564fdc715e384f9ab30bbeb690b3de0538d3891bd278245e4cbd9f0fb77c1f0c0fd53a10a2676d77ee0d4c2839631dff8e887130787bd74038d1a95159960d7b36415ac2cbc2efebdd4cf914c2fcafc3527c989658c46f71ee3d982ab03c79ea1da0b0d2e34f55753b8c47de372f41d89225374a79511ffcfd23ee5283d7f74d7a5fd1af611092afd9d62eef91a72ae605838329e0d7c5d49a0980a86b08702bd2d427d6b7069b6ae72a1dc9a51371697c0b0099208d68eff71dd4e9279908dde601043a058dfb54985ac486428239c3806da39bd19a7ec87c0ceef07438c54229bee00b16ec8fbc6c6c63e8e2e64af76188e338e72ba671748d089dcf1e59898fa1e3eb5b768f7883d69bbfac5b4ca995b6d86e3b29ba0a611ce171b66e28e2693f544d2aa083748d6682f32bb77b216658cfdf4fdd6dd0b770586f0d41382a5c9d55fcbe2e29026b136ba3b6993da0401291dbca537fa1d776e7edd9c36da8a4e8b0d43b4ff56fc24be4e975ff2aeaae233978e5453151b004242531436378838e96a2b1b2c5050b2123393f43474b546a7274828a9ebecce7f603040d1e626d818cc6d3d6dbe2e3090a1219252a2c3b5a707376787b878ccad6f6242a3943526e709facb1c7ce21294b65676d6f90acbfc7f700000000000000000000000000000000000000000000000000000000000e2230434f5bd900128a030a4584009a2a4880018077042031214040844084041004100482506c8bcaf4ac2d88019870b73ef275bea210fd3d73d32aa9c2b927f074ae1c8293adb13b4bad0c40dc02b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71af4009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6", + "hex": "6a4dac0d13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460d27a46ee2b83f54a05dede8982e0b65247365b108e42493ddc6cedb0ad0b73c109451aecdbb5adbfbf887f078bc6f66ef9a323abf440535248e2851ccdcdb732678a10e34a5c01127696d220057227b8b078a99c31b8c51c3695c62ca82630aaba41653d4a3743044056365797ad6fed6ef1aee88e0f7e3a56b6aba07cea2e9f7890808b27f4bb825b3050f2ca526002edac45d5c7b0db51e01d203b25578d311a268766f51f3c9dcf93818f5f7c3b2df5aa66c43bcb5f4f460a1cf17fe8b201459fd6a2aed7c5a368b1ffb13ef407053b9314cdef3012e6a38d12ff43fbd7771eeceb59f0cc37d7614efbf2c3decb515e7dc7b7f7a80d8406a85c7ca088127af72a83577303275ac6a8d3d261780c3e7c4f6419809bd73e90427d89aa51477eda1c4089e6dc9f40e7aa4b22d4ac3156f4ab0d13ea589cf56507177eeac1f33830e67fd359e788e9015b8d7cca0ba6fb4d60c2d6171975965db54e94296d853d495fa3139b8638c7c7758f515e78c598a27996ae86378eff6269aa202660b7194b4784b185a5b9116b837c480d9f2c09c15f663f99d4d9464a94817f9a13e906675a979ba4f08d321a83dbbc849e243db47e903d575b5bbf693ca81ebd2f31edb09b206861dc9a4979214ce0db48c3e1254fbfd3cbc1e23ce715da0070e6126af21bdad5d54d5c7ac6f4a70877b090c9103891726797e3cdf79080eac27875aeacf5c58a3c656f6514951e201ffe97a83fec4ee0ed1b0c19b4ea86f1ffd1461003ad48e783a6e4a4bd8372171e3a8363f92aa800fa0667ce0d0802293996e318e42259d1ca30d219048e09a0ac7ee3bda103d02c9d8b5379b10a226fa4169a51a366a4b8e2c42cb55df56a55cdad844400d64daa3be042b893485010611410fa19b7e4b28d35f2a9a44505dd4b105b92612c7e65b659a18e2459d53749f0d2a08c252978f39526311fcbc13b22c816ca4ab8ea9370161aecda22d6080ab1b0e58ef67740d2ae951ef562ae90652a9260dfa68d40e93796ca1e00d1ea63d45e9e9c384b2c0c7f847c94586ddda9939553574a373d2dd8f309b39b3af5d2962e16d132959b229d590ddc79f0a292db2180712b54a74246cf428d1b1772a89346b824822b0f76290d4d32bc55607ad77b1184fdf16ee23039abf2f64e567e5e9fe97193245562284638290a5b024f170b05dcb9db843350e8c757998f003122f89207e72ada0cefe02d7e42d5aecc9044eee13de5f4282c935f2bfbc8f1e987e01cd5030c39588bcd9d4dd064a9b7e1dbab5914ff1204f2321c4d6e438496f86dc1b5b9556c75fbf3155025679c4f8ad9bc784ea58c8ace5674fc69662da2a76e10d030d3e0af2909dffa005889f01a465bfdd8944cdf4a08432377c9c751f150a430b60a665e8351ca1d708dd7be9637dd0d4deb9c1e402b15c05ffee8a1fc6fe750d5a9f49f8bb13321b30c3d14f859a322595f19800f1da8c84a5a9c036de27b014f8a070d2f2b173c33cf3cc62f799d37f125055446d9d156999e267a2a9299fb95feb99e3da76285580597374c90ac51a858933a85450716842ab56d5fb9e8dd748b04e190b18111de7d9622462fde10a1a524ca886e4f1f7a3ee2cdb590b500033da27dddc5f1879b5031cd7347469a58f0401b600f71c6b59bf9feedd9be50e76b6e7bd69247e0d1ffb75d8099ccfbae3cd86db81b8845ec37f812918bb2f61d1e92fc488ea1e8a2fac18062b8877a8833b4d1823d23792faba5ce210df7cf5b433082b9844de3bbe9552422edd0f07973ee8219512a4050834eedc1be50962565a5d4b7d5b7d05fff4b9144439b3f1d7f5c0930127a418b3298f220737a6232b06042f8058aa9805396feae77e1024c950e4f7b8ba91dcff086e28fd3bfbc0e29683dabe09a80df58d74eeeef7787ce4848b9e62acd87fa6647257f728137326b89c544bfa6b3f38d75ca151e16786e781ee7a6619b70d78f0dd84e71f6314f6d8cda21ac823db28e2303a1b44ecc3f2b5de22deb91942e758da9427452bec2a695fd9b7531cf77bdcf32f9fccd46879b3bfa9b33e4a21b485ad8d04cc6ce89ad45b7d43182975a7c458145598de71c95b803038c315c68ac3927ba6e7c14964176068b0a85bd7b50da987fa0ca2f6fe270decb81be28d54cedbd53adeceaf50cedd1fbe825811838723aa332621b0af0547b1c142e818ed5f200cd88f5d22cc83d276992182928123923a9ee66bcc91fd790bf12e0e116516fcf11137eb7c8fde1ef8269f001ffb2a9b5d12f9f643f3274eed98db6d62db35810521473b4962542706d1ac9740fc9a9fc417e06012c69462e37d724e4e86a1181d254351baf147c10ecf90274416ca86c494c66e7dad4f40d2de90b3055b7dc67c50e33ac2e81bfcf5160d8fc7ba573db2e5ad2ab10708206f59ea65523211456313d44c59b56eaaa576f6973ca1c41afd8ab88d719857c306a77af2a3ff9c37b317e778eb9cf274a920dd030ac407a7a29b57aa849b5aa2bd5416c7b1d6f4e892cdff1a26bf0822cadb4901a9d61c6453dfd419428dce701d2e569ada451cc3fbb1b527731cbd428681c8f3967d59b812d24d3437380294e766a8d74aa9185d17e150d126f4600057794a7e84722aa0fdf990bb9f271935f2c82f957a1af8ba36bdbb592193e358df04d311cd687ab57fef240443f5c0d2e443f9da2e91742d35d7995d648cdcc5961cc176b21ce4c9045a20654741551cb908f4a2237d6e2e38d1254990a60d2e2ec90305f594469a9fe347bbf20f64bcbb0983b1fec37b6c3356e0ffc7bab225249650dff4e7cc403eb2bb900faf96db6eee468cd6bb4ff40663d26c8dfb5f710036a673be8d1f3d14f6e4594771c15269b404c12f4a1a1746e8b70e5b0524515d4ff394386355e0b0df36d7c1d298d3a3757111a6519a7d8503f2efdac07112ed8f127be8d899dc5b3591b20d4305c9e3517a5ffac0b2a68c3079f7bae30fc28a2cb2d68e1d5640be3cd24ef3a7961d1c4325a2562fe412a1096a03c8f62cdd45a6be28df3e812d2c6f9e2b009fc5ec76b34e2a06df5d13a1c19f236a8a37a2303e6a0527909ec120b3f77a5a9ec3c4f3a61de00b1a02b3dcb1a1be67ba3da69a8919a331d343828b013667664e800fbfb3bc69d91e5c426089fc13517216aa6e277562b5800adccb897f096e30a08cd8f2edbc54be3ed6d37b713c789119f0af7eb88b0ca262cc7a84bcf56b4b620a140b284ef2278d05ea9de113b01724331c84f7e8a3d42c421e9856439e2aafa1e50e68104a5a9c54ebf2e8889a20553daece7dc4156324f3400c60e574d0ca4fa627afd60dd3850aa60759733a3ecbb2cb6abe61be7d92120ee2404ad8fa6185c8825b7e325937195c3bf86b5458dd1c946642565b9c7bf9cd1c4e21e9648466a9ec8581ab7644db95dcc2b386afeaeb3b39099ddf0e38a500d6c6ce7a4eb8d4647524f02a4e877cc397138a0856058e6ec0d47f2a6da3746174e56c6107a5f4b67632b3730d467fd14a848f111f09df42e53b3a80260a26fe053527b7ffe830a3399ea8b92f3c13e7b8894688bcf782ab9906c9d4154244cfdadf99043f1d3da7a95f57e07048602640268c4d871b2500e677359bbaf299a80f12d747223b8110ef5af3b29fd2669a0eb5e6dc9ad89d00aaf8588d16607057de76063b9927a6bcba45b9d92f579e232d93e3061ccab36a3ba2cbe183d95c0f28ee132de264f411f712f3fa3c12e520968e70d5635e4756d114ed96407eb4127d1c98e267e54b7d1327b0c11034d27ea761219b2e5cfe9818d86cffe99eef3dc97cc017aee64cd55cc3b73435adf2ab5bcab05a07c353572988a2eafa94df23d9eb316a690ee1fa715322df77c9646eb60615f109808697afd27d2a7a0b47de845eba0989130e198b6554e8142693937e13ee70fed08a46afcd3ed3e488145c984597da6cff5ac9b105df38d2fcdb90ac40c29db5fe5683f360564fdc715e384f9ab30bbeb690b3de0538d3891bd278245e4cbd9f0fb77c1f0c0fd53a10a2676d77ee0d4c2839631dff8e887130787bd74038d1a95159960d7b36415ac2cbc2efebdd4cf914c2fcafc3527c989658c46f71ee3d982ab03c79ea1da0b0d2e34f55753b8c47de372f41d89225374a79511ffcfd23ee5283d7f74d7a5fd1af611092afd9d62eef91a72ae605838329e0d7c5d49a0980a86b08702bd2d427d6b7069b6ae72a1dc9a51371697c0b0099208d68eff71dd4e9279908dde601043a058dfb54985ac486428239c3806da39bd19a7ec87c0ceef07438c54229bee00b16ec8fbc6c6c63e8e2e64af76188e338e72ba671748d089dcf1e59898fa1e3eb5b768f7883d69bbfac5b4ca995b6d86e3b29ba0a611ce171b66e28e2693f544d2aa083748d6682f32bb77b216658cfdf4fdd6dd0b770586f0d41382a5c9d55fcbe2e29026b136ba3b6993da0401291dbca537fa1d776e7edd9c36da8a4e8b0d43b4ff56fc24be4e975ff2aeaae233978e5453151b004242531436378838e96a2b1b2c5050b2123393f43474b546a7274828a9ebecce7f603040d1e626d818cc6d3d6dbe2e3090a1219252a2c3b5a707376787b878ccad6f6242a3943526e709facb1c7ce21294b65676d6f90acbfc7f700000000000000000000000000000000000000000000000000000000000e2230434f5bd900128a030a4584009a2a4880018077042031214040844084041004100482506c8bcaf4ac2d88019870b73ef275bea210fd3d73d32aa9c2b927f074ae1c8293adb13b4bad0c40dc02b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71af4009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6", + "type": "nulldata" + } +} +``` + +The hex value contains more information than we need. The full value is as follows: `E_MARSHAL(ss << evalcode << 'Q' << destpubtxid << sig << voutpubtxids)` + +For now, we are only interested in the `destpubtxid` and `voutpubtxids` values. + +The information is hex-encoded and provided in little-endian format. We would like to convert the data into big-endian format. + +There are many methods available for decoding a hex value, and the language of the developer often has built-in functions to accomplish this. For example, [this linked Stack Exchange discussion](https://stackoverflow.com/questions/46109815/convert-string-from-big-endian-to-little-endian-or-vice-versa-in-python) provides possible methods for Python developers. + +Once converted to big endian, we have the following. + +```bash +d60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f230940af710c0fd6aeb54556ee401803bc4cc39ea9002ad5228f308b27eb3af0e4c4b602dc400cad4b3bb1ad93821cae74f027b9c2a92ad3733dfd10a2be75f23eb7709801882dacf4ca8b6c5082041004100484408440402131200477800180482a9a0084450a038a1200d95b4f4330220e0000000000000000000000000000000000000000000000000000000000f7c7bfac906f6d67654b2921cec7b1ac9f706e5243392a24f6d6ca8c877b787673705a3b2c2a2519120a09e3e2dbd6d3c68c816d621e0d0403f6e7ccbe9e8a8274726a544b47433f3923210b05c5b2b1a2968e8378634331252404b0513145e5783923aeea2aff75e9e44bc26ff54f3bd4b0e8a4a86dc3d9ede776d7a17f53cadb911240a03d99b6a36b136b02292ebefc559d5c2a38410d6f5870b7d06ddd4fdfcf5866217bb72bf382668d7483a02a4d543f69e2286eb671e11c610aba293b6ed8b695a94c5bacbf9bd683788f765bebe3a18f89591ecf9d088d7471a62be738e38861f74ae6e2e8636c6cbc8fec160be0be2942c53874f0ee0c7cc87e9ad19ba36d80c339824286c45a9854fb8d053a0401e6dd089927e9d41df7ef688d2099000b7c697113a5c91d2ae76a9b06b7d627d4d22b70086ba880099ad4c5d7e029838305e62aa791ef2ed6d9af921061afd15f7a4df7d78352ee23fdfc1f51794a372592d8412f37de478c3b75554fe3d2b0a01dea793cb02a983dee716fc45896987c52c3affcc214f94cddebefc2cbc25a41367b0d965951a9d13840d77b783071888eff1d6339284c0dee776d67a2103ad50f0c1f7cb70f9fbd4c5e2478d21b89d33805deb390b6be0bb39a4f385e71dc4f5660f38356feb59dc240ac90dbfcd238df05b1c95aff6cda9745985c1488e4d33ecdaf468ad0fe70ee137e93932614e854658b190e138909ba5e84de470b7a2a7dd2af97868009f11506b66e64c977df225371fae10e696a31ebd923df94faeaa288295753c3075ab0ca5babf2ad3534b7c35cd54ce6ae17c07cc93def9ee9ff6cd81898fe5c2e9b2161a77ed23410c1b027137d4be567e2981c7d12b47e4096ed14d156475e63d5708e9620e5123cfaf312f711f464e22d13ee280f5cd983e1cba23b6ab3ca1c06e3932d239e572fd9b945babca627993b0676de577060168d58f8aa009dd89adce6b50e9a66d29fb2f35aef10813b2247d7120fa899f2ba9b3577e600251b874d8c264026604870e0575fa9a73d1d3f0499dfdacf444215d4c90699ab82f7bc884689b8e7133c2fb9a89e39a330e8ffb7273505fe260a26803a3be542df091f118f844ad17f460d73b33276b6f4a507616ce5746174a36d2a7fd4c06e8e0556088a1397c37c874e2af0247564d4b84e7acec6d600a5380edf9d09393bebeaaf86b3c2dc95db4476ab8185eca9668464e9214e1ccdf97b9c5b564266941cdd58546bf83b5c193759327e5b82c88561fad84a40e20e12927dbe61be6acbb2cb3e3a735907a60a85d30dd6af27a64fcad074e5600c40f3246315c47dceae3d55209a88e8f2eb549c5a4a10680ee5a1af2a9e4356981e422cd4a3e8f7841c332417b013e19dea058d27f24e280b140a624b6bf5bc847acc62a20c8bb87eaff01991783c717bd3d63ebe54bcedf2d88ca0306e097f89cbdc0a80b56275276eaa16725113fc8960425c1ed969bcb3bf0f804e666736018b8243d331a319899aa63dba67bea1b1dcb3021a0be01da6f3c4c39e5a7af7b320c19e9027056a3e30a2378a6a239fc1a1135ddf062a4eb376ecc59f002b9e6f2c2d813edf28bea645dd2cf6c8036a09a112e42f56a225431c1d96a7f34ed23cbe40561d8ed6b22c8ac20fe3baf779308ca6b2c0fa5f7a51e3c905430db291355bdc99d8e87b128fed1271c0daeff203857d9a51a6117175a3d398d2c1d736dfb0e055633894f34f5d5124055b0eb7e846171a4a2fc104b46952c1714759e4f6143d1f8dbe73a63600715ffb8d6cd26306f44fbbd68c46ee6edb96af0f90bbb23e40cce7f4df50962425b2bac7ffe056336c7bc3feb18309bbbc640ff2bb47e39f9a4694f50503c92e2e0da6904925d1382e6e7d23a2f408b91c55414765205a04c9e41cb276c11c96c5dc8c645d99d7352d74912edaf943e4d2c0f5430424ef7fb57a68cd11d304df58e3932159bbbd36baf81a7a952fc8f23519279fbb90f9fda02a72847e4a79570060f426d150e1175d18a94ad7a866e794023837344dd212b8597d96f3c8818642bd1c7327b5b1fbc31c45da9a562e1d70ce8d4219d4df53641cd6a90149dbca2208bf261affcd92e8f4d6b1c71654bda25a9b84aa579ba2a707c40a03dd20a974f29ceb78e717b3379cffa3f27aa706c35798718db88afd1ac4a13c97f676a5aa6eb5594cd413634511325265ea596f200807b12aade5b23d57bac78f0d16f5fc1be8c23ae3507cc67d5b05b390ded2404fad7d6ec694c486ca16442790cf0ec147f1ba5143251d18a1864e4e727de36294c61260e017c49f9afc4097acd106275462493b4721058135db626ddb98ed4e27f343f6f9125d9b2afb1f009f26f81ede8f7ceb3711f1fc1665110e2ef10b79fd91cc6be69e3a9223819282219976d283cc225d8fd80c205fed18e842c1b14705afb0212633aa238783115882be1fddce50afcede3ad5dbce548de21bb8ec0d27fef6a20cfa87a90db5d75ba8b06860176449c1e7a67b92c38ac615c33830805bc971de98551458c4a7752918437d5bd49ae86ccc048dad85b4214a3eb3a9bfb37968d4cc9f2ff3dc7bf71c53b7d95f692aec2b452794da58e74219b9de22deb5f2c3ec441b3a30e228db23c81aa2cdd8f614631fe784ddf0780db719667aee81e78667e151a15cd7383f6bfa4b549cb826731328f7577264a67fd8ac629e8b84e47c78f7eeee748df50da809beda8396e2c0fb3bfd286e08ffdc91bab8f7e450c924107ee7ea6f390598aa58802f04062b23a63707228f29b318a4270193c0f5d7f1b3394414b9f4ff057d5b7d4b5d5a566209e51bdcee340805a4129521e83e97070fdd2e425295be3bde44982b0833b4f57cdf10e25cbafa9237d223184d3b83a877882b0618ac2f8a1eea88c42fe9d1612fbb1829817fc35e84b881db86cde3bacf9c09d875fb1f0d7e2469bde7b6760ee59bddee9fbf596b1cf700b601048fa5697434d71c03b579185fdcdd27da3300500b59db2ceea3f7f1e486a84c521a0ae1fd622462d9e71d11180b194eb048d78d9efbd556ab4268715054a83389851ac50ac974735980552876dae399eb5fb99f29a9a267e29969159d6d445550127fd399f762ccf33cc373b1f2d270a0f814b027de36c0a9a5848cdaf10098f19525329a854fd1c3301b3213bbf8499f5a0d75fec61f8aeeff055cb102e4c1b9ded4d07d63e97bdd08d7a11c35e865a6600b430a151f759c7c373284a0f4cd4489ddbf65a4019f8805a0ff9d90f20a3e0d030de1762ada6296c64f67e5acc858ea84c79badf8c47956025531bf5fc756955b1bdc866f4938e4d6c421234f20f14f91b5ba1d7e9b4a06ddd4d9bc8895c33050cd017e981e8fbcbff235c982425fde13ee4e04c9ec5a2de4d702fecea0ad727e20892f1203f09879758c0e3543b89dcb5db070f124b0a590826384225645321997fee9e567e5642fbf9a0323ee16df4f18b177ad0756c52bd3d49062f7b02248826b34892a77b1d128f46c24744ab5120718b22d290a9fc7dd90d529b25929136de162295dafb3399b308fddd273a37435553999dadd8645c947f8c7c0b284c3e9e9453da61e0de0a16c79930ed468fa0d26a95206e92a56ef51e92a0d7467ef580e1bab80602da2cdae610137a98eaba46c812cb213bcfc116352398f9752c2082a0d9f74539d45e2189a655be6c71226b905b1d45d50449a2a5fd3284b7e9ba10f411106018534892b04bea3da640d4044d8da5ca556df55cb422c8e4b6a361aa56941fa26a2109b37b5d8c9023d10da3beec70a9ae04890210da31c9d25428e316e99932280d0e07c66a00f80aa923f36a8e3712137d84b4a6e3a788ed43a006114fd1f6fa84e9bc1b0d10eeec4fe837ae9ff01e2514951f656c6a3585ccfea5a8727ac0e0879df3c7e7926178903910c097b87704a6facc7d5545dadbd21af26610e07a05d71ce231ebc3cfdfb54123e8cb40dce149297a4c91d8606b209db1ef3d2eb81ca93f6bbb575d503e947db43e249c8bb3da821d3084fba79a97566903ea1f91748a964944d9df963f6159cc0f2d980c437b816915b5a184b78b494710b6602a29a26f6ef7863e86a99278a598ce715f558777c8c63b83931fa95d453d89642e954db65599771612d0cd6b46fbaa0ccd7b815908e789e35fd670e83331facee77715056cf89a53ed1b04a6f15c34a2db2a47a0ef4c96d9e08c4a1ed7714a59ad82704e973bd099841f6c4e7c38017263d8d6aac7532307735a872af278108cac7856a40d8807a7f7bdce715b5ec3d2cbfef14767dc30c9fb5ceee7177bd3ff42fd1386a2e01f3de4c31b9537040ef13fb1f8b365a7ced2a6afd5914208bfe17cfa160f4f4b5bc436ca65adfb2c3f7f51838f9dcc9f3516f7668a211d37855b203d2011eb50d7b5c5dc4da2e0026a52c0f05b325b84b7fb2080889f7e9a2ce07ba6a6ba5e3f7e088ee1aefd6fed67a79656305443074a3d45316a4ab0a6382ca625c69c3518c1bc3998a078b7b225700226d692711c0a5340ea1782673dbdccc51288e24350544bf3a329aef666fbc78f087f8fbdb5abbcdae5194103cb7d00adbcec6dd9324e408b1657324650b2e98e8ed5da0543fb8e26ea4270d46fdd60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f23094051130dac4d6a +``` + +Observe that once converted, the `destpubtxid` for the `KomodoHaxor` handle is the leading data: `d60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f230940`. + +Directly after is the `destpubtxid` for `KomodoFan`: `af710c0fd6aeb54556ee401803bc4cc39ea9002ad5228f308b27eb3af0e4c4b6`. + +From this we verify that `vout0` was addressed to the `KomodoFan` handle and `vout1` was addressed to the `KomodoHaxor` handle. + +{/* Sidd: I don't understand the paragraphs below. I added some stuff to try to help it make more sense, but I may be way off. */} + +Since we know there are `2` vouts (aside from the opreturn vout), we know that `vout1` can be found at index position `[:64]` and `vout0` is found at `[64:128]`. + +We again see `KomodoHaxor`'s `destpubtxid`, `d60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f230940` at `[-76:-12]`. + +This indicates the `destpubtxid` of the inputs. The `destpubtxid` of the sender will always be the same position in a Qsend transaction's OP\_RETURN, `[-76:-12]`. + +## Create A Complex Qsend Transaction + +The above Q transaction was relatively simple. Let's create a complex Q transaction that includes outputs to multiple R addresses and multiple Dilithium handles. + +* This transactions sends `7.6699` coins from the `qUTXO` of the previous transaction to the `KomodoHaxor` handle +* This transaction sends `1` coin to to the `KomodoFan` handle, `1.1` coins to the handle `LABSLover`, and `1.2` coins to the R address `RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK` +* The transaction also sends `1.3` coins to `bKnMWGuXC5HEyxk3GttsT1a9TtYWKbBpEP`, a multisig address, to demonstrate that Dilithium Qsend transctions work with essentially any script hash + + + Qsend transactions do have one limitation. The Dilithium Module's functionality requires that any 32-byte hex string in a transaction be the destpubtxid. + + Therefore, the Dilithium module cannot send a transaction to a 32-byte `scriptPubkey`. + + This is an uncommon `scriptPubkey` under normal circumstances, and therefore this should not be an issue for most users. + + +#### The Change Transaction to KomodoHaxor + +This transaction automatically sends the change back to our handle, `KomodoHaxor`. + +#### Obtaining the destpubtxids for Other Handles + +Our transaction requires that we first obtain the `destpubtxid` for all other handles, and the `ScriptPubKey` for the intended R addresses. + +We obtained the `destpubtxid` to `KomodoFan` in the previous step. + +Use the `handleinfo` RPC to obtain the `destpubtxid` for the `LABSLover` handle. + +```bash +./komodo-cli -ac_name=MUSIG cclib handleinfo 19 "[%22LABSLover%22]" +``` + + + ```json + { + "result": "success", + "handle": "LABSLover", + "destpubtxid": "b625e38064cb0c940a55f0dca7e6b60270aac090d0dd90d4e43e924d696564a2", + "pkaddr": "P8bX1ddLLaR149rZZEXkWTAbLTgczsM4vK", + "pubkey": "03cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61" + } + ``` + + +#### Obtaining the scriptPubkey for R Addresses + +We can use the `validateaddress` rpc command to obtain the `"scriptPubKey` value for both `RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK` and `bKnMWGuXC5HEyxk3GttsT1a9TtYWKbBpEP`. + +```bash +./komodo-cli -ac_name=MUSIG validateaddress RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK +``` + + + ```json + { + "isvalid": true, + "address": "RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK", + "scriptPubKey": "76a914b738b1730cfb58960b1dd1765c6d3276993959e188ac", + "segid": 13, + "ismine": false, + "iswatchonly": false, + "isscript": false + } + ``` + + +```bash +./komodo-cli -ac_name=MUSIG validateaddress bKnMWGuXC5HEyxk3GttsT1a9TtYWKbBpEP +``` + + + ```json + { + "isvalid": true, + "address": "bKnMWGuXC5HEyxk3GttsT1a9TtYWKbBpEP", + "scriptPubKey": "a9144d5e24fcd799f3a3fa15f98a6c69a5829596f56087", + "segid": 26, + "ismine": false, + "iswatchonly": false, + "isscript": true + } + ``` + + +#### Send the Qsend Transaction + +We now have everything we need to assemble and send the complex Qsend transaction. + +```bash +./komodo-cli -ac_name=MUSIG cclib Qsend 19 "[%22d60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f230940%22,%22e580f34e9bdfd23108409e76475c7df3f924d149d494d5cdbc24aeb280237d4a%22,%22af710c0fd6aeb54556ee401803bc4cc39ea9002ad5228f308b27eb3af0e4c4b6%22,1,%22b625e38064cb0c940a55f0dca7e6b60270aac090d0dd90d4e43e924d696564a2%22,1.1,%2276a914b738b1730cfb58960b1dd1765c6d3276993959e188ac%22,1.2,%22a9144d5e24fcd799f3a3fa15f98a6c69a5829596f56087%22,1.3]" +``` + + + ```json + { + "hex": "0400008085202f89016c21f44da4afe05aad8b271659c6cf8cfccb6b6e33fdb9f5f0935a0d6e8ef616010000007b4c79a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b8140ccb5db05dc45a4ec747705d76f2e71f3ab43830693f093536d23e6ab31c18b0c04c2906a8e600629b9264043d4534da3c22c1fe1dbe2192ebce23b8a99cf35eaa100af03800113a10001ffffffff0600e1f50500000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc80778e0600000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc000e2707000000001976a914b738b1730cfb58960b1dd1765c6d3276993959e188ac80a4bf070000000017a9144d5e24fcd799f3a3fa15f98a6c69a5829596f56087a0244c1200000000302ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc0000000000000000fd100e6a4d0c0e13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460de9fbac397128243cdfe192f73c9eb327fcc75338e694a94f4df8bcf7d668868731be4f2b886f5d1292e3542f31f01a390fcd7491d730b57ce1fcd6abd792efbeb4047f2cc24b98d07577f3121a74a141d1a7ce94b1e03fa69031e91baa38ef209866fb9db448445fc4794331f5efaaadd1ee58c58deac4b26012ed65f876fb056711d3902500d2d45c0e4e082d8a058a7a671a2fd2a855bd882ee5a06962ab72d93783c7f1fcfead9f712dd3af0424572ce58a36b4e558bc9c95650351794134f1d74f8f275500f19bc967a64ee0baef222bf34c50f0bb771759afee0b202a542d4a349e2224820a2fc29259192e1dc1c2648b161a31454d9a6489fb26b280ad6dd3f1916cae118150d49c52401665c8b299608760c83659f88783120974f85f22d9af9b5ea1dd4a145b29aca2929ffa0449dc821cbe0dd8f86017a37573ad8ca33901e10664822a0ff0825f957bda6148a41d8bd48ae42a7fd10e73e4f28198e767abd1b2c1297055729ddbb613d3d4476b8cf228be84248bef116546ec8d773d271b2a850711f2a8cafd3502575c94a5c258c322f1a0123f439d796239dc7a40e996ff282eb605b7bea9336fa2d6443924a3487f3275095a8fbe136918cb6a69afa2881d793d0d70433c0e16ac5218da88ce76194d86ae8c283184249cd4fc3824614f95af655556e3c3c90765358a63c411cf5df4075546c9555feb2fa1057f540a79a30ddf997248e47076418b31514607236ee23f56b8bd7ee03e09dd063199c45b0b120af1e44920b535aae890d51d0134ee24872a995b991efa31bd4bf9e551727a877d29ef269b83efc0368d042086535b6bd956c2f7bbc3b686dbd765d092a98e825911a13ea92ad2cd7604288c0e7595ee3763849a4d61c90ed7686a3902417eb90d59e40350b12353fd5fcffc53c52759ee393e68227018c924ac9c0390d3029fd26dcd93609d57f19868abfce563dbb93921837f85b092b8539447e2696a9d60345fe390200ce741eae671561b54ee0f58c32e944a954143dd274e41179907a99394c9c1c978a964555d91d0acdda655064a824c7673dc84d1d5a94f06ca6b19078dcd657acb9d84518b94c2f56e4aed02c50a1861d536fe19c29cfede262d8cdf1fba7848f017ce53bb99eb9b40d0b2e5951b47099d8d975bf3054baa8019a9299794e9c4e1f7117974d15dcd4bf1f75b732ac65cbbcd9d2c232e8445d93f422a9315d7c7627d5e4d424094d04c6e419e9805b7bb7849214d35e02139463e73989d019cd1ea3a9084f353f3145df38f88ad0baafee1f0e95477cacc7b0246db8b4ed485db10c999c508506d0bbff6185c53903f8565edd90fc16e3f6be972463e3246a73cb1e2cb294209c71838ae86732cab6f648d10459123d30a59c1bf63a2232d32c8cfe0d06c4797c883d0ad452643496dbec37f87a1a90b525a938cf3367c9917e57c506d0fa422e530753589bd9317a775af64de696857705c5efed3037ad7ad7e1a4789ef238c6473cb433eda187484592e48e5d237d73f558cfe24f68bad4ee85b77c01b9924e262534c9a2486432a5be199aea85a935f6b2424a4fbf3a5dc7afc1866692404de45f41393aecc7ca5761c25fa5922ccebeb8b0580633c75a944d473d18318fe0fb999dd61259813bd0f5c62ff50df1148c6d12757b2de3be3098e7c283eaa3acea5049f4a7e1393235dfeda7b0fdcca6cdeee5410f023bc4c1a157cda0044edacb30b4f00d3c647e83aec5b966ed4e1829eb1f9ab7da7715f34e07e17ed59e45922500f493d74ab8f8f645f3e9002d202f9c2ed14ec698548b7d0ea182c8ea9de1b9146b3a77df43e80a2d085636eb5a80f9d643682d211ae13bb6569ce3411aaca39727850155274aa842baef36ade2173aec3d6c3f4039038d55ff69a7a35ef2d08b5478106b9f0364a8c0e95cd4751bd905c4c38dca63bbcdce24538bd08fb0cc7d9cd1f5dfc1853d502e1f38adaad6c468d9e50ff81d2a6b8dd3db7602bc272675d2efb70382dc19b9039a0b32d876787f2d0e0671b11adde48aafef6d684c517e77217be631366bf99f1109e55a389436e915d847f212b07a5c6fb94db999662ba20e92e642e88bce288cdce3dbffc0d52607af784f802eb18e810d49766ca752a6534d7459a97a2bf07787c63cd836862eb05347cebd3882df760b37b873b79d935cc4fa6f444a6f4d2bae51dab832432a258c1d741d7c133e55302920527e02f1ec8b0ab2703df6fb4c3d357efa75a53c91666b59ed6135907edee5b7ce73c3730c90e235cde4e384dd51f7d7e1b82e3c7cedff649fd6a5f247e829ea9e00d58c37ffd545cd311ad369928ac396cb5dbdfad2c6de10d0a0b1047df15f26c51b225ee148d95dd9c5aea4a4da592cd59b3fcdd8478ee264ed68e61aee55585c32b6dee251f593e8a9f492b9003208af4e04d0e5ee00afee4d0d074ae9aeaa8fda26e89fdf4825da2f0211b5c9a8eae9f1070f401cd6583d0296057c9707a481983aa45b76b290aa249cc5a545fe8956000fc2d48c4803dbc642e1ef9ac3904652ddfa3b6a29e405984a2188b31eb358ea04462ac751937ef5a153d865e6b5951392dd6b4c6ee16224705486de08d380827554419ab24b37b58bd351d157194640d9eba45c13dee0bb73429b497e3885568161f286a6b6f67d8054674a717c6d26defc68c734622dacb8a2fef4dfbd425ea78575402d15eeb9d8cc6f99b0ebf33738b34e14f34b4b990deba45abe2d3c81038d4fa3352a4e904d9d6b244585ba1b0f450c9da0fe84e711255846bf56fc483755dc006f74f816bd27c408c1d4102e2882702b7afb187096a1046cd47f1be2a10400040d310b862232ec7b8419764d05ffe3833bc8462c90ea3f4b65af3fb07b885c9403434b6e0326b05188f8c05d157e0e721a9514fc189dd7c6455d261482fc46c4c206d94ba737a1e456cd22a11e3daf0f2c5716af6ba28419cc17ffa7303ee25d52675a1612ec1cc3bb708c1f0a720d9f4e4c5b47d4bca46f393eced4e6de925262ef229adb4405c44c7ba73646ded1bad4879f8024e84eec05c8bd635bcc6372e1f420be1b7e7f764d966b8715b21b73efb19c4c2d612210cd13fe06bf45d79b0886bb67c9d8f7308cdabde24127d7d3181b3283582b27ad46e0076e03c3269c11b613a6e0375992cac30acbdfb42eb99d6b3cdd845a978845dc7acf67882eaa532641b56ab5626581fca7481e4d1f54f1fb6e1accaff130a66cbb61fde59bc2052c48325a45219818648791ac33046832b02cc9e6aa587aaedb6e7f5d2e18f9b2e6727763f9511b715a43d7a4f608cb3cd037f4e26a455f8b4f9706ec408d4d435be1e6482c2db2aa2f08f23a31900128d57f210e34cb61f73dea2614cb51c220789a40cbfa35c9d565e1f9b809c81f9e3bcdfd5fd814b619b9c7a579daac86c60abcb7293de50b0a3702e3b877f828777235a49920c9dbf5ed9ce3a3f885c2bf985c620b7d0dafd7366a22554b6601af7866b5ccef7e8d67a29345598d98f946a204c128487fb672acbc68097d722d9e12f625b62e8b9affbf05539e44b62e72f6e2d917f1660033dd2a171d37387002cc04cf857d6100409a47d2ce9926c781758d0b7405d9d40086f5835685cde5648495864ac138bf81dac0f6d972096e993b49973c7dfa9a942edc9fe8fffccceb312a0e25b3a335e3b4f06c34cfbe4828597aeccf738a8164fefd1e88b62b12d76d13a5cef333bf8f16135dcbb84fa257b24eaa1e2b7d9c9e9fef6bf5d908e57a05c75d950dbd9ed6ab6f72a45f29e8fa80987406cad82c8d57c744928e3c5b5dbb054df82952b6d995d8b981b532170b311d701b1c0613787b3dbba56c254ffd8ff11270888029d9b342f08c891d185f2ec769afbc8d2b5e232c2ff3365c038102e09094d7dba19552a773f5d2fd153b24ebf7950f7d8c9b857413461cd68c464eaacdfa050b05e4b67a842727ae83a560e692fd7c473552e0b4d6c33544bb3498e4f77061bd8b06a279e68e813ba1571744328f27ad2f9d92cd0e33897c649c6cf33f235604e092d002c1f7e5fbe5cbff16b92540e33e4b3afd99e7df80bc23eca979125c0f271eb1f3e309c9a4dc48e82873b918c1b75ef029f3fa80a65d0ba9a3d7739a0763bbeee1920cc953d46921dcecb65a57f608b9092221209f5dcdddd66998f295f043114fb4c263634381cd381fd75e6c9d21620d13a4544a1ff4a9b789ca115d8108f8ee063c4ee9fd4e21886d74c3a54fefae364fc924d9a7d0994796f6753f92b7fb77be7ceae095e8de8b064aa3ac04138fc9c92a5b63714644ca35c9a12559a0b406df0dade4bc2018c029e0f5e87326ba85360788188cfb03873255c2adaa347fe8265f1fc32d0a8b90ea49dfb8aacf01c69744cf0096298559670d515540cc929480b7fe97608111f17b6a39e3e4b9c127e027d4ce00a761c3e3336b91e4bedacaf3a84b44e3f69180d8da4c7ddaed25841351096d7e822ed97c87250f901365c656671b5b80b0c182126333945516f8f9294bdc6c7cef8fd1a1e5c686e8081949a9da4aab4bde0eb0a28292f373e4c51545cf9ff11425c6b6f7a7e7f848ca1a8c2cbdcedf0fbff03192527353e3f55878fb2ccd7fc0000000000000000000000000000000000000000000000000000000000000000081b2b374a588124700005070e14a0805080a84a430004891a4412051202000440190140c06261da92a73502f904c0eab1b16b2d2b60ec32c1863d95069848bfe717ae65f8d8b718f7dc2f5b9c0605b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71afa26465694d923ee4d490ddd090c0aa7002b6e6a7dcf0550a940ccb6480e325b6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd600000000fa6c00000000000000000000000000", + "txid": "5aaf4007d6d9af7883da1ad464b63fff9d97453efe0b181d19558cc15f6ff668", + "result": "success" + } + ``` + + +#### Broadcast the Transaction Using sendrawtransaction + +```bash +./komodo-cli -ac_name=MUSIG sendrawtransaction 0400008085202f89016c21f44da4afe05aad8b271659c6cf8cfccb6b6e33fdb9f5f0935a0d6e8ef616010000007b4c79a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b8140ccb5db05dc45a4ec747705d76f2e71f3ab43830693f093536d23e6ab31c18b0c04c2906a8e600629b9264043d4534da3c22c1fe1dbe2192ebce23b8a99cf35eaa100af03800113a10001ffffffff0600e1f50500000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc80778e0600000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc000e2707000000001976a914b738b1730cfb58960b1dd1765c6d3276993959e188ac80a4bf070000000017a9144d5e24fcd799f3a3fa15f98a6c69a5829596f56087a0244c1200000000302ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc0000000000000000fd100e6a4d0c0e13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460de9fbac397128243cdfe192f73c9eb327fcc75338e694a94f4df8bcf7d668868731be4f2b886f5d1292e3542f31f01a390fcd7491d730b57ce1fcd6abd792efbeb4047f2cc24b98d07577f3121a74a141d1a7ce94b1e03fa69031e91baa38ef209866fb9db448445fc4794331f5efaaadd1ee58c58deac4b26012ed65f876fb056711d3902500d2d45c0e4e082d8a058a7a671a2fd2a855bd882ee5a06962ab72d93783c7f1fcfead9f712dd3af0424572ce58a36b4e558bc9c95650351794134f1d74f8f275500f19bc967a64ee0baef222bf34c50f0bb771759afee0b202a542d4a349e2224820a2fc29259192e1dc1c2648b161a31454d9a6489fb26b280ad6dd3f1916cae118150d49c52401665c8b299608760c83659f88783120974f85f22d9af9b5ea1dd4a145b29aca2929ffa0449dc821cbe0dd8f86017a37573ad8ca33901e10664822a0ff0825f957bda6148a41d8bd48ae42a7fd10e73e4f28198e767abd1b2c1297055729ddbb613d3d4476b8cf228be84248bef116546ec8d773d271b2a850711f2a8cafd3502575c94a5c258c322f1a0123f439d796239dc7a40e996ff282eb605b7bea9336fa2d6443924a3487f3275095a8fbe136918cb6a69afa2881d793d0d70433c0e16ac5218da88ce76194d86ae8c283184249cd4fc3824614f95af655556e3c3c90765358a63c411cf5df4075546c9555feb2fa1057f540a79a30ddf997248e47076418b31514607236ee23f56b8bd7ee03e09dd063199c45b0b120af1e44920b535aae890d51d0134ee24872a995b991efa31bd4bf9e551727a877d29ef269b83efc0368d042086535b6bd956c2f7bbc3b686dbd765d092a98e825911a13ea92ad2cd7604288c0e7595ee3763849a4d61c90ed7686a3902417eb90d59e40350b12353fd5fcffc53c52759ee393e68227018c924ac9c0390d3029fd26dcd93609d57f19868abfce563dbb93921837f85b092b8539447e2696a9d60345fe390200ce741eae671561b54ee0f58c32e944a954143dd274e41179907a99394c9c1c978a964555d91d0acdda655064a824c7673dc84d1d5a94f06ca6b19078dcd657acb9d84518b94c2f56e4aed02c50a1861d536fe19c29cfede262d8cdf1fba7848f017ce53bb99eb9b40d0b2e5951b47099d8d975bf3054baa8019a9299794e9c4e1f7117974d15dcd4bf1f75b732ac65cbbcd9d2c232e8445d93f422a9315d7c7627d5e4d424094d04c6e419e9805b7bb7849214d35e02139463e73989d019cd1ea3a9084f353f3145df38f88ad0baafee1f0e95477cacc7b0246db8b4ed485db10c999c508506d0bbff6185c53903f8565edd90fc16e3f6be972463e3246a73cb1e2cb294209c71838ae86732cab6f648d10459123d30a59c1bf63a2232d32c8cfe0d06c4797c883d0ad452643496dbec37f87a1a90b525a938cf3367c9917e57c506d0fa422e530753589bd9317a775af64de696857705c5efed3037ad7ad7e1a4789ef238c6473cb433eda187484592e48e5d237d73f558cfe24f68bad4ee85b77c01b9924e262534c9a2486432a5be199aea85a935f6b2424a4fbf3a5dc7afc1866692404de45f41393aecc7ca5761c25fa5922ccebeb8b0580633c75a944d473d18318fe0fb999dd61259813bd0f5c62ff50df1148c6d12757b2de3be3098e7c283eaa3acea5049f4a7e1393235dfeda7b0fdcca6cdeee5410f023bc4c1a157cda0044edacb30b4f00d3c647e83aec5b966ed4e1829eb1f9ab7da7715f34e07e17ed59e45922500f493d74ab8f8f645f3e9002d202f9c2ed14ec698548b7d0ea182c8ea9de1b9146b3a77df43e80a2d085636eb5a80f9d643682d211ae13bb6569ce3411aaca39727850155274aa842baef36ade2173aec3d6c3f4039038d55ff69a7a35ef2d08b5478106b9f0364a8c0e95cd4751bd905c4c38dca63bbcdce24538bd08fb0cc7d9cd1f5dfc1853d502e1f38adaad6c468d9e50ff81d2a6b8dd3db7602bc272675d2efb70382dc19b9039a0b32d876787f2d0e0671b11adde48aafef6d684c517e77217be631366bf99f1109e55a389436e915d847f212b07a5c6fb94db999662ba20e92e642e88bce288cdce3dbffc0d52607af784f802eb18e810d49766ca752a6534d7459a97a2bf07787c63cd836862eb05347cebd3882df760b37b873b79d935cc4fa6f444a6f4d2bae51dab832432a258c1d741d7c133e55302920527e02f1ec8b0ab2703df6fb4c3d357efa75a53c91666b59ed6135907edee5b7ce73c3730c90e235cde4e384dd51f7d7e1b82e3c7cedff649fd6a5f247e829ea9e00d58c37ffd545cd311ad369928ac396cb5dbdfad2c6de10d0a0b1047df15f26c51b225ee148d95dd9c5aea4a4da592cd59b3fcdd8478ee264ed68e61aee55585c32b6dee251f593e8a9f492b9003208af4e04d0e5ee00afee4d0d074ae9aeaa8fda26e89fdf4825da2f0211b5c9a8eae9f1070f401cd6583d0296057c9707a481983aa45b76b290aa249cc5a545fe8956000fc2d48c4803dbc642e1ef9ac3904652ddfa3b6a29e405984a2188b31eb358ea04462ac751937ef5a153d865e6b5951392dd6b4c6ee16224705486de08d380827554419ab24b37b58bd351d157194640d9eba45c13dee0bb73429b497e3885568161f286a6b6f67d8054674a717c6d26defc68c734622dacb8a2fef4dfbd425ea78575402d15eeb9d8cc6f99b0ebf33738b34e14f34b4b990deba45abe2d3c81038d4fa3352a4e904d9d6b244585ba1b0f450c9da0fe84e711255846bf56fc483755dc006f74f816bd27c408c1d4102e2882702b7afb187096a1046cd47f1be2a10400040d310b862232ec7b8419764d05ffe3833bc8462c90ea3f4b65af3fb07b885c9403434b6e0326b05188f8c05d157e0e721a9514fc189dd7c6455d261482fc46c4c206d94ba737a1e456cd22a11e3daf0f2c5716af6ba28419cc17ffa7303ee25d52675a1612ec1cc3bb708c1f0a720d9f4e4c5b47d4bca46f393eced4e6de925262ef229adb4405c44c7ba73646ded1bad4879f8024e84eec05c8bd635bcc6372e1f420be1b7e7f764d966b8715b21b73efb19c4c2d612210cd13fe06bf45d79b0886bb67c9d8f7308cdabde24127d7d3181b3283582b27ad46e0076e03c3269c11b613a6e0375992cac30acbdfb42eb99d6b3cdd845a978845dc7acf67882eaa532641b56ab5626581fca7481e4d1f54f1fb6e1accaff130a66cbb61fde59bc2052c48325a45219818648791ac33046832b02cc9e6aa587aaedb6e7f5d2e18f9b2e6727763f9511b715a43d7a4f608cb3cd037f4e26a455f8b4f9706ec408d4d435be1e6482c2db2aa2f08f23a31900128d57f210e34cb61f73dea2614cb51c220789a40cbfa35c9d565e1f9b809c81f9e3bcdfd5fd814b619b9c7a579daac86c60abcb7293de50b0a3702e3b877f828777235a49920c9dbf5ed9ce3a3f885c2bf985c620b7d0dafd7366a22554b6601af7866b5ccef7e8d67a29345598d98f946a204c128487fb672acbc68097d722d9e12f625b62e8b9affbf05539e44b62e72f6e2d917f1660033dd2a171d37387002cc04cf857d6100409a47d2ce9926c781758d0b7405d9d40086f5835685cde5648495864ac138bf81dac0f6d972096e993b49973c7dfa9a942edc9fe8fffccceb312a0e25b3a335e3b4f06c34cfbe4828597aeccf738a8164fefd1e88b62b12d76d13a5cef333bf8f16135dcbb84fa257b24eaa1e2b7d9c9e9fef6bf5d908e57a05c75d950dbd9ed6ab6f72a45f29e8fa80987406cad82c8d57c744928e3c5b5dbb054df82952b6d995d8b981b532170b311d701b1c0613787b3dbba56c254ffd8ff11270888029d9b342f08c891d185f2ec769afbc8d2b5e232c2ff3365c038102e09094d7dba19552a773f5d2fd153b24ebf7950f7d8c9b857413461cd68c464eaacdfa050b05e4b67a842727ae83a560e692fd7c473552e0b4d6c33544bb3498e4f77061bd8b06a279e68e813ba1571744328f27ad2f9d92cd0e33897c649c6cf33f235604e092d002c1f7e5fbe5cbff16b92540e33e4b3afd99e7df80bc23eca979125c0f271eb1f3e309c9a4dc48e82873b918c1b75ef029f3fa80a65d0ba9a3d7739a0763bbeee1920cc953d46921dcecb65a57f608b9092221209f5dcdddd66998f295f043114fb4c263634381cd381fd75e6c9d21620d13a4544a1ff4a9b789ca115d8108f8ee063c4ee9fd4e21886d74c3a54fefae364fc924d9a7d0994796f6753f92b7fb77be7ceae095e8de8b064aa3ac04138fc9c92a5b63714644ca35c9a12559a0b406df0dade4bc2018c029e0f5e87326ba85360788188cfb03873255c2adaa347fe8265f1fc32d0a8b90ea49dfb8aacf01c69744cf0096298559670d515540cc929480b7fe97608111f17b6a39e3e4b9c127e027d4ce00a761c3e3336b91e4bedacaf3a84b44e3f69180d8da4c7ddaed25841351096d7e822ed97c87250f901365c656671b5b80b0c182126333945516f8f9294bdc6c7cef8fd1a1e5c686e8081949a9da4aab4bde0eb0a28292f373e4c51545cf9ff11425c6b6f7a7e7f848ca1a8c2cbdcedf0fbff03192527353e3f55878fb2ccd7fc0000000000000000000000000000000000000000000000000000000000000000081b2b374a588124700005070e14a0805080a84a430004891a4412051202000440190140c06261da92a73502f904c0eab1b16b2d2b60ec32c1863d95069848bfe717ae65f8d8b718f7dc2f5b9c0605b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71afa26465694d923ee4d490ddd090c0aa7002b6e6a7dcf0550a940ccb6480e325b6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd600000000fa6c00000000000000000000000000 +``` + + + ```bash + 5aaf4007d6d9af7883da1ad464b63fff9d97453efe0b181d19558cc15f6ff668 + ``` + + +#### Understanding the inputs and outputs of the above transaction + +Use the [getrawtransaction](/smart-chains/api/rawtransactions/#getrawtransaction) RPC to observe the inputs and outputs of the response. + +```bash +./komodo-cli -ac_name=MUSIG getrawtransaction 5aaf4007d6d9af7883da1ad464b63fff9d97453efe0b181d19558cc15f6ff668 2 +``` + + + ```json + { + "hex": "0400008085202f89016c21f44da4afe05aad8b271659c6cf8cfccb6b6e33fdb9f5f0935a0d6e8ef616010000007b4c79a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b8140ccb5db05dc45a4ec747705d76f2e71f3ab43830693f093536d23e6ab31c18b0c04c2906a8e600629b9264043d4534da3c22c1fe1dbe2192ebce23b8a99cf35eaa100af03800113a10001ffffffff0600e1f50500000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc80778e0600000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc000e2707000000001976a914b738b1730cfb58960b1dd1765c6d3276993959e188ac80a4bf070000000017a9144d5e24fcd799f3a3fa15f98a6c69a5829596f56087a0244c1200000000302ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc0000000000000000fd100e6a4d0c0e13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460de9fbac397128243cdfe192f73c9eb327fcc75338e694a94f4df8bcf7d668868731be4f2b886f5d1292e3542f31f01a390fcd7491d730b57ce1fcd6abd792efbeb4047f2cc24b98d07577f3121a74a141d1a7ce94b1e03fa69031e91baa38ef209866fb9db448445fc4794331f5efaaadd1ee58c58deac4b26012ed65f876fb056711d3902500d2d45c0e4e082d8a058a7a671a2fd2a855bd882ee5a06962ab72d93783c7f1fcfead9f712dd3af0424572ce58a36b4e558bc9c95650351794134f1d74f8f275500f19bc967a64ee0baef222bf34c50f0bb771759afee0b202a542d4a349e2224820a2fc29259192e1dc1c2648b161a31454d9a6489fb26b280ad6dd3f1916cae118150d49c52401665c8b299608760c83659f88783120974f85f22d9af9b5ea1dd4a145b29aca2929ffa0449dc821cbe0dd8f86017a37573ad8ca33901e10664822a0ff0825f957bda6148a41d8bd48ae42a7fd10e73e4f28198e767abd1b2c1297055729ddbb613d3d4476b8cf228be84248bef116546ec8d773d271b2a850711f2a8cafd3502575c94a5c258c322f1a0123f439d796239dc7a40e996ff282eb605b7bea9336fa2d6443924a3487f3275095a8fbe136918cb6a69afa2881d793d0d70433c0e16ac5218da88ce76194d86ae8c283184249cd4fc3824614f95af655556e3c3c90765358a63c411cf5df4075546c9555feb2fa1057f540a79a30ddf997248e47076418b31514607236ee23f56b8bd7ee03e09dd063199c45b0b120af1e44920b535aae890d51d0134ee24872a995b991efa31bd4bf9e551727a877d29ef269b83efc0368d042086535b6bd956c2f7bbc3b686dbd765d092a98e825911a13ea92ad2cd7604288c0e7595ee3763849a4d61c90ed7686a3902417eb90d59e40350b12353fd5fcffc53c52759ee393e68227018c924ac9c0390d3029fd26dcd93609d57f19868abfce563dbb93921837f85b092b8539447e2696a9d60345fe390200ce741eae671561b54ee0f58c32e944a954143dd274e41179907a99394c9c1c978a964555d91d0acdda655064a824c7673dc84d1d5a94f06ca6b19078dcd657acb9d84518b94c2f56e4aed02c50a1861d536fe19c29cfede262d8cdf1fba7848f017ce53bb99eb9b40d0b2e5951b47099d8d975bf3054baa8019a9299794e9c4e1f7117974d15dcd4bf1f75b732ac65cbbcd9d2c232e8445d93f422a9315d7c7627d5e4d424094d04c6e419e9805b7bb7849214d35e02139463e73989d019cd1ea3a9084f353f3145df38f88ad0baafee1f0e95477cacc7b0246db8b4ed485db10c999c508506d0bbff6185c53903f8565edd90fc16e3f6be972463e3246a73cb1e2cb294209c71838ae86732cab6f648d10459123d30a59c1bf63a2232d32c8cfe0d06c4797c883d0ad452643496dbec37f87a1a90b525a938cf3367c9917e57c506d0fa422e530753589bd9317a775af64de696857705c5efed3037ad7ad7e1a4789ef238c6473cb433eda187484592e48e5d237d73f558cfe24f68bad4ee85b77c01b9924e262534c9a2486432a5be199aea85a935f6b2424a4fbf3a5dc7afc1866692404de45f41393aecc7ca5761c25fa5922ccebeb8b0580633c75a944d473d18318fe0fb999dd61259813bd0f5c62ff50df1148c6d12757b2de3be3098e7c283eaa3acea5049f4a7e1393235dfeda7b0fdcca6cdeee5410f023bc4c1a157cda0044edacb30b4f00d3c647e83aec5b966ed4e1829eb1f9ab7da7715f34e07e17ed59e45922500f493d74ab8f8f645f3e9002d202f9c2ed14ec698548b7d0ea182c8ea9de1b9146b3a77df43e80a2d085636eb5a80f9d643682d211ae13bb6569ce3411aaca39727850155274aa842baef36ade2173aec3d6c3f4039038d55ff69a7a35ef2d08b5478106b9f0364a8c0e95cd4751bd905c4c38dca63bbcdce24538bd08fb0cc7d9cd1f5dfc1853d502e1f38adaad6c468d9e50ff81d2a6b8dd3db7602bc272675d2efb70382dc19b9039a0b32d876787f2d0e0671b11adde48aafef6d684c517e77217be631366bf99f1109e55a389436e915d847f212b07a5c6fb94db999662ba20e92e642e88bce288cdce3dbffc0d52607af784f802eb18e810d49766ca752a6534d7459a97a2bf07787c63cd836862eb05347cebd3882df760b37b873b79d935cc4fa6f444a6f4d2bae51dab832432a258c1d741d7c133e55302920527e02f1ec8b0ab2703df6fb4c3d357efa75a53c91666b59ed6135907edee5b7ce73c3730c90e235cde4e384dd51f7d7e1b82e3c7cedff649fd6a5f247e829ea9e00d58c37ffd545cd311ad369928ac396cb5dbdfad2c6de10d0a0b1047df15f26c51b225ee148d95dd9c5aea4a4da592cd59b3fcdd8478ee264ed68e61aee55585c32b6dee251f593e8a9f492b9003208af4e04d0e5ee00afee4d0d074ae9aeaa8fda26e89fdf4825da2f0211b5c9a8eae9f1070f401cd6583d0296057c9707a481983aa45b76b290aa249cc5a545fe8956000fc2d48c4803dbc642e1ef9ac3904652ddfa3b6a29e405984a2188b31eb358ea04462ac751937ef5a153d865e6b5951392dd6b4c6ee16224705486de08d380827554419ab24b37b58bd351d157194640d9eba45c13dee0bb73429b497e3885568161f286a6b6f67d8054674a717c6d26defc68c734622dacb8a2fef4dfbd425ea78575402d15eeb9d8cc6f99b0ebf33738b34e14f34b4b990deba45abe2d3c81038d4fa3352a4e904d9d6b244585ba1b0f450c9da0fe84e711255846bf56fc483755dc006f74f816bd27c408c1d4102e2882702b7afb187096a1046cd47f1be2a10400040d310b862232ec7b8419764d05ffe3833bc8462c90ea3f4b65af3fb07b885c9403434b6e0326b05188f8c05d157e0e721a9514fc189dd7c6455d261482fc46c4c206d94ba737a1e456cd22a11e3daf0f2c5716af6ba28419cc17ffa7303ee25d52675a1612ec1cc3bb708c1f0a720d9f4e4c5b47d4bca46f393eced4e6de925262ef229adb4405c44c7ba73646ded1bad4879f8024e84eec05c8bd635bcc6372e1f420be1b7e7f764d966b8715b21b73efb19c4c2d612210cd13fe06bf45d79b0886bb67c9d8f7308cdabde24127d7d3181b3283582b27ad46e0076e03c3269c11b613a6e0375992cac30acbdfb42eb99d6b3cdd845a978845dc7acf67882eaa532641b56ab5626581fca7481e4d1f54f1fb6e1accaff130a66cbb61fde59bc2052c48325a45219818648791ac33046832b02cc9e6aa587aaedb6e7f5d2e18f9b2e6727763f9511b715a43d7a4f608cb3cd037f4e26a455f8b4f9706ec408d4d435be1e6482c2db2aa2f08f23a31900128d57f210e34cb61f73dea2614cb51c220789a40cbfa35c9d565e1f9b809c81f9e3bcdfd5fd814b619b9c7a579daac86c60abcb7293de50b0a3702e3b877f828777235a49920c9dbf5ed9ce3a3f885c2bf985c620b7d0dafd7366a22554b6601af7866b5ccef7e8d67a29345598d98f946a204c128487fb672acbc68097d722d9e12f625b62e8b9affbf05539e44b62e72f6e2d917f1660033dd2a171d37387002cc04cf857d6100409a47d2ce9926c781758d0b7405d9d40086f5835685cde5648495864ac138bf81dac0f6d972096e993b49973c7dfa9a942edc9fe8fffccceb312a0e25b3a335e3b4f06c34cfbe4828597aeccf738a8164fefd1e88b62b12d76d13a5cef333bf8f16135dcbb84fa257b24eaa1e2b7d9c9e9fef6bf5d908e57a05c75d950dbd9ed6ab6f72a45f29e8fa80987406cad82c8d57c744928e3c5b5dbb054df82952b6d995d8b981b532170b311d701b1c0613787b3dbba56c254ffd8ff11270888029d9b342f08c891d185f2ec769afbc8d2b5e232c2ff3365c038102e09094d7dba19552a773f5d2fd153b24ebf7950f7d8c9b857413461cd68c464eaacdfa050b05e4b67a842727ae83a560e692fd7c473552e0b4d6c33544bb3498e4f77061bd8b06a279e68e813ba1571744328f27ad2f9d92cd0e33897c649c6cf33f235604e092d002c1f7e5fbe5cbff16b92540e33e4b3afd99e7df80bc23eca979125c0f271eb1f3e309c9a4dc48e82873b918c1b75ef029f3fa80a65d0ba9a3d7739a0763bbeee1920cc953d46921dcecb65a57f608b9092221209f5dcdddd66998f295f043114fb4c263634381cd381fd75e6c9d21620d13a4544a1ff4a9b789ca115d8108f8ee063c4ee9fd4e21886d74c3a54fefae364fc924d9a7d0994796f6753f92b7fb77be7ceae095e8de8b064aa3ac04138fc9c92a5b63714644ca35c9a12559a0b406df0dade4bc2018c029e0f5e87326ba85360788188cfb03873255c2adaa347fe8265f1fc32d0a8b90ea49dfb8aacf01c69744cf0096298559670d515540cc929480b7fe97608111f17b6a39e3e4b9c127e027d4ce00a761c3e3336b91e4bedacaf3a84b44e3f69180d8da4c7ddaed25841351096d7e822ed97c87250f901365c656671b5b80b0c182126333945516f8f9294bdc6c7cef8fd1a1e5c686e8081949a9da4aab4bde0eb0a28292f373e4c51545cf9ff11425c6b6f7a7e7f848ca1a8c2cbdcedf0fbff03192527353e3f55878fb2ccd7fc0000000000000000000000000000000000000000000000000000000000000000081b2b374a588124700005070e14a0805080a84a430004891a4412051202000440190140c06261da92a73502f904c0eab1b16b2d2b60ec32c1863d95069848bfe717ae65f8d8b718f7dc2f5b9c0605b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71afa26465694d923ee4d490ddd090c0aa7002b6e6a7dcf0550a940ccb6480e325b6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd600000000fa6c00000000000000000000000000", + "txid": "5aaf4007d6d9af7883da1ad464b63fff9d97453efe0b181d19558cc15f6ff668", + "overwintered": true, + "version": 4, + "versiongroupid": "892f2085", + "locktime": 0, + "expiryheight": 27898, + "vin": [ + { + "txid": "16f68e6e0d5a93f0f5b9fd336e6bcbfc8ccfc65916278bad5ae0afa44df4216c", + "vout": 1, + "address": "RWzd2iZT7rTU91mJVXzXpK8NWseMgZnW74", + "scriptSig": { + "asm": "a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b8140ccb5db05dc45a4ec747705d76f2e71f3ab43830693f093536d23e6ab31c18b0c04c2906a8e600629b9264043d4534da3c22c1fe1dbe2192ebce23b8a99cf35eaa100af03800113a10001", + "hex": "4c79a276a072a26ba067a56580210377ffe2b64443ac5e746f29b021e22411c7731d675f169d32423f8f3d6fc9ea3b8140ccb5db05dc45a4ec747705d76f2e71f3ab43830693f093536d23e6ab31c18b0c04c2906a8e600629b9264043d4534da3c22c1fe1dbe2192ebce23b8a99cf35eaa100af03800113a10001" + }, + "value": 7.6699, + "valueSat": 766990000, + "address": "RWzd2iZT7rTU91mJVXzXpK8NWseMgZnW74", + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 1.0, + "valueSat": 100000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7"] + } + }, + { + "value": 1.1, + "valueSat": 110000000, + "n": 1, + "scriptPubKey": { + "asm": "a22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7"] + } + }, + { + "value": 1.2, + "valueSat": 120000000, + "n": 2, + "scriptPubKey": { + "asm": "OP_DUP OP_HASH160 b738b1730cfb58960b1dd1765c6d3276993959e1 OP_EQUALVERIFY OP_CHECKSIG", + "hex": "76a914b738b1730cfb58960b1dd1765c6d3276993959e188ac", + "reqSigs": 1, + "type": "pubkeyhash", + "addresses": ["RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK"] + } + }, + { + "value": 1.3, + "valueSat": 130000000, + "n": 3, + "scriptPubKey": { + "asm": "OP_HASH160 4d5e24fcd799f3a3fa15f98a6c69a5829596f560 OP_EQUAL", + "hex": "a9144d5e24fcd799f3a3fa15f98a6c69a5829596f56087", + "reqSigs": 1, + "type": "scripthash", + "addresses": ["bKnMWGuXC5HEyxk3GttsT1a9TtYWKbBpEP"] + } + }, + { + "value": 3.0698, + "valueSat": 306980000, + "n": 4, + "scriptPubKey": { + "asm": "a22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c80200c0396b7e2db09ab239f0b337fbc7df888273e60323a63d0caa862116bcf51a48103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RWzd2iZT7rTU91mJVXzXpK8NWseMgZnW74"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 5, + "scriptPubKey": { + "asm": "OP_RETURN 13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460de9fbac397128243cdfe192f73c9eb327fcc75338e694a94f4df8bcf7d668868731be4f2b886f5d1292e3542f31f01a390fcd7491d730b57ce1fcd6abd792efbeb4047f2cc24b98d07577f3121a74a141d1a7ce94b1e03fa69031e91baa38ef209866fb9db448445fc4794331f5efaaadd1ee58c58deac4b26012ed65f876fb056711d3902500d2d45c0e4e082d8a058a7a671a2fd2a855bd882ee5a06962ab72d93783c7f1fcfead9f712dd3af0424572ce58a36b4e558bc9c95650351794134f1d74f8f275500f19bc967a64ee0baef222bf34c50f0bb771759afee0b202a542d4a349e2224820a2fc29259192e1dc1c2648b161a31454d9a6489fb26b280ad6dd3f1916cae118150d49c52401665c8b299608760c83659f88783120974f85f22d9af9b5ea1dd4a145b29aca2929ffa0449dc821cbe0dd8f86017a37573ad8ca33901e10664822a0ff0825f957bda6148a41d8bd48ae42a7fd10e73e4f28198e767abd1b2c1297055729ddbb613d3d4476b8cf228be84248bef116546ec8d773d271b2a850711f2a8cafd3502575c94a5c258c322f1a0123f439d796239dc7a40e996ff282eb605b7bea9336fa2d6443924a3487f3275095a8fbe136918cb6a69afa2881d793d0d70433c0e16ac5218da88ce76194d86ae8c283184249cd4fc3824614f95af655556e3c3c90765358a63c411cf5df4075546c9555feb2fa1057f540a79a30ddf997248e47076418b31514607236ee23f56b8bd7ee03e09dd063199c45b0b120af1e44920b535aae890d51d0134ee24872a995b991efa31bd4bf9e551727a877d29ef269b83efc0368d042086535b6bd956c2f7bbc3b686dbd765d092a98e825911a13ea92ad2cd7604288c0e7595ee3763849a4d61c90ed7686a3902417eb90d59e40350b12353fd5fcffc53c52759ee393e68227018c924ac9c0390d3029fd26dcd93609d57f19868abfce563dbb93921837f85b092b8539447e2696a9d60345fe390200ce741eae671561b54ee0f58c32e944a954143dd274e41179907a99394c9c1c978a964555d91d0acdda655064a824c7673dc84d1d5a94f06ca6b19078dcd657acb9d84518b94c2f56e4aed02c50a1861d536fe19c29cfede262d8cdf1fba7848f017ce53bb99eb9b40d0b2e5951b47099d8d975bf3054baa8019a9299794e9c4e1f7117974d15dcd4bf1f75b732ac65cbbcd9d2c232e8445d93f422a9315d7c7627d5e4d424094d04c6e419e9805b7bb7849214d35e02139463e73989d019cd1ea3a9084f353f3145df38f88ad0baafee1f0e95477cacc7b0246db8b4ed485db10c999c508506d0bbff6185c53903f8565edd90fc16e3f6be972463e3246a73cb1e2cb294209c71838ae86732cab6f648d10459123d30a59c1bf63a2232d32c8cfe0d06c4797c883d0ad452643496dbec37f87a1a90b525a938cf3367c9917e57c506d0fa422e530753589bd9317a775af64de696857705c5efed3037ad7ad7e1a4789ef238c6473cb433eda187484592e48e5d237d73f558cfe24f68bad4ee85b77c01b9924e262534c9a2486432a5be199aea85a935f6b2424a4fbf3a5dc7afc1866692404de45f41393aecc7ca5761c25fa5922ccebeb8b0580633c75a944d473d18318fe0fb999dd61259813bd0f5c62ff50df1148c6d12757b2de3be3098e7c283eaa3acea5049f4a7e1393235dfeda7b0fdcca6cdeee5410f023bc4c1a157cda0044edacb30b4f00d3c647e83aec5b966ed4e1829eb1f9ab7da7715f34e07e17ed59e45922500f493d74ab8f8f645f3e9002d202f9c2ed14ec698548b7d0ea182c8ea9de1b9146b3a77df43e80a2d085636eb5a80f9d643682d211ae13bb6569ce3411aaca39727850155274aa842baef36ade2173aec3d6c3f4039038d55ff69a7a35ef2d08b5478106b9f0364a8c0e95cd4751bd905c4c38dca63bbcdce24538bd08fb0cc7d9cd1f5dfc1853d502e1f38adaad6c468d9e50ff81d2a6b8dd3db7602bc272675d2efb70382dc19b9039a0b32d876787f2d0e0671b11adde48aafef6d684c517e77217be631366bf99f1109e55a389436e915d847f212b07a5c6fb94db999662ba20e92e642e88bce288cdce3dbffc0d52607af784f802eb18e810d49766ca752a6534d7459a97a2bf07787c63cd836862eb05347cebd3882df760b37b873b79d935cc4fa6f444a6f4d2bae51dab832432a258c1d741d7c133e55302920527e02f1ec8b0ab2703df6fb4c3d357efa75a53c91666b59ed6135907edee5b7ce73c3730c90e235cde4e384dd51f7d7e1b82e3c7cedff649fd6a5f247e829ea9e00d58c37ffd545cd311ad369928ac396cb5dbdfad2c6de10d0a0b1047df15f26c51b225ee148d95dd9c5aea4a4da592cd59b3fcdd8478ee264ed68e61aee55585c32b6dee251f593e8a9f492b9003208af4e04d0e5ee00afee4d0d074ae9aeaa8fda26e89fdf4825da2f0211b5c9a8eae9f1070f401cd6583d0296057c9707a481983aa45b76b290aa249cc5a545fe8956000fc2d48c4803dbc642e1ef9ac3904652ddfa3b6a29e405984a2188b31eb358ea04462ac751937ef5a153d865e6b5951392dd6b4c6ee16224705486de08d380827554419ab24b37b58bd351d157194640d9eba45c13dee0bb73429b497e3885568161f286a6b6f67d8054674a717c6d26defc68c734622dacb8a2fef4dfbd425ea78575402d15eeb9d8cc6f99b0ebf33738b34e14f34b4b990deba45abe2d3c81038d4fa3352a4e904d9d6b244585ba1b0f450c9da0fe84e711255846bf56fc483755dc006f74f816bd27c408c1d4102e2882702b7afb187096a1046cd47f1be2a10400040d310b862232ec7b8419764d05ffe3833bc8462c90ea3f4b65af3fb07b885c9403434b6e0326b05188f8c05d157e0e721a9514fc189dd7c6455d261482fc46c4c206d94ba737a1e456cd22a11e3daf0f2c5716af6ba28419cc17ffa7303ee25d52675a1612ec1cc3bb708c1f0a720d9f4e4c5b47d4bca46f393eced4e6de925262ef229adb4405c44c7ba73646ded1bad4879f8024e84eec05c8bd635bcc6372e1f420be1b7e7f764d966b8715b21b73efb19c4c2d612210cd13fe06bf45d79b0886bb67c9d8f7308cdabde24127d7d3181b3283582b27ad46e0076e03c3269c11b613a6e0375992cac30acbdfb42eb99d6b3cdd845a978845dc7acf67882eaa532641b56ab5626581fca7481e4d1f54f1fb6e1accaff130a66cbb61fde59bc2052c48325a45219818648791ac33046832b02cc9e6aa587aaedb6e7f5d2e18f9b2e6727763f9511b715a43d7a4f608cb3cd037f4e26a455f8b4f9706ec408d4d435be1e6482c2db2aa2f08f23a31900128d57f210e34cb61f73dea2614cb51c220789a40cbfa35c9d565e1f9b809c81f9e3bcdfd5fd814b619b9c7a579daac86c60abcb7293de50b0a3702e3b877f828777235a49920c9dbf5ed9ce3a3f885c2bf985c620b7d0dafd7366a22554b6601af7866b5ccef7e8d67a29345598d98f946a204c128487fb672acbc68097d722d9e12f625b62e8b9affbf05539e44b62e72f6e2d917f1660033dd2a171d37387002cc04cf857d6100409a47d2ce9926c781758d0b7405d9d40086f5835685cde5648495864ac138bf81dac0f6d972096e993b49973c7dfa9a942edc9fe8fffccceb312a0e25b3a335e3b4f06c34cfbe4828597aeccf738a8164fefd1e88b62b12d76d13a5cef333bf8f16135dcbb84fa257b24eaa1e2b7d9c9e9fef6bf5d908e57a05c75d950dbd9ed6ab6f72a45f29e8fa80987406cad82c8d57c744928e3c5b5dbb054df82952b6d995d8b981b532170b311d701b1c0613787b3dbba56c254ffd8ff11270888029d9b342f08c891d185f2ec769afbc8d2b5e232c2ff3365c038102e09094d7dba19552a773f5d2fd153b24ebf7950f7d8c9b857413461cd68c464eaacdfa050b05e4b67a842727ae83a560e692fd7c473552e0b4d6c33544bb3498e4f77061bd8b06a279e68e813ba1571744328f27ad2f9d92cd0e33897c649c6cf33f235604e092d002c1f7e5fbe5cbff16b92540e33e4b3afd99e7df80bc23eca979125c0f271eb1f3e309c9a4dc48e82873b918c1b75ef029f3fa80a65d0ba9a3d7739a0763bbeee1920cc953d46921dcecb65a57f608b9092221209f5dcdddd66998f295f043114fb4c263634381cd381fd75e6c9d21620d13a4544a1ff4a9b789ca115d8108f8ee063c4ee9fd4e21886d74c3a54fefae364fc924d9a7d0994796f6753f92b7fb77be7ceae095e8de8b064aa3ac04138fc9c92a5b63714644ca35c9a12559a0b406df0dade4bc2018c029e0f5e87326ba85360788188cfb03873255c2adaa347fe8265f1fc32d0a8b90ea49dfb8aacf01c69744cf0096298559670d515540cc929480b7fe97608111f17b6a39e3e4b9c127e027d4ce00a761c3e3336b91e4bedacaf3a84b44e3f69180d8da4c7ddaed25841351096d7e822ed97c87250f901365c656671b5b80b0c182126333945516f8f9294bdc6c7cef8fd1a1e5c686e8081949a9da4aab4bde0eb0a28292f373e4c51545cf9ff11425c6b6f7a7e7f848ca1a8c2cbdcedf0fbff03192527353e3f55878fb2ccd7fc0000000000000000000000000000000000000000000000000000000000000000081b2b374a588124700005070e14a0805080a84a430004891a4412051202000440190140c06261da92a73502f904c0eab1b16b2d2b60ec32c1863d95069848bfe717ae65f8d8b718f7dc2f5b9c0605b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71afa26465694d923ee4d490ddd090c0aa7002b6e6a7dcf0550a940ccb6480e325b6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6", + "hex": "6a4d0c0e13514009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6fd460de9fbac397128243cdfe192f73c9eb327fcc75338e694a94f4df8bcf7d668868731be4f2b886f5d1292e3542f31f01a390fcd7491d730b57ce1fcd6abd792efbeb4047f2cc24b98d07577f3121a74a141d1a7ce94b1e03fa69031e91baa38ef209866fb9db448445fc4794331f5efaaadd1ee58c58deac4b26012ed65f876fb056711d3902500d2d45c0e4e082d8a058a7a671a2fd2a855bd882ee5a06962ab72d93783c7f1fcfead9f712dd3af0424572ce58a36b4e558bc9c95650351794134f1d74f8f275500f19bc967a64ee0baef222bf34c50f0bb771759afee0b202a542d4a349e2224820a2fc29259192e1dc1c2648b161a31454d9a6489fb26b280ad6dd3f1916cae118150d49c52401665c8b299608760c83659f88783120974f85f22d9af9b5ea1dd4a145b29aca2929ffa0449dc821cbe0dd8f86017a37573ad8ca33901e10664822a0ff0825f957bda6148a41d8bd48ae42a7fd10e73e4f28198e767abd1b2c1297055729ddbb613d3d4476b8cf228be84248bef116546ec8d773d271b2a850711f2a8cafd3502575c94a5c258c322f1a0123f439d796239dc7a40e996ff282eb605b7bea9336fa2d6443924a3487f3275095a8fbe136918cb6a69afa2881d793d0d70433c0e16ac5218da88ce76194d86ae8c283184249cd4fc3824614f95af655556e3c3c90765358a63c411cf5df4075546c9555feb2fa1057f540a79a30ddf997248e47076418b31514607236ee23f56b8bd7ee03e09dd063199c45b0b120af1e44920b535aae890d51d0134ee24872a995b991efa31bd4bf9e551727a877d29ef269b83efc0368d042086535b6bd956c2f7bbc3b686dbd765d092a98e825911a13ea92ad2cd7604288c0e7595ee3763849a4d61c90ed7686a3902417eb90d59e40350b12353fd5fcffc53c52759ee393e68227018c924ac9c0390d3029fd26dcd93609d57f19868abfce563dbb93921837f85b092b8539447e2696a9d60345fe390200ce741eae671561b54ee0f58c32e944a954143dd274e41179907a99394c9c1c978a964555d91d0acdda655064a824c7673dc84d1d5a94f06ca6b19078dcd657acb9d84518b94c2f56e4aed02c50a1861d536fe19c29cfede262d8cdf1fba7848f017ce53bb99eb9b40d0b2e5951b47099d8d975bf3054baa8019a9299794e9c4e1f7117974d15dcd4bf1f75b732ac65cbbcd9d2c232e8445d93f422a9315d7c7627d5e4d424094d04c6e419e9805b7bb7849214d35e02139463e73989d019cd1ea3a9084f353f3145df38f88ad0baafee1f0e95477cacc7b0246db8b4ed485db10c999c508506d0bbff6185c53903f8565edd90fc16e3f6be972463e3246a73cb1e2cb294209c71838ae86732cab6f648d10459123d30a59c1bf63a2232d32c8cfe0d06c4797c883d0ad452643496dbec37f87a1a90b525a938cf3367c9917e57c506d0fa422e530753589bd9317a775af64de696857705c5efed3037ad7ad7e1a4789ef238c6473cb433eda187484592e48e5d237d73f558cfe24f68bad4ee85b77c01b9924e262534c9a2486432a5be199aea85a935f6b2424a4fbf3a5dc7afc1866692404de45f41393aecc7ca5761c25fa5922ccebeb8b0580633c75a944d473d18318fe0fb999dd61259813bd0f5c62ff50df1148c6d12757b2de3be3098e7c283eaa3acea5049f4a7e1393235dfeda7b0fdcca6cdeee5410f023bc4c1a157cda0044edacb30b4f00d3c647e83aec5b966ed4e1829eb1f9ab7da7715f34e07e17ed59e45922500f493d74ab8f8f645f3e9002d202f9c2ed14ec698548b7d0ea182c8ea9de1b9146b3a77df43e80a2d085636eb5a80f9d643682d211ae13bb6569ce3411aaca39727850155274aa842baef36ade2173aec3d6c3f4039038d55ff69a7a35ef2d08b5478106b9f0364a8c0e95cd4751bd905c4c38dca63bbcdce24538bd08fb0cc7d9cd1f5dfc1853d502e1f38adaad6c468d9e50ff81d2a6b8dd3db7602bc272675d2efb70382dc19b9039a0b32d876787f2d0e0671b11adde48aafef6d684c517e77217be631366bf99f1109e55a389436e915d847f212b07a5c6fb94db999662ba20e92e642e88bce288cdce3dbffc0d52607af784f802eb18e810d49766ca752a6534d7459a97a2bf07787c63cd836862eb05347cebd3882df760b37b873b79d935cc4fa6f444a6f4d2bae51dab832432a258c1d741d7c133e55302920527e02f1ec8b0ab2703df6fb4c3d357efa75a53c91666b59ed6135907edee5b7ce73c3730c90e235cde4e384dd51f7d7e1b82e3c7cedff649fd6a5f247e829ea9e00d58c37ffd545cd311ad369928ac396cb5dbdfad2c6de10d0a0b1047df15f26c51b225ee148d95dd9c5aea4a4da592cd59b3fcdd8478ee264ed68e61aee55585c32b6dee251f593e8a9f492b9003208af4e04d0e5ee00afee4d0d074ae9aeaa8fda26e89fdf4825da2f0211b5c9a8eae9f1070f401cd6583d0296057c9707a481983aa45b76b290aa249cc5a545fe8956000fc2d48c4803dbc642e1ef9ac3904652ddfa3b6a29e405984a2188b31eb358ea04462ac751937ef5a153d865e6b5951392dd6b4c6ee16224705486de08d380827554419ab24b37b58bd351d157194640d9eba45c13dee0bb73429b497e3885568161f286a6b6f67d8054674a717c6d26defc68c734622dacb8a2fef4dfbd425ea78575402d15eeb9d8cc6f99b0ebf33738b34e14f34b4b990deba45abe2d3c81038d4fa3352a4e904d9d6b244585ba1b0f450c9da0fe84e711255846bf56fc483755dc006f74f816bd27c408c1d4102e2882702b7afb187096a1046cd47f1be2a10400040d310b862232ec7b8419764d05ffe3833bc8462c90ea3f4b65af3fb07b885c9403434b6e0326b05188f8c05d157e0e721a9514fc189dd7c6455d261482fc46c4c206d94ba737a1e456cd22a11e3daf0f2c5716af6ba28419cc17ffa7303ee25d52675a1612ec1cc3bb708c1f0a720d9f4e4c5b47d4bca46f393eced4e6de925262ef229adb4405c44c7ba73646ded1bad4879f8024e84eec05c8bd635bcc6372e1f420be1b7e7f764d966b8715b21b73efb19c4c2d612210cd13fe06bf45d79b0886bb67c9d8f7308cdabde24127d7d3181b3283582b27ad46e0076e03c3269c11b613a6e0375992cac30acbdfb42eb99d6b3cdd845a978845dc7acf67882eaa532641b56ab5626581fca7481e4d1f54f1fb6e1accaff130a66cbb61fde59bc2052c48325a45219818648791ac33046832b02cc9e6aa587aaedb6e7f5d2e18f9b2e6727763f9511b715a43d7a4f608cb3cd037f4e26a455f8b4f9706ec408d4d435be1e6482c2db2aa2f08f23a31900128d57f210e34cb61f73dea2614cb51c220789a40cbfa35c9d565e1f9b809c81f9e3bcdfd5fd814b619b9c7a579daac86c60abcb7293de50b0a3702e3b877f828777235a49920c9dbf5ed9ce3a3f885c2bf985c620b7d0dafd7366a22554b6601af7866b5ccef7e8d67a29345598d98f946a204c128487fb672acbc68097d722d9e12f625b62e8b9affbf05539e44b62e72f6e2d917f1660033dd2a171d37387002cc04cf857d6100409a47d2ce9926c781758d0b7405d9d40086f5835685cde5648495864ac138bf81dac0f6d972096e993b49973c7dfa9a942edc9fe8fffccceb312a0e25b3a335e3b4f06c34cfbe4828597aeccf738a8164fefd1e88b62b12d76d13a5cef333bf8f16135dcbb84fa257b24eaa1e2b7d9c9e9fef6bf5d908e57a05c75d950dbd9ed6ab6f72a45f29e8fa80987406cad82c8d57c744928e3c5b5dbb054df82952b6d995d8b981b532170b311d701b1c0613787b3dbba56c254ffd8ff11270888029d9b342f08c891d185f2ec769afbc8d2b5e232c2ff3365c038102e09094d7dba19552a773f5d2fd153b24ebf7950f7d8c9b857413461cd68c464eaacdfa050b05e4b67a842727ae83a560e692fd7c473552e0b4d6c33544bb3498e4f77061bd8b06a279e68e813ba1571744328f27ad2f9d92cd0e33897c649c6cf33f235604e092d002c1f7e5fbe5cbff16b92540e33e4b3afd99e7df80bc23eca979125c0f271eb1f3e309c9a4dc48e82873b918c1b75ef029f3fa80a65d0ba9a3d7739a0763bbeee1920cc953d46921dcecb65a57f608b9092221209f5dcdddd66998f295f043114fb4c263634381cd381fd75e6c9d21620d13a4544a1ff4a9b789ca115d8108f8ee063c4ee9fd4e21886d74c3a54fefae364fc924d9a7d0994796f6753f92b7fb77be7ceae095e8de8b064aa3ac04138fc9c92a5b63714644ca35c9a12559a0b406df0dade4bc2018c029e0f5e87326ba85360788188cfb03873255c2adaa347fe8265f1fc32d0a8b90ea49dfb8aacf01c69744cf0096298559670d515540cc929480b7fe97608111f17b6a39e3e4b9c127e027d4ce00a761c3e3336b91e4bedacaf3a84b44e3f69180d8da4c7ddaed25841351096d7e822ed97c87250f901365c656671b5b80b0c182126333945516f8f9294bdc6c7cef8fd1a1e5c686e8081949a9da4aab4bde0eb0a28292f373e4c51545cf9ff11425c6b6f7a7e7f848ca1a8c2cbdcedf0fbff03192527353e3f55878fb2ccd7fc0000000000000000000000000000000000000000000000000000000000000000081b2b374a588124700005070e14a0805080a84a430004891a4412051202000440190140c06261da92a73502f904c0eab1b16b2d2b60ec32c1863d95069848bfe717ae65f8d8b718f7dc2f5b9c0605b6c4e4f03aeb278b308f22d52a00a99ec34cbc031840ee5645b5aed60f0c71afa26465694d923ee4d490ddd090c0aa7002b6e6a7dcf0550a940ccb6480e325b6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004009234f4b9e071de316eb740134544ad8d72ea75c4c060705a455784d220dd6", + "type": "nulldata" + } + } + ], + "vjoinsplit": [], + "valueBalance": 0.0, + "vShieldedSpend": [], + "vShieldedOutput": [], + "blockhash": "00dd330b0cdd98a8dbef975080de7a554f7907cdb72e13fda84191df049f5c68", + "height": 27878, + "confirmations": 16, + "rawconfirmations": 16, + "time": 1552876080, + "blocktime": 1552876080 + } + ``` + + +As seen above, this transaction spent the qutxo created in the previous step. + +#### Convert the Opreturn Hex Value to Big Endian + +Convert the `hex` value of the opreturn to big endian. + +```bash +d60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f23094000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b625e38064cb0c940a55f0dca7e6b60270aac090d0dd90d4e43e924d696564a2af710c0fd6aeb54556ee401803bc4cc39ea9002ad5228f308b27eb3af0e4c4b605069c5b2fdcf718b7d8f865ae17e7bf489806953d86c132ec602b2d6bb1b1eac004f90235a792da6162c040011940040002120512441a890400434aa8805080a0140e070500702481584a372b1b080000000000000000000000000000000000000000000000000000000000000000fcd7ccb28f87553f3e3527251903fffbf0eddccbc2a8a18c847f7e7a6f6b5c4211fff95c54514c3e372f29280aebe0bdb4aaa49d9a9481806e685c1e1afdf8cec7c6bd94928f6f514539332621180c0bb8b57166655c3601f95072c897ed22e8d79610354158d2aeddc7a48d0d18693f4eb4843aafaced4b1eb936333e1c760ae04c7d027e129c4b3e9ea3b6171f110876e97f0b4829c90c5415d5709655986209f04c74691cf0ac8afb9da40eb9a8d032fcf16582fe47a3da2a5c257338b0cf8881786053a86b32875e0f9e028c01c24bdedaf06d400b9a55129a5ca34c641437b6a5929cfc3841c03aaa64b0e88d5e09aecee77bb77f2bf953676f7994097d9a4d92fc64e3fafe543a4cd78618e2d49feec463e08e8f10d815a19c789b4affa144453ad12016d2c9e675fd81d31c383436264cfb1431045f298f9966dddddcf509122292908b607fa565cbce1d92463d95cc2019eebe3b76a039773d9abad0650aa83f9f02ef751b8c913b87828ec44d9a9c303e1feb71f2c0259197ca3ec20bf87d9ed9afb3e4330e54926bf1bf5cbe5f7e1f2c002d094e6035f233cfc649c69738e3d02cd9f9d27af22843747115ba13e8689e276ab0d81b06774f8e49b34b54336c4d0b2e5573c4d72f690e563ae87a7242a8674b5eb050a0dfacea64c468cd61344157b8c9d8f75079bf4eb253d12f5d3f772a5519ba7d4d09092e1038c06533ffc232e2b5d2c8fb9a76ecf285d191c8082f349b9d0288082711ffd8ff54c256badbb3873761c0b101d711b37021531b988b5d996d2b9582df54b0dbb5c5e32849747cd5c882ad6c408709a88f9ef2452af7b66aedd9db50d9755ca0578e905dbff6fee9c9d9b7e2a1ea247b25fa84bbdc3561f1f83b33ef5c3ad1762db1628be8d1ef4f16a838f7ccae978582e4fb4cc3064f3b5e333a5be2a012b3ceccff8ffec9ed42a9a9dfc77399b493e99620976d0fac1df88b13ac6458494856de5c6835586f08409d5d40b7d05817786c92e92c7da4090410d657f84cc02c008773d371a1d23d0360167f912d6e2fe7624be43955f0fbafb9e8625b622fe1d922d79780c6cb2a67fb8784124c206a948fd9985534297ad6e8f7ce5c6b86f71a60b65425a26673fddad0b720c685f92b5c883f3aced95ebf9d0c92495a237787827f873b2e70a3b050de9372cbab606cc8aa9d577a9c9b614b81fdd5dfbce3f9819c809b1f5e569d5ca3bf0ca48907221cb54c61a2de731fb64ce310f2578d120019a3238ff0a22adbc282641ebe35d4d408c46e70f9b4f855a4264e7f03cdb38c604f7a3da415b711953f7627672e9b8fe1d2f5e7b6edaa87a56a9ecc022b834630c31a794886811952a42583c45220bc59de1fb6cb660a13ffcaace1b61f4ff5d1e48174ca1f582656ab561b6432a5ea8278f6acc75d8478a945d8cdb3d699eb42fbbdac30ac2c9975036e3a611bc169323ce076006ed47ab2823528b381317d7d1224deabcd08738f9d7cb66b88b0795df46be03fd10c2112d6c2c419fb3eb7215b71b866d964f7e7b7e10b421f2e37c6bc35d68b5cc0ee844e02f87948ad1bed6d6473bac7445c40b4ad29f22e2625e96d4eedec93f346ca4b7db4c5e4f4d920a7f0c108b73bccc12e61a17526d525ee0373fa7fc19c4128baf66a71c5f2f0dae3112ad26c451e7a73ba946d204c6cc42f4861d255647cdd89c14f51a921e7e057d1058c8f18056b32e0b6343440c985b807fbf35ab6f4a30ec96284bc3338fe5fd0649741b8c72e2362b810d3400040102abef147cd46106a0987b1afb7022788e202411d8c407cd26b814ff706c05d7583c46ff56b845512714ee80fdac950f4b0a15b5844b2d6d904e9a45233fad43810c8d3e2ab45bade90b9b4344fe1348b7333bf0e9bf9c68c9deb5ed102545778ea25d4fb4def2f8acbda2246738cc6ef6dd2c617a7744605d8676f6b6a281f16685588e397b42934b70bee3dc145ba9e0d649471151d35bd587bb324ab1944552708388de06d4805472216eec6b4d62d3951596b5e863d155aef371975ac6244a08e35eb318b18a28459409ea2b6a3df2d650439acf91e2e64bc3d80c4482dfc006095e85f545acc49a20a296bb745aa8319487a70c9576029d08365cd01f470109fae8e9a5c1b21f0a25d82f4fd896ea2fda8ea9aae74d0d0e4fe0ae05e0e4de0f48a2003902b499f8a3e591f25ee6d2bc38555e5ae618ed64e26ee7884ddfcb359cd92a54d4aea5a9cdd958d14ee25b2516cf215df47100b0a0de16d2caddfdbb56c39ac289936ad11d35c54fd7fc3580de0a99e827e245f6afd49f6dfcec7e3821b7e7d1fd54d384ede5c230ec930373ce77c5beeed075913d69eb56616c9535aa7ef57d3c3b46fdf0327abb0c81e2fe02705920253e533c1d741d7c158a2322483ab1de5bad2f4a644f4a64fcc35d9793b877bb360f72d88d3eb7c3405eb626883cd637c7807bfa2979a45d734652a75ca6697d410e818eb02f884f77a60520dfcbf3dcecd88e2bc882e642ee920ba629699db94fbc6a5072b217f845d916e4389a3559e10f199bf661363be1772e717c584d6f6feaa48dead111b67e0d0f28767872db3a039909bc12d3870fb2e5d6772c22b60b73dddb8a6d281ff509e8d466cadda8af3e102d55318fc5d1fcdd9c70cfb08bd3845e2dcbc3ba6dc384c5c90bd5147cd950e8c4a36f0b9068147b5082def357a9af65fd5389003f4c3d6c3ae7321de6af3ae2b84aa74521550787239caaa1134ce6965bb13ae11d28236649d0fa8b56e6385d0a2803ef47da7b346911bdea98e2c18ead0b7488569ec14edc2f902d202903e5f648f8fab743d490f502259e459ed177ee0345f71a77dabf9b19e82e1d46e965bec3ae847c6d3004f0bb3aced4400da7c151a4cbc23f01054eede6ccadc0f7bdafe5d2393137e4a9f04a5ce3aaa3e287c8e09e33bdeb25727d1c64811df50ff625c0fbd13982561dd99b90ffe1883d173d444a9753c6380058bebebcc2259fa251c76a57cccae9313f445de0424696618fc7adca5f3fba424246b5f935aa8ae99e15b2a4386249a4c5362e224991bc0775be84ead8bf624fe8c553fd737d2e5482e59847418da3e43cb73648c23ef89471a7eadd77a03d3fe5e5c70576869de64af75a71793bd89357530e522a40f6d507ce517997c36f38c935a520ba9a1877fc3be6d49432645add083c897476cd0e0cfc8322d23a263bfc1590ad3239145108d646fab2c7386ae3818c7094229cbe2b13ca746323e4672e96b3f6ec10fd9ed65853f90535c18f6bf0b6d5008c599c910db85d44e8bdb46027bccca7754e9f0e1feaa0bad888ff35d14f353f384903aead19c019d98733e463921e0354d214978bbb705989e416e4cd09440424d5e7d62c7d715932a423fd945842e232c9dcdbb5cc62a735bf7f14bcd5dd1747911f7e1c4e9949729a91980aa4b05f35b978d9d09471b95e5b2d0409beb99bb53ce17f04878ba1fdf8c2d26defe9cc219fe36d561180ac502ed4a6ef5c2948b51849dcb7a65cd8d07196bca064fa9d5d184dc73764c824a0655a6ddacd0915d5564a978c9c1c99493a9079917414e27dd4341954a942ec3580fee541b5671e6ea41e70c2090e35f34609d6a69e2479453b892b0857f832139b9db63e5fcab6898f1579d6093cd6dd29f02d390039cac24c9187022683e39ee5927c553fccf5ffd5323b15003e4590db97e4102396a68d70ec9614d9a846337ee95750e8c280476cdd22aa93ea11159828ea992d065d7db86b6c3bbf7c256d96b5b538620048d36c0ef839b26ef297d877a7251e5f94bbd31fa1e995b992a8724ee34011dd590e8aa35b52049e4f10a120b5bc4993106dd093ee07ebdb8563fe26e23074651318b417670e4487299df0da3790a547f05a12feb5f55c9465507f45dcf11c4638a356507c9c3e3565565af954f612438fcd49c248431288cae864d1976ce88da1852ac160e3c43700d3d791d88a2af696acb186913be8f5a0975327f48a3243944d6a26f33a9beb705b62e28ff96e9407adc3962799d433f12a0f122c358c2a5945c570235fdcaa8f21107852a1b273d778dec466511ef8b2484be28f28c6b47d4d313b6db9d72557029c1b2d1ab67e79881f2e4730ed17f2ae48ad48b1da44861da7b955f82f00f2a826406e10139a38cad7375a31760f8d80dbe1c82dc4904fa9f92a2ac295b144adda15e9bafd9225ff87409128387f85936c860876099b2c8651640529cd4508111ae6c91f1d36dad80b226fb89649a4d45311a168b64c2c11d2e195992c22f0a8224229e344a2d542a200beeaf591777bbf0504cf32b22efbae04ea667c99bf10055278f4fd7f1344179510365959cbc58e5b4368ae52c572404afd32d719fadfefcf1c78337d972ab6269a0e52e88bd55a8d22f1a677a8a058a2d084e0e5cd4d2002590d3116705fb76f865ed1260b2c4ea8dc558eed1adaaeff5314379c45f4448b49dfb669820ef38aa1be93190a63fe0b194cea7d141a1741a12f37775d0984bc22c7f04b4beef92d7abd6fce17cb530d79174cd0f391af0312f54e392125d6f882b4fbe31878668d6f7bcf84d4fa994e63853c7fc27b39e3cf792e1df3c24287139acfbe90d46fdd60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f23094051130e0c4d6a +``` + +* At position `[:64]` we see the `destpubtxid` for vout 4: `d60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f230940` +* At position `[64:128]` is null bytes + * Vout 3 is addressed to a normal address, as opposed to a Dilithium handle +* At position `[128:192]` is null bytes + * `[128:192]` is vout 2 +* At position `[192:256]` we see the `destpubtxid` for the `LABSLover` handle: `b625e38064cb0c940a55f0dca7e6b60270aac090d0dd90d4e43e924d696564a2` +* At position `[256:320]` we see the `destpubtxid` for the `KomodoFan` handle: `af710c0fd6aeb54556ee401803bc4cc39ea9002ad5228f308b27eb3af0e4c4b6` +* At position `[-76:-12]` we see the sender's `destpubtxid`: `d60d224d7855a40507064c5ca72ed7d84a54340174eb16e31d079e4b4f230940` + +## Find the Balance of an Arbitrary Handle + +{/* Sidd: There was something in the paragraph below about q_listunspent, but I didn't understand it. */} + +To find the balance in a normal address we might use the [listunspent](/smart-chains/api/wallet/#listunspent) RPC. + +A handle, however, is based on a Dilithium-related Antara Address, and these are more complicated. In this section of the tutorial, we use a series of RPCs and our own customized code to find all the utxos in a public Dilithium handle of our choosing. + +We can call this customized action a "Q listunspent" function, by way of conversation. + +#### Obtain the Antara Address for the Handle + +Our target for this example is the `LABSLover` handle. + +Use the [handleinfo](/antara/api/dilithium/#handleinfo) and [cclibaddress](/smart-chains/api/cclib/#cclibaddress) RPC to obtain the Antara Address of this handle. + +```bash +./komodo-cli -ac_name=MUSIG cclib handleinfo 19 "[%22LABSLover%22]" +``` + + + ```json + { + "result": "success", + "handle": "LABSLover", + "destpubtxid": "b625e38064cb0c940a55f0dca7e6b60270aac090d0dd90d4e43e924d696564a2", + "pkaddr": "P8bX1ddLLaR149rZZEXkWTAbLTgczsM4vK", + "pubkey": "03cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61" + } + ``` + + +Use the returned `pubkey` value with the `cclibaddress` RPC. + +```bash +./komodo-cli -ac_name=MUSIG cclibaddress 19 03cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61 +``` + + + ```json + { + "result": "success", + "CClibCCAddress": "RJxChTpGrT8Y64NxTK95TVs3r8wPCwswKF", + "CClibCCBalance": 0.01, + "CClibNormalAddress": "RCUDfxQCgXpB8bKqkzwBrR4cG8HxjAzJ7Y", + "CClibNormalBalance": 0.0, + "CClibCCTokensAddress": "RJzz5iNW4fa8epQJH81CNK5vqPv8PzGz6A", + "PubkeyCCaddress(CClib)": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "PubkeyCCbalance(CClib)": 7.4996, + "myCCAddress(CClib)": "RWzd2iZT7rTU91mJVXzXpK8NWseMgZnW74", + "myCCbalance(CClib)": 3.0699, + "myaddress": "RVXJpc9N4j35psbqmRZzgpKmo98w1CnvHA", + "mybalance": 91.22945 + } + ``` + + +The `"PubkeyCCaddress(CClib)"` value is the Antara Address for `LABSLover`: `RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7` + +Use the [getaddressutxos](/smart-chains/api/address/#getaddressutxos) RPC to find the utxos in this `PubkeyCCaddress(CClib)` address. + +```bash +./komodo-cli -ac_name=MUSIG getaddressutxos '{"addresses": ["RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7"]}' +``` + + + ```json + [ + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "adebadd9483bb3d6edd10304dc162506a36adc4aabb14dd13a623042f339236d", + "outputIndex": 1, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 10000, + "height": 24921 + }, + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "fc6c067ec1091ec0d57ab86812af85a8650b10c6f1f0b954fc8db8c0e877e2a9", + "outputIndex": 1, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 10000, + "height": 24922 + }, + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "5b5dab18abbfc0b85c6632ec6b4f71e30d7e28cbfa5e29a6a6e4d48f2fb730cf", + "outputIndex": 0, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 100000000, + "height": 25034 + }, + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "5b5dab18abbfc0b85c6632ec6b4f71e30d7e28cbfa5e29a6a6e4d48f2fb730cf", + "outputIndex": 1, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 429930000, + "height": 25034 + }, + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "af710c0fd6aeb54556ee401803bc4cc39ea9002ad5228f308b27eb3af0e4c4b6", + "outputIndex": 1, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 10000, + "height": 26317 + }, + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "ab91e6d67e88557e2fbc459574facdb31e4b8df6352cb564391dcfb653013372", + "outputIndex": 1, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 10000, + "height": 27853 + }, + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "6638c62562a9a9e5cf78cdcd7c77aa54746822bddce9b318d09f5ede565145f5", + "outputIndex": 0, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 100000, + "height": 27853 + }, + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "6638c62562a9a9e5cf78cdcd7c77aa54746822bddce9b318d09f5ede565145f5", + "outputIndex": 1, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 9890000, + "height": 27853 + }, + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "b625e38064cb0c940a55f0dca7e6b60270aac090d0dd90d4e43e924d696564a2", + "outputIndex": 1, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 10000, + "height": 27859 + }, + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "5aaf4007d6d9af7883da1ad464b63fff9d97453efe0b181d19558cc15f6ff668", + "outputIndex": 1, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 110000000, + "height": 27878 + }, + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "a23579447936e891182d713be4a35c634a0785c5355bd45c81566bc01196aa98", + "outputIndex": 0, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 1000000, + "height": 28175 + }, + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "a23579447936e891182d713be4a35c634a0785c5355bd45c81566bc01196aa98", + "outputIndex": 1, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 10000000, + "height": 28175 + }, + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "a23579447936e891182d713be4a35c634a0785c5355bd45c81566bc01196aa98", + "outputIndex": 2, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 20000000, + "height": 28175 + }, + { + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "a23579447936e891182d713be4a35c634a0785c5355bd45c81566bc01196aa98", + "outputIndex": 3, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 68990000, + "height": 28175 + } + ] + ``` + + +In the returned response we observe many utxos. + +We cannot assume that all of the returned utxos belong to the `LABSLover` handle, however. Recall that a handle must be associated with a single Antara Address, but an Antara Address can have multiple handles. Therefore, some of the above utxos belong to `LABSLover`, and some may belong to another handle. + +To ascertain which utxos belong to which handle, we must write a script that performs several tasks. First, the script iterates over each utxo and checks whether the utxo is a "Dilithium send transaction" or a "Dilithium Qsend transaction". For those that are Qsend transactions, the script then checks whether each utxo belongs to the `LABSLover` handle. + +Generally, any utxo with a value of `0.0001` coins can be ignored in this circumstance. These utxos are created by the Dilithium register RPC and are used to index handles for a given pubkey. + +For this example, we select one of the above utxos for closer inspection. Our first task is to ascertain whether this utxo is related to Dilithium. + +```json +{ + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "txid": "5b5dab18abbfc0b85c6632ec6b4f71e30d7e28cbfa5e29a6a6e4d48f2fb730cf", + "outputIndex": 0, + "script": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "satoshis": 100000000, + "height": 25034 +} +``` + +Use the getrawtransaction RPC with the `txid` value. + +```bash +./komodo-cli -ac_name=MUSIG getrawtransaction 5b5dab18abbfc0b85c6632ec6b4f71e30d7e28cbfa5e29a6a6e4d48f2fb730cf 2 +``` + + + ```json + { + "hex": "0400008085202f890373510b5982b590c12b37fc743dc7749ac8f0cdb51fa72119056026ee0b50a776000000007b4c79a276a072a26ba067a565802103cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e618140ad8f8664af1ba877d0404c206510e0f083f9a18572606c90c25ded0f9c12c80c0e9ad3711d900ec2f0258a96ba219b75a42a8f51562d8546644d19a463bc7a9fa100af03800113a10001ffffffffa137c5974e69ac63d7f3434d1a8cbde8ef3bb08d54b5689d68af945255759f33000000007b4c79a276a072a26ba067a565802103cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61814029e181b897695bc7e747255d9dd8b46010abe885212b51ede555d3a7d9bbf6fd0d36f9c95f57241efa1b31c3a5ba37da9eb65e140069bb7aa9ccc96aa4cecb95a100af03800113a10001ffffffffa6470a9f967e4b294127a62cffe75310012dc0487299c5a55d48425640730c5b000000007b4c79a276a072a26ba067a565802103cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e618140fea184b62a5d4a5d7d812a976922814059dc64b4e1e9eac5bbafcf66e922038131cb1ded8bb8523f7f4968b8e6e5bd4167dd70d1acb3ee554055d043ab4c0785a100af03800113a10001ffffffff0300e1f50500000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc1036a01900000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc0000000000000000fdb00d6a4dac0d13516d2339f34230623ad14db1ab4adc6aa3062516dc0403d1edd6b33b48d9adebadfd460d09f633110175d9f8e08a310ad7fe88d97b4a41903dd0c0db05154d01eafd2ffb4ec74a5cb468cba9b963d6005091f53bd044cae57ae44b6879e66c19791d5f52239f1d980de5f8958a6aa5869bd9efa343d3cabd170d23904efab800cb2a8497b78d702fb8bf3a312a18635dc9c905919bc3e119f919dca5421e51ba10bf3aa31e816b884187c841683ef87aebf89bf72f0b9492d20c1156e27dbfdb991b40671dbb372004f0d40398dbecc26f745a164ce14116f004d68672d4200d04106a67708293d890d88e99f381d78230245fb6a420162e9ade3e7c61e2d72e812ab4b7d439996fd1c2a659fae4658ef7fc196ec1c8017672c1bd7838e59916795fe4171e126a09322f213c306eb4b4563f72ebf1bb91b61850f451cc79dc644e51625db5a82cf1985df5e94b6ead6e92aa91f6da67e0431c843def9125c2c33db4631720ed1e3ea53a0d86f5174c842bc54f710556c9de8aae18cd545094333fe539cc6ccac859ec6dd02271437bc0ec93f511030ad79b57f168e5bbc93e6907a144cbc3fcce8dec42e26a5b9ea445a4f53a33ca7939d7db03c8637d655db9629c108198f1be4d133e5a99801ac5baebf9a8065e6fb5f34d64e0fe1bd7a4383e62134ae0a7df3bfb6f03881308925685b52d80d4f99351e71c80763605fd47c44129028ac475860070209527d626a720d79218776de338bed124fed901944db74735e9ae021474bfa98b1bfff4347e65df70d6d9dc68bab40fa071e2a73cb55f98163d32fe094de1c608836591df0158faa061211783fded36759fd27f9e950e729a4210b18390ff7d7cda94ec6d844c2aa980295bde433ddbdc870c56e7226e105327b2615734e08e688d757eb7ae5a98d9a08b4e2f10b9d77c04e1de4a489068110b7d463facb2c232561c53a97d00230ccb8c056ffd3a52d76c17baed79b8123d8d6bd6ab0641d44b4a623ef0c54bd306bc8fbc4196e9e54c615a6eb43a2243f88756b00f567ed27bdddf929894ced73bdda70813e04160cb6de9e7da2568b9c56ab884dde1ad2a219878a727301e9597de33f00cb191caf3dc358c159abdacfd0239cf96f206eba195217ae5e3b19ce0687b0991b8483da09a74b9b9c7aff6e6178bc4a23bea2069a7dc7b0003273935e2ae25e67d3c6fd4b788a0be7e4c45e378af4f7d6af047c7e938560a25610f4dfcc4a8a0998a1f32c193b026cf6344d152e4764364b57278197ae0754794bbdbf329e966563d57e5bf039cd20482f04866f6d4e8912e3a6590f639b9d487a83792cb30b394d5783df4bae3b6201b3d0d215e0a0eea21baeb41a3c88dc09abfa4cffdb2ff02867344e1e01edf7d545d5e8118471f94da80fd8aeccb507abece80c6e9ee0bb92651f2129a216e4a417b5be6ce9fdb1a608ffea107b8ab2b7f158d3eda057e8fff79b0178c61c6491e136d1946ffc3598f6d87318be6d9dd941489cc4c0e363d7771d0514e83f41e875ae0eddd4c44fa60ed34091dfbab8810a3a0b0fdef1ba21f412254e92f63343e22bedfaf4c329202f24b7158021f82a18eb8aab64a1d6ef7861ed22c515cd892f9b38b0b4e26c12efff5fce1d5605fddd00bf3b72fe04da6b27ca9e54d24a1dbe77dc3793ca1055b73e64344535abf199124c6c46661386521608a65df19598dbc57b88e6a19f6a950eff6290e11029291c579a34e0dea645f08afe76cd1b654e1a3e89efd436c5fe24a6a46cb62a3e2c1c051f6b7e13c37781d38259d82b921852fc3dc70c49d5e7c2b81bf95a442f0f0bbaa0da47406464533ec8b26a1df27143ecda9ac680fb351bf46c35c2c8be959174e78c390d9c5aacbe12635952c144e454f27f141579eff7be53b1425dbc544337acd5497ff9e95c54ba9e83330c332bcbc424c3125af4f56e367a8a76ea9277956abc474a7a641ac52142330d9cf43bebdca704b44264bc3055e4a5267a8bc726ab12d7672a3794944375019a3abf4ad25f4aa9400798a745c5d27c404a103fbe9424fa6c216e21d58b23bc584c70704e155678835773da1337eca84172d2cba605f59c9c7c09d6aa7131024299ec43704bd199b66c2362c54a50f59709ead7c7e85b88bf21ff2d46d7362c2dede76867b9b28d76e47cb6fcf0f6a248b905b0021811472bb8c0006e86115d8997c4b4e8ca7c6f76cf0105ca5da3404674d8ac7b66738eaeab719378c2a5527c0abf93265cc4d3654cd19840285a5da86827016f07e3d432cdc43c26dc050daf0fdd785c8739220f57e61c8fd549be91a4219ecd3800c1b2049b3025a2c67aadfbc0a0a852af98d507c8ff0c74edc01de88795cc4d770f4653dbbe3c2ee5dda524b5d239888e2c663512601e1c95ef466fabd717089d1e1cd07a9690ba562f1dbda071759b9fad9a2f877022052b4a177c7092385527867390523eb5b3b1e2ad302ec98391d5540f4b3a583828bfcf8d8a44324da51d81219990cd8deea7a32cc156279650fec21e1ea323a6c05239a4716016b1b4da636e042b8be781802fe2cf21adbf9aba87e99d29bc9be1b495d7b4d3db08a8eb54648aa3055e890918d092ec4dc93e9a50b7a44eeceefba2b81c7ec416c62080d390460bec13da6fe6c1cf393dfdc9ae0aa40fe8640bad6b8244740ab9fed0e6702b117590961212372c31ad90b8acabf8da9f5a3d0b9896e941619681d54636905fc8e20c034d313ad1d59ece5c74fef6cf5c21e35b212ee37536a6423643466b79667eab34fb797aebbb5c263b72014a18f172d383af03343466b5d014f35943699d8a97a30f90cebae2dc772e7d45163d60dd7025f2ee03cacd039a4caa7cffb58ce015023a8f90ae03dd2a89ea26988701a1f9b27abf4feea25de6af90649a6eab86f47869f3b0363d782b7ea939629948cbcd2d3d7db471810fd46ea9bcdcbe75df0692a8f644f0e22e56bd327cfe26e578e929b67c29d326e6e8cfa317fa4383c9a775344837009c68f29398d0b7db44ef2b5a21b6b28c9acc5b5f954b2ca52f54e9cd2b2b3d6e8ea76b3bebd3e8d5a5fade34429054a9b535c9ad7414d116ecae7abf48e67dbed24f4f122d0949c28f38a0de8dec1eb52a180dbbd36fdd0208b71fe7b0ce8fe454b958057d4d28f90ad013c321846ab9b79fbbe2c764c94b1bea1a4131502f8c6a3f198e1deb2ec1a8f478f6c8f0076c524f1c4da99416dc4f065eea6d607d0e2dbdf20e9871c998ef41fb2cd1d89e66ed36d9ea54e3b7f1d05db9451377df0eb053242a9eb7a931f786de2b35ccae9ddb0fa126bb7c2aeaa8af2d0ef7d7f105ebe71abb7b999341a5113b1f846cd1a8037c83759f46674f6491e2c0149d725a6482730ed60398d8b31d661fde40e89acd66ed547f247e42037cdd6ab1649d7fe6b2a1a28a52c5298d7c192057dcbc26ed5ab0bd2945cd67e99b2ae8a9269c904b1c22f23873fa2505b3eee45ad9666782215bb21cba019b6461e382d0e454fdf17fa871b136a5989cdc06025655ffa0af728f8679bc82d2427b8d7df82d93dcdb41f6a5d80f1932214a7ba7d7c821c9d0de3ec2d954510372c69dd4edc33f4422678f1b1962c64961dcdc850c94377d846cd5cd2f123f454fa7ad01d672a03ee5db3c4a66fc1633c3440481447435951ff6acb1c7dec1d1d31dd80a855f96a278cf8e65fc923bfddf0c407251ef8253ec426842de97022bf0cde525b7bc0011ab116ca3d7e6884fefeb3bb58c1b800f5783282f69ffc18b4b440312ec35515ab11fab9e3f6efe4b9fe0dc4d4151efcbdbce309689301dedbe25d2d22adcf13206bbcdf33775a14e3ed2edf59cdd8f5d367414b42b8439fdcff90a397fe3578f765eda874b43ca34fe26ff1e940321209c27014296682244861b7519c914e72499e6dbfd012c6b8613436bc52b3285ef869878f404d52de6516a63cd669a9f2f703b68d681973b3080428515efab1183e87f14030c1dcb52e1f984a71c7b75fc5b1e93243261f1159a18d474b14ba13997a89fbed67a8eb9b1a82dab818e79cd0151937cd68e66d2444ac1db467322a942566d0c52c45bea2a49cf1e474f16edd169c37de235b8e53ac8a4c43890017a11e08a8260433d6a0222ea4024b3fbad06a0071d0669a56bd387ed33a49e8bbde613e4ea90dc337648705c07dd44ddd4eab96fc5b4b14f1c8c5cc57dfaa742e22e6ab2ac143e0f6901c972e94bf13129daefa9b7dd3bd10e18d8a17c6e5ac1e396a6f4c651b047de66d8c13ecf7dc651558ee474fa64365720196babf3b1229442a762501d881e7395b76ae981fee7ed0ecd01fb492451d701efc7e1d6a47be75d1bf5d7ba8ba1d461e4ab7e2a53e32c2efaafc7e2ad1a94a1fa2dd01a723351ce05e4764da17b46bd447edc8e7f5919f2bdb57a67558de74683416c8974036c5999172d00d56f1463d960110e7d125acb002c64a842100feeb8f3796168677d94fa621b863d5a639298b7ae686016d44fa9d51bb95f17264a2b4b975347d56e648715f3a3dba5960c187d3962a4d0b6ef71600da022d5c696b7e9ea2a9f32c3133353c595b7689939596c8e3e6f1090c3a404a5b5c5d6f7692b1bcbec4d4f7020a27677f879ba9bec2c4f805092d35394672a2a8a9b7fe081f212c3c43464d8692999fa5ef0000000000000000000000000000000000000000000000000000000000000000000000000000000a1a2b37435112a00464600c413880a4c02210040002a1020118400a23a19668480c300210081b5b40b9554af400711620f22e412b414fd2d6df6799ab0d264e83dc6e955aa192065f24d7d1325202a9e277e8c0b88dfc54b9f0f1c6100b65a885af1268b87ad5c01e09c17e066cfc6d2339f34230623ad14db1ab4adc6aa3062516dc0403d1edd6b33b48d9adebad00000000dd6100000000000000000000000000", + "txid": "5b5dab18abbfc0b85c6632ec6b4f71e30d7e28cbfa5e29a6a6e4d48f2fb730cf", + "overwintered": true, + "version": 4, + "versiongroupid": "892f2085", + "locktime": 0, + "expiryheight": 25053, + "vin": [ + { + "txid": "76a7500bee2660051921a71fb5cdf0c89a74c73d74fc372bc190b582590b5173", + "vout": 0, + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "scriptSig": { + "asm": "a276a072a26ba067a565802103cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e618140ad8f8664af1ba877d0404c206510e0f083f9a18572606c90c25ded0f9c12c80c0e9ad3711d900ec2f0258a96ba219b75a42a8f51562d8546644d19a463bc7a9fa100af03800113a10001", + "hex": "4c79a276a072a26ba067a565802103cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e618140ad8f8664af1ba877d0404c206510e0f083f9a18572606c90c25ded0f9c12c80c0e9ad3711d900ec2f0258a96ba219b75a42a8f51562d8546644d19a463bc7a9fa100af03800113a10001" + }, + "value": 0.1, + "valueSat": 10000000, + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "sequence": 4294967295 + }, + { + "txid": "339f75555294af689d68b5548db03befe8bd8c1a4d43f3d763ac694e97c537a1", + "vout": 0, + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "scriptSig": { + "asm": "a276a072a26ba067a565802103cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61814029e181b897695bc7e747255d9dd8b46010abe885212b51ede555d3a7d9bbf6fd0d36f9c95f57241efa1b31c3a5ba37da9eb65e140069bb7aa9ccc96aa4cecb95a100af03800113a10001", + "hex": "4c79a276a072a26ba067a565802103cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61814029e181b897695bc7e747255d9dd8b46010abe885212b51ede555d3a7d9bbf6fd0d36f9c95f57241efa1b31c3a5ba37da9eb65e140069bb7aa9ccc96aa4cecb95a100af03800113a10001" + }, + "value": 0.2999, + "valueSat": 29990000, + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "sequence": 4294967295 + }, + { + "txid": "5b0c73405642485da5c5997248c02d011053e7ff2ca62741294b7e969f0a47a6", + "vout": 0, + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "scriptSig": { + "asm": "a276a072a26ba067a565802103cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e618140fea184b62a5d4a5d7d812a976922814059dc64b4e1e9eac5bbafcf66e922038131cb1ded8bb8523f7f4968b8e6e5bd4167dd70d1acb3ee554055d043ab4c0785a100af03800113a10001", + "hex": "4c79a276a072a26ba067a565802103cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e618140fea184b62a5d4a5d7d812a976922814059dc64b4e1e9eac5bbafcf66e922038131cb1ded8bb8523f7f4968b8e6e5bd4167dd70d1acb3ee554055d043ab4c0785a100af03800113a10001" + }, + "value": 4.8995, + "valueSat": 489950000, + "address": "RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7", + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 1.0, + "valueSat": 100000000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7"] + } + }, + { + "value": 4.2993, + "valueSat": 429930000, + "n": 1, + "scriptPubKey": { + "asm": "a22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN 13516d2339f34230623ad14db1ab4adc6aa3062516dc0403d1edd6b33b48d9adebadfd460d09f633110175d9f8e08a310ad7fe88d97b4a41903dd0c0db05154d01eafd2ffb4ec74a5cb468cba9b963d6005091f53bd044cae57ae44b6879e66c19791d5f52239f1d980de5f8958a6aa5869bd9efa343d3cabd170d23904efab800cb2a8497b78d702fb8bf3a312a18635dc9c905919bc3e119f919dca5421e51ba10bf3aa31e816b884187c841683ef87aebf89bf72f0b9492d20c1156e27dbfdb991b40671dbb372004f0d40398dbecc26f745a164ce14116f004d68672d4200d04106a67708293d890d88e99f381d78230245fb6a420162e9ade3e7c61e2d72e812ab4b7d439996fd1c2a659fae4658ef7fc196ec1c8017672c1bd7838e59916795fe4171e126a09322f213c306eb4b4563f72ebf1bb91b61850f451cc79dc644e51625db5a82cf1985df5e94b6ead6e92aa91f6da67e0431c843def9125c2c33db4631720ed1e3ea53a0d86f5174c842bc54f710556c9de8aae18cd545094333fe539cc6ccac859ec6dd02271437bc0ec93f511030ad79b57f168e5bbc93e6907a144cbc3fcce8dec42e26a5b9ea445a4f53a33ca7939d7db03c8637d655db9629c108198f1be4d133e5a99801ac5baebf9a8065e6fb5f34d64e0fe1bd7a4383e62134ae0a7df3bfb6f03881308925685b52d80d4f99351e71c80763605fd47c44129028ac475860070209527d626a720d79218776de338bed124fed901944db74735e9ae021474bfa98b1bfff4347e65df70d6d9dc68bab40fa071e2a73cb55f98163d32fe094de1c608836591df0158faa061211783fded36759fd27f9e950e729a4210b18390ff7d7cda94ec6d844c2aa980295bde433ddbdc870c56e7226e105327b2615734e08e688d757eb7ae5a98d9a08b4e2f10b9d77c04e1de4a489068110b7d463facb2c232561c53a97d00230ccb8c056ffd3a52d76c17baed79b8123d8d6bd6ab0641d44b4a623ef0c54bd306bc8fbc4196e9e54c615a6eb43a2243f88756b00f567ed27bdddf929894ced73bdda70813e04160cb6de9e7da2568b9c56ab884dde1ad2a219878a727301e9597de33f00cb191caf3dc358c159abdacfd0239cf96f206eba195217ae5e3b19ce0687b0991b8483da09a74b9b9c7aff6e6178bc4a23bea2069a7dc7b0003273935e2ae25e67d3c6fd4b788a0be7e4c45e378af4f7d6af047c7e938560a25610f4dfcc4a8a0998a1f32c193b026cf6344d152e4764364b57278197ae0754794bbdbf329e966563d57e5bf039cd20482f04866f6d4e8912e3a6590f639b9d487a83792cb30b394d5783df4bae3b6201b3d0d215e0a0eea21baeb41a3c88dc09abfa4cffdb2ff02867344e1e01edf7d545d5e8118471f94da80fd8aeccb507abece80c6e9ee0bb92651f2129a216e4a417b5be6ce9fdb1a608ffea107b8ab2b7f158d3eda057e8fff79b0178c61c6491e136d1946ffc3598f6d87318be6d9dd941489cc4c0e363d7771d0514e83f41e875ae0eddd4c44fa60ed34091dfbab8810a3a0b0fdef1ba21f412254e92f63343e22bedfaf4c329202f24b7158021f82a18eb8aab64a1d6ef7861ed22c515cd892f9b38b0b4e26c12efff5fce1d5605fddd00bf3b72fe04da6b27ca9e54d24a1dbe77dc3793ca1055b73e64344535abf199124c6c46661386521608a65df19598dbc57b88e6a19f6a950eff6290e11029291c579a34e0dea645f08afe76cd1b654e1a3e89efd436c5fe24a6a46cb62a3e2c1c051f6b7e13c37781d38259d82b921852fc3dc70c49d5e7c2b81bf95a442f0f0bbaa0da47406464533ec8b26a1df27143ecda9ac680fb351bf46c35c2c8be959174e78c390d9c5aacbe12635952c144e454f27f141579eff7be53b1425dbc544337acd5497ff9e95c54ba9e83330c332bcbc424c3125af4f56e367a8a76ea9277956abc474a7a641ac52142330d9cf43bebdca704b44264bc3055e4a5267a8bc726ab12d7672a3794944375019a3abf4ad25f4aa9400798a745c5d27c404a103fbe9424fa6c216e21d58b23bc584c70704e155678835773da1337eca84172d2cba605f59c9c7c09d6aa7131024299ec43704bd199b66c2362c54a50f59709ead7c7e85b88bf21ff2d46d7362c2dede76867b9b28d76e47cb6fcf0f6a248b905b0021811472bb8c0006e86115d8997c4b4e8ca7c6f76cf0105ca5da3404674d8ac7b66738eaeab719378c2a5527c0abf93265cc4d3654cd19840285a5da86827016f07e3d432cdc43c26dc050daf0fdd785c8739220f57e61c8fd549be91a4219ecd3800c1b2049b3025a2c67aadfbc0a0a852af98d507c8ff0c74edc01de88795cc4d770f4653dbbe3c2ee5dda524b5d239888e2c663512601e1c95ef466fabd717089d1e1cd07a9690ba562f1dbda071759b9fad9a2f877022052b4a177c7092385527867390523eb5b3b1e2ad302ec98391d5540f4b3a583828bfcf8d8a44324da51d81219990cd8deea7a32cc156279650fec21e1ea323a6c05239a4716016b1b4da636e042b8be781802fe2cf21adbf9aba87e99d29bc9be1b495d7b4d3db08a8eb54648aa3055e890918d092ec4dc93e9a50b7a44eeceefba2b81c7ec416c62080d390460bec13da6fe6c1cf393dfdc9ae0aa40fe8640bad6b8244740ab9fed0e6702b117590961212372c31ad90b8acabf8da9f5a3d0b9896e941619681d54636905fc8e20c034d313ad1d59ece5c74fef6cf5c21e35b212ee37536a6423643466b79667eab34fb797aebbb5c263b72014a18f172d383af03343466b5d014f35943699d8a97a30f90cebae2dc772e7d45163d60dd7025f2ee03cacd039a4caa7cffb58ce015023a8f90ae03dd2a89ea26988701a1f9b27abf4feea25de6af90649a6eab86f47869f3b0363d782b7ea939629948cbcd2d3d7db471810fd46ea9bcdcbe75df0692a8f644f0e22e56bd327cfe26e578e929b67c29d326e6e8cfa317fa4383c9a775344837009c68f29398d0b7db44ef2b5a21b6b28c9acc5b5f954b2ca52f54e9cd2b2b3d6e8ea76b3bebd3e8d5a5fade34429054a9b535c9ad7414d116ecae7abf48e67dbed24f4f122d0949c28f38a0de8dec1eb52a180dbbd36fdd0208b71fe7b0ce8fe454b958057d4d28f90ad013c321846ab9b79fbbe2c764c94b1bea1a4131502f8c6a3f198e1deb2ec1a8f478f6c8f0076c524f1c4da99416dc4f065eea6d607d0e2dbdf20e9871c998ef41fb2cd1d89e66ed36d9ea54e3b7f1d05db9451377df0eb053242a9eb7a931f786de2b35ccae9ddb0fa126bb7c2aeaa8af2d0ef7d7f105ebe71abb7b999341a5113b1f846cd1a8037c83759f46674f6491e2c0149d725a6482730ed60398d8b31d661fde40e89acd66ed547f247e42037cdd6ab1649d7fe6b2a1a28a52c5298d7c192057dcbc26ed5ab0bd2945cd67e99b2ae8a9269c904b1c22f23873fa2505b3eee45ad9666782215bb21cba019b6461e382d0e454fdf17fa871b136a5989cdc06025655ffa0af728f8679bc82d2427b8d7df82d93dcdb41f6a5d80f1932214a7ba7d7c821c9d0de3ec2d954510372c69dd4edc33f4422678f1b1962c64961dcdc850c94377d846cd5cd2f123f454fa7ad01d672a03ee5db3c4a66fc1633c3440481447435951ff6acb1c7dec1d1d31dd80a855f96a278cf8e65fc923bfddf0c407251ef8253ec426842de97022bf0cde525b7bc0011ab116ca3d7e6884fefeb3bb58c1b800f5783282f69ffc18b4b440312ec35515ab11fab9e3f6efe4b9fe0dc4d4151efcbdbce309689301dedbe25d2d22adcf13206bbcdf33775a14e3ed2edf59cdd8f5d367414b42b8439fdcff90a397fe3578f765eda874b43ca34fe26ff1e940321209c27014296682244861b7519c914e72499e6dbfd012c6b8613436bc52b3285ef869878f404d52de6516a63cd669a9f2f703b68d681973b3080428515efab1183e87f14030c1dcb52e1f984a71c7b75fc5b1e93243261f1159a18d474b14ba13997a89fbed67a8eb9b1a82dab818e79cd0151937cd68e66d2444ac1db467322a942566d0c52c45bea2a49cf1e474f16edd169c37de235b8e53ac8a4c43890017a11e08a8260433d6a0222ea4024b3fbad06a0071d0669a56bd387ed33a49e8bbde613e4ea90dc337648705c07dd44ddd4eab96fc5b4b14f1c8c5cc57dfaa742e22e6ab2ac143e0f6901c972e94bf13129daefa9b7dd3bd10e18d8a17c6e5ac1e396a6f4c651b047de66d8c13ecf7dc651558ee474fa64365720196babf3b1229442a762501d881e7395b76ae981fee7ed0ecd01fb492451d701efc7e1d6a47be75d1bf5d7ba8ba1d461e4ab7e2a53e32c2efaafc7e2ad1a94a1fa2dd01a723351ce05e4764da17b46bd447edc8e7f5919f2bdb57a67558de74683416c8974036c5999172d00d56f1463d960110e7d125acb002c64a842100feeb8f3796168677d94fa621b863d5a639298b7ae686016d44fa9d51bb95f17264a2b4b975347d56e648715f3a3dba5960c187d3962a4d0b6ef71600da022d5c696b7e9ea2a9f32c3133353c595b7689939596c8e3e6f1090c3a404a5b5c5d6f7692b1bcbec4d4f7020a27677f879ba9bec2c4f805092d35394672a2a8a9b7fe081f212c3c43464d8692999fa5ef0000000000000000000000000000000000000000000000000000000000000000000000000000000a1a2b37435112a00464600c413880a4c02210040002a1020118400a23a19668480c300210081b5b40b9554af400711620f22e412b414fd2d6df6799ab0d264e83dc6e955aa192065f24d7d1325202a9e277e8c0b88dfc54b9f0f1c6100b65a885af1268b87ad5c01e09c17e066cfc6d2339f34230623ad14db1ab4adc6aa3062516dc0403d1edd6b33b48d9adebad", + "hex": "6a4dac0d13516d2339f34230623ad14db1ab4adc6aa3062516dc0403d1edd6b33b48d9adebadfd460d09f633110175d9f8e08a310ad7fe88d97b4a41903dd0c0db05154d01eafd2ffb4ec74a5cb468cba9b963d6005091f53bd044cae57ae44b6879e66c19791d5f52239f1d980de5f8958a6aa5869bd9efa343d3cabd170d23904efab800cb2a8497b78d702fb8bf3a312a18635dc9c905919bc3e119f919dca5421e51ba10bf3aa31e816b884187c841683ef87aebf89bf72f0b9492d20c1156e27dbfdb991b40671dbb372004f0d40398dbecc26f745a164ce14116f004d68672d4200d04106a67708293d890d88e99f381d78230245fb6a420162e9ade3e7c61e2d72e812ab4b7d439996fd1c2a659fae4658ef7fc196ec1c8017672c1bd7838e59916795fe4171e126a09322f213c306eb4b4563f72ebf1bb91b61850f451cc79dc644e51625db5a82cf1985df5e94b6ead6e92aa91f6da67e0431c843def9125c2c33db4631720ed1e3ea53a0d86f5174c842bc54f710556c9de8aae18cd545094333fe539cc6ccac859ec6dd02271437bc0ec93f511030ad79b57f168e5bbc93e6907a144cbc3fcce8dec42e26a5b9ea445a4f53a33ca7939d7db03c8637d655db9629c108198f1be4d133e5a99801ac5baebf9a8065e6fb5f34d64e0fe1bd7a4383e62134ae0a7df3bfb6f03881308925685b52d80d4f99351e71c80763605fd47c44129028ac475860070209527d626a720d79218776de338bed124fed901944db74735e9ae021474bfa98b1bfff4347e65df70d6d9dc68bab40fa071e2a73cb55f98163d32fe094de1c608836591df0158faa061211783fded36759fd27f9e950e729a4210b18390ff7d7cda94ec6d844c2aa980295bde433ddbdc870c56e7226e105327b2615734e08e688d757eb7ae5a98d9a08b4e2f10b9d77c04e1de4a489068110b7d463facb2c232561c53a97d00230ccb8c056ffd3a52d76c17baed79b8123d8d6bd6ab0641d44b4a623ef0c54bd306bc8fbc4196e9e54c615a6eb43a2243f88756b00f567ed27bdddf929894ced73bdda70813e04160cb6de9e7da2568b9c56ab884dde1ad2a219878a727301e9597de33f00cb191caf3dc358c159abdacfd0239cf96f206eba195217ae5e3b19ce0687b0991b8483da09a74b9b9c7aff6e6178bc4a23bea2069a7dc7b0003273935e2ae25e67d3c6fd4b788a0be7e4c45e378af4f7d6af047c7e938560a25610f4dfcc4a8a0998a1f32c193b026cf6344d152e4764364b57278197ae0754794bbdbf329e966563d57e5bf039cd20482f04866f6d4e8912e3a6590f639b9d487a83792cb30b394d5783df4bae3b6201b3d0d215e0a0eea21baeb41a3c88dc09abfa4cffdb2ff02867344e1e01edf7d545d5e8118471f94da80fd8aeccb507abece80c6e9ee0bb92651f2129a216e4a417b5be6ce9fdb1a608ffea107b8ab2b7f158d3eda057e8fff79b0178c61c6491e136d1946ffc3598f6d87318be6d9dd941489cc4c0e363d7771d0514e83f41e875ae0eddd4c44fa60ed34091dfbab8810a3a0b0fdef1ba21f412254e92f63343e22bedfaf4c329202f24b7158021f82a18eb8aab64a1d6ef7861ed22c515cd892f9b38b0b4e26c12efff5fce1d5605fddd00bf3b72fe04da6b27ca9e54d24a1dbe77dc3793ca1055b73e64344535abf199124c6c46661386521608a65df19598dbc57b88e6a19f6a950eff6290e11029291c579a34e0dea645f08afe76cd1b654e1a3e89efd436c5fe24a6a46cb62a3e2c1c051f6b7e13c37781d38259d82b921852fc3dc70c49d5e7c2b81bf95a442f0f0bbaa0da47406464533ec8b26a1df27143ecda9ac680fb351bf46c35c2c8be959174e78c390d9c5aacbe12635952c144e454f27f141579eff7be53b1425dbc544337acd5497ff9e95c54ba9e83330c332bcbc424c3125af4f56e367a8a76ea9277956abc474a7a641ac52142330d9cf43bebdca704b44264bc3055e4a5267a8bc726ab12d7672a3794944375019a3abf4ad25f4aa9400798a745c5d27c404a103fbe9424fa6c216e21d58b23bc584c70704e155678835773da1337eca84172d2cba605f59c9c7c09d6aa7131024299ec43704bd199b66c2362c54a50f59709ead7c7e85b88bf21ff2d46d7362c2dede76867b9b28d76e47cb6fcf0f6a248b905b0021811472bb8c0006e86115d8997c4b4e8ca7c6f76cf0105ca5da3404674d8ac7b66738eaeab719378c2a5527c0abf93265cc4d3654cd19840285a5da86827016f07e3d432cdc43c26dc050daf0fdd785c8739220f57e61c8fd549be91a4219ecd3800c1b2049b3025a2c67aadfbc0a0a852af98d507c8ff0c74edc01de88795cc4d770f4653dbbe3c2ee5dda524b5d239888e2c663512601e1c95ef466fabd717089d1e1cd07a9690ba562f1dbda071759b9fad9a2f877022052b4a177c7092385527867390523eb5b3b1e2ad302ec98391d5540f4b3a583828bfcf8d8a44324da51d81219990cd8deea7a32cc156279650fec21e1ea323a6c05239a4716016b1b4da636e042b8be781802fe2cf21adbf9aba87e99d29bc9be1b495d7b4d3db08a8eb54648aa3055e890918d092ec4dc93e9a50b7a44eeceefba2b81c7ec416c62080d390460bec13da6fe6c1cf393dfdc9ae0aa40fe8640bad6b8244740ab9fed0e6702b117590961212372c31ad90b8acabf8da9f5a3d0b9896e941619681d54636905fc8e20c034d313ad1d59ece5c74fef6cf5c21e35b212ee37536a6423643466b79667eab34fb797aebbb5c263b72014a18f172d383af03343466b5d014f35943699d8a97a30f90cebae2dc772e7d45163d60dd7025f2ee03cacd039a4caa7cffb58ce015023a8f90ae03dd2a89ea26988701a1f9b27abf4feea25de6af90649a6eab86f47869f3b0363d782b7ea939629948cbcd2d3d7db471810fd46ea9bcdcbe75df0692a8f644f0e22e56bd327cfe26e578e929b67c29d326e6e8cfa317fa4383c9a775344837009c68f29398d0b7db44ef2b5a21b6b28c9acc5b5f954b2ca52f54e9cd2b2b3d6e8ea76b3bebd3e8d5a5fade34429054a9b535c9ad7414d116ecae7abf48e67dbed24f4f122d0949c28f38a0de8dec1eb52a180dbbd36fdd0208b71fe7b0ce8fe454b958057d4d28f90ad013c321846ab9b79fbbe2c764c94b1bea1a4131502f8c6a3f198e1deb2ec1a8f478f6c8f0076c524f1c4da99416dc4f065eea6d607d0e2dbdf20e9871c998ef41fb2cd1d89e66ed36d9ea54e3b7f1d05db9451377df0eb053242a9eb7a931f786de2b35ccae9ddb0fa126bb7c2aeaa8af2d0ef7d7f105ebe71abb7b999341a5113b1f846cd1a8037c83759f46674f6491e2c0149d725a6482730ed60398d8b31d661fde40e89acd66ed547f247e42037cdd6ab1649d7fe6b2a1a28a52c5298d7c192057dcbc26ed5ab0bd2945cd67e99b2ae8a9269c904b1c22f23873fa2505b3eee45ad9666782215bb21cba019b6461e382d0e454fdf17fa871b136a5989cdc06025655ffa0af728f8679bc82d2427b8d7df82d93dcdb41f6a5d80f1932214a7ba7d7c821c9d0de3ec2d954510372c69dd4edc33f4422678f1b1962c64961dcdc850c94377d846cd5cd2f123f454fa7ad01d672a03ee5db3c4a66fc1633c3440481447435951ff6acb1c7dec1d1d31dd80a855f96a278cf8e65fc923bfddf0c407251ef8253ec426842de97022bf0cde525b7bc0011ab116ca3d7e6884fefeb3bb58c1b800f5783282f69ffc18b4b440312ec35515ab11fab9e3f6efe4b9fe0dc4d4151efcbdbce309689301dedbe25d2d22adcf13206bbcdf33775a14e3ed2edf59cdd8f5d367414b42b8439fdcff90a397fe3578f765eda874b43ca34fe26ff1e940321209c27014296682244861b7519c914e72499e6dbfd012c6b8613436bc52b3285ef869878f404d52de6516a63cd669a9f2f703b68d681973b3080428515efab1183e87f14030c1dcb52e1f984a71c7b75fc5b1e93243261f1159a18d474b14ba13997a89fbed67a8eb9b1a82dab818e79cd0151937cd68e66d2444ac1db467322a942566d0c52c45bea2a49cf1e474f16edd169c37de235b8e53ac8a4c43890017a11e08a8260433d6a0222ea4024b3fbad06a0071d0669a56bd387ed33a49e8bbde613e4ea90dc337648705c07dd44ddd4eab96fc5b4b14f1c8c5cc57dfaa742e22e6ab2ac143e0f6901c972e94bf13129daefa9b7dd3bd10e18d8a17c6e5ac1e396a6f4c651b047de66d8c13ecf7dc651558ee474fa64365720196babf3b1229442a762501d881e7395b76ae981fee7ed0ecd01fb492451d701efc7e1d6a47be75d1bf5d7ba8ba1d461e4ab7e2a53e32c2efaafc7e2ad1a94a1fa2dd01a723351ce05e4764da17b46bd447edc8e7f5919f2bdb57a67558de74683416c8974036c5999172d00d56f1463d960110e7d125acb002c64a842100feeb8f3796168677d94fa621b863d5a639298b7ae686016d44fa9d51bb95f17264a2b4b975347d56e648715f3a3dba5960c187d3962a4d0b6ef71600da022d5c696b7e9ea2a9f32c3133353c595b7689939596c8e3e6f1090c3a404a5b5c5d6f7692b1bcbec4d4f7020a27677f879ba9bec2c4f805092d35394672a2a8a9b7fe081f212c3c43464d8692999fa5ef0000000000000000000000000000000000000000000000000000000000000000000000000000000a1a2b37435112a00464600c413880a4c02210040002a1020118400a23a19668480c300210081b5b40b9554af400711620f22e412b414fd2d6df6799ab0d264e83dc6e955aa192065f24d7d1325202a9e277e8c0b88dfc54b9f0f1c6100b65a885af1268b87ad5c01e09c17e066cfc6d2339f34230623ad14db1ab4adc6aa3062516dc0403d1edd6b33b48d9adebad", + "type": "nulldata" + } + } + ], + "vjoinsplit": [], + "valueBalance": 0.0, + "vShieldedSpend": [], + "vShieldedOutput": [], + "blockhash": "002cec0850ce8435455410053ccfcd2c712705a5f0b510f1b5d9f04e018b3de5", + "height": 25034, + "confirmations": 3183, + "rawconfirmations": 3183, + "time": 1552703495, + "blocktime": 1552703495 + } + ``` + + +Check whether this transaction has an opreturn vout. If there is no opreturn, move onto the next utxo from getaddresstxids. + +This transaction does in fact have an opreturn output. + +Use the [decodeccopret](/smart-chains/api/util/#decodeccopret) RPC to decode the hex value of the opreturn. + +(The only argument for the decodeccopret RPC here should be the `hex` value of the opreturn output.) + +```bash +./komodo-cli -ac_name=MUSIG decodeccopret 6a4dac0d13516d2339f34230623ad14db1ab4adc6aa3062516dc0403d1edd6b33b48d9adebadfd460d09f633110175d9f8e08a310ad7fe88d97b4a41903dd0c0db05154d01eafd2ffb4ec74a5cb468cba9b963d6005091f53bd044cae57ae44b6879e66c19791d5f52239f1d980de5f8958a6aa5869bd9efa343d3cabd170d23904efab800cb2a8497b78d702fb8bf3a312a18635dc9c905919bc3e119f919dca5421e51ba10bf3aa31e816b884187c841683ef87aebf89bf72f0b9492d20c1156e27dbfdb991b40671dbb372004f0d40398dbecc26f745a164ce14116f004d68672d4200d04106a67708293d890d88e99f381d78230245fb6a420162e9ade3e7c61e2d72e812ab4b7d439996fd1c2a659fae4658ef7fc196ec1c8017672c1bd7838e59916795fe4171e126a09322f213c306eb4b4563f72ebf1bb91b61850f451cc79dc644e51625db5a82cf1985df5e94b6ead6e92aa91f6da67e0431c843def9125c2c33db4631720ed1e3ea53a0d86f5174c842bc54f710556c9de8aae18cd545094333fe539cc6ccac859ec6dd02271437bc0ec93f511030ad79b57f168e5bbc93e6907a144cbc3fcce8dec42e26a5b9ea445a4f53a33ca7939d7db03c8637d655db9629c108198f1be4d133e5a99801ac5baebf9a8065e6fb5f34d64e0fe1bd7a4383e62134ae0a7df3bfb6f03881308925685b52d80d4f99351e71c80763605fd47c44129028ac475860070209527d626a720d79218776de338bed124fed901944db74735e9ae021474bfa98b1bfff4347e65df70d6d9dc68bab40fa071e2a73cb55f98163d32fe094de1c608836591df0158faa061211783fded36759fd27f9e950e729a4210b18390ff7d7cda94ec6d844c2aa980295bde433ddbdc870c56e7226e105327b2615734e08e688d757eb7ae5a98d9a08b4e2f10b9d77c04e1de4a489068110b7d463facb2c232561c53a97d00230ccb8c056ffd3a52d76c17baed79b8123d8d6bd6ab0641d44b4a623ef0c54bd306bc8fbc4196e9e54c615a6eb43a2243f88756b00f567ed27bdddf929894ced73bdda70813e04160cb6de9e7da2568b9c56ab884dde1ad2a219878a727301e9597de33f00cb191caf3dc358c159abdacfd0239cf96f206eba195217ae5e3b19ce0687b0991b8483da09a74b9b9c7aff6e6178bc4a23bea2069a7dc7b0003273935e2ae25e67d3c6fd4b788a0be7e4c45e378af4f7d6af047c7e938560a25610f4dfcc4a8a0998a1f32c193b026cf6344d152e4764364b57278197ae0754794bbdbf329e966563d57e5bf039cd20482f04866f6d4e8912e3a6590f639b9d487a83792cb30b394d5783df4bae3b6201b3d0d215e0a0eea21baeb41a3c88dc09abfa4cffdb2ff02867344e1e01edf7d545d5e8118471f94da80fd8aeccb507abece80c6e9ee0bb92651f2129a216e4a417b5be6ce9fdb1a608ffea107b8ab2b7f158d3eda057e8fff79b0178c61c6491e136d1946ffc3598f6d87318be6d9dd941489cc4c0e363d7771d0514e83f41e875ae0eddd4c44fa60ed34091dfbab8810a3a0b0fdef1ba21f412254e92f63343e22bedfaf4c329202f24b7158021f82a18eb8aab64a1d6ef7861ed22c515cd892f9b38b0b4e26c12efff5fce1d5605fddd00bf3b72fe04da6b27ca9e54d24a1dbe77dc3793ca1055b73e64344535abf199124c6c46661386521608a65df19598dbc57b88e6a19f6a950eff6290e11029291c579a34e0dea645f08afe76cd1b654e1a3e89efd436c5fe24a6a46cb62a3e2c1c051f6b7e13c37781d38259d82b921852fc3dc70c49d5e7c2b81bf95a442f0f0bbaa0da47406464533ec8b26a1df27143ecda9ac680fb351bf46c35c2c8be959174e78c390d9c5aacbe12635952c144e454f27f141579eff7be53b1425dbc544337acd5497ff9e95c54ba9e83330c332bcbc424c3125af4f56e367a8a76ea9277956abc474a7a641ac52142330d9cf43bebdca704b44264bc3055e4a5267a8bc726ab12d7672a3794944375019a3abf4ad25f4aa9400798a745c5d27c404a103fbe9424fa6c216e21d58b23bc584c70704e155678835773da1337eca84172d2cba605f59c9c7c09d6aa7131024299ec43704bd199b66c2362c54a50f59709ead7c7e85b88bf21ff2d46d7362c2dede76867b9b28d76e47cb6fcf0f6a248b905b0021811472bb8c0006e86115d8997c4b4e8ca7c6f76cf0105ca5da3404674d8ac7b66738eaeab719378c2a5527c0abf93265cc4d3654cd19840285a5da86827016f07e3d432cdc43c26dc050daf0fdd785c8739220f57e61c8fd549be91a4219ecd3800c1b2049b3025a2c67aadfbc0a0a852af98d507c8ff0c74edc01de88795cc4d770f4653dbbe3c2ee5dda524b5d239888e2c663512601e1c95ef466fabd717089d1e1cd07a9690ba562f1dbda071759b9fad9a2f877022052b4a177c7092385527867390523eb5b3b1e2ad302ec98391d5540f4b3a583828bfcf8d8a44324da51d81219990cd8deea7a32cc156279650fec21e1ea323a6c05239a4716016b1b4da636e042b8be781802fe2cf21adbf9aba87e99d29bc9be1b495d7b4d3db08a8eb54648aa3055e890918d092ec4dc93e9a50b7a44eeceefba2b81c7ec416c62080d390460bec13da6fe6c1cf393dfdc9ae0aa40fe8640bad6b8244740ab9fed0e6702b117590961212372c31ad90b8acabf8da9f5a3d0b9896e941619681d54636905fc8e20c034d313ad1d59ece5c74fef6cf5c21e35b212ee37536a6423643466b79667eab34fb797aebbb5c263b72014a18f172d383af03343466b5d014f35943699d8a97a30f90cebae2dc772e7d45163d60dd7025f2ee03cacd039a4caa7cffb58ce015023a8f90ae03dd2a89ea26988701a1f9b27abf4feea25de6af90649a6eab86f47869f3b0363d782b7ea939629948cbcd2d3d7db471810fd46ea9bcdcbe75df0692a8f644f0e22e56bd327cfe26e578e929b67c29d326e6e8cfa317fa4383c9a775344837009c68f29398d0b7db44ef2b5a21b6b28c9acc5b5f954b2ca52f54e9cd2b2b3d6e8ea76b3bebd3e8d5a5fade34429054a9b535c9ad7414d116ecae7abf48e67dbed24f4f122d0949c28f38a0de8dec1eb52a180dbbd36fdd0208b71fe7b0ce8fe454b958057d4d28f90ad013c321846ab9b79fbbe2c764c94b1bea1a4131502f8c6a3f198e1deb2ec1a8f478f6c8f0076c524f1c4da99416dc4f065eea6d607d0e2dbdf20e9871c998ef41fb2cd1d89e66ed36d9ea54e3b7f1d05db9451377df0eb053242a9eb7a931f786de2b35ccae9ddb0fa126bb7c2aeaa8af2d0ef7d7f105ebe71abb7b999341a5113b1f846cd1a8037c83759f46674f6491e2c0149d725a6482730ed60398d8b31d661fde40e89acd66ed547f247e42037cdd6ab1649d7fe6b2a1a28a52c5298d7c192057dcbc26ed5ab0bd2945cd67e99b2ae8a9269c904b1c22f23873fa2505b3eee45ad9666782215bb21cba019b6461e382d0e454fdf17fa871b136a5989cdc06025655ffa0af728f8679bc82d2427b8d7df82d93dcdb41f6a5d80f1932214a7ba7d7c821c9d0de3ec2d954510372c69dd4edc33f4422678f1b1962c64961dcdc850c94377d846cd5cd2f123f454fa7ad01d672a03ee5db3c4a66fc1633c3440481447435951ff6acb1c7dec1d1d31dd80a855f96a278cf8e65fc923bfddf0c407251ef8253ec426842de97022bf0cde525b7bc0011ab116ca3d7e6884fefeb3bb58c1b800f5783282f69ffc18b4b440312ec35515ab11fab9e3f6efe4b9fe0dc4d4151efcbdbce309689301dedbe25d2d22adcf13206bbcdf33775a14e3ed2edf59cdd8f5d367414b42b8439fdcff90a397fe3578f765eda874b43ca34fe26ff1e940321209c27014296682244861b7519c914e72499e6dbfd012c6b8613436bc52b3285ef869878f404d52de6516a63cd669a9f2f703b68d681973b3080428515efab1183e87f14030c1dcb52e1f984a71c7b75fc5b1e93243261f1159a18d474b14ba13997a89fbed67a8eb9b1a82dab818e79cd0151937cd68e66d2444ac1db467322a942566d0c52c45bea2a49cf1e474f16edd169c37de235b8e53ac8a4c43890017a11e08a8260433d6a0222ea4024b3fbad06a0071d0669a56bd387ed33a49e8bbde613e4ea90dc337648705c07dd44ddd4eab96fc5b4b14f1c8c5cc57dfaa742e22e6ab2ac143e0f6901c972e94bf13129daefa9b7dd3bd10e18d8a17c6e5ac1e396a6f4c651b047de66d8c13ecf7dc651558ee474fa64365720196babf3b1229442a762501d881e7395b76ae981fee7ed0ecd01fb492451d701efc7e1d6a47be75d1bf5d7ba8ba1d461e4ab7e2a53e32c2efaafc7e2ad1a94a1fa2dd01a723351ce05e4764da17b46bd447edc8e7f5919f2bdb57a67558de74683416c8974036c5999172d00d56f1463d960110e7d125acb002c64a842100feeb8f3796168677d94fa621b863d5a639298b7ae686016d44fa9d51bb95f17264a2b4b975347d56e648715f3a3dba5960c187d3962a4d0b6ef71600da022d5c696b7e9ea2a9f32c3133353c595b7689939596c8e3e6f1090c3a404a5b5c5d6f7692b1bcbec4d4f7020a27677f879ba9bec2c4f805092d35394672a2a8a9b7fe081f212c3c43464d8692999fa5ef0000000000000000000000000000000000000000000000000000000000000000000000000000000a1a2b37435112a00464600c413880a4c02210040002a1020118400a23a19668480c300210081b5b40b9554af400711620f22e412b414fd2d6df6799ab0d264e83dc6e955aa192065f24d7d1325202a9e277e8c0b88dfc54b9f0f1c6100b65a885af1268b87ad5c01e09c17e066cfc6d2339f34230623ad14db1ab4adc6aa3062516dc0403d1edd6b33b48d9adebad +``` + + + ```json + { + "result": "success", + "OpRets": [ + { + "eval_code": "0x13", + "function": "Q" + } + ] + } + ``` + + +#### Note the Eval Code + +Note that there is a returned key by the name of `eval_code`. + +By design each Antara Module has its own unique eval code. This allows a developer to recognize which specific Antara Module a transaction regards. + +The `eval_code` value here matches the eval code for the Dilithium Antara Module, and therefore we know that we are dealing with a Dilithium utxo. + +(To learn more about eval codes, [read this linked section of the Advanced Tutorial Series.)](/antara/tutorials/advanced-series-2/#the-eval-code) + +#### Note the Function Value + +By design, an Antara Module has unique types of transactions. The ability to create unique transactions is a key power of the Antara Framework. + +Within an Antara Module can be numerous types of transactions, and therefore each transaction type needs its own identifier. + +The `function` key in the structure of the response returned above is this identifier. + +In our response above we see `"function": "Q",`. We need to interpret this `Q` value into a more common term. + +To obtain a list of all types of transactions for all Antara Modules on a Smart Chain, use the [cclibinfo](/smart-chains/api/cclib/#cclibinfo) RPC. + +```bash +./komodo-cli -ac_name=MUSIG cclibinfo +``` + + + ```json + { + "result": "success", + "CClib": "sudoku", + "methods": [ + // ... (in this tutorial we ommit all non-Dilithium objects for brevity) ... + + { + "evalcode": 19, + "funcid": "K", + "name": "dilithium", + "method": "keypair", + "help": "[hexseed]", + "params_required": 0, + "params_max": 1 + }, + { + "evalcode": 19, + "funcid": "R", + "name": "dilithium", + "method": "register", + "help": "handle, [hexseed]", + "params_required": 1, + "params_max": 2 + }, + { + "evalcode": 19, + "funcid": "I", + "name": "dilithium", + "method": "handleinfo", + "help": "handle", + "params_required": 1, + "params_max": 1 + }, + { + "evalcode": 19, + "funcid": "S", + "name": "dilithium", + "method": "sign", + "help": "msg [hexseed]", + "params_required": 1, + "params_max": 2 + }, + { + "evalcode": 19, + "funcid": "V", + "name": "dilithium", + "method": "verify", + "help": "pubtxid msg sig", + "params_required": 3, + "params_max": 3 + }, + { + "evalcode": 19, + "funcid": "x", + "name": "dilithium", + "method": "send", + "help": "handle pubtxid amount", + "params_required": 3, + "params_max": 3 + }, + { + "evalcode": 19, + "funcid": "y", + "name": "dilithium", + "method": "spend", + "help": "sendtxid scriptPubKey [hexseed]", + "params_required": 2, + "params_max": 3 + }, + { + "evalcode": 19, + "funcid": "Q", + "name": "dilithium", + "method": "Qsend", + "help": "mypubtxid hexseed/'mypriv' destpubtxid,amount, ...", + "params_required": 4, + "params_max": 66 + } + ] + } + ``` + + +Towards the bottom we see a json object with `"funcid": "Q",` and `"method": "Qsend",`. + +This tells us that this transaction was executed using Dilithium's Qsend RPC. + +The response also confirms that the eval code for Dilithium is `19` (or `0x13` in hex). +(We discuss each of the Dilithium-related function types in the above response later in this document.) + +#### Obtain the destpubtxids of the Inputs and the Outputs + +Now that we know this is in fact a Dilithium Qsend transaction, let's use the same process as before to get the `destpubtxids` of the inputs and outputs. + +First, convert the opreturn's `hex` value to big endian. + +```bash +adebadd9483bb3d6edd10304dc162506a36adc4aabb14dd13a623042f339236dfc6c067ec1091ec0d57ab86812af85a8650b10c6f1f0b954fc8db8c0e877e2a9025232d1d7245f0692a15a956edc834e260dab9967dfd6d24f412b412ef220167100f44a55b9405b1b081002300c486896a1230a40180102a10200041022c0a48038410c606404a0125143372b1a0a000000000000000000000000000000000000000000000000000000000000000000000000000000efa59f9992864d46433c2c211f08feb7a9a8a2724639352d0905f8c4c2bea99b877f67270a02f7d4c4bebcb192766f5d5c5b4a403a0c09f1e6e3c896959389765b593c3533312cf3a9a29e7e6b695c2d02da0016f76e0b4d2a96d387c16059ba3d3a5f7148e6567d3475b9b4a26472f195bb519dfa446d0186e67a8b2939a6d563b821a64fd977861696378febfe0021844ac602b0ac25d1e71001963d46f1560dd0729199c5364097c816346874de5875a657db2b9f91f5e7c8ed47d46bb417da64475ee01c3523a701dda21f4aa9d12a7efcaaefc2323ea5e2b74a1e461dbaa87b5dbfd175be476a1d7efc1e701d4592b41fd0ecd07eee1f98ae765b39e781d80125762a4429123bbfba9601726543a64f47ee581565dcf7ec138c6de67d041b654c6f6a391eace5c6178a8de110bdd37d9bfaae9d1213bf942e971c90f6e043c12aabe6222e74aadf57ccc5c8f1144b5bfc96ab4edd4dd47dc005876437c30da94e3e61debbe8493ad37e38bd569a66d071006ad0ba3f4b02a42e22a0d6330426a8081ea1170089434c8aac538e5b23de379c16dd6ef174e4f19ca4a2be452cc5d06625942a3267b41dac44246de668cd371915d09ce718b8da821a9beba867edfb897a9913ba144b478da159111f264332e9b1c55fb7c7714a981f2eb5dcc13040f1873e18b1fa5e51280408b37319688db603f7f2a969d63ca61665de524d408f8769f85e28b352bc363461b8c612d0bf6d9e49724e919c51b76148248266291470c209123240e9f16fe24fa33cb474a8ed65f77835fe97a390ffdc9f43b8424b4167d3f5d8cd59df2eede3145a7733dfbc6b2013cfad222d5de2dbde01936809e3bcbdfc1e15d4c40dfeb9e4eff6e3b9fa11ab1555c32e3140b4b418fc9ff6823278f500b8c158bbb3fefe84687e3dca16b11a01c07b5b52de0cbf2270e92d8426c43e25f81e2507c4f0ddbf23c95fe6f88c276af955a880dd311d1dec7d1ccb6aff51594347144840343c63c16fa6c4b35dee032a671dd07afa54f423f1d25ccd46d87743c950c8cd1d96642c96b1f1782642f433dc4edd692c371045952dece30d9d1c827c7dbaa7142293f1805d6a1fb4cd3dd982dfd7b827242dc89b67f828f70afa5f652560c0cd89596a131b87fa17df4f450e2d381e46b619a0cb21bb1522786696ad45ee3e5b50a23f87232fc2b104c969928aaeb2997ed65c94d20babd56ec2cb7d0592c1d798522ca5281a2a6bfed74916abd6cd3720e447f247d56ed6ac890ee4fd61d6318b8d3960ed302748a625d749012c1e49f67466f45937c837801acd46f8b113511a3499b9b7ab71be5e107f7defd0f28aaaaec2b76b12fab0dde9ca5cb3e26d781f937aeba9423205ebf07d375194db051d7f3b4ea59e6dd36ee6891dcdb21ff48e991c87e920dfdbe2d007d6a6ee65f0c46d4199dac4f124c576008f6c8f478f1aecb2dee198f1a3c6f8021513a4a1beb1944c762cbefb799bab4618323c01ad908fd2d45780954b45fee80c7bfe718b20d0fd36bddb80a152ebc1dee80d8af3289c94d022f1f424eddb678ef4abe7ca6e114d41d79a5c539b4a052944e3ad5f5a8d3ebdbeb376eae8d6b3b2d29c4ef552cab254f9b5c5acc9286b1ba2b5f24eb47d0b8d39298fc60970834453779a3c38a47f31fa8c6e6e329dc2679b928e576ee2cf27d36be5220e4f648f2a69f05de7cbcd9bea46fd101847dbd7d3d2bc8c94299693eab782d763033b9f86476fb8eaa64906f96ade25eafef4ab279b1f1a708869a29ea8d23de00af9a8235001ce58fbcfa7caa439d0ac3ce02e5f02d70dd66351d4e772c72daeeb0cf9307aa9d8993694354f015d6b464333f03a382d178fa11420b763c2b5bbae97b74fb3ea6796b766346423646a5337ee12b2351ec2f56cef4fc7e5ec591dad13d334c0208efc056963541d681916946e89b9d0a3f5a98dbfca8a0bd91ac372232161095917b102670eed9fab404724b8d6ba4086fe40aae09adcdf93f31c6cfea63dc1be6004390d08626c41ecc7812bbaefceee447a0ba5e993dcc42e098d9190e85530aa4846b58e8ab03d4d7b5d491bbec99bd2997ea8abf9db1af22cfe021878beb842e036a64d1b6b0116479a23056c3a32eae121ec0f65796215cc327aeaded80c991912d851da2443a4d8f8fc8b8283a5b3f440551d3998ec02d32a1e3b5beb230539677852852309c777a1b452200277f8a2d9fab9591707dadbf162a50b69a907cde1d1897071bdfa66f45ec9e101265163c6e28898235d4b52da5deec2e3bb3d65f470d7c45c7988de01dc4ec7f08f7c508df92a850a0abcdfaa672c5a02b349201b0c80d3ec19421ae99b54fdc8617ef5209273c885d7fdf0da50c06dc243dc2c433d7ef016708286daa585028419cd54364dcc6532f9abc027552a8c3719b7eaea3867b6c78a4d670434daa55c10f06cf7c6a78c4e4b7c99d81561e806008cbb72148121005b908b246a0fcf6fcb476ed7289b7b8676dedec262736dd4f21ff28bb8857e7cad9e70590fa5542c36c2669b19bd0437c49e29241013a76a9dc0c7c9595f60ba2c2d1784ca7e33a13d7735886755e10407c784c53bb2581de216c2a64f42e9fb03a104c4275d5c748a790094aaf425adf4aba3195037444979a372762db16a72bca867524a5e05c34b26444b70cabdbe43cfd930231452ac41a6a774c4ab567927a96ea7a867e3564faf25314c42bcbc32c33033e8a94bc5959eff9754cd7a3344c5db25143be57bff9e5741f1274f454e142c953526e1cbaac5d990c3784e1759e98b2c5cc346bf51b30f68aca9cd3e1427dfa1268bec3345460674a40daabbf0f042a495bf812b7c5e9dc470dcc32f8521b9829d25381d78373ce1b7f651c0c1e2a362cb466a4ae25f6c43fd9ee8a3e154b6d16ce7af085f64ea0d4ea379c5919202110e29f6ef50a9f6196a8eb857bc8d5919df658a602165386166c4c6249119bf5a534443e6735b05a13c79c37de7dba1244de5a97cb2a64de02fb7f30bd0dd5f60d5e1fcf5ff2ec1264e0b8bb3f992d85c512cd21e86f76e1d4ab6aab88ea1821f0258714bf20292324cafdfbe223e34632fe95422411fa21beffdb0a0a31088abfb1d0934ed60fa444cddede05a871ef4834e51d071773d360e4ccc891494ddd9e68b31876d8f59c3ff46196d131e49c6618c17b079ff8f7e05da3e8d157f2babb807a1fe8f601adb9fcee65b7b414a6e219a12f25126b90beee9c680cebe7a50cbec8afd80da941f4718815e5d547ddf1ee0e144738602ffb2fdcfa4bf9ac08dc8a341ebba21ea0e0a5e210d3d1b20b6e3baf43d78d594b330cb9237a887d4b939f690653a2e91e8d4f66648f08204d29c03bfe5573d5666e929f3dbbb944775e07a197872b5644376e452d14463cf26b093c1321f8a99a0a8c4fc4d0f61250a5638e9c747f06a7d4faf78e3454c7ebea088b7d46f3c7de625aee235392703007bdca76920ea3ba2c48b17e6f6afc7b9b9749aa03d48b891097b68e09cb1e3e57a2195a1eb06f296cf3902fdacbd9a158c35dcf3ca91b10cf033de97951e3027a77898212aade1dd84b86ac5b96825dae7e96dcb6041e01308a7dd3bd7ce949892dfdd7bd27e560fb05687f843223ab46e5a614ce5e99641bc8fbc06d34bc5f03e624a4bd44106abd66b8d3d12b879edba176cd7523afd6f058ccb0c23007da9531c5632c2b2ac3f467d0b116890484adee1047cd7b9102f4e8ba0d9985aaeb77e758d688ee0345761b22753106e22e7560c87dcdb3d43de5b2980a92a4c846dec94da7c7dff9083b110429a720e959e7fd29f7536edfd83172161a0fa5801df91658308c6e14d09fe323d16985fb53ca7e271a00fb4ba68dcd9d670df657e34f4ff1b8ba9bf741402aee93547b74d9401d9fe24d1be38e36d771892d720a726d627952070008675c48a022941c447fd053676801ce75193f9d4802db5855692081388036ffb3bdfa7e04a13623e38a4d71bfee0644df3b56f5e06a8f9ebbac51a80995a3e134dbef19881109c62b95d657d63c803dbd73979ca333af5a445a49e5b6ae242ec8dcefcc3cb44a107693ec9bbe568f1579bd70a0311f593ecc07b437122d06dec59c8ca6ccc39e53f33945054cd18ae8adec95605714fc52b844c17f5860d3aa53e1eed201763b43dc3c22591ef3d841c43e067daf691aa926ead6e4be9f55d98f12ca8b55d62514e64dc79cc51f45018b691bbf1eb723f56b4b46e303c212f32096a121e17e45f791699e53878bdc1727601c8c16e19fcf78e65e4fa59a6c2d16f9939d4b7b42a812ed7e2617c3ede9a2e1620a4b65f243082d781f3998ed890d8938270676a10040d20d47286d604f01641e14c165a746fc2ecdb9803d4f0042037bb1d67401b99dbbf7de256110cd292940b2ff79bf8eb7af83e6841c88741886b811ea33abf10ba511e42a5dc19f919e1c39b9105c9c95d63182a313abfb82f708db797842acb00b8fa4e90230d17bdcad343a3efd99b86a56a8a95f8e50d981d9f23525f1d79196ce679684be47ae5ca44d03bf5915000d663b9a9cb68b45c4ac74efb2ffdea014d1505dbc0d03d90414a7bd988fed70a318ae0f8d975011133f6090d46fdadebadd9483bb3d6edd10304dc162506a36adc4aabb14dd13a623042f339236d51130dac4d6a` +``` + +From our getrawtransaction response earlier we already know this transaction has two outputs (besides the opreturn output). Therfore, the Dilithium handle's `destpubtxid` for vout1 is located at position `[:64]` and the `destpubtixd` for vout0 is located at `[64:128]`. + +In vout1's position we find `adebadd9483bb3d6edd10304dc162506a36adc4aabb14dd13a623042f339236d`. + +In vout0's position we find `fc6c067ec1091ec0d57ab86812af85a8650b10c6f1f0b954fc8db8c0e877e2a9`. + +Neither of these vouts match the `destpubtxid` for the `LABSLover` handle, and therefore this utxo does not belong to the `LABSLover` handle. + +#### Create a Customized Function to Determine the Full Handle + +To find out which handles these do belong to, we need to write a more elaborate customized function in a programming language of our choice. + +Any programming language that is capable of sending RPCs to the daemon is capable of creating this type of customized function. + +For this tutorial, we use the Python language and the `python3` toolset. We also use the [slickrpc](https://github.com/barjomet/slick-bitcoinrpc) library to interact with the daemon. + +(To learn how to use the slickrpc library, [visit this linked documentation.](https://github.com/KomodoPlatform/Documentation/blob/master/docs/komodo/python-rpc-komodod.md) + +```python +# function to get handle from register txid +def handle_get(register_txid, rpc_connection): + tx = rpc_connection.getrawtransaction(register_txid, 1) + OP_ret = tx['vout'][-1]['scriptPubKey']['hex'] + byte_length = OP_ret[12:14] + byte_length_int = int(byte_length, 16) + x = (byte_length_int * 2) + 14 + return(bytes.fromhex(OP_ret[14:x]).decode('utf-8')) +``` + +Use the getrawtransaction to obtain the opreturn for the `destpubtxid`: `adebadd9483bb3d6edd10304dc162506a36adc4aabb14dd13a623042f339236d`. + +```bash +./komodo-cli -ac_name=MUSIG getrawtransaction adebadd9483bb3d6edd10304dc162506a36adc4aabb14dd13a623042f339236d 2 +``` + + + ```json + [ + { + "value": 0.0, + "valueSat": 0, + "n": 5, + "scriptPubKey": { + "asm": "OP_RETURN 1352056e657732302103cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61fde0069c35399f231edecd6448d94856704085409b2c253bfeb8b5d3af5e0905e424904333942904b85236941e332252c340e4e2187e2b13434338cf4d0ed81c0d6bcf54129c2aa93397024686058823126b5b51ef1895504cab5b925c10ac0b2dbb4783b0ef1f09a07db30d01d2ffd822a0c6955a8d595f700071d0d75eaf3b0921d8b78778d939c0e7ac34e56f8709ce87725b351a7f0967b999bff1b455f2a9db10c3e59190eb224281763979d99870fce70bd3f0a4a886aabad417601354a014c2882f9f46027d9b44cd68fa3a1ed65738db951cd450ae7d0c8cb2c70e6fa8bfde217f3ae9f7768f40aa283c3cc5f1f29855ccc0e60401f014c7894fc37ad1eb77e42b6a7503b8432513f87fa2e726f7103057e19e8c19911594488809faecd2865d822f2e82763e9f3d4d51465c40f5e69314071f962bd2ed34843f47a063f292e12773b3fa63d050d328d621aa8b2d775e04744a2ceaa29a4b373a074c428d54d61dcaa4b76fe6e7e57a0fd71227a510928a49055305ab2bd5696264b9f43d6c92f8d88fc929e49f8faa6b9a6307a867af92ed97bc1fcbbd474d9c2f49b0659ea547a5ad9f31c81bf5c189c2fc51e248e60a3fd9841f08dc62c559ea7dfe6275cb02f7cebeb1258412c8d0b9ace086f286c59911ed52faa5ac8443d10845bcd3c60697a5428c023263d1a466fadd5075e4794b9dd6955450cb3d7b595658325441440876eda2caaf385dd0ef6c1bc64fc5e54d4eff2ab2e7301a99adb53e015cd130cc0ea259b332a606c8f91da629cd649ffa3d84f4866ed921b4138cd74480cbdbc238636324fa1020263ecfa7693621654de04f14218e01f831fe59b4b3db4c612141e4130438af6b9c203a8af2128a8ea1e2574bd13421caa85e054a06d5df4fb1c92def5bc782548d61bfa50ec8fd70ac17bacc885b9fedde62ad4ab8df1e56f4b9928536bb7cc8988d99d503be8a213030f9a335a8c428424a20fc7373cb141cc32bf185dd13d82d2897e3638f9e8e868f00a398e6beca60231ce568e8698fdede5f63ee32e7b7058379b4f0b83135c73ac6084474ede0e38030e5be8241f4af53188edbe4d68056f2934f717d53eed69d2cb4f1b25f16f08f2aafec71ff53e73001f111f1c9e0314870c7be32a6651f5bdf8607bb0ca35d6f33eab8bc7236f89e01a921d30b9cf562575fa4799e566620699d1e123a8795b77fadd55a16d44cb220fd2857bbb8fa8c48f65b8458e7a0faae52e62b8d0746cc5aa24366fa76c25001ee3187b894246ecb96247372668bf58ea753c996a5726ac9e6524fd03e335e5e896141089acd99b417afdf07ad7604cacc7606023fb53a5ad68630f3e08fc49b6cd59241c58c1b8a8170c00f7db4ed774d02ec07d05903f94f95766e32f4edb5c79012f4d8bad48c3d913fdc5c8950449296a55753097b3d75c5ad580feeb24eec216f3fee16ffadc2a7575b3fb11eaa31b9e4d79d19bec16bed2d86a65c694a23535630a73696def1c9f1ca43622836eafb0cb3eaa136d43cb376d1e6b50d3c4bbe8e0bfc07fa6ffce15305a8ca695fffffbf29333e7da4532647cf09b370bafa17f5e498924921fc00371a1be856324be3accd973d6495b2d8105adefeb0f6d8d36ec678c4c6a55cfbbfd704ab6cb9ac939ccb1f104036e3ff213ba5a983c2b46cba5d4ea48c9cd2d50483f5f51d72aa2ea2e8ca68b5e7e14791fa51204af13541618a2aedba47de8229f31c967a7381ec22822617d19dd460942878a2af8273f072e293017608f876566c6180704596b9be2806eb2706349c3e1e1d4c4eda819843d922870491e0f8f5cbcd12e2feb1346eb877019203525eda9c411450c660b94da968ca6a0008d76fd757ade57e00f00a4f349d9ab0b0bcc97e74e2d92b5188d1d42dca80b4c3f619729b698bb301ba0ad31fb3a8c22a69a6516ec1f19d5a7651acd8951a674abb9ffa2d2aa64dfa98286c7ea26f1629f6a5892488fd69ca1f81af0109655f1f12c8d26b74f039c52c20e7798692901c1fff0460d0e18d60c15ec42b3ee6b11bd4b27a7c919c3484e5e02da76fd16e08fd6d7b20e710056d625b93317c1ebaa08deead7534907bc371ef539a608a159296973158969c6255c8907f02f9025802ba3ff0f6ee503ed17a764a10d6d41d140f6f9433b222927e16edb5f573d28cba228f026d56ba23db7f6b17606e095c78b2e7d3ce1a65343bf4f61569372a1cd90f6a4acfbe233000de8d27139eba523ce53500a2f861609e4b45bc16a7e96c8dbc6101e11b405621dba2dde1ec3a02d9836465383d6d9ad5ed7eb0714bfba607d9d63f2f27160645a196f02b7359af59c71ce12b044627144354e16d22786c6c4b6e5ecab9d27f94a78ee3e45156b1a872178dae6ff87a9165fb6e451c515fcf81b74500a4fc8b92cb700e94575ab1b5afe788f5263d473349ea0ca00a11ba562b645d481ed19d185a41ff8f887859948ad6", + "hex": "6a4d0d071352056e657732302103cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61fde0069c35399f231edecd6448d94856704085409b2c253bfeb8b5d3af5e0905e424904333942904b85236941e332252c340e4e2187e2b13434338cf4d0ed81c0d6bcf54129c2aa93397024686058823126b5b51ef1895504cab5b925c10ac0b2dbb4783b0ef1f09a07db30d01d2ffd822a0c6955a8d595f700071d0d75eaf3b0921d8b78778d939c0e7ac34e56f8709ce87725b351a7f0967b999bff1b455f2a9db10c3e59190eb224281763979d99870fce70bd3f0a4a886aabad417601354a014c2882f9f46027d9b44cd68fa3a1ed65738db951cd450ae7d0c8cb2c70e6fa8bfde217f3ae9f7768f40aa283c3cc5f1f29855ccc0e60401f014c7894fc37ad1eb77e42b6a7503b8432513f87fa2e726f7103057e19e8c19911594488809faecd2865d822f2e82763e9f3d4d51465c40f5e69314071f962bd2ed34843f47a063f292e12773b3fa63d050d328d621aa8b2d775e04744a2ceaa29a4b373a074c428d54d61dcaa4b76fe6e7e57a0fd71227a510928a49055305ab2bd5696264b9f43d6c92f8d88fc929e49f8faa6b9a6307a867af92ed97bc1fcbbd474d9c2f49b0659ea547a5ad9f31c81bf5c189c2fc51e248e60a3fd9841f08dc62c559ea7dfe6275cb02f7cebeb1258412c8d0b9ace086f286c59911ed52faa5ac8443d10845bcd3c60697a5428c023263d1a466fadd5075e4794b9dd6955450cb3d7b595658325441440876eda2caaf385dd0ef6c1bc64fc5e54d4eff2ab2e7301a99adb53e015cd130cc0ea259b332a606c8f91da629cd649ffa3d84f4866ed921b4138cd74480cbdbc238636324fa1020263ecfa7693621654de04f14218e01f831fe59b4b3db4c612141e4130438af6b9c203a8af2128a8ea1e2574bd13421caa85e054a06d5df4fb1c92def5bc782548d61bfa50ec8fd70ac17bacc885b9fedde62ad4ab8df1e56f4b9928536bb7cc8988d99d503be8a213030f9a335a8c428424a20fc7373cb141cc32bf185dd13d82d2897e3638f9e8e868f00a398e6beca60231ce568e8698fdede5f63ee32e7b7058379b4f0b83135c73ac6084474ede0e38030e5be8241f4af53188edbe4d68056f2934f717d53eed69d2cb4f1b25f16f08f2aafec71ff53e73001f111f1c9e0314870c7be32a6651f5bdf8607bb0ca35d6f33eab8bc7236f89e01a921d30b9cf562575fa4799e566620699d1e123a8795b77fadd55a16d44cb220fd2857bbb8fa8c48f65b8458e7a0faae52e62b8d0746cc5aa24366fa76c25001ee3187b894246ecb96247372668bf58ea753c996a5726ac9e6524fd03e335e5e896141089acd99b417afdf07ad7604cacc7606023fb53a5ad68630f3e08fc49b6cd59241c58c1b8a8170c00f7db4ed774d02ec07d05903f94f95766e32f4edb5c79012f4d8bad48c3d913fdc5c8950449296a55753097b3d75c5ad580feeb24eec216f3fee16ffadc2a7575b3fb11eaa31b9e4d79d19bec16bed2d86a65c694a23535630a73696def1c9f1ca43622836eafb0cb3eaa136d43cb376d1e6b50d3c4bbe8e0bfc07fa6ffce15305a8ca695fffffbf29333e7da4532647cf09b370bafa17f5e498924921fc00371a1be856324be3accd973d6495b2d8105adefeb0f6d8d36ec678c4c6a55cfbbfd704ab6cb9ac939ccb1f104036e3ff213ba5a983c2b46cba5d4ea48c9cd2d50483f5f51d72aa2ea2e8ca68b5e7e14791fa51204af13541618a2aedba47de8229f31c967a7381ec22822617d19dd460942878a2af8273f072e293017608f876566c6180704596b9be2806eb2706349c3e1e1d4c4eda819843d922870491e0f8f5cbcd12e2feb1346eb877019203525eda9c411450c660b94da968ca6a0008d76fd757ade57e00f00a4f349d9ab0b0bcc97e74e2d92b5188d1d42dca80b4c3f619729b698bb301ba0ad31fb3a8c22a69a6516ec1f19d5a7651acd8951a674abb9ffa2d2aa64dfa98286c7ea26f1629f6a5892488fd69ca1f81af0109655f1f12c8d26b74f039c52c20e7798692901c1fff0460d0e18d60c15ec42b3ee6b11bd4b27a7c919c3484e5e02da76fd16e08fd6d7b20e710056d625b93317c1ebaa08deead7534907bc371ef539a608a159296973158969c6255c8907f02f9025802ba3ff0f6ee503ed17a764a10d6d41d140f6f9433b222927e16edb5f573d28cba228f026d56ba23db7f6b17606e095c78b2e7d3ce1a65343bf4f61569372a1cd90f6a4acfbe233000de8d27139eba523ce53500a2f861609e4b45bc16a7e96c8dbc6101e11b405621dba2dde1ec3a02d9836465383d6d9ad5ed7eb0714bfba607d9d63f2f27160645a196f02b7359af59c71ce12b044627144354e16d22786c6c4b6e5ecab9d27f94a78ee3e45156b1a872178dae6ff87a9165fb6e451c515fcf81b74500a4fc8b92cb700e94575ab1b5afe788f5263d473349ea0ca00a11ba562b645d481ed19d185a41ff8f887859948ad6", + "type": "nulldata" + } + } + ] + ``` + + +In all `destpubtxids` in the Dilithium Module, the value at the position `[12:14]` provides the length of the handle. + +In this case, the value is `05`. Therefore, the 5 bytes following this value is the handle, provided in ascii format. + +Observe the following 5 bytes at `[14:24]` and we see `6e65773230`. + +Once converted from ascii to text this provides the value: `new20`. + +This should be the handle that we seek. + +{/* Sidd: is the value below a utxo or txid? */} + +Use the handleinfo RPC to verify that this is the handle for the `destpubtxid` of the value `adebadd9483bb3d6edd10304dc162506a36adc4aabb14dd13a623042f339236d`. + +```bash +./komodo-cli -ac_name=MUSIG cclib handleinfo 19 "[%22new20%22]" +``` + + + ```json + { + "result": "success", + "handle": "new20", + "destpubtxid": "adebadd9483bb3d6edd10304dc162506a36adc4aabb14dd13a623042f339236d", + "pkaddr": "PPYtLWAwewUY1TNwsHyJpo7GdFLgrZcf5t", + "pubkey": "03cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61" + } + ``` + + +#### Repeat the Same Process for vout0 + +Repeat the same process for vout0, where the `destpubtxid` is `fc6c067ec1091ec0d57ab86812af85a8650b10c6f1f0b954fc8db8c0e877e2a9` and returned response is the `new21` handle. + +#### Repeat This Process on Each Utxo + +Repeat this full process on each utxo provided in the getaddressutxos output above. + +The customized approach we take for this tutorial is to use the `dil_listunspent` function [provided in this linked repository.](https://github.com/KMDLabs/pos64staker/blob/513d8bb0f18ee1a5011ea50e6e2aa766f01c5ad3/stakerlib.py#L876) The source code and function here is also based on python3. + +Having executed the dil\_listunspent python3 function we receive the following response for our pubkey. + +{/* Sidd: Which pubkey? Is that the PubkeyCCaddress(cclib) pubkey used previously? */} + + + ```json + { + "KomodoFan": [ + { + "funcid": "Q", + "height": 27853, + "received_from": "KomodoFan", + "txid": "6638c62562a9a9e5cf78cdcd7c77aa54746822bddce9b318d09f5ede565145f5", + "value": 0.0989, + "vout": 1 + }, + { + "funcid": "Q", + "height": 28175, + "received_from": "KomodoFan", + "txid": "a23579447936e891182d713be4a35c634a0785c5355bd45c81566bc01196aa98", + "value": 0.6899, + "vout": 3 + } + ], + "LABSLover": [ + { + "funcid": "Q", + "height": 27878, + "received_from": "KomodoHaxor", + "txid": "5aaf4007d6d9af7883da1ad464b63fff9d97453efe0b181d19558cc15f6ff668", + "value": 1.1, + "vout": 1 + }, + { + "funcid": "Q", + "height": 28175, + "received_from": "KomodoFan", + "txid": "a23579447936e891182d713be4a35c634a0785c5355bd45c81566bc01196aa98", + "value": 0.01, + "vout": 0 + }, + { + "funcid": "Q", + "height": 28175, + "received_from": "KomodoFan", + "txid": "a23579447936e891182d713be4a35c634a0785c5355bd45c81566bc01196aa98", + "value": 0.1, + "vout": 1 + }, + { + "funcid": "Q", + "height": 28175, + "received_from": "KomodoFan", + "txid": "a23579447936e891182d713be4a35c634a0785c5355bd45c81566bc01196aa98", + "value": 0.2, + "vout": 2 + }, + { + "funcid": "x", + "height": 28186, + "received_from": ["REU3fRjFrfs6ir6g3qcJK1N1AzNafzCw7B"], + "txid": "5d15a272a3cbd07611ccd64045fd55d49fdcbb41c0fb21df3b7e8d6011e8b5a9", + "value": 0.333, + "vout": 0 + } + ], + "new20": [ + { + "funcid": "Q", + "height": 25034, + "received_from": "new20", + "txid": "5b5dab18abbfc0b85c6632ec6b4f71e30d7e28cbfa5e29a6a6e4d48f2fb730cf", + "value": 4.2993, + "vout": 1 + }, + { + "funcid": "Q", + "height": 27853, + "received_from": "KomodoFan", + "txid": "6638c62562a9a9e5cf78cdcd7c77aa54746822bddce9b318d09f5ede565145f5", + "value": 0.001, + "vout": 0 + } + ], + "new21": [ + { + "funcid": "Q", + "height": 24980, + "received_from": "new01", + "txid": "6b0600623088b7328e627d7de51baa7601c83a41198b133b038100b3669a63bc", + "value": 0.0, + "vout": 0 + }, + { + "funcid": "Q", + "height": 25034, + "received_from": "new20", + "txid": "5b5dab18abbfc0b85c6632ec6b4f71e30d7e28cbfa5e29a6a6e4d48f2fb730cf", + "value": 1.0, + "vout": 0 + } + ] + } + ``` + + +The dil\_listunspent python3 function also decodes this tranasaction: + +```json +{ + "funcid": "x", + "height": 28186, + "received_from": ["REU3fRjFrfs6ir6g3qcJK1N1AzNafzCw7B"], + "txid": "5d15a272a3cbd07611ccd64045fd55d49fdcbb41c0fb21df3b7e8d6011e8b5a9", + "value": 0.333, + "vout": 0 +} +``` + +This is a `t` to `q` Dilithium `send` qutxo. Here is one possible method to decode this type of transaction. + +```bash +./komodo-cli -ac_name=MUSIG getrawtransaction 5d15a272a3cbd07611ccd64045fd55d49fdcbb41c0fb21df3b7e8d6011e8b5a9 2 +``` + + + ```json + { + "hex": "0400008085202f890172330153b6cf1d3964b52c35f68d4b1eb3cdfa749545bc2f7e55887ed6e691ab04000000484730440220363c5fcb1be87a789c6cfe970c73e035742f24ff2ee7c4da642a399744ff1f240220535933764fb9e652eaabfa6fbb8df4b2c2f6075d575820dc22006f21fffc0cc901ffffffff03201efc0100000000302ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc08ba07e901000000232103cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61ac0000000000000000246a221378a26465694d923ee4d490ddd090c0aa7002b6e6a7dcf0550a940ccb6480e325b6000000002e6e00000000000000000000000000", + "txid": "5d15a272a3cbd07611ccd64045fd55d49fdcbb41c0fb21df3b7e8d6011e8b5a9", + "overwintered": true, + "version": 4, + "versiongroupid": "892f2085", + "locktime": 0, + "expiryheight": 28206, + "vin": [ + { + "txid": "ab91e6d67e88557e2fbc459574facdb31e4b8df6352cb564391dcfb653013372", + "vout": 4, + "address": "REU3fRjFrfs6ir6g3qcJK1N1AzNafzCw7B", + "scriptSig": { + "asm": "30440220363c5fcb1be87a789c6cfe970c73e035742f24ff2ee7c4da642a399744ff1f240220535933764fb9e652eaabfa6fbb8df4b2c2f6075d575820dc22006f21fffc0cc9[ALL]", + "hex": "4730440220363c5fcb1be87a789c6cfe970c73e035742f24ff2ee7c4da642a399744ff1f240220535933764fb9e652eaabfa6fbb8df4b2c2f6075d575820dc22006f21fffc0cc901" + }, + "value": 82.37875, + "valueSat": 8237875000, + "address": "REU3fRjFrfs6ir6g3qcJK1N1AzNafzCw7B", + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.333, + "valueSat": 33300000, + "n": 0, + "scriptPubKey": { + "asm": "a22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401 OP_CHECKCRYPTOCONDITION", + "hex": "2ea22c802008b4a3a211fa1ecb9d245b3267827a56924653fe9bb4697510cf5d65e4bbfea98103120c008203000401cc", + "reqSigs": 1, + "type": "cryptocondition", + "addresses": ["RGBrSwrGR4ypFFufyvHEuMMbxs7ETD8Xv7"] + } + }, + { + "value": 82.04565, + "valueSat": 8204565000, + "n": 1, + "scriptPubKey": { + "asm": "03cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61 OP_CHECKSIG", + "hex": "2103cebc558e6ba1c0f56f4ad490391c93336b5ccd8b08d123f4e7f1cdd4d5d21e61ac", + "reqSigs": 1, + "type": "pubkey", + "addresses": ["REU3fRjFrfs6ir6g3qcJK1N1AzNafzCw7B"] + } + }, + { + "value": 0.0, + "valueSat": 0, + "n": 2, + "scriptPubKey": { + "asm": "OP_RETURN 1378a26465694d923ee4d490ddd090c0aa7002b6e6a7dcf0550a940ccb6480e325b6", + "hex": "6a221378a26465694d923ee4d490ddd090c0aa7002b6e6a7dcf0550a940ccb6480e325b6", + "type": "nulldata" + } + } + ], + "vjoinsplit": [], + "valueBalance": 0.0, + "vShieldedSpend": [], + "vShieldedOutput": [], + "blockhash": "00860646a11f7913754c7ac53aca57c84f9125f67df7ae52114adccb8e890052", + "height": 28186, + "confirmations": 1407, + "rawconfirmations": 1407, + "time": 1552893881, + "blocktime": 1552893881 + } + ``` + + +Use the `decodeccopret` RPC on this transaction's opreturn `hex` value and observe that the returned `function` value is `x`. This tell us that this transaction is a Dilithium send `t` -> `q` transaction. + +```bash +./komodo-cli -ac_name=MUSIG decodeccopret 6a221378a26465694d923ee4d490ddd090c0aa7002b6e6a7dcf0550a940ccb6480e325b6 +``` + + + ```json + { + "result": "success", + "OpRets": [ + { + "eval_code": "0x13", + "function": "x" + } + ] + } + ``` + + +Convert this `hex` value to big endian: + +```bash +b625e38064cb0c940a55f0dca7e6b60270aac090d0dd90d4e43e924d696564a27813226a +``` + +Take the first 32 bytes of this (position \[:64]): + +``` +b625e38064cb0c940a55f0dca7e6b60270aac090d0dd90d4e43e924d696564a2 +``` + +This is the matching `destpubtxid` to which vout0 was sent in our transaction. + +Use the same handle\_get function from the previous step and we find that this `destpubtxid` is associated with the handle `LABSLover`. + +Collecting all the vouts of the `qutxos` that belong to this handle and creating a sum of their balances provides the total balance. +export const title = "Gateways Tutorial"; +export const description = "This tutorial covers Smart Chain creation, preparing an oracle, binding tokens and the oracle to a gateway, depositing and withdrawing KMD."; + +# Gateways Module Tutorial + +## Tutorial + +In this tutorial, we will create a gateway that can serve to represent KMD. The following are the steps in the gateway-creation process: + +* Create a new Smart Chain and provide representative tokens +* Prepare a special oracle to monitor Komodo's chain state +* Bind the tokens and the oracle to our gateway +* Deposit KMD into the gateway +* Exchange tokens with other tokens on-chain +* Use the tokens to withdraw KMD + +Please ensure that you have the KMD main chain downloaded and synced before continuing further in the guide. + +Also, please open an empty text file and save all output transaction ids and hex-encoded data from each step. You will need the information at various stages. + +#### Manually Compile and Install Komodo From Source + +For this tutorial, please compile and install Komodo software from the source repositories. + +[Information on manual installations can be found at this linked documentation.](/smart-chains/setup/installing-from-source/#linux) + +#### Create a New Blockchain + +For this tutorial we will create a temporary Smart Chain called `HELLOWORLD` for educational purposes. + +Make sure that the total `ac_supply` of this Smart Chain is fairly large. `777777` coins will do for our purposes. + +[Follow these linked instructions](/smart-chains/tutorials/create-a-default-smart-chain/) before continuing. + +Recall also that a user must have a `pubkey` enabled when interacting with an Antara-related Smart Chain. [View this linked material for an explanation.](/antara/tutorials/understanding-antara-addresses/) + +If desired, the reader may use an existing Smart Chain instead of a temporary educational chain. [Follow this link](https://github.com/jl777/komodo/blob/master/src/assetchains.old) for a list of asset-chain launch parameters. + +#### Create a Token to Represent an External Cryptocurrency + +For the GatewaysCC module to function it must have access to tokens that can represent an external cryptocurrency. We use the [Tokens](/antara/api/tokens/) CC module to this effect. + +#### Decide the Number of Tokens to Create + +We want the number of total tokens to be the maximum possible amount of the represented cryptocurrency that we expect to hold. + +Each token is created not from a full coin, but rather from a satoshi. + +For example, `1` HELLOWORLD coin creates `100000000` tokens. + +The HELLOWORLD satoshis should pair on a one-to-one basis with KMD satoshis. + +For our purposes, we will use `1000` coins of HELLOWORLD. + +#### Creating the tokens + +To create the tokens, execute the following command: + +```bash +./komodo-cli -ac_name=HELLOWORLD tokencreate KMD 1000 KMD_equivalent_token_for_gatewaysCC +``` + +This creates a `100000000000` token supply of on-chain tokens with the name of `KMD`, which represent the external cryptocurrency, `KMD`. + +For more details on the above command, see [tokencreate.](/antara/api/tokens/#tokencreate) + +This command returns a hex value as a response: + +````json +{ + "result": "success", + "hex": "01000000022c223cfc9c3349aed24ca89e44af6fcdb030150443bd6ac55e2080ce4b097c3002000000484730440220316605c400c47e2d5aa6104ac5c5229e71683b8db9482efa1655d257690d338802202344f254b208a6d724f52f4503531cf005a8ca68119bde4b6cb281ab9fccaf1101ffffffff80e66c0c47311449c5effc2782134006f05fd31e79659bc4b0608d7e247e280c0000000049483045022100ec494d3fa5c76fe0382e83980affdfd091509fb4e18b20fff8c095374e6b6bee022015ddaf95dc8b03e8cbba00ff7a377b80a7bd2200a68669718c329c617549757701ffffffff0400a0724e18090000302ea22c8020bc485b86ffd067abe520c078b74961f6b25e4efca6388c6bfd599ca3f53d8dae8103120c008203000401cc1027000000000000232102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702acc01f66fa15090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac0000000000000000396a37e3632103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc0354414b0e54657374696e672070686173652e00000000" } ``` +```` + +Select the hex value (`01000000022c223c...`) and copy it (CTRL + SHFT + C). + +Broadcast this value using [sendrawtransaction:](/smart-chains/api/rawtransactions/#sendrawtransaction) + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction insert_hex +``` + +This returns a string, and this string is our `tokenid`. + +```bash +315d16c2dddd737f8a48f81499908897b53d05d20fb1344e349e304fb603f6bf +``` + +Copy the `tokenid` into the text editor we opened at the beginning of the tutorial and keep it available for future use. + +Watch the mempool using [getrawmempool](/smart-chains/api/blockchain/#getrawmempool) to verify that the `tokenid` is successfully mined: + +```bash +./komodo-cli -ac_name=HELLOWORLD getrawmempool +``` + +Once the `tokenid` disappears from the mempool the transaction is mined. + +If this Smart Chain were receiving full dPoW security services, at this point it would be appropriate to wait for notarization. We can use [getinfo](/smart-chains/api/control/#getinfo) to watch for the `notarizations` property to increase: + +```bash +./komodo-cli -ac_name=HELLOWORLD getinfo +``` + +On this educational Smart Chain, however, we can continue without waiting for notarization. + +We can check to see that our token is successfully created on the chain using [tokeninfo](/antara/api/tokens/#tokeninfo) + +```bash +./komodo-cli -ac_name=HELLOWORLD tokeninfo insert_token_id +``` + +We can check the balance of our `pubkey` using [tokenbalance:](/antara/api/tokens/#tokenbalance) + +```bash +./komodo-cli -ac_name=HELLOWORLD tokenbalance insert_tokenid insert_pubkey +``` + +#### Create an Oracle + +We use the [Oracles](/antara/api/oracles/#introduction) Module to add external data to the blockchain. + +The name of our oracle should be identical to the name of our tokens, `KMD`, and the data format must start with `Ihh` (height, blockhash, merkleroot): + +Create the oracle using [oraclescreate:](/antara/api/oracles/#oraclescreate) + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclescreate KMD blockheaders Ihh +``` + +This returns a hex value: + +```json +{ + "result": "success", + "hex": "010000000185b76ed0fbdb9ee2bdb5693f491b6ea23de6498f42c6e83f9f36c1eaf411dd990200000049483045022100aa198a2ae959ee191e1359df48867480bf5a1a5bd4fa76b4398481c89ff3095102205034824dcd56b312183acd65c27a002a13dae84f5d22c767f1efaae09ef63a5c01ffffffff0310270000000000002321038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aac378740a804000000232103810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5ac00000000000000001c6a1aec43064e5957544852014c0e5765617468657220696e204e594300000000" +} +``` + +Broadcast the returned hex data using [sendrawtransaction:](/smart-chains/api/rawtransactions/#sendrawtransaction) + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction insert_hex_data +``` + +This returns a transaction id, which is the `oracleid`: + +```bash +0df7c4d844f08dba08abd4bb174558739f17cfe268feb005fb6333b3761d9203 +``` + +Record this in the text editor. + +Before registering as an oracle publisher, we need to run the `oraclesfund` method: + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclesfund 7b6e7745058ffded423546eecc61dcc05069279b90776384c52692765246b64c +``` + + + ```json + { + "result": "success", + "hex": "0400008085202f890124839445f1cdca84c42563fa87742a562824815729625184117c80dc2a06510e0000000049483045022100c4442ff211289ebc5967da35843f1d210c4a8985d5797a11c42e245aafdf6985022031e7dfb40e3778033f1fb92c0f1175cb4a658bb32749469d69379968fcf92be701ffffffff031027000000000000302ea22c802083071e46d28313148751bdd5e4ffd0509c4234f4770c4c0550cc48b6d45215188103120c008203000401cce0950b5402000000232102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5ac00000000000000004f6a4c4cec464cb64652769226c5846377909b276950c0dc61ccee463542edfd8f0545776e7b2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5102700000000000000000000b60700000000000000000000000000" + } + ``` + + +Send the raw transaction by broadcasting the hex value: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0400008085202f890124839445f1cdca84c42563fa87742a562824815729625184117c80dc2a06510e0000000049483045022100c4442ff211289ebc5967da35843f1d210c4a8985d5797a11c42e245aafdf6985022031e7dfb40e3778033f1fb92c0f1175cb4a658bb32749469d69379968fcf92be701ffffffff031027000000000000302ea22c802083071e46d28313148751bdd5e4ffd0509c4234f4770c4c0550cc48b6d45215188103120c008203000401cce0950b5402000000232102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5ac00000000000000004f6a4c4cec464cb64652769226c5846377909b276950c0dc61ccee463542edfd8f0545776e7b2102c59cc849a87ef401942abb5b5fe81c1a468454fd68c94c849c20b13f5ebd91a5102700000000000000000000b60700000000000000000000000000 + +``` + +Response: + + + ```bash + ab038ff4369974d0596f13be1e69105ed97b5374f694afe7b96b664a9fe07192 + ``` + + +(Use `./komodo-cli -ac_name=HELLOWORLD getrawmempool` to ensure that the transaction receives confirmation.) + +To prepare for the oraclefeed instance, use [oraclesregister](/antara/api/oracles/#oraclesregister) to register as a publisher for the oracle. This must be done on a node which can post KMD block headers and which can execute withdrawal transactions: + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclesregister insert_oracleid data_fee_in_satoshis` +``` + +This returns a hex value (not shown for brevity), which we now broadcast: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction insert_hex_value +``` + +Retrieve the data publisher's `pubkey` using [oraclesinfo:](/antara/api/oracles/#oraclesinfo) + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclesinfo insert_oracleid +``` + + + ```json + { + "result": "success", + "txid": "46e2dc958477160eb37de3a1ec1bb18899d77f5b47bd52b8a6f7a9ce14729157", + "name": "KMD", + "description": "blockheaders", + "format": "Ihh", + "marker": "RNFz9HAuzXhAjx6twEJzcHXconzChfiNM6", + "registered": [ + { + "publisher": "03810d28146f60a42090991b044fe630d1664f3f8f46286c61e7420523318047b5", + "baton": "RWg43P8s8RtJatAGNa2kV8N2abhQqH93w9", + "batontxid": "99dd11f4eac1369f3fe8c6428f49e63da26e1b493f69b5bde29edbfbd06eb785", + "lifetime": "0.00000000", + "funds": "0.00000000", + "datafee": "0.01000000" + } + ] + } + ``` + + +The property, `"publisher"`, in the entry, `"registered"`, of the returned json object is the data publisher's `pubkey`, also called the `publisherpubkey`. + +Subscribe to the oracle using [oraclessubscribe](/antara/api/oracles/#oraclessubscribe) to receive utxo information for data publishing. + +The frequency of data-publishing transactions we can perform in a block is equal to the number of active subscriptions committed to the oracle. Therefore, we must have at least one subscription for the oracle to allow publishing. + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclessubscribe insert_oracleid insert_publisherpubkey insert_amount_of_funds_to_add +``` + +This returns a hex value (not shown for brevity), which we now broadcast: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction insert_hex_value +``` + + + Execute the oraclessubscribe and sendrawtransaction methods + several times and with the same amount. This gives us the opportunity to + broadcast more than one sample of data per block. In our example, we want to + publish data for more than one KMD-height per block. + + +Verify the oracle information to ensure it is properly established: + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclesinfo insert_oracleid +``` + +#### Activating Gateway Binding + +We now create a gateway and bind our information to it, using the [gatewaysbind](/antara/api/gateways/#gatewaysbind) method. + +This method requires that we decide how many total gateway signatures we desire (`N`), and how many signatures are required to withdraw funds (`M`). + +For our educational example, we may set both `N` and `M` equal to `1`, for simplicity. + +As a part of this command we will need to indicate the `pubtype`, `p2shtype`, and `wiftype` values for our chosen coin. For KMD, these values are `60`, `85` and `188` respectively. + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysbind insert_tokenid insert_oracleid KMD insert_tokensupply 1 1 insert_gatewayspubkey 60 85 188 +``` + +This method returns a hex value (not shown for brevity), which we now broadcast: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction insert_hex_value +``` + +The broadcast returns a transaction id, also called the `bindtxid`. Copy this information into the text editor. + +Assuming everything is properly created and executed, we may now review our new gateway using [gatewaysinfo:](/antara/api/gateways/#gatewaysinfo) + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysinfo insert_bindtxid +``` + +Use the returned information to verify that the `tokenid` and `oracleid` match the information in our text editor. + +#### Assemble an Oracle Instance + +An oracle instance automates the transfer of merkleroot data to our oracle. The Komodo software suite includes built-in tools for creating an oracle instance. + +Change into the correct directory (this command assumes we installed Komodo in the default directory): + +```bash +cd ~/komodo/src/ +``` + +Compile the instance: + +```bash +gcc cc/dapps/oraclefeed.c -lm -o oraclefeed +``` + +Run the instance: + +```bash +./oraclefeed HELLOWORLD insert_oracleid insert_mypubkey Ihh insert_bindtxid & +``` + + + ```bash + (succesfull oraclization of KMD heights): + KMD ht.1023334 <- 669d0f009eaf85900be0d54fa1b5f455d49edfc1d9dcfe71c43b8be19b7927dda3ecd20c0175bc7b8eb98d857baeeef6a18fc7d6b58bd34b4eb00beaa18c5842bbe5566a + broadcast HELLOWORLD txid.(9484283d8d4bf28b4053e21e7b7e8210eb59c41668e9c7280c4e6c4fbf61579a) + KMD ht.1023335 <- 679d0f00173d5dc169a64bba92e5765fde848cc620a700295ecce8837cb2a13b05000000ed71033532278f72c8f64990e27f0cb185310df163b3278faf267e87d12bf84b + broadcast HELLOWORLD txid.(837c132ab47f1ac1eee2e03828a9818369b919c1de128b99958ac95ffdc96551) + KMD ht.1023336 <- 689d0f0006a53215d5a07d9ee1c9206dcdccacd1c364968b555c56cdf78f9f0c40f87d08b30fdf63299d25bd9a09a3b3fb8a26800a0a4f6e93ca6cd8cb41b98b756dd937 + broadcast HELLOWORLD txid.(f33d5ffaec7d13f14605556cee86262299db8fad0337d1baefadc59ec24b6055) + ``` + + +#### Using the Gateway + +With our gateway created and our oracle instance running as a background process, we are finally prepared to test our gateway. + +First, we need the `gatewaysDepositAddress`. This is the address where we will deposit our KMD on the main KMD chain. + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysinfo insert_bindtxid +``` + + + ```json + { + "result": "success", + "name": "Gateways", + "pubkey": "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0", + "coin": "KMD", + "oracletxid": "ba26ba27dc17a017a2c0915378c0a8430e468dffb42c4fc1cd36abf69c88388b", + "taddr": 0, + "prefix": 60, + "prefix2": 85, + "deposit": "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp", + "tokenid": "07646d72dec393f486f8a116facd9b8a575dcf00ec99f819151fd1784015941b", + "totalsupply": "1.00000000", + "remaining": "1.00000000", + "issued": "0.00000000" + } + ``` + + +The `deposit` property contains the `gatewaysDepositAddress`. When we send funds to this address, we receive in return HELLOWORLD KMD tokens to an on-chain address that we indicate as follows. + +Use the [z\_sendmany](/smart-chains/api/wallet/#z-sendmany) method to send funds to two addresses simultaneously. The first address is the normal address for the `pubkey` that corresponds to our pubkey on the HELLOWORLD Smart Chain which will receive tokens. The second address is the `gatewaysDepositAddress` on the KMD chain. We send a nominal amount into the first address, and the amount we wish to have available for trading into the second address. This is done on the external chain -- in this case, KMD. + +```bash +./komodo-cli z_sendmany "insert_address_where_KMD_funds_are_currently_held" '[{"address":"addressOfPubkeyForTokenizedKmd","amount":0.0001},{"address":"gatewaysDepositAddress","amount":0.1}]' +``` + +The returned string is the `operation_id`. Use this with the [z\_getoperationstatus](/smart-chains/api/wallet/#z-getoperationstatus) method. + +```bash +./komodo-cli z_getoperationstatus '["insert_operation_id"]' +``` + +Execute this every few seconds until the `status` property reads `success`. Once this occurs, find the `txid` value. This is our `cointxid`, and we copy this into our text editor. + +Wait for the transaction to be mined. Once confirmed, execute the [gettransaction](/smart-chains/api/wallet/#gettransaction) method with the `cointxid` to obtain more information we will need later. + +```bash +./komodo-cli gettransaction insert_cointxid +``` + +Via the returned information from the `gettransaction` method, we can verify the addresses were correct by looking at the `vout` properties. At the bottom, there is a `hex` value. Copy the value to the text editor for later. + +In the returned results there is also a `blockhash` value, which we can use to find out the height of the block which contains the `cointtxid` by using the method below. + +```bash +./komodo-cli getblock insert_blockhash | jq '.height' +``` + +Next, execute the following command for more information: + +```bash + ./komodo-cli gettxoutproof '["insert_cointxid"]' +``` + +This returns a `proof` value. Transfer this to the text editor. + +We now have the necessary data to execute the [gatewaysdeposit](/antara/api/gateways/#gatewaysdeposit) method on the HELLOWORLD Smart Chain. + +The `gatewaysdeposit` method broadcasts the relevant data on the Smart Chain so that the gateway nodes may validate the information and prepare to distribute the KMD tokens. + +Here is the information we need for this call: + +* `BINDTXID`: our bindtxid +* `HEIGHT`: the `height` value of the `blockhash` containing the `cointxid` transaction +* `COIN`: KMD for this example +* `COINTXID`: the `cointxid` returned from `z_sendmany` +* `CLAIMVOUT`: the `vout` of the claim (this value should be 0, as it is our first use) +* `DEPOSITHEX`: the `hex` value that is found by executing `gettransaction` on the cointxid +* `PROOF`: the `proof` value returned after executing `gettxoutproof` on the cointxid +* `DESTPUB`: the public key where the KMD tokens should be received on the Smart Chain (the same pubkey used earlier to retrieve the first address for the z\_sendmany method) +* `AMOUNT`: the amount of the deposit (in this case 0.1) + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysdeposit BINDTXID HEIGHT COIN COINTXID CLAIMVOUT DEPOSITHEX PROOF DESTPUB AMOUNT +``` + +Successfully executing this command will return a hex value. + +Broadcast the hex data: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction insert_hex_data +``` + +The broadcast returns a transaction id. Copy this to the text editor. It is the `deposittxid`. + + + For the deposit to process successfully, the oraclefeed instance must first + process the block height of the z\_sendmany transaction through the oracle + + +#### Claim the Funds on the Smart Chain + +To claim the funds we must spend the marker and the deposit asset, and perform the claim. + +This method is only available to the owner of the `privkey` corresponding to the pubkey used previously in the `gatewaysdeposit` method. The pubkey should be the `-pubkey=$PUBKEY` parameter used to launch the daemon. + +* `BINDTXID`: our bindtxid +* `COIN`: KMD for this example +* `DEPOSITTXID`: the transaction id returned from the `gatewaysdeposit` call +* `DESTPUB`: the public key where these tokens should be received on the Smart Chain +* `AMOUNT`: the amount of the deposit (in this case 0.1) + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysclaim BINDTXID COIN DEPOSITTXID DESTPUB AMOUNT +``` + +Broadcast the returned hex value: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction insert_hex_data +``` + +Once this transaction is successfully confirmed, the gateway will credit tokens to our indicated pubkey. These tokens are now usable as regular Token CC tokens. + + + For the claim to process successfully, the deposit and bind transaction must + be confirmed first. This requires either 101 confirmations, or if the chain + has dPoW, 1 notarization. + + +#### Withdrawing KMD Funds + +When finished with our tokens, we may send them to the gateway and withdraw the corresponding KMD funds via the [gatewayswithdraw](/antara/api/gateways/#gatewayswithdraw) method. Only the current owner of the KMD funds may execute the `gatewayswithdraw` method for these funds. + + + Recall that for the gateway to function, the oracle instance must be running. + + +Before we execute `gatewayswithdraw`, we must first import the private key for the `gatewaysdeposit address` on node which has oraclefeed instance running (this is needed only once). + +Find the `gatewayDepositAddress` in the `deposit` property of the returned values of the following command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysinfo insert_bindtxid +``` + +Find the private key returned from this command: + +```bash +./komodo-cli -ac_name=HELLOWORLD dumprivkey insert_gatewayDepositAddress +``` + +Execute the following commands on the node running the oraclefeed instance: + +```bash +./komodo-cli importprivkey "insert_private_key" "label" false +``` + +Information for the next command: + +* `BINDTXID`: our bindtxid +* `COIN`: KMD for this example +* `WITHDRAWPUB`: the pubkey where the withdrawn coins should appear on the external chain; in this case, the KMD pubkey +* `AMOUNT`: the amount to withdraw + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewayswithdraw insert_bindtxid KMD insert_withdraw_pubkey insert_desired_withdraw_amount +``` + +Once executed, the remaining portion of the withdrawal process should happen automatically. + +Congratulations, you have successfully completed the cycle of the Gateways CC module. + +## Full Example + +The following content provides the full terminal input and output of a complete gateway cycle. + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD tokencreate KMD 1 testing +``` + + + ```json + { + "result": "success", + "hex": "010000000100ab0161028985d24b473d758ee9cbb944006c27b69eb6ec5b0625e7c72bdab400000000494830450221008914c99e55f8471d7985db10fead22d4abdd52670709da9c962e20a1dd77064c022022e1900ab245872eede0439e3acbd8e481304a9ba71039590ee4ca452a628fa801ffffffff0400e1f50500000000302ea22c802090bc95b90831a7837c7ef178f6fd47f26a933bcf8de56da4a2f62894ab6c73fc8103120c008203000401cc1027000000000000232102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702ace0707c48180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac0000000000000000326a30e36321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0034b4d440774657374696e6700000000" + } + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000100ab0161028985d24b473d758ee9cbb944006c27b69eb6ec5b0625e7c72bdab400000000494830450221008914c99e55f8471d7985db10fead22d4abdd52670709da9c962e20a1dd77064c022022e1900ab245872eede0439e3acbd8e481304a9ba71039590ee4ca452a628fa801ffffffff0400e1f50500000000302ea22c802090bc95b90831a7837c7ef178f6fd47f26a933bcf8de56da4a2f62894ab6c73fc8103120c008203000401cc1027000000000000232102adf84e0e075cf90868bd4e3d34a03420e034719649c41f371fc70d8e33aa2702ace0707c48180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac0000000000000000326a30e36321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0034b4d440774657374696e6700000000 +``` + + + ```bash + 315d16c2dddd737f8a48f81499908897b53d05d20fb1344e349e304fb603f6bf + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD tokeninfo 315d16c2dddd737f8a48f81499908897b53d05d20fb1344e349e304fb603f6bf +``` + + + ```json + { + "result": "success", + "tokenid": "315d16c2dddd737f8a48f81499908897b53d05d20fb1344e349e304fb603f6bf", + "owner": "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0", + "name": "KMD", + "supply": 100000000, + "description": "testing" + } + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclescreate KMD testing Ihh +``` + + + ```json + { + "result": "success", + "hex": "010000000100d7be6a83f6398b2b30315d6a9fb6af048971fbdc233e36fb4307fde654ab5a0000000049483045022100a0155127857c36c35d72e718f052a8a6b2ac5003f8a67e622c006f2f071e5d020220087febeac78eba36a2b6c92a860f32141f9dc453f77988f9da6cfaa14d1e9d9001ffffffff0310270000000000002321038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aace051724e180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac0000000000000000146a12ec43034b4d44034968680774657374696e6700000000" + } + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000100d7be6a83f6398b2b30315d6a9fb6af048971fbdc233e36fb4307fde654ab5a0000000049483045022100a0155127857c36c35d72e718f052a8a6b2ac5003f8a67e622c006f2f071e5d020220087febeac78eba36a2b6c92a860f32141f9dc453f77988f9da6cfaa14d1e9d9001ffffffff0310270000000000002321038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aace051724e180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac0000000000000000146a12ec43034b4d44034968680774657374696e6700000000 +``` + + + ```bash + 9e2b634427c209afb844d05e20f10f9ea799b3a1e8763cb5ba89084e20ab7e40 + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclesregister 9e2b634427c209afb844d05e20f10f9ea799b3a1e8763cb5ba89084e20ab7e40 10000 +``` + + + ```json + { + "result": "success", + "hex": "010000000100da09e69ee37b713b3bbc5e4cf5f7b9525766af13c86fd5bddb246aff675cbe000000004847304402202d1aa9c1c39ed4428f381d727780fdd6fddfeef616595b7add6b0c7dac66e35f022070c227072ea93b099941daa1b5a2a41afa84ea955a536727c2307c10dc5aa53c01ffffffff041027000000000000232102407eab204e0889bab53c76e8a1b399a79e0ff1205ed044b8af09c22744632b9eac1027000000000000302ea22c802070f8ca74a159596583083b3744665976848f8c9f2e6d61b962e66c8a0d6b225d8103120c008203000401ccd02a724e180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac00000000000000004f6a4c4cec52407eab204e0889bab53c76e8a1b399a79e0ff1205ed044b8af09c22744632b9e21024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0102700000000000000000000" + } + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000100da09e69ee37b713b3bbc5e4cf5f7b9525766af13c86fd5bddb246aff675cbe000000004847304402202d1aa9c1c39ed4428f381d727780fdd6fddfeef616595b7add6b0c7dac66e35f022070c227072ea93b099941daa1b5a2a41afa84ea955a536727c2307c10dc5aa53c01ffffffff041027000000000000232102407eab204e0889bab53c76e8a1b399a79e0ff1205ed044b8af09c22744632b9eac1027000000000000302ea22c802070f8ca74a159596583083b3744665976848f8c9f2e6d61b962e66c8a0d6b225d8103120c008203000401ccd02a724e180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac00000000000000004f6a4c4cec52407eab204e0889bab53c76e8a1b399a79e0ff1205ed044b8af09c22744632b9e21024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0102700000000000000000000 +``` + + + ```bash + b0bbe39a33e794ecff5af817440c0cd7d92479cca74f3c763f88111383015d73 + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclesinfo 9e2b634427c209afb844d05e20f10f9ea799b3a1e8763cb5ba89084e20ab7e40 +``` + + + ```json + { + "result": "success", + "txid": "9e2b634427c209afb844d05e20f10f9ea799b3a1e8763cb5ba89084e20ab7e40", + "name": "KMD", + "description": "testing", + "format": "Ihh", + "marker": "RVzbTDynxQysZbYXURkq5W3TjnevyWX1fA", + "registered": [ + { + "publisher": "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0", + "baton": "RMYk1vLfWGi3aVxjGJYaAyYNZkZUvmoFJ6", + "batontxid": "b0bbe39a33e794ecff5af817440c0cd7d92479cca74f3c763f88111383015d73", + "lifetime": "0.00000000", + "funds": "0.00000000", + "datafee": "0.00010000" + } + ] + } + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD oraclessubscribe 9e2b634427c209afb844d05e20f10f9ea799b3a1e8763cb5ba89084e20ab7e40 024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0 1 +``` + + + ```json + { + "result": "success", + "hex": "010000000100e078a6ecd74f0b1609656ea3e7ee54c4a95ae66bfd19929c2e2cdc781b0f410000000049483045022100d48c862acde5e8756d11ef14ea9aaae26cf3da4344b49eb0e496b639c91499e602204dd685b86aae4dd8685e0b14b53c8a2957f5980a61f36d30eb8886726894570401ffffffff0400e1f50500000000302ea22c8020d5ad5ece52f2a6c9dd46cd4e658abce5dc1881e9c470d5cdf1f3f71199996f788103120c008203000401cc1027000000000000232102407eab204e0889bab53c76e8a1b399a79e0ff1205ed044b8af09c22744632b9eace0707c48180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac00000000000000004f6a4c4cec53407eab204e0889bab53c76e8a1b399a79e0ff1205ed044b8af09c22744632b9e21024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff000e1f5050000000000000000" + } + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000100e078a6ecd74f0b1609656ea3e7ee54c4a95ae66bfd19929c2e2cdc781b0f410000000049483045022100d48c862acde5e8756d11ef14ea9aaae26cf3da4344b49eb0e496b639c91499e602204dd685b86aae4dd8685e0b14b53c8a2957f5980a61f36d30eb8886726894570401ffffffff0400e1f50500000000302ea22c8020d5ad5ece52f2a6c9dd46cd4e658abce5dc1881e9c470d5cdf1f3f71199996f788103120c008203000401cc1027000000000000232102407eab204e0889bab53c76e8a1b399a79e0ff1205ed044b8af09c22744632b9eace0707c48180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac00000000000000004f6a4c4cec53407eab204e0889bab53c76e8a1b399a79e0ff1205ed044b8af09c22744632b9e21024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff000e1f5050000000000000000 +``` + + + ```bash + 2e0192ed35349009581cb6be842283b472247abbbeff62d8daef6fc2acfdf808 + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysbind 315d16c2dddd737f8a48f81499908897b53d05d20fb1344e349e304fb603f6bf 9e2b634427c209afb844d05e20f10f9ea799b3a1e8763cb5ba89084e20ab7e40 KMD 100000000 1 1 024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0 60 85 188 +``` + + + ```json + { + "result": "success", + "hex": "010000000101069d6ef8a20a726959a9802151f3367558a3e2360bb5620cf269c5949777430000000048473044022065e97dc3e0f8aee9c6bc041c728c18ab021c174b8570a8c332a170ec7a94773f022023c19d04002940298ae961d1c155e889df29ae9976bb61cfebd87715de3d7fbf01ffffffff031027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cce051724e180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac0000000000000000796a4c76f142034b4d443c5500bff603b64f309e344e34b10fd2053db59788909914f8488a7f73ddddc2165d3100e1f5050000000001010121024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0407eab204e0889bab53c76e8a1b399a79e0ff1205ed044b8af09c22744632b9e00000000" + } + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000101069d6ef8a20a726959a9802151f3367558a3e2360bb5620cf269c5949777430000000048473044022065e97dc3e0f8aee9c6bc041c728c18ab021c174b8570a8c332a170ec7a94773f022023c19d04002940298ae961d1c155e889df29ae9976bb61cfebd87715de3d7fbf01ffffffff031027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cce051724e180900002321024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0ac0000000000000000796a4c76f142034b4d443c5500bff603b64f309e344e34b10fd2053db59788909914f8488a7f73ddddc2165d3100e1f5050000000001010121024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0407eab204e0889bab53c76e8a1b399a79e0ff1205ed044b8af09c22744632b9e00000000 +``` + + + ```bash + 897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysinfo 897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d +``` + + + ```json + { + "result": "success", + "name": "Gateways", + "pubkey": "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0", + "coin": "KMD", + "oracletxid": "9e2b634427c209afb844d05e20f10f9ea799b3a1e8763cb5ba89084e20ab7e40", + "taddr": 0, + "prefix": 60, + "prefix2": 85, + "deposit": "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp", + "tokenid": "315d16c2dddd737f8a48f81499908897b53d05d20fb1344e349e304fb603f6bf", + "totalsupply": "1.00000000", + "remaining": "1.00000000", + "issued": "0.00000000" + } + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD dumpprivkey RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp +``` + + + ```bash + DONOTUSE_privkey_STRING + ``` + + +Command: + +```bash +./komodo-cli importprivkey "privkey" "label" false +``` + + + ```bash + (corresponding address to privkey) + ``` + + +Command: + +```bash +./oraclefeed HELLOWORLD 9e2b634427c209afb844d05e20f10f9ea799b3a1e8763cb5ba89084e20ab7e40 024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0 Ihh 897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d +``` + + + ```bash + % Total % Received % Xferd Average Speed Time Time Time Current + Dload Upload Total Spent Left Speed + 100 671 100 671 0 0 41937 0 --:--:-- --:--:-- --:--:-- 41937 + BTC/USD 3836.4150 + Powered by CoinDesk (https://www.coindesk.com/price/) 3836.41500000 + coin.KMD vs KMD + set refcoin RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp <- KMD [./komodo-cli] M.1 of N.1 + broadcast HELLOWORLD txid.(8553c068743984692dfa91bee2ce27749352c9b2aef5a06b011f1d3bd263eada) + KMD ht.1116166 <- 060811006a039b728c305c8d98b42801cde542386fc3fba3a7dbcdfbb97e6e88a891d909976d2c4de105822f03f6b81d35f3075e08bb098553bfbd3709127aac112a7819 + ``` + + +#### Example Continues - From Gateway USER Node + +Make a Deposit + +```bash +./komodo-cli listaddressgroupings +``` + + + ```bash + [ + [ + "RFUL6arBgucq9TUPvTaUTnpQ2DkrcxtSxx", + 0.26455000 + ] + ] + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD getaccountaddress "" +``` + + + ```bash + RBm4FN3JhjhbVFaGKJ8DQgtgPHKXvhFMs3 + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysinfo 897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d +``` + + + ```json + { + "result": "success", + "name": "Gateways", + "pubkey": "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0", + "coin": "KMD", + "oracletxid": "9e2b634427c209afb844d05e20f10f9ea799b3a1e8763cb5ba89084e20ab7e40", + "taddr": 0, + "prefix": 60, + "prefix2": 85, + "deposit": "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp", + "tokenid": "315d16c2dddd737f8a48f81499908897b53d05d20fb1344e349e304fb603f6bf", + "totalsupply": "1.00000000", + "remaining": "1.00000000", + "issued": "0.00000000" + } + ``` + + +Command: + +```bash +./komodo-cli z_sendmany "RFUL6arBgucq9TUPvTaUTnpQ2DkrcxtSxx" '[{"address":"RBm4FN3JhjhbVFaGKJ8DQgtgPHKXvhFMs3","amount":0.0001},{"address":"RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp","amount":0.1}]' +``` + + + ```bash + opid-fbe98b01-a870-4bd5-9bc9-b937b08c79b5 + ``` + + +Command: + +```bash +./komodo-cli z_getoperationstatus '["opid-fbe98b01-a870-4bd5-9bc9-b937b08c79b5"]' +``` + + + ```json + [ + { + "id": "opid-fbe98b01-a870-4bd5-9bc9-b937b08c79b5", + "status": "success", + "creation_time": 1543366284, + "result": { + "txid": "907812ee8d2762b589f6ca88ee8ba18a65ebf5c7486c472df7395628d22d0d98" + }, + "execution_secs": 0.007361979, + "method": "z_sendmany", + "params": { + "fromaddress": "RFUL6arBgucq9TUPvTaUTnpQ2DkrcxtSxx", + "amounts": [ + { + "address": "RBm4FN3JhjhbVFaGKJ8DQgtgPHKXvhFMs3", + "amount": 0.0001 + }, + { + "address": "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp", + "amount": 0.1 + } + ], + "minconf": 1, + "fee": 0.0001 + } + } + ] + ``` + + +Wait until this height is oraclized by the `oraclefeed` instance. + +Find the `height` and `hex` values here: + +Command: + +```bash +./komodo-cli getrawtransaction 907812ee8d2762b589f6ca88ee8ba18a65ebf5c7486c472df7395628d22d0d98 1 +``` + + + ```json + { + "hex": "010000000197d6ea16c68dc5db95b72e029a0e23cb403ae0a33b561b863963cfd9cbfec747000000006b483045022100aca47515602989979b514b6211c375e4d0d9471dd8297c5238c12245ad01dd830220191105caf1b63313c6988194f5f03fd6f70d4a30edc7820add1185d35edff1bb012102924664b536f3710a8e8abea38bb4bf71b470a653a4dceabd50df08d7b2a38436ffffffff0310270000000000001976a9141b355cb6b76cab1b16cb873db8828fe5d2521ae488ac80969800000000001976a914f0d1fc29f8962ac2805a1659192d9ad26794d22988ac38c7fa00000000001976a91482804b943dd6a2008af73f8ba40449c062f0935188ac50e6fd5b", + "txid": "907812ee8d2762b589f6ca88ee8ba18a65ebf5c7486c472df7395628d22d0d98", + "overwintered": false, + "version": 1, + "locktime": 1543366224, + "vin": [ + { + "txid": "47c7fecbd9cf6339861b563ba3e03a40cb230e9a022eb795dbc58dc616ead697", + "vout": 0, + "address": "RFUL6arBgucq9TUPvTaUTnpQ2DkrcxtSxx", + "scriptSig": { + "asm": "3045022100aca47515602989979b514b6211c375e4d0d9471dd8297c5238c12245ad01dd830220191105caf1b63313c6988194f5f03fd6f70d4a30edc7820add1185d35edff1bb[ALL] 02924664b536f3710a8e8abea38bb4bf71b470a653a4dceabd50df08d7b2a38436", + "hex": "483045022100aca47515602989979b514b6211c375e4d0d9471dd8297c5238c12245ad01dd830220191105caf1b63313c6988194f5f03fd6f70d4a30edc7820add1185d35edff1bb012102924664b536f3710a8e8abea38bb4bf71b470a653a4dceabd50df08d7b2a38436" + }, + "sequence": 4294967295 + } + ], + "vout": [ + { + "value": 0.0001, + "interest": 0.0, + "valueSat": 10000, + "n": 0, + "scriptPubKey": { + "asm": "OP_DUP OP_HASH160 1b355cb6b76cab1b16cb873db8828fe5d2521ae4 OP_EQUALVERIFY OP_CHECKSIG", + "hex": "76a9141b355cb6b76cab1b16cb873db8828fe5d2521ae488ac", + "reqSigs": 1, + "type": "pubkeyhash", + "addresses": ["RBm4FN3JhjhbVFaGKJ8DQgtgPHKXvhFMs3"] + } + }, + { + "value": 0.1, + "interest": 0.0, + "valueSat": 10000000, + "n": 1, + "scriptPubKey": { + "asm": "OP_DUP OP_HASH160 f0d1fc29f8962ac2805a1659192d9ad26794d229 OP_EQUALVERIFY OP_CHECKSIG", + "hex": "76a914f0d1fc29f8962ac2805a1659192d9ad26794d22988ac", + "reqSigs": 1, + "type": "pubkeyhash", + "addresses": ["RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp"] + } + }, + { + "value": 0.16435, + "interest": 0.0, + "valueSat": 16435000, + "n": 2, + "scriptPubKey": { + "asm": "OP_DUP OP_HASH160 82804b943dd6a2008af73f8ba40449c062f09351 OP_EQUALVERIFY OP_CHECKSIG", + "hex": "76a91482804b943dd6a2008af73f8ba40449c062f0935188ac", + "reqSigs": 1, + "type": "pubkeyhash", + "addresses": ["RMBDcZbvjhfureuAaobJmKJLSApAVbBx6g"] + } + } + ], + "vjoinsplit": [], + "blockhash": "00000006396dff8e9eb78217f17dbf83711d9066a91f25917cc504c76a83a85f", + "height": 1116196, + "confirmations": 1, + "rawconfirmations": 1, + "time": 1543366322, + "blocktime": 1543366322 + } + ``` + + +Command: + +```bash +./komodo-cli gettxoutproof '["907812ee8d2762b589f6ca88ee8ba18a65ebf5c7486c472df7395628d22d0d98"]' +``` + + + ```bash + 04000000380b8fd2b9bdf570358980a4c9fc94e418ac656913999b5f9a016ec5afc46b0b188320f231637a0ded0b0bdada1f34c81ad5873b8c3f096b2014018af13f43980000000000000000000000000000000000000000000000000000000000000000b2e6fd5ba786061d57fff87a00000000000046430000000000000200000000000000000000000000fd40050035435dd2c1df5c20cb48e0617b6cee81f5349f0735b36fe93f17f82d678ad3eb374d0e398b049fddcb21a4d7ddf7345867c6a363eddcfe61f31d49dbc35652794c60da61bd5f164fd554f17b5bd669f636744412822af2ebd0f318dacb71514720164c59c392ef2b1ccc3a5dc5c9c83cd37a11f98b97c8f5170a357a972ec3cacbeb0dab34b757354883b46a598f2b93fcd735b4163db6b2b037f7d7d71a773e909ac4ce3f1228012d5bebfd9edad9842ae8c6cddf6942c543594b85013591a604c4223a3d2e007ed25f5994e9d8f6b6a704daf57cad41aea9609923612eee2fc55ad075c91c23a8cc46af9a45a7390c537d2e2302994239ae44230537ceaa2188e7f4eb6a0ab55471d152b9177e9fd90843504f29d3e92fd3d7142caae018b51318ec6b86083b7e2d155ce868f6b673b13cf1ed59107d15c6c84201441dde14074930f4755ec64975f354a99bd957021c073768f575dde3ab020dd73b488e2d03d57bc414a16d45b3e2052b24fb2360ec5f73524525fc59d2151b89310b19764541b801ad72171085bc6275832222484b8d7ee6ed91ab6a544c45af5c4d8445b0624f04a234aec6997eecf007f0e971eea33b21e45ba8f72825fa84605cdfa929aeb6dc425f2612000e7ce2ba04ff8c53061154eb38cba7f6d0bfe5dab031dadea2095e01e93f9e063d0b42e412f865572625f77aa8b10b58f7b0428ea0ff530ea10d37150496bb181e37fc5814ad524ce4618955e9158b6aebb956b02b961f920ee48eb5a08efc39d27fc2fd4ec175e38798bcca7331a7b5da2ca6c56fcb98e740c2f471eac6b67ced78125c5fcecd4f76eac1d76233aa58ed808e398b9e2b1eaa74e773d18276b732239403ce0c452cb26f0f34156a0a63e007ccfbd76f168fb941fbd2fbe23b57e519835c804ace6e22e281b3d0adda7c4b93a87d94500103315c780fe91ee67320a422eecb4a6daedc2d774567bfebc1d5b72fa693178f3443aa1eb47f18d6931f7b0fc6ec151caad4eae5f787c2a963c3963ffc924ba66a7ea1754763faf2884de0c86a0f75fe7f8dfb1265b449184668cb7348520810cf731663f5180ac31642d6b135d5ce7de88ba63d6db3d6c5dfa19492281dfed3b3765451717f3497ac2b4c040e2e4e77219b2586c227cd138b8d94ccc273fbfbb51a35523870c503e2d8527b840ced11917075e8a41ae9616f1df8d41df5bae39c6d6de5bb8d43d401bb9089723db59f0f06aa4fdf4145a905812ef799eb574abb9985de878a289e5f4b1256ca2121d553465f44065580cb5bde170459d1c22e8d388cbec9e37dc3cca07e489a9859942a9ccef4a5e45eed7228b94c86d10a233b5a1ddfcb1735cb9b16de6e8f49f3c841796acba31a8e9c90b531952ed03bd72e0b00fa3373ea4bc845d7469afae305639c772285a5223bf2d86a12c92312dc19db86400c6760b9e75af40ce4c16278bba8a804d5a69b88290dd4c2b43423bee9eb97c54261f956a32d80fdd3f421d1199ee45d42ad657e928be2e9fa54d844cff60b06bc525ce54daca9689e0616bfdbdbc36e09bea11a276d25d3ca9a80ed7109183784dfd1d23b7c791a7913a633e2d28948c655e68ade706654e38f717fe29119af4282430c8d1f702a52ea189f1e9e6faafb213205a195dab1c2d01dc6a3711f671ea118e8a3c995632903c58ebbd4eae5dbc4555b24c1649e89e03efb92134b9e24fb9fc649462f928d992fa33d45edcb4ef13f0d5c2cb6663e7dbf2414b5ed617e56b8715ace6910807e4a901ba603dab4092f9eeb46566ec3f38f3a1789c60822530c390d19b1d939217b7a691abb91454fce76cccf3557ddb3fc55bd4f44761aa9363db0f38360adf60e743ba3b902788bb254637f6074df62460400000003a973b7134b7fcbcb1fe70fdfaaf056c209a9f5dd77800eb37b065ca8317cbb3a980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890445df562c183ed7279f2f8e37ba249447439884d5b7030eac6485112eb07ea2d010b + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysdeposit 897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d 1116196 KMD 907812ee8d2762b589f6ca88ee8ba18a65ebf5c7486c472df7395628d22d0d98 0 010000000197d6ea16c68dc5db95b72e029a0e23cb403ae0a33b561b863963cfd9cbfec747000000006b483045022100aca47515602989979b514b6211c375e4d0d9471dd8297c5238c12245ad01dd830220191105caf1b63313c6988194f5f03fd6f70d4a30edc7820add1185d35edff1bb012102924664b536f3710a8e8abea38bb4bf71b470a653a4dceabd50df08d7b2a38436ffffffff0310270000000000001976a9141b355cb6b76cab1b16cb873db8828fe5d2521ae488ac80969800000000001976a914f0d1fc29f8962ac2805a1659192d9ad26794d22988ac38c7fa00000000001976a91482804b943dd6a2008af73f8ba40449c062f0935188ac50e6fd5b 04000000380b8fd2b9bdf570358980a4c9fc94e418ac656913999b5f9a016ec5afc46b0b188320f231637a0ded0b0bdada1f34c81ad5873b8c3f096b2014018af13f43980000000000000000000000000000000000000000000000000000000000000000b2e6fd5ba786061d57fff87a00000000000046430000000000000200000000000000000000000000fd40050035435dd2c1df5c20cb48e0617b6cee81f5349f0735b36fe93f17f82d678ad3eb374d0e398b049fddcb21a4d7ddf7345867c6a363eddcfe61f31d49dbc35652794c60da61bd5f164fd554f17b5bd669f636744412822af2ebd0f318dacb71514720164c59c392ef2b1ccc3a5dc5c9c83cd37a11f98b97c8f5170a357a972ec3cacbeb0dab34b757354883b46a598f2b93fcd735b4163db6b2b037f7d7d71a773e909ac4ce3f1228012d5bebfd9edad9842ae8c6cddf6942c543594b85013591a604c4223a3d2e007ed25f5994e9d8f6b6a704daf57cad41aea9609923612eee2fc55ad075c91c23a8cc46af9a45a7390c537d2e2302994239ae44230537ceaa2188e7f4eb6a0ab55471d152b9177e9fd90843504f29d3e92fd3d7142caae018b51318ec6b86083b7e2d155ce868f6b673b13cf1ed59107d15c6c84201441dde14074930f4755ec64975f354a99bd957021c073768f575dde3ab020dd73b488e2d03d57bc414a16d45b3e2052b24fb2360ec5f73524525fc59d2151b89310b19764541b801ad72171085bc6275832222484b8d7ee6ed91ab6a544c45af5c4d8445b0624f04a234aec6997eecf007f0e971eea33b21e45ba8f72825fa84605cdfa929aeb6dc425f2612000e7ce2ba04ff8c53061154eb38cba7f6d0bfe5dab031dadea2095e01e93f9e063d0b42e412f865572625f77aa8b10b58f7b0428ea0ff530ea10d37150496bb181e37fc5814ad524ce4618955e9158b6aebb956b02b961f920ee48eb5a08efc39d27fc2fd4ec175e38798bcca7331a7b5da2ca6c56fcb98e740c2f471eac6b67ced78125c5fcecd4f76eac1d76233aa58ed808e398b9e2b1eaa74e773d18276b732239403ce0c452cb26f0f34156a0a63e007ccfbd76f168fb941fbd2fbe23b57e519835c804ace6e22e281b3d0adda7c4b93a87d94500103315c780fe91ee67320a422eecb4a6daedc2d774567bfebc1d5b72fa693178f3443aa1eb47f18d6931f7b0fc6ec151caad4eae5f787c2a963c3963ffc924ba66a7ea1754763faf2884de0c86a0f75fe7f8dfb1265b449184668cb7348520810cf731663f5180ac31642d6b135d5ce7de88ba63d6db3d6c5dfa19492281dfed3b3765451717f3497ac2b4c040e2e4e77219b2586c227cd138b8d94ccc273fbfbb51a35523870c503e2d8527b840ced11917075e8a41ae9616f1df8d41df5bae39c6d6de5bb8d43d401bb9089723db59f0f06aa4fdf4145a905812ef799eb574abb9985de878a289e5f4b1256ca2121d553465f44065580cb5bde170459d1c22e8d388cbec9e37dc3cca07e489a9859942a9ccef4a5e45eed7228b94c86d10a233b5a1ddfcb1735cb9b16de6e8f49f3c841796acba31a8e9c90b531952ed03bd72e0b00fa3373ea4bc845d7469afae305639c772285a5223bf2d86a12c92312dc19db86400c6760b9e75af40ce4c16278bba8a804d5a69b88290dd4c2b43423bee9eb97c54261f956a32d80fdd3f421d1199ee45d42ad657e928be2e9fa54d844cff60b06bc525ce54daca9689e0616bfdbdbc36e09bea11a276d25d3ca9a80ed7109183784dfd1d23b7c791a7913a633e2d28948c655e68ade706654e38f717fe29119af4282430c8d1f702a52ea189f1e9e6faafb213205a195dab1c2d01dc6a3711f671ea118e8a3c995632903c58ebbd4eae5dbc4555b24c1649e89e03efb92134b9e24fb9fc649462f928d992fa33d45edcb4ef13f0d5c2cb6663e7dbf2414b5ed617e56b8715ace6910807e4a901ba603dab4092f9eeb46566ec3f38f3a1789c60822530c390d19b1d939217b7a691abb91454fce76cccf3557ddb3fc55bd4f44761aa9363db0f38360adf60e743ba3b902788bb254637f6074df62460400000003a973b7134b7fcbcb1fe70fdfaaf056c209a9f5dd77800eb37b065ca8317cbb3a980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890445df562c183ed7279f2f8e37ba249447439884d5b7030eac6485112eb07ea2d010b 02d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d 0.1 +``` + + + ```json + { + "result": "success", + "hex": "01000000010db4b1686d1f27de5e2a11c793dfd30f09b296754f95ae8649858cca97d5b07a0000000049483045022100ad6bc26f0c66b89f5d63aff251c78965a50201f909a997b8ed6469da0334aa0c0220136d71f5ad1f4496785df81864f9be3ae7b8dd012dae08d59fd544869eacb3ba01ffffffff041027000000000000302ea22c80205fd998129698de9cf1455f4f4795794c9e57bf1fd5f28598b5e6c0322de5d0358103120c008203000401cc1027000000000000232102980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890acd02a724e18090000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000fd04096a4d0009f144034b4d440d8d1f63bf680d6191b100d90992b0f6bf6ce1cc851f259da8b49e74524e7a890121024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0012fea85ecfda42975a2aaed72e946792df41a486033af8dc45ab1e4ddcb34b1b424081100980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee12789000000000fd080230313030303030303031393764366561313663363864633564623935623732653032396130653233636234303361653061333362353631623836333936336366643963626665633734373030303030303030366234383330343530323231303061636134373531353630323938393937396235313462363231316333373565346430643934373164643832393763353233386331323234356164303164643833303232303139313130356361663162363333313363363938383139346635663033666436663730643461333065646337383230616464313138356433356564666631626230313231303239323436363462353336663337313061386538616265613338626234626637316234373061363533613464636561626435306466303864376232613338343336666666666666666630333130323730303030303030303030303031393736613931343162333535636236623736636162316231366362383733646238383238666535643235323161653438386163383039363938303030303030303030303139373661393134663064316663323966383936326163323830356131363539313932643961643236373934643232393838616333386337666130303030303030303030313937366139313438323830346239343364643661323030386166373366386261343034343963303632663039333531383861633530653666643562fd360604000000380b8fd2b9bdf570358980a4c9fc94e418ac656913999b5f9a016ec5afc46b0b188320f231637a0ded0b0bdada1f34c81ad5873b8c3f096b2014018af13f43980000000000000000000000000000000000000000000000000000000000000000b2e6fd5ba786061d57fff87a00000000000046430000000000000200000000000000000000000000fd40050035435dd2c1df5c20cb48e0617b6cee81f5349f0735b36fe93f17f82d678ad3eb374d0e398b049fddcb21a4d7ddf7345867c6a363eddcfe61f31d49dbc35652794c60da61bd5f164fd554f17b5bd669f636744412822af2ebd0f318dacb71514720164c59c392ef2b1ccc3a5dc5c9c83cd37a11f98b97c8f5170a357a972ec3cacbeb0dab34b757354883b46a598f2b93fcd735b4163db6b2b037f7d7d71a773e909ac4ce3f1228012d5bebfd9edad9842ae8c6cddf6942c543594b85013591a604c4223a3d2e007ed25f5994e9d8f6b6a704daf57cad41aea9609923612eee2fc55ad075c91c23a8cc46af9a45a7390c537d2e2302994239ae44230537ceaa2188e7f4eb6a0ab55471d152b9177e9fd90843504f29d3e92fd3d7142caae018b51318ec6b86083b7e2d155ce868f6b673b13cf1ed59107d15c6c84201441dde14074930f4755ec64975f354a99bd957021c073768f575dde3ab020dd73b488e2d03d57bc414a16d45b3e2052b24fb2360ec5f73524525fc59d2151b89310b19764541b801ad72171085bc6275832222484b8d7ee6ed91ab6a544c45af5c4d8445b0624f04a234aec6997eecf007f0e971eea33b21e45ba8f72825fa84605cdfa929aeb6dc425f2612000e7ce2ba04ff8c53061154eb38cba7f6d0bfe5dab031dadea2095e01e93f9e063d0b42e412f865572625f77aa8b10b58f7b0428ea0ff530ea10d37150496bb181e37fc5814ad524ce4618955e9158b6aebb956b02b961f920ee48eb5a08efc39d27fc2fd4ec175e38798bcca7331a7b5da2ca6c56fcb98e740c2f471eac6b67ced78125c5fcecd4f76eac1d76233aa58ed808e398b9e2b1eaa74e773d18276b732239403ce0c452cb26f0f34156a0a63e007ccfbd76f168fb941fbd2fbe23b57e519835c804ace6e22e281b3d0adda7c4b93a87d94500103315c780fe91ee67320a422eecb4a6daedc2d774567bfebc1d5b72fa693178f3443aa1eb47f18d6931f7b0fc6ec151caad4eae5f787c2a963c3963ffc924ba66a7ea1754763faf2884de0c86a0f75fe7f8dfb1265b449184668cb7348520810cf731663f5180ac31642d6b135d5ce7de88ba63d6db3d6c5dfa19492281dfed3b3765451717f3497ac2b4c040e2e4e77219b2586c227cd138b8d94ccc273fbfbb51a35523870c503e2d8527b840ced11917075e8a41ae9616f1df8d41df5bae39c6d6de5bb8d43d401bb9089723db59f0f06aa4fdf4145a905812ef799eb574abb9985de878a289e5f4b1256ca2121d553465f44065580cb5bde170459d1c22e8d388cbec9e37dc3cca07e489a9859942a9ccef4a5e45eed7228b94c86d10a233b5a1ddfcb1735cb9b16de6e8f49f3c841796acba31a8e9c90b531952ed03bd72e0b00fa3373ea4bc845d7469afae305639c772285a5223bf2d86a12c92312dc19db86400c6760b9e75af40ce4c16278bba8a804d5a69b88290dd4c2b43423bee9eb97c54261f956a32d80fdd3f421d1199ee45d42ad657e928be2e9fa54d844cff60b06bc525ce54daca9689e0616bfdbdbc36e09bea11a276d25d3ca9a80ed7109183784dfd1d23b7c791a7913a633e2d28948c655e68ade706654e38f717fe29119af4282430c8d1f702a52ea189f1e9e6faafb213205a195dab1c2d01dc6a3711f671ea118e8a3c995632903c58ebbd4eae5dbc4555b24c1649e89e03efb92134b9e24fb9fc649462f928d992fa33d45edcb4ef13f0d5c2cb6663e7dbf2414b5ed617e56b8715ace6910807e4a901ba603dab4092f9eeb46566ec3f38f3a1789c60822530c390d19b1d939217b7a691abb91454fce76cccf3557ddb3fc55bd4f44761aa9363db0f38360adf60e743ba3b902788bb254637f6074df62460400000003a973b7134b7fcbcb1fe70fdfaaf056c209a9f5dd77800eb37b065ca8317cbb3a980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890445df562c183ed7279f2f8e37ba249447439884d5b7030eac6485112eb07ea2d010b2102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d809698000000000000000000" + } + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000010db4b1686d1f27de5e2a11c793dfd30f09b296754f95ae8649858cca97d5b07a0000000049483045022100ad6bc26f0c66b89f5d63aff251c78965a50201f909a997b8ed6469da0334aa0c0220136d71f5ad1f4496785df81864f9be3ae7b8dd012dae08d59fd544869eacb3ba01ffffffff041027000000000000302ea22c80205fd998129698de9cf1455f4f4795794c9e57bf1fd5f28598b5e6c0322de5d0358103120c008203000401cc1027000000000000232102980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890acd02a724e18090000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000fd04096a4d0009f144034b4d440d8d1f63bf680d6191b100d90992b0f6bf6ce1cc851f259da8b49e74524e7a890121024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0012fea85ecfda42975a2aaed72e946792df41a486033af8dc45ab1e4ddcb34b1b424081100980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee12789000000000fd080230313030303030303031393764366561313663363864633564623935623732653032396130653233636234303361653061333362353631623836333936336366643963626665633734373030303030303030366234383330343530323231303061636134373531353630323938393937396235313462363231316333373565346430643934373164643832393763353233386331323234356164303164643833303232303139313130356361663162363333313363363938383139346635663033666436663730643461333065646337383230616464313138356433356564666631626230313231303239323436363462353336663337313061386538616265613338626234626637316234373061363533613464636561626435306466303864376232613338343336666666666666666630333130323730303030303030303030303031393736613931343162333535636236623736636162316231366362383733646238383238666535643235323161653438386163383039363938303030303030303030303139373661393134663064316663323966383936326163323830356131363539313932643961643236373934643232393838616333386337666130303030303030303030313937366139313438323830346239343364643661323030386166373366386261343034343963303632663039333531383861633530653666643562fd360604000000380b8fd2b9bdf570358980a4c9fc94e418ac656913999b5f9a016ec5afc46b0b188320f231637a0ded0b0bdada1f34c81ad5873b8c3f096b2014018af13f43980000000000000000000000000000000000000000000000000000000000000000b2e6fd5ba786061d57fff87a00000000000046430000000000000200000000000000000000000000fd40050035435dd2c1df5c20cb48e0617b6cee81f5349f0735b36fe93f17f82d678ad3eb374d0e398b049fddcb21a4d7ddf7345867c6a363eddcfe61f31d49dbc35652794c60da61bd5f164fd554f17b5bd669f636744412822af2ebd0f318dacb71514720164c59c392ef2b1ccc3a5dc5c9c83cd37a11f98b97c8f5170a357a972ec3cacbeb0dab34b757354883b46a598f2b93fcd735b4163db6b2b037f7d7d71a773e909ac4ce3f1228012d5bebfd9edad9842ae8c6cddf6942c543594b85013591a604c4223a3d2e007ed25f5994e9d8f6b6a704daf57cad41aea9609923612eee2fc55ad075c91c23a8cc46af9a45a7390c537d2e2302994239ae44230537ceaa2188e7f4eb6a0ab55471d152b9177e9fd90843504f29d3e92fd3d7142caae018b51318ec6b86083b7e2d155ce868f6b673b13cf1ed59107d15c6c84201441dde14074930f4755ec64975f354a99bd957021c073768f575dde3ab020dd73b488e2d03d57bc414a16d45b3e2052b24fb2360ec5f73524525fc59d2151b89310b19764541b801ad72171085bc6275832222484b8d7ee6ed91ab6a544c45af5c4d8445b0624f04a234aec6997eecf007f0e971eea33b21e45ba8f72825fa84605cdfa929aeb6dc425f2612000e7ce2ba04ff8c53061154eb38cba7f6d0bfe5dab031dadea2095e01e93f9e063d0b42e412f865572625f77aa8b10b58f7b0428ea0ff530ea10d37150496bb181e37fc5814ad524ce4618955e9158b6aebb956b02b961f920ee48eb5a08efc39d27fc2fd4ec175e38798bcca7331a7b5da2ca6c56fcb98e740c2f471eac6b67ced78125c5fcecd4f76eac1d76233aa58ed808e398b9e2b1eaa74e773d18276b732239403ce0c452cb26f0f34156a0a63e007ccfbd76f168fb941fbd2fbe23b57e519835c804ace6e22e281b3d0adda7c4b93a87d94500103315c780fe91ee67320a422eecb4a6daedc2d774567bfebc1d5b72fa693178f3443aa1eb47f18d6931f7b0fc6ec151caad4eae5f787c2a963c3963ffc924ba66a7ea1754763faf2884de0c86a0f75fe7f8dfb1265b449184668cb7348520810cf731663f5180ac31642d6b135d5ce7de88ba63d6db3d6c5dfa19492281dfed3b3765451717f3497ac2b4c040e2e4e77219b2586c227cd138b8d94ccc273fbfbb51a35523870c503e2d8527b840ced11917075e8a41ae9616f1df8d41df5bae39c6d6de5bb8d43d401bb9089723db59f0f06aa4fdf4145a905812ef799eb574abb9985de878a289e5f4b1256ca2121d553465f44065580cb5bde170459d1c22e8d388cbec9e37dc3cca07e489a9859942a9ccef4a5e45eed7228b94c86d10a233b5a1ddfcb1735cb9b16de6e8f49f3c841796acba31a8e9c90b531952ed03bd72e0b00fa3373ea4bc845d7469afae305639c772285a5223bf2d86a12c92312dc19db86400c6760b9e75af40ce4c16278bba8a804d5a69b88290dd4c2b43423bee9eb97c54261f956a32d80fdd3f421d1199ee45d42ad657e928be2e9fa54d844cff60b06bc525ce54daca9689e0616bfdbdbc36e09bea11a276d25d3ca9a80ed7109183784dfd1d23b7c791a7913a633e2d28948c655e68ade706654e38f717fe29119af4282430c8d1f702a52ea189f1e9e6faafb213205a195dab1c2d01dc6a3711f671ea118e8a3c995632903c58ebbd4eae5dbc4555b24c1649e89e03efb92134b9e24fb9fc649462f928d992fa33d45edcb4ef13f0d5c2cb6663e7dbf2414b5ed617e56b8715ace6910807e4a901ba603dab4092f9eeb46566ec3f38f3a1789c60822530c390d19b1d939217b7a691abb91454fce76cccf3557ddb3fc55bd4f44761aa9363db0f38360adf60e743ba3b902788bb254637f6074df62460400000003a973b7134b7fcbcb1fe70fdfaaf056c209a9f5dd77800eb37b065ca8317cbb3a980d2dd2285639f72d476c48c7f5eb658aa18bee88caf689b562278dee127890445df562c183ed7279f2f8e37ba249447439884d5b7030eac6485112eb07ea2d010b2102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d809698000000000000000000 +``` + + + ```bash + 07d79e39354cc38a76dfe2ca8a5fb711432192237608ea066621662f13e0c08e + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysclaim 897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d KMD 07d79e39354cc38a76dfe2ca8a5fb711432192237608ea066621662f13e0c08e 02d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d 0.1 +``` + + + ```json + { + "result": "success", + "hex": "01000000030a9a982a898012f4cc982796f381f16c9e2e5fe28e0be58ad59c7c90409530f8020000004847304402207959e4befae9e917cde7d6ba6f5e62e4cf679858b1a5c8b1eb270b1c7eac7c7e0220503ea9a24245db21b4db8ae68e48da6c5d33ef436371c6d03872d45d1364047c01ffffffffc6fc3b75a37a6ed10507a1bb73f2c5d5c8f75bcb358b0aa4bab3b80b5aa39f19010000007b4c79a276a072a26ba067a565802103ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb408140d4c46b8282d42d7e7ebe99361264c21b9ee221b7b3a47e1549e06bf06659fa194298618a2969a421543753a5994ebc3944e93ac6072a233ab617b229b3922a52a100af038001f1a10001ffffffff8ec0e0132f66216606ea08762392214311b75f8acae2df768ac34c35399ed707000000007b4c79a276a072a26ba067a565802102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d8140f3938953c9087e1e25c31263c5a717dd59d2f7d6f0815cfd7c0cb01a6c4d586b630b11cca1e60a19036d937095941660e488a07494fc721471d4a53f5eb89a25a100af038001f1a10001ffffffff048096980000000000302ea22c8020abd72b18452f1bc72f4312dbb1cd341b7c7f38a994ddacd8b35412231f01cb088103120c008203000401cc804a5d0500000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cc1027000000000000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000936a4c90e374bff603b64f309e344e34b10fd2053db59788909914f8488a7f73ddddc2165d31034b4d440d8d1f63bf680d6191b100d90992b0f6bf6ce1cc851f259da8b49e74524e7a898ec0e0132f66216606ea08762392214311b75f8acae2df768ac34c35399ed7072102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d809698000000000000000000" + } + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000030a9a982a898012f4cc982796f381f16c9e2e5fe28e0be58ad59c7c90409530f8020000004847304402207959e4befae9e917cde7d6ba6f5e62e4cf679858b1a5c8b1eb270b1c7eac7c7e0220503ea9a24245db21b4db8ae68e48da6c5d33ef436371c6d03872d45d1364047c01ffffffffc6fc3b75a37a6ed10507a1bb73f2c5d5c8f75bcb358b0aa4bab3b80b5aa39f19010000007b4c79a276a072a26ba067a565802103ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb408140d4c46b8282d42d7e7ebe99361264c21b9ee221b7b3a47e1549e06bf06659fa194298618a2969a421543753a5994ebc3944e93ac6072a233ab617b229b3922a52a100af038001f1a10001ffffffff8ec0e0132f66216606ea08762392214311b75f8acae2df768ac34c35399ed707000000007b4c79a276a072a26ba067a565802102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d8140f3938953c9087e1e25c31263c5a717dd59d2f7d6f0815cfd7c0cb01a6c4d586b630b11cca1e60a19036d937095941660e488a07494fc721471d4a53f5eb89a25a100af038001f1a10001ffffffff048096980000000000302ea22c8020abd72b18452f1bc72f4312dbb1cd341b7c7f38a994ddacd8b35412231f01cb088103120c008203000401cc804a5d0500000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cc1027000000000000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000936a4c90e374bff603b64f309e344e34b10fd2053db59788909914f8488a7f73ddddc2165d31034b4d440d8d1f63bf680d6191b100d90992b0f6bf6ce1cc851f259da8b49e74524e7a898ec0e0132f66216606ea08762392214311b75f8acae2df768ac34c35399ed7072102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d809698000000000000000000 +``` + + + ```bash + 9bf287d544c6f5597ccf67641398718398cd79fde02caa32a4b338b5a923cb61 + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD tokenbalance 315d16c2dddd737f8a48f81499908897b53d05d20fb1344e349e304fb603f6bf +``` + + + ```json + { + "result": "success", + "CCaddress": "RTjscp9uKYQ8bT3jmShC8mEbuz3qwtGWor", + "tokenid": "315d16c2dddd737f8a48f81499908897b53d05d20fb1344e349e304fb603f6bf", + "balance": 10000000 + } + ``` + + +#### User Withdraws Funds + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewayswithdraw 897a4e52749eb4a89d251f85cce16cbff6b09209d900b191610d68bf631f8d0d KMD 0271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328 0.1 +``` + + + ```json + { + "result": "success", + "hex": "01000000020e2778e5c0917b00a995ffd0e027ac896492b70b2004ca0096d5309bc1d695ce0000000048473044022072bd3e74c1fb6a56111fc34caab1d605cedfbcb0a9dcd1a4c8d0dae9db61d43902205ccea739077b3374559353af3392e637b7c462ca699f9b9dba786b5398491b4201ffffffff8425c1bf730444ceac45a47376164d66a156e6c2a48116ec14cd17a88f8ab8e5010000007b4c79a276a072a26ba067a565802102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d814051e39b89bace8226f3ca1779b754f2b57ee480e9636b16322bb36a89ec22de967ea66cdc906debb5f6b7c26a51ac2d089966aeb92d07aacc43507b1555c02313a100af038001f1a10001ffffffff058096980000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cc102700000000000023210271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328ac1027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401ccd02a724e18090000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000536a4c50f157bff603b64f309e344e34b10fd2053db59788909914f8488a7f73ddddc2165d31034b4d44210271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328809698000000000000000000" + } + ``` + + +Command: + +```bash +./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000020e2778e5c0917b00a995ffd0e027ac896492b70b2004ca0096d5309bc1d695ce0000000048473044022072bd3e74c1fb6a56111fc34caab1d605cedfbcb0a9dcd1a4c8d0dae9db61d43902205ccea739077b3374559353af3392e637b7c462ca699f9b9dba786b5398491b4201ffffffff8425c1bf730444ceac45a47376164d66a156e6c2a48116ec14cd17a88f8ab8e5010000007b4c79a276a072a26ba067a565802102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9d814051e39b89bace8226f3ca1779b754f2b57ee480e9636b16322bb36a89ec22de967ea66cdc906debb5f6b7c26a51ac2d089966aeb92d07aacc43507b1555c02313a100af038001f1a10001ffffffff058096980000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cc102700000000000023210271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328ac1027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401ccd02a724e18090000232102d389e879ca68809794c0ef29869b23b4dd8e22122fcc4e8b69adb1d33752dd9dac0000000000000000536a4c50f157bff603b64f309e344e34b10fd2053db59788909914f8488a7f73ddddc2165d31034b4d44210271bc6b553f5f763ca7f64457710f8a0b3f5273b2941edc5091ca41cec39b7328809698000000000000000000 +``` + + + ```bash + 79d41ffefa359a7ae2f62adf728a3ec3f3d2653889780ed9776bf9b74fe9a6fe + ``` + +export const title = "Antara Tutorials" +export const description = "This section contains various tutorials about Antara development and setup for Smart Chains" + +# Antara Tutorials + +This section of the documentation contains various tutorials about Antara development and setup for Smart Chains +export const title = "Antara Tutorials"; +export const description = "This section contains tutorials that are specifically designed for the aspects of Komodo Smart Chain software that deal with the Antara framework."; + +# Introduction to Antara Tutorials + +Welcome to the Antara tutorial documentation. + +This section contains tutorials that are specifically designed for the aspects of Komodo Smart Chain software that deal with the Antara framework. + +The Antara framework encompasses many of the enhancements and innovations that Komodo adds to upstream technologies. Aspects of Antara include the Antara Customizations for a Smart Chain and Antara Modules, which allow for advanced blockchain functionality. + +For tutorials regarding other Komodo software, such as AtomicDEX, which offers cross-chain atomic-swap compatibility, please see the respective documentation centers. + +For a targeted learning approach to Komodo's Smart Chain software, please see the Learning Launchpad. + +[Link to Learning Launchpad](/start-here/learning-launchpad/) +export const title = "Musig Tutorial"; +export const description = "This tutorial explains how to use the Musig antara module."; + +# Musig Module Tutorial + +## Installation + +MuSig is currently only available on MacOS and Linux operating systems. + +Please check with the Komodo team on [Discord](https://komodoplatform.com/discord) for information regarding Windows functionality. + +### Install Dependencies + +Ensure that local repositories are up to date: + +```bash +sudo apt-get update && sudo apt-get upgrade -y +``` + +Install Dependencies: + +```bash +sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libgtest-dev libqt4-dev libqrencode-dev libdb++-dev ntp ntpdate software-properties-common curl libcurl4-gnutls-dev cmake clang libsodium-dev -y +``` + +### Build instructions + +Build `komodod` by executing the following series of commands. Each line should be executed separately: + +```bash +git clone https://github.com/jl777/komodo +cd komodo +git checkout jl777 +./zcutil/fetch-params.sh +./zcutil/build.sh -j$(nproc) +``` + +Compile the appropriate library: + +```bash +cd src/cc +./makecclib +cp sudokucc.so ../libcc.so +cd ../.. +make -j$(nproc) +``` + +### Update + +Update the `komodod` daemon by executing the following series of commands. Each line should be executed separately: + +```bash +cd komodo +git checkout jl777 +git pull +cd src/cc +./makecclib +cd ../.. +make -j$(nproc) +``` + +### Launch the Smart Chain + +Change into the `~/komodo/src` directory: + +```bash +cd ~/komodo/src +``` + +Launch the MuSig Smart Chain using the following launch parameters. + +```bash +./komodod -ac_name=MUSIG -ac_supply=100000 -ac_reward=10000000 -pubkey= -ac_cclib=sudoku -ac_cc=2 -addnode=5.9.102.210 & +``` + +### Obtain a Pubkey + +Without a pubkey, the MuSig Smart Chain will not function properly on the user's local machine. Follow these instruction for obtaining and setting a pubkey: + +* [Instructions for obtaining and setting a pubkey](/antara/tutorials/understanding-antara-addresses/#creating-and-launching-with-a-pubkey) + +Once the Smart Chain is relaunched with the new pubkey included as a launch parameter, the MuSig Smart Chain is prepared for use. + +### Acquire Funds for Testing + + + The reader should launch the Smart Chain with a pubkey whose private key is already imported to the wallet. If this is not the case, restart the Smart Chain with an appropriate pubkey, or use the [importprivkey](/smart-chains/api/wallet/#importprivkey) method to import the private key of the desired pubkey. + + +The MuSig Smart Chain has an available faucet. The faucet allows a user to obtain a nominal amount of funds for testing and orientation purposes. + +Ensure that the terminal's working directory is in the `~/komodo/src` directory: + +```bash +cd ~/komodo/src +``` + +Execute the `faucetget` method: + +```bash +./komodo-cli -ac_name=MUSIG faucetget +``` + +This method returns a hex value in the terminal. Select the entire hex value and copy it to the clipboard. (Use `CTRL + SHFT + C` to copy within the terminal) + +Broadcast the hex value using the `sendrawtransaction` method: + +```bash +./komodo-cli -ac_name=MUSIG sendrawtransaction +``` + +Wait for the transaction to be confirmed. + +Once the broadcast transaction is confirmed, check the balance using the `getbalance` method: + +```bash +./komodo-cli -ac_name=MUSIG getbalance +``` + +There should be a small amount of funds in the balance. + +## Full Example + +The aim of this example is to create a `20f2` MuSig pubkey, fund it, and spend from it. + +To accomplish this, two nodes are necessary. + +In this MuSig example we use the following pubkeys on our two nodes: + +* Node1's daemon is launched using the pubkey: `0225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270a` +* Node2's daemon is launched using the pubkey: `02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567` + +The `EVALCODE` for the MuSig module is `18`. + +For this example, we use [the normal array formatting for cclib methods](/smart-chains/api/cclib/#cclib-formatting), as we are not creating a bash script. + +Steps 1 through 5 and 11 through 12 need to be executed only on the first node. + +#### Step 1: combine + +Use the [combine](/antara/api/musig/#combine) method to create a `combined_pk` address: + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib combine 18 '["0225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270a","02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567"]' +``` + + + ```json + { + "pkhash": "8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9", + "combined_pk": "03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a", + "result": "success" + } + ``` + + +Copy the values of `pkhash` and `combined_pk` and save them in a secure location for later use. + +#### Step 2: send + +Use the [send](/antara/api/musig/#send) method to send `1` coin to the `combined_pk` address: + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib send 18 '["03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a",1]' +``` + + + ```json + { + "hex": "0400008085202f890b02b1bdd8707f82bc6f4cdeb4756eb04dfc3cc7a4b5ac38a388c0205cf8f31a0e0000000048473044022004de31b5132f03f761fc0d0d9761efbf77bb27b07ee99f2cc54928e2150f1f16022069381b36bb9839cc9cb3e1d584e00dbd52efadf7e2f3fa092e0bcca839cdce6801ffffffff04949d5bf1722c5df04f58cf2c7e662f32ab65de2f7990ce4c734df4f2991eb60000000049483045022100ab3ab2bb95ef095763dd3eeb56961d1234aa25efd91a30fa14e397717368e6a0022048d7f8268463cfb44f34467bd77eb2aee962eaec09a079741c75c5de898b4f6c01ffffffff0476a06188887bf93bec4e64a3a5681b5e271cb7055a11d0667dc565e498b6190000000048473044022022ef03c33b5942b1af16f7e4a9acd2aa485d73f6f6b5e0a01e15f70238cd85cd022063779c69511ee4eba179b40ce28d80da22d43f19110be2a9a97d0b47d6a5cca201ffffffff045587699381853735482dbfb1fe25dda8d5a7a238c05b872ecfcd97be38232f00000000484730440220051e6047dd9e82b004c29a2837bf127f94caa638c65d96c761371c18ff36170002204e73ddfbbe748f295d7a93e46d942618f291d302b7a666b78b49ab38594a89ac01ffffffff0426d8098ed0c5ee19ac8d4254ec9887ab7a231c68a8d9b024a50f417f0a94ff0000000049483045022100ebd193262a04f8c9cf1872527d2a7d4933222f8ce8ea11add90e263c483ca56a02204a29902ae6b31dc41f84b5ffad3b2076755ad19f25be47479704b2ab5e37463a01ffffffff040e294b76ca4492909b75b829566b3702b35245595e8c4806b7ef6a7f612dd6000000004847304402201573d230af50aa6d326b607ac6ba77bb15c1a143256e5141197ce6729195b0e602201301be6ad22ba5599597205cdfb7e2cf6823ce4597e5b902b6d4336958e0fbe101ffffffff03d9a453070627c94d940f57b40829713ee6b6bce4d801e591117c801221225900000000494830450221009d5eec551265274ade816fdb3a0dfee20e716a7d3f56155b698a9d0c41ccd11202202e811c4611ebf982b34db8a43002c759c54a077023ced1498421c4af2b12a0f901ffffffff03ce7cb872bdfdf264576c45ed899c00731959051cade1a19b088eabc02e07780000000049483045022100a9c8c795e34a393fafb839ef4bbf11e4adf04b4c8a8493ef0bd2353e7a1ddd430220251ff7eb5ca3d2ed4ee4145906532af803caaed756ff3d21e86ac4876333067e01ffffffff030d66186013342f71335bc67d0d87240b4a27809e67ba55e01dd72e7ae1b0af0000000049483045022100d4c82867562aa040a7695ffd53056018e0dc3a071d971b3774cdb8511b0f49aa022029b72c5af1b9c16e27d81827d478910ec3135415037cf2b3492922ff618538bc01ffffffff02f9b92abfa0324272e0ce465b856e6d9b53e3e2e0828934c8a0c8c2c10e67d5000000004847304402205df4c99c581bfe95ea95740320b16c423531663b42e25b97315d3126250c24a202206dff5da29fbb0fe21ae6ce3da7bac1e502feb8fdd7b803c0fafa6541e80ec0ff01ffffffff02bd8679e8383e6d9c4a10917b68b8918ed3f518fe2deef5b23e0012461fbf370000000049483045022100a04210427173ea0721f3cf859b99328c8e234ba39250c033aebfb37fb2c5a1d502200d5cb16ed0dccc5dfc0385a8763340cf98a162e863994069354a5fee187b8bd401ffffffff031008f60500000000302ea22c8020c71ddb3aac7f9b9e4bdacf032aaa8b8e4433c4ff9f8a43cebb9c1f5da96928a48103120c008203000401cc604898000000000023210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac0000000000000000266a2412782103d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a000000003f0800000000000000000000000000", + "txid": "09daa45cb6e17028f9568347291a993cbf29c152a527b53e9ac0925d4900c293", + "result": "success" + } + ``` + + +Copy the `hex` value to your clipboard. + +#### Step 3: Broadcast the hex Value and Retrieve the sendtxid + +Use the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method to broadcast the raw hex value: + +Command: + +```bash +./komodo-cli -ac_name=MUSIG sendrawtransaction 0400008085202f890b02b1bdd8707f82bc6f4cdeb4756eb04dfc3cc7a4b5ac38a388c0205cf8f31a0e0000000048473044022004de31b5132f03f761fc0d0d9761efbf77bb27b07ee99f2cc54928e2150f1f16022069381b36bb9839cc9cb3e1d584e00dbd52efadf7e2f3fa092e0bcca839cdce6801ffffffff04949d5bf1722c5df04f58cf2c7e662f32ab65de2f7990ce4c734df4f2991eb60000000049483045022100ab3ab2bb95ef095763dd3eeb56961d1234aa25efd91a30fa14e397717368e6a0022048d7f8268463cfb44f34467bd77eb2aee962eaec09a079741c75c5de898b4f6c01ffffffff0476a06188887bf93bec4e64a3a5681b5e271cb7055a11d0667dc565e498b6190000000048473044022022ef03c33b5942b1af16f7e4a9acd2aa485d73f6f6b5e0a01e15f70238cd85cd022063779c69511ee4eba179b40ce28d80da22d43f19110be2a9a97d0b47d6a5cca201ffffffff045587699381853735482dbfb1fe25dda8d5a7a238c05b872ecfcd97be38232f00000000484730440220051e6047dd9e82b004c29a2837bf127f94caa638c65d96c761371c18ff36170002204e73ddfbbe748f295d7a93e46d942618f291d302b7a666b78b49ab38594a89ac01ffffffff0426d8098ed0c5ee19ac8d4254ec9887ab7a231c68a8d9b024a50f417f0a94ff0000000049483045022100ebd193262a04f8c9cf1872527d2a7d4933222f8ce8ea11add90e263c483ca56a02204a29902ae6b31dc41f84b5ffad3b2076755ad19f25be47479704b2ab5e37463a01ffffffff040e294b76ca4492909b75b829566b3702b35245595e8c4806b7ef6a7f612dd6000000004847304402201573d230af50aa6d326b607ac6ba77bb15c1a143256e5141197ce6729195b0e602201301be6ad22ba5599597205cdfb7e2cf6823ce4597e5b902b6d4336958e0fbe101ffffffff03d9a453070627c94d940f57b40829713ee6b6bce4d801e591117c801221225900000000494830450221009d5eec551265274ade816fdb3a0dfee20e716a7d3f56155b698a9d0c41ccd11202202e811c4611ebf982b34db8a43002c759c54a077023ced1498421c4af2b12a0f901ffffffff03ce7cb872bdfdf264576c45ed899c00731959051cade1a19b088eabc02e07780000000049483045022100a9c8c795e34a393fafb839ef4bbf11e4adf04b4c8a8493ef0bd2353e7a1ddd430220251ff7eb5ca3d2ed4ee4145906532af803caaed756ff3d21e86ac4876333067e01ffffffff030d66186013342f71335bc67d0d87240b4a27809e67ba55e01dd72e7ae1b0af0000000049483045022100d4c82867562aa040a7695ffd53056018e0dc3a071d971b3774cdb8511b0f49aa022029b72c5af1b9c16e27d81827d478910ec3135415037cf2b3492922ff618538bc01ffffffff02f9b92abfa0324272e0ce465b856e6d9b53e3e2e0828934c8a0c8c2c10e67d5000000004847304402205df4c99c581bfe95ea95740320b16c423531663b42e25b97315d3126250c24a202206dff5da29fbb0fe21ae6ce3da7bac1e502feb8fdd7b803c0fafa6541e80ec0ff01ffffffff02bd8679e8383e6d9c4a10917b68b8918ed3f518fe2deef5b23e0012461fbf370000000049483045022100a04210427173ea0721f3cf859b99328c8e234ba39250c033aebfb37fb2c5a1d502200d5cb16ed0dccc5dfc0385a8763340cf98a162e863994069354a5fee187b8bd401ffffffff031008f60500000000302ea22c8020c71ddb3aac7f9b9e4bdacf032aaa8b8e4433c4ff9f8a43cebb9c1f5da96928a48103120c008203000401cc604898000000000023210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac0000000000000000266a2412782103d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a000000003f0800000000000000000000000000 +``` + + + ```bash + 09daa45cb6e17028f9568347291a993cbf29c152a527b53e9ac0925d4900c293 + ``` + + +The returned value is our `sendtxid`. Copy this to a secure location for later use. + +#### Step 4: Obtain the change\_script Value + +Use the [getrawtransaction](/smart-chains/api/rawtransactions/#getrawtransaction) method to decode the raw transaction. + +Command: + +```bash +./komodo-cli -ac_name=MUSIG getrawtransaction 09daa45cb6e17028f9568347291a993cbf29c152a527b53e9ac0925d4900c293 1 +``` + +In the response there are a series of `vout` values, each of which has an array of json objects. Search for the `vout` value that has the `"type":"pubkey"` key pair listed. In this object, retrieve the `hex` value from the `scriptPubkey`: + +```json + +... (omitted for brevity) ... + +"vout": [ + + ... (omitted for brevity) ... + + { + "value": 0.09980000, + "valueSat": 9980000, + "n": 1, + "scriptPubKey": { + "asm": "0225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270a OP_CHECKSIG", + "hex": "210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac", + "reqSigs": 1, + "type": "pubkey", + "addresses": [ + "RUfCUd3UryKJ49baQvSuAs42wakNunvvfT" + ] + } + }, + + ... (omitted for brevity) ... + + ] + +... (omitted for brevity) ... + +``` + +This `hex` is our `change_script` value. Save this to a secure location for later use. + +#### Step 5: calcmsg + +Use the `calcmsg` method to calculate the `msg` value. The `calcmsg` method needs the `sendtxid` and `change_script` values retrieved from previous commands. + +**cclib calcmsg 18 '\["insert\_sendtxid\_here","insert\_change\_script\_here"]'** + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib calcmsg 18 '["09daa45cb6e17028f9568347291a993cbf29c152a527b53e9ac0925d4900c293","210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac"]' +``` + + + ```json + { + "msg": "3ef43614242afd3c57e02a75a3bc99342fea7c731f6190b791c0f99826789603", + "result": "success" + } + ``` + + +Copy the `msg` value to a secure location for later use. + +#### Step 6: session + +From this point forward, all steps should be executed on both nodes 1 and 2. + +After each step performed on each node, copy the relevant data to the opposing node. + +##### Node 1 + +The following `session` command requires an array of arguments. The arguments are as follows: + +1. `ind`: the index of the signatory in the set. In this example our current node, Node 1, is `0` +2. `numsigners`: the number of pubkeys participating in the multi-signature transaction +3. `combined_pk`: the `combined_pk` address, retrieved previously +4. `pkhash`: the `pkhash` value, retrieved previously +5. `msg`: the `msg` to be signed, retrieved previously + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib session 18 '[0,2,"03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a","8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9","3ef43614242afd3c57e02a75a3bc99342fea7c731f6190b791c0f99826789603"]' +``` + + + ```json + { + "myind": 0, + "numsigners": 2, + "commitment": "a886a3a3c57efec161f6f72554b66f837de89ffdabe0acc46ae4cd59aab8129e", + "result": "success" + } + ``` + + +Copy the value of `commitment` both to a secure location and to Node 2. + +##### Node 2 + +Execute the same command as before, only change the `ind` value from `0` to `1` to indicate Node 2. + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib session 18 '[1,2,"03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a","8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9","3ef43614242afd3c57e02a75a3bc99342fea7c731f6190b791c0f99826789603"]' +``` + + + ```json + { + "myind": 1, + "numsigners": 2, + "commitment": "2854473733147ebdbf2fb70b956c8086c9d7659ca0093627fe0371098f8bc003", + "result": "success" + } + ``` + + +Copy the `commitment` value both to a secure location and to Node 1. + +#### Step 7: commit + +##### Node 1 + +The `commit` method requires an array of arguments. The arguments are as follows: + +1. `pkhash`: the `pkhash` value, retrieved previously +2. `ind`: the index of the opposite node. In our example, Node 2 is `1` +3. `commitment`: the `commitment` value from the opposing node + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib commit 18 '["8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9",1,"2854473733147ebdbf2fb70b956c8086c9d7659ca0093627fe0371098f8bc003"]' +``` + + + ```json + { + "added_index": 1, + "myind": 0, + "nonce": "0379f6f42cf4c2cb30d064a6cac22ab6ffb3d93388d49b07f0623ff9bc8d191f89", + "result": "success" + } + ``` + + +Copy the `nonce` value both to a secure location and to Node 2. + +##### Node 2 + +Execute the same command as before, only change the value of `ind` to `0` to indicate Node 1. + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib commit 18 '["8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9",0,"a886a3a3c57efec161f6f72554b66f837de89ffdabe0acc46ae4cd59aab8129e"]' +``` + + + ```json + { + "added_index": 0, + "myind": 1, + "nonce": "02402fe26abd7ed2cf22d872a6b22ced4309aac8ec273b9c89e0f8f5b77f1574db", + "result": "success" + } + ``` + + +Copy the `nonce` value both to a secure location and to Node 1. + +#### Step 8: nonce + +##### Node 1 + +The `nonce` method requires an array of arguments. The arguments are as follows: + +1. `pkhash`: the `pkhash` value, retrieved previously +2. `ind`: the index of the opposing node. In our example, the index of Node 2 is `1`. +3. `nonce`: the `nonce` from the opposing node + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib nonce 18 '["8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9",1,"02402fe26abd7ed2cf22d872a6b22ced4309aac8ec273b9c89e0f8f5b77f1574db"]' +``` + + + ```json + { + "added_index": 1, + "myind": 0, + "partialsig": "dc913a9e7532c8edf2f822f482afdcf48c61919bf905fb77f6684a2d7e58d972", + "result": "success" + } + ``` + + +Copy the `partialsig` value both to a secure location and to Node 2. + +##### Node 2 + +Execute the same command, only change the `ind` value to `0` to indicate Node 1, and change the `nonce` to the value retrieved from Node 1. + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib nonce 18 '["8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9",0,"0379f6f42cf4c2cb30d064a6cac22ab6ffb3d93388d49b07f0623ff9bc8d191f89"]' +``` + + + ```json + { + "added_index": 0, + "myind": 1, + "partialsig": "9e964dfd402f973ea1e9407e19918b1c3897ff6544d60dcdb19cfb0e5bc4c0c1", + "result": "success" + } + ``` + + +Copy the `partialsig` value both to a secure location and to Node 1. + +#### Step 9: partialsig + +##### Node 1 + +The `partialsig` method requires an array of arguments. The arguments are as follows: + +1. `pkhash`: the `pkhash` value, retrieved previously +2. `ind`: the index of the opposing node. In our example, the index of Node 2 is `1` +3. `partialsig`: the `partialsig` retrieved from the opposing node + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib partialsig 18 '["8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9",1,"9e964dfd402f973ea1e9407e19918b1c3897ff6544d60dcdb19cfb0e5bc4c0c1"]' +``` + + + ```json + { + "added_index": 1, + "result": "success", + "combinedsig": "4b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f2" + } + ``` + + +Copy the `combinedsig` value both to a secure location and to Node 2. + +##### Node 2 + +Execute the same command, but change the `ind` value to `0` to indicate Node 1, and change the `partialsig` to the value retrieved from Node 1 previously. + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib partialsig 18 '["8897e150bfb07d3f967ffadb4b0f3c84ea73a94c0d715c4b7e6d9c816c5113a9",0,"dc913a9e7532c8edf2f822f482afdcf48c61919bf905fb77f6684a2d7e58d972"]' +``` + + + ```json + { + "added_index": 0, + "result": "success", + "combinedsig": "4b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f2" + } + ``` + + +Copy the `combinedsig` value to a secure location. + +If the values of `combinedsig` produced by both nodes is the same, then you have followed the example without any errors to this point. Visually verify that this `combinedsig` value matches with the `combinedsig` value returned on Node 1. + +#### Step 10: verify + +##### Node 1 + +The `verify` method requires an array of arguments. The arguments are as follows: + +1. `msg`: the `msg` value, retrieved previously +2. `combined_pk`: the `combined_pk` value, retrieved previously +3. `combinedsig`: the `combinedsig` value, retrieved previously + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib verify 18 '["3ef43614242afd3c57e02a75a3bc99342fea7c731f6190b791c0f99826789603","03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a","4b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f2"]' +``` + + + ```json + { + "msg": "3ef43614242afd3c57e02a75a3bc99342fea7c731f6190b791c0f99826789603", + "combined_pk": "03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a", + "combinedsig": "4b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f2", + "result": "success" + } + ``` + + +##### Node 2 + +Execute the same command on Node 2. + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib verify 18 '["3ef43614242afd3c57e02a75a3bc99342fea7c731f6190b791c0f99826789603","03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a","4b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f2"]' +``` + + + ```json + { + "msg": "3ef43614242afd3c57e02a75a3bc99342fea7c731f6190b791c0f99826789603", + "combined_pk": "03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a", + "combinedsig": "4b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f2", + "result": "success" + } + ``` + + +The response from both nodes should display a `"result": "success"` key pair. If this is not the case, you made an error in a previous step. + +#### Step 11: spend + + + Currently, each node will output different raw transaction values, as both + nodes are attempting to spend funds to their own wallets. Of the two, the node + that broadcasts its returned raw transaction value first will receive the + coins. The other node does not need to create or broadcast a transaction + value. + + +##### Node 1 + +We are now prepared to execute the `spend` method. + +The `spend` method requires an array of arguments. The arguments are as follows: + +1. `sendtxid`: the `sendtxid`, retrieved previously +2. `change_script`: the `change_script` value, retrieved previously +3. `combinedsig`: the `combinedsig` value, retrieved previously + +Command: + +```bash +./komodo-cli -ac_name=MUSIG cclib spend 18 '["09daa45cb6e17028f9568347291a993cbf29c152a527b53e9ac0925d4900c293","210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac","4b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f2"]' +``` + + + ```json + { + "msg": "3ef43614242afd3c57e02a75a3bc99342fea7c731f6190b791c0f99826789603", + "combined_pk": "03d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a", + "combinedsig": "4b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f2", + "hex": "0400008085202f890193c200495d92c09a3eb527a552c129bf3c991a29478356f92870e1b65ca4da09000000007b4c79a276a072a26ba067a5658021032d29d6545a2aafad795d9cf50912ecade549137163934dfb2895ebc0e211ce8a8140878ae4c7520e729e74339e1d463d8aabc1e63c0f726c868adcf7ceab268ef62870596c7c87bdd9382bd364749662ffc79e6ee094a155678b7c2127480960b631a100af03800112a10001ffffffff0200e1f5050000000023210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac0000000000000000686a4c6512792103d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a404b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f200000000460800000000000000000000000000", + "txid": "332373cd0e4cbdddd3916e827a408ba4a175eb5039cc5a43725a50b83cb74e52", + "result": "success" + } + ``` + + +Copy the `hex` value to a secure location. + +##### Node 2 + +In this example, our desire is to receive the transferred coins on Node 1, not on Node 2. + +Therefore, it is not necessary to execute the `spend` method again, nor is it necessary for Node 2 to execute the following step. + +#### Step 12: sendrawtransaction + +##### Node 1 + +Broadcast the `hex` value using [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction): + +```bash +./komodo-cli -ac_name=MUSIG sendrawtransaction "0400008085202f890193c200495d92c09a3eb527a552c129bf3c991a29478356f92870e1b65ca4da09000000007b4c79a276a072a26ba067a5658021032d29d6545a2aafad795d9cf50912ecade549137163934dfb2895ebc0e211ce8a81401272d03e011f002a464aa75e8c3d093d45a2c4865b7b334998c8dc2fbaa814c17a2f34c9746d2921483b884d577b86465095ce64a4716b4b5d2f0b578860e149a100af03800112a10001ffffffff0200e1f5050000000023210225f1cbbda1a0c406bb8f6dc7a589d88b2f9e28cd4fdb3f59139f8aff1f5d270aac0000000000000000686a4c6512792103d31479e789014a96ba6dd60d50210045aa8292fe693f293d44615929f04cf57a404b3a9b2b162802bc6c2cca2d22e70ab1cf738a9d4f5692f4f881d0cce0319c137b27889bb562602c94e163729c4168120a4ab41a8e936909e832e6af09e758f200000000470800000000000000000000000000" +``` + +Once the broadcast transaction is mined and notarized, the MuSig transaction is complete. + +You have now successfully executed a full cycle of the MuSig module. +export const title = "Antara Modules: Part-1"; +export const description = "Learn about Antara modules and their role in smart contract development on the Komodo Platform. Part I provides an overview of Antara modules and their benefits."; + +# Overview of Antara Modules - Part I + +## Introduction + +Welcome to an Overview of Antara Modules - Part I. + +Part I of this discussion covers the basic aspects of Antara modules, without delving deeply into the technical aspects of the technology. + +The conversation should be attainable for a normal developer in the Komodo ecosystem, as well as for non-developers who otherwise possess experience in the blockchain industry. + +A later discussion, [Overview of Antara Modules - Part II](/antara/tutorials/overview-of-antara-modules-part-ii/), covers additional conceptual aspects of this technology. Part II is recommended for anyone who intends to utilize Antara technology in a development environment. + +## Smart Contracts on the Komodo Platform + +Komodo is built on the Bitcoin protocol, which features a simple programming language, called Bitcoin Script, that allows a developer to perform rudimentary scripting tasks. + +Traditionally, Bitcoin Script is considered to be incapable of supporting the complex "smart contracts" found on other blockchain platforms. This limitation is mostly from the fact that Bitcoin Script is (intentionally) not Turing complete. + +Now, the capabilities of extending Bitcoin Script into a competitive, and arguably stronger, method for creating smart-contract-like modules is changing through Komodo's Antara Framework. This framework integrates a broader technology, called CryptoConditions, which allows for complex utxo-based logic. + +As is often the case, Komodo Platform is leading the blockchain industry in this brand new technology. This section will explain Antara's implementation of CryptoConditions, how it works, and how utxo-based smart contracts will dramatically alter the blockchain landscape. + +## A Brief Review of Bitcoin Script + +The very first block in the Bitcoin blockchain was mined on or around January 3, 2009. Since then, this revolutionary technology has exploded, forever changing the way we think of money and currency. We owe many of these developments to Satoshi Nakamoto and his original Bitcoin-core code. + +The Bitcoin-core code itself is written in C++. A time-tested and well-known programming language, C++ is Turing complete and can therefore do all that any other Turing complete programming language can do. + +However, Bitcoin transactions are not executed with C++. Instead, transactions are carried out with a special protocol called Bitcoin Script. This scripting language has a number of "opcodes", or commands, that tell nodes how to deal with any specific transaction request. + +While most computer programming languages are considered Turing complete, Bitcoin Script is not. It’s widely accepted that this was an intentional decision. But before we can discuss the relative merits of making a programming language Turing complete, let’s take a moment to understand what exactly "Turing complete" means. + +## Turing Completeness + +In 1936, a British computer scientist and mathematician named Alan Turing published an academic paper called “On Computable Numbers, with an Application to the Entscheidungsproblem.” It is a seminal essay in the fields of computer science and computational theory. + +In the essay, Turing describes a hypothetical machine that, when granted a few basic assumptions, can theoretically “compute any computable sequence.” This basically means it can solve any mathematical problem that uses only computable numbers. According to Turing’s definition, “a number is computable if its decimal can be written down by a machine.” + +Turing called this device a “universal machine” but it is now better known as a “Turing machine.” + +Turing machines are generally described in this way: Imagine a simple device that can read and write numbers. This device also has the ability to store data. (Turing assumes that the device has an infinitely large storage capacity, but this is not essential to understanding the concept of Turing completeness.) + +Now, imagine that this simple machine moves from left to right along a thin, infinitely long piece of tape. It reads a number, decides what to do based on a series of instructions to which it is bound, and then executes the instructions accordingly. + +In simply reading numbers, executing commands, and writing numbers, this simple machine can solve any computational sequence. It may take an arbitrarily long period of time but, theoretically, the machine would eventually solve the problem. + +So what does all of this actually mean? Why is it important? + +The idea of something being “Turing complete” is derived from this idea of a Turing machine. While we know that no machine has an infinitely large memory, we can use the basic theoretical framework to decide whether or not a machine can solve any computable sequence. + +It is in this sense that computer languages are said to be Turing complete. A language is Turing complete if it can solve any mathematical problem made up of computable numbers. + +As we noted above, Bitcoin Script is not Turing complete. This means that there are some problems and sequences that Bitcoin Script is not capable of solving. + +## Gas-based Smart Contract Platforms + +This is where the gas-based smart contract platforms of Ethereum, EOS, NEO, and many other blockchain platforms enter the picture. We will focus on Ethereum, as it is the originator of this model, and it is currently the most popular. + +In December 2013, Vitalik Buterin released [Ethereum’s first white paper.](https://github.com/ethereum/wiki/wiki/White-Paper) One of the major contributions Ethereum offered was a Turing complete programming language, called Solidity, that can be used to write smart contracts. + +In fact, Buterin makes this perfectly clear on the first page of the white paper: + +“What Ethereum intends to provide is a blockchain with a built-in fully fledged Turing-complete programming language that can be used to create 'contracts' that can be used to encode arbitrary state transition functions, allowing users to create any of the systems described above, as well as many others that we have not yet imagined, simply by writing up the logic in a few lines of code.” + +In many ways, Ethereum's 'smart-contract' language is an improvement over Bitcoin Script. It allows “systems which automatically move digital assets according to arbitrary pre-specified rules”, and this opened up a new world of possibilities for blockchain technology. + +At the same time, Turing completeness creates a few vulnerabilities. Let’s discuss. + +## Pros and Cons of Turing Completeness + +Any Turing complete programming language has the ability to create “loops.” A loop just means that a certain operation or set of commands can be written once but commanded to execute an arbitrary number of times. + +In a language that is not Turing complete, like Bitcoin Script, loops are not available. A programmer needs to copy and paste the same piece of code `X` number of times when he wants a computer to execute the operation `X` times. + +While loops are beneficial in some ways, they also present vulnerabilities. A programmer may accidentally write an infinite loop into a smart contract, unnecessarily burdening the network with an infinite number of meaningless operations to perform. + +If malicious spammers want to attack an unprepared network that runs on a Turing-complete language, they can unleash a great number of smart contracts each bearing infinite loops. These pointless, endless operations can cause crippling congestion. + +To avoid this possibility, Buterin introduced the idea of “gas” to the Ethereum network. + +## Gas: A Way to Avoid Infinite Loops + +In short, users must pay a fee for every single operation that they want the network’s nodes to perform. These fees are simply called “gas.” Gas prices discourage malicious actors from spamming the network. It also encourages developers to write efficient contracts that require as few processes as possible. + +Moreover, gas prevents an accidental infinite loop from wreaking havoc on the network, because once all the gas is used up, the network stops processing the contract. The loop runs out of gas and the nodes stop executing the loop. + +An important benefit the gas-based platform brought to the world is that it broke the barrier for allowing developers to decentralize software execution in a p2p environment. + +For example, in a non-decentralized p2p software application, users typically must rely on a centralized server or other impersonal third-party to maintain sanity in the execution of software instructions. Decentralized applications allow users to interact with software while relying not on a centralized server, but on the decentralized blockchain. + +## The Problem with the Gas-based Model + +While the concept of gas is a clever innovation, it also makes complex applications prohibitively expensive, and it hinders innovation and audience growth. + +If a particular contract or dApp needs the network to perform a large number of operations to function as designed, it costs too much money to keep it running. + +Take these two competing statements from Buterin by way of illustration. In January of 2014 he said, “...Our goal is to provide a platform for decentralized applications – an android of the cryptocurrency world, where all efforts can share a common set of APIs, trustless interactions and no compromises.” [But later, in July 2018, Buterin had this to say:](https://www.coindesk.com/markets/2018/04/04/vitalik-ethereum-apps-are-being-screwed-by-scaling/) “If you want to build a decentralized Uber and Lyft on top of an unscalable Ethereum, you are screwed. Full stop.” + +The "Uber" reference is to a popular phone app where users can hail and share a freelance-taxi service. On average, this app processes 12 financial transactions per second. At the time of Buterin's statement, Ethereum can process 15 transactions per second. Let's make a rough analysis of the cost to maintain this one dApp on Ethereum. + +The value of the gas fees for an Uber-like decentralized app would have to cover \~80% of the cost of maintaining the Ethereum blockchain (`(12 txs / 15 txs) * 100 = 80%`). Today (cr. 2018-2019), it costs about [$150,000 USD per hour](https://www.crypto51.app/) to maintain the Ethereum hash rate. The dApp developer and their end-users would be responsible for 80% of this, so they would have to pay gas fees of at least $120,000 per hour, which translates to \~$30 per second. + +Therefore, looking only at the costs, and not at the lack of space for multiple dApps, we begin to see the enormous flaws of the gas-based model. While existing large corporations and their customer bases may be able to afford this financial burn rate, it is difficult to conceive of a startup that can afford it. The ongoing gas fees to continually maintain the functionality of this dApp are simply too expensive. + +All this is assuming that the dApp only processes one transaction per ride, per customer. If the dApp is instead a game that has a looping function, the gas fees can grow even more absurd. + +Furthermore, all dApps on the Ethereum platform have to share the same gas, and the same blockchain, and this compounds the problem. If an existing business running a dApp on the platform becomes suddenly popular, the surge of people wanting to use the dApp must purchase gas, and this causes the price of gas to rapidly rise. The burst of activity can also cause the blockchain to grind to a halt. + +While the spike in the price of gas can be advantageous for financial speculation, the spike is arguably terrible for many necessary blockchain use cases. For example, a startup business that wants to serve a new customer base using the same gas-based platform must now convince their potential customers to purchase the platform's gas at an unpredictably high price. + +Until blockchain technology is capable of processing potentially billions, if not trillions, of transactions per second on a single blockchain, the gas-based blockchain platform is fundamentally flawed for today's market. The more popular a gas-based platform becomes, the more difficult, expensive, and prohibitive it is for businesses to develop on it, and for users to buy into it. + +Having observed crucial flaws in the currently popular gas-based smart-contract platform, we are now prepared to turn to the smart-contract solution Komodo proposes. + +## Introducing Antara Modules + +Recall that Satoshi Nakamoto's Bitcoin Script is not Turing complete. This choice was deliberate. Leaving Bitcoin Script in a simple form was a quicker, safer alternative to a Turing complete language. This is true because it removes the possibility of infinite loops clogging the Bitcoin network. + +However, at the same time, the lack of Turing completeness also prevented smart-contract like functionality on Bitcoin-protocol based blockchains — until now. + +Komodo now offers Antara Modules. These modules allow for the same functionalities found in smart contracts, and even more advanced features. This new technology is compatible with Bitcoin-protocol based blockchains, and this includes all Komodo Smart Chains. + +Furthermore, Antara Modules gain more usefulness when combined with Komodo's unique design. Recall that Komodo is built not to require all developers and users to function on the main Komodo blockchain. Rather, Komodo empowers developers with their own independent blockchain, each secured with the hash rate of Bitcoin. This facilitates an interconnected network between all Smart Chains through Komodo's other technologies, such as atomic-swaps, cross-chain syncing, and more. + +This combination of Komodo technologies overcomes the challenges of the currently popular, gas-based, single-blockchain platforms. + +With Antara Modules, the developer can maintain interactivity with the Komodo ecosystem, while also being able to run on a private blockchain. Because the developer has the full blockchain all to themselves, they are able to safely occupy the full transaction capacity without fear of interruption by activity elsewhere in the ecosystem. Developers of highly active blockchains can even split their single blockchain into multiple blockchains, using the Antara framework. + +Likewise, end-users of a blockchain service in the Komodo ecosystem need only purchase the currency of the developer's Smart Chain; there is no need to purchase KMD. Therefore, for the end-user, the price of participating in the developer's business is tied only to the design and success of the developer's blockchain software, and not to the unpredictability of the ecosystem at large. + +In short, if you want to use blockchain technology to compete with the Uber taxi app, Komodo is the platform for you. + +## Antara Modules are Based on Utxo Technology + +Antara Modules function in a completely different manner from the popular gas-based model of other platforms. Before we can explain how Antara Modules work, we must first briefly explain the concept of an "unspent transaction", also called a "utxo," for short. Utxos are integral to a blockchain's functionality, but many users do not know they exist. + +A utxo is simply a bill of value sitting in your digital wallet — much like the many small fiat dollar bills you may have sitting in your physical wallet. The collection of utxos in your digital wallet make up the total balance. + +For example, a user could have in their digital wallet a utxo worth 1 KMD, another utxo worth 2 KMD, and another worth 7 KMD. Altogether, in the software interface the user would see that they have 10 KMD total. Most users would never know that they actually have three separate utxos that make up the full balance, as utxos are typically managed automatically by blockchain software. + +When the user spends money, the blockchain software automatically splits the money they spend into new utxos. If our user desires to spend 6 KMD, the software splits the 7 KMD utxo into two pieces: a 6 KMD utxo is sent to the destination address, as the user instructed, and the remaining 1 KMD is returned to the user as "change." + +The user now has a 1 KMD utxo, a 2 KMD utxo, and another 1 KMD utxo. The total that they see in their wallet is 4 KMD. + +## Antara Modules: Utxo-based Smart Contracts + +Coming to this from a programmer's perspective, a utxo is a programmable object. As with many objects, it allows software to add and subtract properties from it, including properties that allow for Turing-complete programming. In Komodo, utxos allow us to create a smart-contract functionality that is dramatically cheaper to utilize, and more secure in practice; than the gas-based models of other platforms. + +In its simplest form, an Antara Module locks a utxo in a publicly-known address and prevents it from being spent until a certain set of conditions are met. Once the conditions are fulfilled, the utxo is unlocked and sent to the appropriate address. The idea behind it really is that simple. + +It is fundamentally different than the gas-based model. In the gas-based model, a user has a total balance and they instruct their blockchain software to execute a smart-contract either until the contract is complete, or their total balance is gone. + +With Komodo's Antara Modules, a user locks a series of utxos in a contract with a set of instructions that must be met before the utxo can be sent to its final destination. + +This is a dramatically more secure setup. Only the utxos that have been indicated as belonging to an instance of an Antara Module can be spent. This is different from the gas-based model, where a bug in the software can (and frequently does) allow a faulty smart contract to drain the full balance of a wallet. + +Before diving any deeper into Antara Modules, we need to understand a few things about Bitcoin Scripts. + +## How Antara Modules Interact with Bitcoin Script + +There are several different ways to execute a Bitcoin payment. In particular, there are pay-to-pubkey payments, pay-to-pubkey-hash payments, and pay-to-script-hash payments. These three payment types represent the overwhelming majority of Bitcoin transactions, and each type of payment is limited in the possibilities it allows to the user and the developer. + +Now, Komodo has implemented an additional type of payment script that designates a utxo as belonging to a specific instance of an Antara Module. In other words, this new payment script puts constraints on the utxo. The name of this new script is called a "CryptoCondition," and we explore the specifications of this script in later articles. + +#### Antara Modules Maintain Scarcity Within the Module + +Every Antara Module has its own unique code, called an "EVAL" code, and this keeps funds in one module separate from another, and separate from the main Smart Chain's coins. + +When a user spends funds in a manner that links a utxo with an Antara Module, the utxo is locked to this EVAL code in the utxo-data structure. + +This keeps the utxo associated with the Antara Module, and thus the utxo is not free to enter into another Antara Module unless the current module allows this behavior. + +#### A User Has a Unique Address for Each Antara Module + +For each Antara Module, the user has a unique address that can only be used with funds created as a part of this module. This keeps funds that are created within an Antara Module separate from funds that are created in other Antara Modules. In this manner, there is never any confusion about where funds are sent. + +#### Each Module Has a Global Address + +Each Antara Module also has a global address that is known and usable by everyone. Even the private key to this address is public. + +Making the private key public allows users to interact with the module using lite-mode software (i.e. syncing the blockchain is not required). Also, the global address serves as a repository of information for all users within the module. + +The global address allows all users to query the state of the module and discover current and past behavior. + +#### Developers Set the Rules for Each Module-Related Transaction + +At the same time, the funds within this module cannot be moved until all the conditions of the module are satisfied. + +For example, the module can require that funds only be spent to a specific and approved address, as set in advance by a group of collaborating users. This is similar to the Bitcoin Lightning Network's intended effect, yet dramatically simpler in design. + +With these rules in place, an Antara Module effectively becomes a miniature consensus mechanism. The module forces consensus for its participants, just like the master consensus mechanism of the Smart Chain. + +Now let's take a closer look at the many advantages of Antara Modules. + +## Advantages Of Antara Modules + +#### Access to Established and Turing Complete Languages + +Antara Modules are hard-coded into the Komodo code base, which means they can be written in C and C++. They can also be written in any compiled programming language that can create a linkable library capable of calling and being called by C/C++ functions. In that sense, Komodo’s utxo-based contracts are language agnostic. + +The C and C++ programming languages are widely understood, time-tested, and, perhaps most importantly, Turing complete. Thus, utxo-based smart contracts can be programmed to do anything that any other existing program or application is able to do. + +#### No Need for a Virtual Machine + +Because Antara Modules on Komodo run in the daemon, developers can avoid the limitations and hassles of having to run code in a virtual machine, as is the case with the many gas-based smart contract platforms. On Komodo, you have far more speed, flexibility, and power. This is made possible by our unique design of connecting independent blockchains together, rather than forcing all users to run on a layer-one main chain. + +#### Utxos are More Secure Than Balance-Based Programming + +Utxo-based modules are more secure than balance-based smart contracts. This is true in several ways. For example, because Komodo’s modules are utxo-based, it is far more difficult, if not impossible, to use a module to flood the main chain's coin supply with illegitimate coins. + +This is not the case with balance-based smart contracts. Because the smart contracts are linked to balances, rather than blockchain-enforced utxos, a malicious actor can manipulate balances to disastrous ends. We have seen this happen again and again and again. + +#### RPCs Make Module Consumption Easy + +Utxo-based smart contracts are also essentially an extension of the Bitcoin protocol, so a series of Remote Procedure Calls (RPCs) can be established. With an RPC, a normal developer can bring the functionality of an existing Antara Module into a foreign software environment with a simple command. + +With many Antara Modules, a Graphic User Interface (GUI) can allow non-technical users to make use of the technology without needing to work through the command line. Eventually, once a large variety of RPC calls are available, a normal developer should be able to build decentralized software using RPC calls alone. + +#### Instantaneous Confirmation + +A challenge that many developers face in the blockchain industry is the aspect of creating software that must wait for decentralized consensus before the software's users can assume finality. + +Antara Modules allow the developer to overcome this challenge. Antara Modules allow for zero-confirmation micro-payments. These micro-payments are secured by Komodo’s delayed Proof of Work security mechanism. The payments are fully peer-to-peer, and are considered confirmed as soon as they are initiated. + +#### No Need for Gas + +Antara Modules do not require a shared “gas” coin for every process executed. Recall that the smart contracts and dApps built on Ethereum must pay in Ethereum's ecosystem-wide gas (Ether) for every single step of progress. The tremendous expense placed on common users and developers makes complex blockchain-based software nigh impossible. + +Komodo, on the other hand, is far more scalable as the cost of blockchain processing is tied only to an individual Smart Chain's native coin, and not to the main Komodo coin (KMD) that ties the ecosystem together. + +## Difficult to Create, but Easy to Reuse + +Creating a new Antara Module is more difficult than creating a new smart contract on a gas-based platform. However, the functionality of a module need only be programmed once, and then other users in the Komodo ecosystem can reuse the finished module. + +Building and designing a new Antara Module requires a strong proficiency in blockchain technology and in advanced programming techniques. The module must be stable and secure enough to withstand the pressure of the wild-open Internet. + +However, once created, other users may rely on the module's RPC commands to utilize the module's functionality without having to understand how the module functions. + +For example, consider how the MuSig Antara Module serves non-blockchain developers. This module relies on Antara to enable a complicated technology called Schnorr Signatures, which are a new method for creating multi-signature blockchain transactions. The RPC's for this module allow any developer of essentially any skill level to adopt the MuSig functionality into the developer's software without having to gain an in-depth understanding of Schnorr technology. + +[See the MuSig module documentation here](/antara/api/musig/#introduction) + +As the library of available modules grows, so too do the advantages to the many types of developers in the Komodo ecosystem. For this reason, members of the Komodo community express gratitude to the more experienced blockchain developers who build and share Antara Modules via open-source ideology. + +## Komodo is Developing and Testing Default Modules + +The Komodo team has already created many Antara Modules that are freely available for all developers in the Komodo ecosystem. The team is also exhaustively testing the Antara Modules' code prior to implementation, to ensure a quality and bug-free environment. + +Once complete, the modules are embedded into the default source code of a Komodo Smart Chain. This technology is provided using open-source philosophy, and thus anyone can verify the code of the modules. + +If you would like to have an Antara Module available that is not already in the code base, submit a Pull Request to the Komodo repository on Github with the details of your desired module. If accepted, Komodo will write the module and make it available to all users during our next hard fork. This occurs on an annual or semi-annual basis. + +To our knowledge, no other blockchain project has successfully implemented utxo-based contracts on a live chain. Considering atomic swaps, on-demand scalability, cross-chain interoperability syncing, and utxo-based modules, the Komodo team continues to develop technologies at the bleeding edge of the blockchain industry. + +Join us for Part II of this discussion. Part II delves a little deeper into the methods of Antara Module functionality, and continues preparing the developer for Antara Module utilization. + +[Link to Part II of an Overview of Antara Modules](/antara/tutorials/overview-of-antara-modules-part-ii/) +export const title = "Antara Modules: Part-2"; +export const description = + "Explore Part II of the Overview of Antara Modules, delving into the technical aspects of Antara Modules and the integration of CryptoConditions technology."; + +# Overview of Antara Modules - Part II + +## Introduction + +Welcome to an Overview of Antara Modules - Part II. + +The following content is provided for developers desiring to discover deeper levels of potential in Komodo software. The content covers technical aspects of Antara Modules that are not necessary for a common user to understand. Learning this content can help any developer in the Komodo ecosystem utilize or create new Antara Modules. + +#### Assumptions for this Content + +This discussion is intended for developers who feel confident in at least one mainstream programming language, and who understand the core concepts of blockchain and Komodo technology. + +Other readers, such as business or marketing developers, may also find the content useful, although some topics may be difficult to understand. We invite any interested reader to reach out to our team on [Discord](https://komodoplatform.com/discord) with questions. + +Consider reading the following resources, if necessary. + +* [Overview of Antara Modules - Part I](/antara/tutorials/overview-of-antara-modules-part-i/) +* [Core Technology Discussions](/start-here/core-technology-discussions/) +* [Mastering Bitcoin](https://github.com/bitcoinbook/bitcoinbook) + +#### Before We Begin: A Brief Note for Normal Developers + +Creating a new Antara Module is challenging. Fortunately, not every developer in the Komodo ecosystem is expected to program new modules from scratch. Rather, Komodo anticipates that many developers will consume existing modules without attempting to create new modules. + +Each module built on the Antara framework can be designed to have Remote Procedure Calls (RPC's) that can be called quickly and easily from other software and programming languages. + +A good example can be seen in the MuSig module. This module uses the Antara framework to enable a complicated and useful technology called Schnorr Signatures. The RPC's for this module allow any developer of essentially any skill level to adopt MuSig functionality into their software without having to gain an in-depth understanding of Schnorr technology. + +[See the MuSig module documentation here](/antara/api/musig/#introduction) + +As the library of available modules grows, so too do the advantages to the many types of developers in the Komodo ecosystem. + +## Understanding the Problem that Antara Modules Solve + +Antara is Komodo's technology framework that developers use while creating decentralized software. Antara Modules are but one aspect of the wider Antara framework. The modules are a crucial element of the framework, as they allow any capable developer to directly add arbitrary code into the Smart Chain itself. + +The reader may better understand the purpose and use case of Antara Modules by first understanding the key problem that they solve. + +#### A Consensus Mechanism Is Not Easy to Create or Change + +Adding new code into a blockchain's consensus mechanism (CM) is a challenging task. Creating an entirely new CM is more difficult by an order of magnitude. Yet, despite these facts, often when an experienced developer first approaches blockchain technology with creative intent, their initial impulse is to dive directly into the CM itself. As time passes, the developer can come to a realization that they are attempting to solve a problem that is too large for any one person. + +Consider the Bitcoin consensus mechanism. This protocol is approximately ten years old and receives perhaps more attention than all other blockchain protocols combined. Every year, thousands upon thousands of the world's most intelligent developers, mathematicians, and cryptographers pore over the intricacies of this profitable technology. Yet, despite this valuable insight, mistakes in the code continue to reveal themselves: in 2018, the Bitcoin Core and Bitcoin Cash teams together [discovered a flaw in the code](https://www.coindesk.com/markets/2018/09/21/the-latest-bitcoin-bug-was-so-bad-developers-kept-its-full-details-a-secret/) that would have allowed a malicious user to print an arbitrary number of new Bitcoins. + +{/* below: need a link to that flow path for the "viable use case for a blockchain" flow path */} + +Mistakes in the code of a CM can cause economic instability, and volatility of this nature can wreak havoc on the lives of the CM's users. For this reason, seasoned blockchain engineers often avoid changing the CM altogether, once it is relatively stable. + +For those few projects that create a useful and unique consensus mechanism, a new challenge immediately presents itself. If the CM relies on a Proof of Work type model, the project team must attract a sufficient number of miners. If the CM is more akin to Proof of Stake, the team must ensure the blockchain's total stake is distributed in a manner that ensures trustlessness. Neither of these tasks are easy to achieve. + +In light of these challenges, the blockchain engineer finds themselves confronted with a paradox. The engineer desires to create something new, and at the same time, they cannot easily change the core software. + +#### A Popular, But Flawed Solution: The Decentralized Virtual Machine + +A popular solution to this paradox is to associate the consensus mechanism (CM) with a virtual machine (VM). This method was made popular by the Ethereum project. + +In this model, the CM's design can be similar to existing and stable CM's, but it has one difference. The CM listens to instructions given by an external VM that is decentralized across all validating nodes. While code inside the VM can be arbitrary, the CM does not listen to the code's execution. Instead, the CM only listens to the same data as before: the history of transactions and associated meta data. + +This solution is more effective than writing an entirely new CM, yet the solution is limited. The limitations include: the requirement of working in the mandatory VM programming language, such as Solidity; an excessive dependency on the core-software development team; volatile economics, and a lack of blockchain processing and storage capacity. + +The requirement of the limited programming language derives from security concerns. All validating nodes in the decentralized VM must run all blockchain-related code in the ecosystem. Having this code written in a unique language designed for the VM reduces the available opportunities to malicious actors. While the limitation provides baseline security, the customized and often unstable nature of the VM programming language can make the creative process difficult. Also, the need to master a new language adds an additional burden to the developer. + +The dependency on the blockchain's core engineers also slows creative progress for ecosystem developers. When the ecosystem developer discovers a new core-level technology that would increase the developer's productivity and creativity, they must convince the main chain's core-software team to implement the new feature. The core-software engineers, however, may have conflicting interests, as their decisions must meet the needs of all developers and users in their ecosystem. + +In many of the VM-based models, economics for blockchain usage can be volatile. The underlying "gas" token that the VM requires (such as Ether) can change in price and value according to the interests of the uneducated masses. This may sound advantageous to a speculator, but a practical business will find that the volatility scares away new users. + +The fact that the VM frequently relies on a single blockchain further hinders developers and users. Block space can be in short supply due to high demand on popular chains. Furthermore, data that is entirely irrelevant to the developer can become required baggage. + +These challenges make the VM model unpleasant for many experienced blockchain engineers. In fact, before Komodo existed, these very concerns inspired the Komodo engineers to avoid the VM model in search of a better solution. + +Antara Modules provide this solution through Komodo's integration of a technology called CryptoConditions. + +## CryptoConditions: An Industry-Wide Standard + +CryptoConditions is a technology that allows for arbitrary logical conditions and fulfillments to be evaluated as a part of consensus. This allows for a Smart Chain's consensus mechanism to evaluate the results of arbitrary code and update state in the blockchain's data in a decentralized and secure fashion. + +CryptoConditions technology is not a new concept. The [Interledger](https://interledger.org/) team originally proposed this technology in 2016. + +The [original proposal](https://datatracker.ietf.org/doc/html/draft-thomas-crypto-conditions-01) was that it would be an open-source industry-wide standard format. The Interledger team does not seem to have continued exploring the technology beyond the original proposal. + +Komodo, on the other hand, found the CryptoConditions concept to be intriguing. In 2018, Komodo adopted this open-source technology into the suite of offerings in our Antara framework. + +Our implementation uses many of the key ideas put forth by the Interledger team, and at the same time we depart in several significant ways. Those who are curious for specific details on this topic can explore the open-source code in the respective repositories. + +The important takeaway is that Antara Modules rely on a core technology called, CryptoConditions (CC). This technology allows a developer to add arbitrary logical conditions and fulfillment to their Smart Chain, and to rely on the consensus mechanism to ensure state integrity in a decentralized environment. + +## Creativity at the Consensus Level, Without Losing the Consensus Mechanism + +Antara Modules and CryptoConditions together allow a developer to add arbitrary code at the consensus level, and within the core software's daemon, without interfering with the existing consensus mechanism (CM). This grants the developer the ability to add core-level features and innovations without waiting for the approval of other members of the Komodo ecosystem. Combined with Komodo's Bitcoin-hash rate security, the simplicity of Antara Modules provides the developer with a competitive level of creative freedom. + +The entry point between Antara Modules and the CM is a new Bitcoin-script [operation code](https://bitcoin.org/en/glossary/op-code), "OP\_CHECKCRYPTOCONDITIONS", or OP\_CCC for short. When executed, OP\_CCC is able to initiate additional arbitrary code that is written in any programming language, assuming the language can call and execute C/C++ code in return. The arbitrary code is separate from the CM, thus maintaining the CM's reliability. When the arbitrary code completes, OP\_CCC returns a `true` or `false` statement to the daemon. If the returned OP\_CCC value is `true`, the daemon performs a transaction. + +The transaction can contain meta data in the normal manner. Therefore, these transactions can also implement other data-storage features of Komodo software. Examples include the [key-value storage](/smart-chains/api/blockchain/#kvupdate) feature, the [Oracles Antara Module](/antara/api/oracles/#introduction), or the native `vout` and `batontxid` key-value pairs. + +With access to the meta data established, Antara Modules are able to act as an application-state manager. State-related data is held in utxos that are accessible to the CM. As application-state management is based on the utxo model, the management also follows the CM's rules for consensus. This powerful combination allows the developer to collect, organize, and act upon data in a securely decentralized manner. + +In addition, once the data is notarized, it can also be called by other Komodo-based Smart Chains, depending on the manner in which the developer(s) form their chain. This allows developers to form clusters of blockchains to enhance their software, as opposed to relying on a single blockchain, or on a single child chain. The speed and data-storage capabilities of a cluster are thus exponentially greater than the offerings of many VM-based competitors. + +Also of note is the simplicity of the Antara Module architecture. All new code created for an individual Antara Module is contained in an optional library. Modules from the library are included in compilation only on participating blockchains. In this manner, developers who desire a module's functionality can include the necessary libraries, and those who do not require the module can avoid this excess baggage. + +The Komodo daemon has no need of an external VM. This eliminates what would otherwise be a cumbersome requirement for the developer and the core engineers. At the same time, the daemon offers all the capabilities of a VM-based blockchain — ⁠and arguably more. + +## Antara Modules In Action: Accomplishing Years' Worth of Work In But A Weekend + +Examples of the power of Antara Modules can be found by observing existing modules. Consider how Antara allowed the Komodo ecosystem to swiftly and easily upgrade the Komodo consensus mechanism (CM) to include quantum-proofing capabilities. + +In years past, other blockchain projects in the cryptocurrency community had focused on manually upgrading their CM for quantum-proofing protection. Although this feature appeared to be an advantage, this was not true. Adding customized code to the CM itself to protect addresses from quantum-capable computers was a time-consuming and expensive process. + +Paradoxically, once the new quantum-proof CM was achieved, it only served to isolate the project team. The code itself was untested and unreliable, and the users of the cryptocurrency community had to endure these roadblocks. Furthermore, the customized CM was often incompatible with much of the activity in the open-source blockchain ecosystem; for each industry-wide technological advancement, the team often had to adapt their customized CM on their own. + +Komodo's engineers chose not to spend energy building a new quantum-proof CM, but rather they worked to add Antara Modules first. Once this technology was available, the Komodo core software team took existing quantum-proofing technology, read summaries published by academics and researchers, and created a new Antara Module to add quantum-proofing functionality to the Komodo CM. + +The time between project initiation and releasing a beta version for community testing was approximately one weekend. Only one core developer's attention was required. The Komodo daemon remains compatible with all other software features as before, able to quickly adopt new ideas from others in the open-source community as soon as they arrive. At the same time, users who desire quantum proofing for their long-term financial interests have a module readily available, and users who are not interested have not experienced an interruption in their blockchain services. + +The ability to adopt the ideas of others quickly, while maintaining the accomplishments, security, and compatibilities of one's predecessors, makes Antara Modules a wise choice for experienced developers who wish to have the most advanced technology available without a significant hassle. +export const title = "Pegs Module Creator Tutorial"; +export const description = + "This tutorial assists the reader in discovering the process of creating a new Smart Chain with an active stablecoin using the Pegs Antara Module."; + +# Pegs Module Creator Tutorial + + + The Pegs Module is in the final stages of production. + + The following tutorial is currently only compatible with computer-hardware setups that are running Linux OS's Ubuntu/Debian-based distributions. + + For questions and assistance, please reach out to the Komodo team using the `#cc-pegs` channel on the [Komodo Discord](https://komodoplatform.com/discord) live-chat server. Thank you. + + +## Tutorial Overview + +This tutorial assists the reader in discovering the process of creating a new Smart Chain with an active stablecoin using the [Pegs Antara Module.](/antara/api/pegs/) + +#### Tutorial Outline + +* Launch a new test Smart Chain (`CREATORUSDK`) to activate the Pegs Module +* Peg the test chain's coins to `USD` and create a pathway for users to back the stablecoin with `KMD` +* Create tokens to represent the `KMD` coins +* Create an oracle, register as a publisher, and subscribe to it +* Create a gateway and bind the previously created token and oracle to it +* Start the `oraclefeed` software to bring the `blockheader` data from the `KMD` chain to the `CREATORUSDK` chain through the oracle +* Create a peg by attaching the gateway to it + +Upon completion of this tutorial, the reader may follow the [user tutorial](/antara/tutorials/pegs-module-user-tutorial/) and use the Smart Chain created here to discover the possibilities of the Pegs Module. + +## Installation + + + The following installation procedure creates a version of the Komodo software daemon that should not be used for any purpose other than testing. Several of the customizations active on this particular version of the daemon are intended for testing purposes only. + + +#### Dependencies + +Execute the following commands to install the necessary dependencies. + +```bash +sudo apt-get update && sudo apt-get upgrade -y +sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libgtest-dev libqt4-dev libqrencode-dev libdb++-dev ntp ntpdate software-properties-common curl clang libcurl4-gnutls-dev cmake clang libsodium-dev -y +``` + +#### Create a Swap Partition (Optional) + +For tutorial users using a VPS with a low amount of RAM, create a swap partition. + +On the VPS, execute the following commands to create a 4GB SWAP file. (If sufficient space is available, consider creating an 8GB swap file instead, as this can facilitate better software performance.) + +```bash +sudo swapon --show +free -h +df -h +sudo fallocate -l 4G /swapfile +ls -lh /swapfile +sudo chmod 600 /swapfile +ls -lh /swapfile +sudo mkswap /swapfile +sudo swapon /swapfile +sudo swapon --show +free -h +sudo cp /etc/fstab /etc/fstab.bak +echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab +sudo sysctl vm.swappiness=10 # This setting will persist until the next reboot. We can set this value automatically at restart by adding the line to our /etc/sysctl.conf file: +sudo nano /etc/sysctl.conf +vm.swappiness=10 +``` + +## Build the Komodo daemon + +Execute the following commands to build the Komodo daemon. + +```bash +git clone https://github.com/Mixa84/komodo +cd komodo +git checkout pegsCC +export CONFIGURE_FLAGS='CPPFLAGS=-DTESTMODE' # Tweaks some settings to make it easy for testing +./zcutil/fetch-params.sh +./zcutil/build.sh -j$(nproc) +cd src +``` + +This tutorial requires that the tutorial reader compile the Komodo daemon from source code. For more instructions, please see the [installation section](/antara/tutorials/pegs-module-creator-tutorial/#installation) .If you have access to two VPS, follow [this guide](/smart-chains/tutorials/create-a-default-smart-chain/). If you want to launch this Smart Chain in your Personal Computer or using a single VPS, follow [this guide](/smart-chains/tutorials/creating-a-smart-chain-on-a-single-node/) + +#### Obtain a pubkey + +Recall also that a user must have a `pubkey` enabled when interacting with an Antara-related Smart Chain. [View this linked material for an explanation.](/antara/tutorials/understanding-antara-addresses/) + +## Launch the Test Smart Chain + +The command below creates and launches a new Smart Chain. + +The following list explains a few of the Smart Chain customizations that are necessary and desirable for a Smart Chain designed for testing purposes. + +* `-ac_name=CREATORUSDK` — the name of this Smart Chain is set to `CREATORUSDK` +* `-ac_import=PEGSCC` — the key customization that activated the Pegs Antara Module on the new Smart Chain +* `-ac_end=1` — sets the mining block reward to zero (after the first block) +* `-debug` — a debug parameter that instructs the daemon to track various information for console output +* `-printoconsole` — instructs the daemon to print the information from the `debug` parameter to the console +* `-ac_supply=1000000` — the amount of intial coin supply for the chain (an arbitrary amount here that includes enough coin to manage testing purposes of the chain) + +Consult the [Antara Customizations](/antara/setup/antara-customizations/) documentation for explanations of the other parameters in the command. + +```bash +./komodod -ac_supply=1000000 -ac_reward=10000 -ac_name=CREATORUSDK -ac_cc=2 -ac_import=PEGSCC -ac_end=1 -ac_perc=0 -ac_cbopret=5 -debug=pegscc-2 -debug=importcoin -debug=cctokens -debug=gatewayscc -printtoconsole=1 +``` + +## Create a Token to Represent KMD Coins + +To create tokens that are capable of representing `KMD` (although the tokens are not yet tied to actual `KMD`), execute the following command on the test chain. + +```bash +./komodo-cli -ac_name=CREATORUSDK tokencreate KMD 100000 "KMD_BTC,BTC_USD,*,1" +``` + +This creates a total of `100000 * 10^8` tokens named `KMD` on the `CREATORUSDK` chain. Each token is capable of representing a single satoshi of the external coin `KMD`. + +All the tokens combined allow up to `100000` `KMD` coins on the `CREATORUSDK` chain. + +The description of the token, `"KMD_BTC,BTC_USD,*,1"` specifies the synthetic price to be used by a peg (not yet created). + +`"KMD_BTC,BTC_USD,*,1"` means `(KMD/BTC) * (BTC/USD) * 1`. This simplifies to `KMD/USD`, which provides an exchange price between the two currencies. This provides the necessary information to peg the `CREATORUSDK` stablecoin to `USD` and to back the coin using `KMD`. + +The command returns a hex value as a response. + +```json +{ + "result": "success", + "hex": "0100000001c05c55f5183a412750a912579bf5f915a261b68d51b2ce5e2664659e9dcce3010000000049483045022100e4a0fffaf4aa10be58716561a1f2043dfdc2c3a4b595e74031582bac9edcc7690220211a5984f8ab480ff7641073f9dc8622b02ee602228fe27fda788443cd6aadb401ffffffff041027000000000000302ea22c8020432de388aabcb6b4e3326351d1d815cee8be9a8d37b055cd1c0cf8782e5c50c08103120c008203000401cc00a0724e18090000302ea22c80205dcc33b0b3f0573b306ab85ffa9ce8622fbcb81cb6ad8ec00f366935bbf500f78103120c008203000401cc1f0493c2da510000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac0000000000000000426a40f2632102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567074b4d4454455354134b4d445f4254432c4254435f5553442c2a2c3100000000" +} +``` + +Select the hex value (`0100000001c05c55f5183a412750a...`) and copy it using (CTRL + SHFT + C). + +Broadcast this value using [sendrawtransaction.](/smart-chains/api/rawtransactions/#sendrawtransaction) + +```bash +./komodo-cli -ac_name=CREATORUSDK sendrawtransaction insert_hex +``` + +The value of the response is called the `tokenid`. + +```bash +0946d12135cca0757a12931944ff930657f21fd676966c12d66d5750848ea712 +``` + +Copy the `tokenid` into a text editor and keep it available for future use. + +Watch the mempool using [getrawmempool](/smart-chains/api/blockchain/#getrawmempool) to verify that the `tokenid` is successfully mined. + +```bash +./komodo-cli -ac_name=CREATORUSDK getrawmempool +``` + +Once the `tokenid` disappears from the mempool the transaction is mined. + +Use [tokeninfo](/antara/api/tokens/#tokeninfo) to check that the token is successfully created. + +```bash +./komodo-cli -ac_name=CREATORUSDK tokeninfo 0946d12135cca0757a12931944ff930657f21fd676966c12d66d5750848ea712 +``` + + + ```json + { + "result": "success", + "tokenid": "0946d12135cca0757a12931944ff930657f21fd676966c12d66d5750848ea712", + "owner": "02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567", + "name": "KMD", + "supply": 10000000000000, + "description": "KMD_BTC,BTC_USD,*,1" + } + ``` + + +The tutorial reader may now check the balance of the `pubkey` used to launch the daemon using [tokenbalance](/antara/api/tokens/#tokenbalance). + +```bash +./komodo-cli -ac_name=CREATORUSDK tokenbalance insert_tokenid insert_pubkey +``` + +## Create an Oracle + +The [Oracles](/antara/api/oracles/#introduction) Module is able to add external data to a blockchain. This modules allows the Pegs module to obtain the information needed regarding user activity and accurate prices. + +When creating a new oracle, the name of the oracle is identical to the name of the tokens, `KMD` and the data format starts with `Ihh` (height, blockhash, merkleroot). + +Create the oracle using [oraclescreate](/antara/api/oracles/#oraclescreate). + +```bash +./komodo-cli -ac_name=CREATORUSDK oraclescreate KMD blockheaders Ihh +``` + +The response is a hex value. + +```json +{ + "hex": "0400008085202f890112a78e8450576dd6126c9676d61ff2570693ff441993127a75a0cc3521d14609020000004847304402206d05f874b04808f5d989325e140e0a618de8081909bc20db24fd70ebfd53fedc02205f88c98f2399119ab680a246ac0613dffabb4a77022cc755b9fca6c96f50c52d01ffffffff0310270000000000002321038c1d42db6a45a57eccb8981b078fb7857b9b496293fe299d2b8d120ac5b5691aacffb592c2da510000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac00000000000000001d6a1bec43074b4d4454455354034968680c626c6f636b6865616465727300000000280100000000000000000000000000", + "result": "success" +} +``` + +Broadcast the returned hex value using [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction). + +```bash +./komodo-cli -ac_name=CREATORUSDK sendrawtransaction insert_hex_data +``` + +The response is a transaction id, called the `oracleid`. + +```bash +ee684674d3671daf596395a9ca6c409381d1cf6c2c7ff05c65c6bb5c16967a0e +``` + +Record this value in the text editor. + +Execute the `oraclesfund` method to fund the oracle. + +```bash +./komodo-cli -ac_name=CREATORUSDK oraclesfund ee684674d3671daf596395a9ca6c409381d1cf6c2c7ff05c65c6bb5c16967a0e +``` + + + ```json + { + "hex": "0400008085202f89010e7a96165cbbc6655cf07f2c6ccfd18193406ccaa9956359af1d67d3744668ee01000000494830450221008f3db99deddacc6cf6c39260faac62aa00395a808715923e0301d6063a23618d022044565a478e2fbf316f843ac96c2921f267da71701f51fd0c244aff1aedb00ed101ffffffff031027000000000000302ea22c8020de1ac583c081d079fd4118ec0c29fe975121739d8fba70103e5fb45614913cbe8103120c008203000401ccdf6792c2da510000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac00000000000000004f6a4c4cec460e7a96165cbbc6655cf07f2c6ccfd18193406ccaa9956359af1d67d3744668ee2102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567102700000000000000000000290100000000000000000000000000", + "result": "success" + } + ``` + + +Send the raw transaction by broadcasting the hex value. + +```bash +./komodo-cli -ac_name=CREATORUSDK sendrawtransaction 0400008085202f89010e7a96165cbbc6655cf07f2c6ccfd18193406ccaa9956359af1d67d3744668ee01000000494830450221008f3db99deddacc6cf6c39260faac62aa00395a808715923e0301d6063a23618d022044565a478e2fbf316f843ac96c2921f267da71701f51fd0c244aff1aedb00ed101ffffffff031027000000000000302ea22c8020de1ac583c081d079fd4118ec0c29fe975121739d8fba70103e5fb45614913cbe8103120c008203000401ccdf6792c2da510000232102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567ac00000000000000004f6a4c4cec460e7a96165cbbc6655cf07f2c6ccfd18193406ccaa9956359af1d67d3744668ee2102d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567102700000000000000000000290100000000000000000000000000 +``` + +Response: + + + ```bash + 4f87b9769300282ce706eb0bd75d534d7cbbc940b04c1a7131c70e4b35f7c240 + ``` + + +Optionally use the [getrawmempool](/smart-chains/api/blockchain/#getrawmempool) method to ensure that the transaction receives confirmation. + +To prepare for the oraclefeed instance, use [oraclesregister](/antara/api/oracles/#oraclesregister) to register as a publisher for the oracle. This command must be executed on a node which can post `KMD` block headers and which can execute withdrawal transactions. + +```bash +./komodo-cli -ac_name=CREATORUSDK oraclesregister insert_oracleid data_fee_in_satoshis` +``` + +This returns a hex value which must be broadcast using [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction). (Not shown for brevity) + +```bash +./komodo-cli -ac_name=CREATORUSDK sendrawtransaction insert_hex_value +``` + +Retrieve the data publisher's `pubkey` using [oraclesinfo](/antara/api/oracles/#oraclesinfo). + +```bash +./komodo-cli -ac_name=CREATORUSDK oraclesinfo insert_oracleid +``` + + + ```json + { + "result": "success", + "txid": "ee684674d3671daf596395a9ca6c409381d1cf6c2c7ff05c65c6bb5c16967a0e", + "name": "KMD", + "description": "blockheaders", + "format": "Ihh", + "marker": "RKbG81CYx6Qtxnu59edtQS6isycKbbFB1o", + "registered": [ + { + "publisher": "02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567", + "baton": "RSY69ZqzUADpqSeVNR7o3Jdo2UnXjMCbjq", + "batontxid": "1bfbdbc1062921b3e2620d57af2f7d6989ccc5dce5e6bdb2d8c2809ec98bdc44", + "lifetime": "0.00000000", + "funds": "0.00000000", + "datafee": "0.00100000" + } + ] + } + ``` + + +The key, `"publisher"`, in the entry, `"registered"`, of the returned json object is the data publisher's `pubkey`, also called the `publisherpubkey`. + +Subscribe to the oracle using [oraclessubscribe](/antara/api/oracles/#oraclessubscribe) to receive utxo information for data publishing. + +The frequency of data-publishing transactions that can be included in a block is equal to the number of active subscriptions committed to the oracle. Therefore, there must be at least one subscription for the oracle to allow publishing. + +Subscribe to the oracle using the following command. + +```bash +./komodo-cli -ac_name=CREATORUSDK oraclessubscribe insert_oracleid insert_publisherpubkey insert_amount_of_funds_to_add +``` + +This returns a hex value that must be broadcast using sendrawtransaction (not shown for brevity). + +```bash +./komodo-cli -ac_name=CREATORUSDK sendrawtransaction insert_hex_value +``` + +In this tutorial example, the tutorial reader needs to be able to publish data more than once per block. Therefore, execute the oraclessubscribe and sendrawtransaction methods several times and with the same amount. + +Verify the oracle information to ensure it is properly established. + +```bash +./komodo-cli -ac_name=CREATORUSDK oraclesinfo insert_oracleid +``` + + + ```json + { + "result": "success", + "txid": "ee684674d3671daf596395a9ca6c409381d1cf6c2c7ff05c65c6bb5c16967a0e", + "name": "KMD", + "description": "blockheaders", + "format": "Ihh", + "marker": "RKbG81CYx6Qtxnu59edtQS6isycKbbFB1o", + "registered": [ + { + "publisher": "02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567", + "baton": "RSY69ZqzUADpqSeVNR7o3Jdo2UnXjMCbjq", + "batontxid": "1bfbdbc1062921b3e2620d57af2f7d6989ccc5dce5e6bdb2d8c2809ec98bdc44", + "lifetime": "4.00000000", + "funds": "4.00000000", + "datafee": "0.00100000" + } + ] + } + ``` + + +## Bind the Token and Oracle to a Gateway + +Create a gateway and bind the data from this tutorial to the gateway using the [gatewaysbind](/antara/api/gateways/#gatewaysbind) method. + +This method requires that tutorial reader decide how many total gateway signatures are desired (represented by the value `N`), and how many signatures are required to withdraw funds (represented by the value `M`). + +For this tutorial, the reader may set both `N` and `M` equal to `1` for simplicity. + +The gatewaysbind command requires that the user indicate the `pubtype`, `p2shtype`, and `wiftype` values for the chosen coin. For Smart Chains, these values are `60`, `85` and `188` respectively. + +```bash +./komodo-cli -ac_name=CREATORUSDK gatewaysbind insert_tokenid insert_oracleid KMD insert_tokensupply 1 1 insert_gatewayspubkey 60 85 188 +``` + +This method returns a hex value that must be broadcast using sendrawtransaction (not shown for brevity). + +```bash +./komodo-cli -ac_name=CREATORUSDK sendrawtransaction insert_hex_value +``` + +The broadcast returns a transaction id, also called the `bindtxid`. Copy this information to the text editor. + +Assuming everything is properly created and executed, review the new gateway using [gatewaysinfo](/antara/api/gateways/#gatewaysinfo). + +```bash +./komodo-cli -ac_name=HELLOWORLD gatewaysinfo insert_bindtxid +``` + + + ```json + { + "result": "success", + "name": "Gateways", + "M": 1, + "N": 1, + "pubkeys": [ + "02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567" + ], + "coin": "KMD", + "oracletxid": "ee684674d3671daf596395a9ca6c409381d1cf6c2c7ff05c65c6bb5c16967a0e", + "taddr": 0, + "prefix": 60, + "prefix2": 85, + "wiftype": 188, + "deposit": "RN727JeeiZ6NXic7PUKTCiHT1HvuBN4RDa", + "tokenid": "0946d12135cca0757a12931944ff930657f21fd676966c12d66d5750848ea712", + "totalsupply": "100000.00000000", + "remaining": "100000.00000000", + "issued": "0.00000000" + } + ``` + + +Use the returned information to verify that the `tokenid` and `oracleid` match the information copied from this tutorial to the text editor. + +## Start the oraclefeed software + +The `oraclefeed` software instance automates the transfer of merkleroot data from the `KMD` chain to the oracle on the `CREATORUSDK` chain. + +Change into the directory where `komodod` and `komodo-cli` are compiled. + +```bash +cd ~/komodo/src/ +``` + +Compile the `oraclefeed` software instance. + +```bash +gcc cc/dapps/oraclefeed.c -lm -o oraclefeed +``` + +Initiate the instance. + +```bash +./oraclefeed CREATORUSDK insert_oracleid insert_mypubkey Ihh insert_bindtxid "cli command to access te external coin(KMD)" +``` + +Inserting the values. + +```bash +./oraclefeed CREATORUSDK ee684674d3671daf596395a9ca6c409381d1cf6c2c7ff05c65c6bb5c16967a0e 02d3431950c2f0f9654217b6ce3d44468d3a9ca7255741767fdeee7c5ec6b47567 Ihh 0b5716554e523aa4678112a8ac3d15039e0aae6f4812b9d4c631cc9cfbf48786 "./komodo-cli" +``` + + + ```bash + BTC/USD 8469.7417 + Powered by CoinDesk (https://www.coindesk.com/price/) 8469.74170000 + must supply reference coin + set refcoin RN727JeeiZ6NXic7PUKTCiHT1HvuBN4RDa <- KMD [./komodo-cli] M.1 of N.1 + broadcast CREATORUSDK txid.(13bb4ba78686ae65894c79e67e346e8f8c0bde96dda8d041d4653ce203423b17) + KMD ht.16 <- 10000000f7a5a84d008a6c4107c3bbad442a879355bd7f951e4bf5ac48b8458afa6a1600bbf054d5a9219e8034990f764106c719f9bfc278b1d909be4486ff52d8523ca6 + broadcast CREATORUSDK txid.(2eaef55baf9895b4a5b45f0450cc8b4b8e6f95563bc4c0d95086b3ff0d4d394a) + KMD ht.17 <- 1100000010da30ab6d70443dc881c8ee85b02869b3520d016fcd076e4a1e67543a3a9c0714d4bad1c68f74d6d65b7e26ed821fc38aed36f03c101d117440e094823fb2fa + broadcast CREATORUSDK txid.(eff38402e9669ffe7521ab98368e114e44fa8c5ec7a98d57bf600d6ba1cac45d) + KMD ht.18 <- 1200000018d4169fde5fc716b9ebc44da85fa3cfe5d64adf94d4bee09d97bbbebaaeb80e098c0417881230d51281346f29d2566cd164b7ef0e6a6c08332f969f690e10c9 + broadcast CREATORUSDK txid.(388c23187083cdc789483d9b8af90c4a4ce3ecaf856785b86f00bf37db900ede) + KMD ht.19 <- 13000000f1fea637bf33149d161bd5a1d20e0ad8911a3710cf941a318b68fa973d4d9403bb5521d6171bcb1d65d6cadff6916e96814b46ae2487d100987820367b702c2f + ``` + + +## Create the Peg + +Create a peg that will create `CREATORUSDK` coins pegged to USD and backed by `KMD` using the [pegscreate](/antara/api/pegs/#pegscreate) method. + +The pegscreate method is capable of creating a peg that is backed by more than one external coin. This is accomplished by adding more than one `bindtxid` to the `pegscreate` command. + +Each associated gateway requires a unique token, oracle, and a running instance of the `oraclefeed` software, as previously described in this tutorial. + +For the sake of simplicity, this tutorial utilizes only one gateway (bound to `KMD` coins). + +```bash +./komodo-cli -ac_name=CREATORUSDK pegscreate 100000 1 0b5716554e523aa4678112a8ac3d15039e0aae6f4812b9d4c631cc9cfbf48786 +``` + +This method returns a hex value that must be broadcast using sendrawtransaction (not shown for brevity). + +```bash +./komodo-cli -ac_name=CREATORUSDK sendrawtransaction insert_hex_value +``` + +The broadcast returns a transaction id, also called the `pegstxid`. Copy this information to the text editor. + +The `pegstxid` is the reference to the peg created in this tutorial. To make sure all the nodes running the `CREATORUSDK` chain are aware of the correct pegs contract, after the `pegstxid` transaction is mined the reader must shutdown any daemons running the chain. The tutorial reader then restarts the nodes, but with a slightly modified version of the launch parameters. The parameters now include `-earlytxid`, and this parameter is set equal to the value of `pegstxid`. + +In the following command, replace the text `` with the `pegstxid` from this tutorial. + +```bash +./komodod -ac_supply=1000000 -ac_reward=10000 -ac_name=CREATORUSDK -ac_cc=2 -ac_import=PEGSCC -ac_end=1 -ac_perc=0 -ac_cbopret=5 -debug=pegscc-2 -debug=importcoin -debug=cctokens -debug=gatewayscc -printtoconsole=1 -earkytxid= +``` + + + For any Smart Chain, the `-earlytxid` must be added to the launch parameters before the chain reaches a total block height of `100`. The tutorial reader may control the pace of mining on a Smart Chain with the commands `./komodo-cli setgenerate true 1` (starting) and `./komodo-cli setgenerate false` (stopping). + + +Any new node joining the `CREATORUSDK` network must use the new launch parameters with the `-earlytxid` included. + +## Test the Setup + +Follow the [Pegs Module Tutorial - User](/antara/tutorials/pegs-module-user-tutorial/) documentation to continue learning about the Pegs Antara Module. +export const title = "Pegs Module User Tutorial"; +export const description = "This tutorial uses the USDKTEST test Smart Chain to introduce the process and workflow of a user of the Pegs Antara Module."; + +# Pegs Module User Tutorial + + + The Pegs Module is in the final stages of production. + + The following tutorial is currently only compatible with computer-hardware setups that are running Linux OS's Ubuntu/Debian-based distributions. + + For questions and assistance, please reach out to the Komodo team using the `#cc-pegs` channel of the [Komodo Discord](https://komodoplatform.com/discord) live-chat server. Thank you. + + +## Tutorial Overview + +This tutorial uses the `USDKTEST` test and development Smart Chain to introduce the process and workflow of a user of the [Pegs Antara Module.](/antara/api/pegs/) + +#### Tutorial Outline + +* Connect to the test Smart Chain `USDKTEST` +* Deposit `KMD` coins (on the `KMD` Smart Chain) in the address associated with the `USDKTEST` Gateways Module +* Claim tokenized `KMD` on the `USDKTEST` chain +* Lock tokenized `KMD` in the Pegs Module and receive `USDK` coins +* Redeem tokenized `KMD` using the `pegsredeem` method +* Return tokenized `KMD` to the Gateway to receive `KMD` coins on the `KMD` Smart Chain + +## Installation + + + The following installation procedure creates a version of the Komodo software daemon that should not be used for any purpose other than testing. Several of the customizations active on this particular version of the daemon are intended for testing purposes only. + + +### Dependencies + +Execute the following commands in the Unix terminal. + +```bash +sudo apt-get update && sudo apt-get upgrade -y +sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libgtest-dev libqt4-dev libqrencode-dev libdb++-dev ntp ntpdate software-properties-common curl clang libcurl4-gnutls-dev cmake clang libsodium-dev -y +``` + +#### Create a Swap Partition (Optional) + +For tutorial users using a VPS with a low amount of RAM, create a swap partition. + +On the VPS, execute the following commands to create a 4GB SWAP file. (If sufficient space is available, consider creating an 8GB swap file instead, as this can facilitate better software performance.) + +```bash +sudo swapon --show +free -h +df -h +sudo fallocate -l 4G /swapfile +ls -lh /swapfile +sudo chmod 600 /swapfile +ls -lh /swapfile +sudo mkswap /swapfile +sudo swapon /swapfile +sudo swapon --show +free -h +sudo cp /etc/fstab /etc/fstab.bak +echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab +sudo sysctl vm.swappiness=10 # This setting persists until the next reboot of the VPS. To instead set this value automatically at restart, execute the following lines to edit the /etc/sysctl.conf file: +sudo nano /etc/sysctl.conf +vm.swappiness=10 +``` + +### Build the Komodo daemon + +```bash +git clone https://github.com/Mixa84/komodo +cd komodo +git checkout pegsCC +export CONFIGURE_FLAGS='CPPFLAGS=-DTESTMODE' # Tweaks some settings to make it easy for testing +./zcutil/fetch-params.sh +./zcutil/build.sh -j$(nproc) +cd src +``` + +## Connect and Sync to USDKTEST and KMD + +Navigate to the source directory. + +```bash +cd ~/komodo/src +``` + +Execute the following launch parameters. + +In the following command, replace the text, ``, with the appropriate pubkey. [To learn more about setting a proper pubkey, please read this linked article from the Komodo documentation.](/antara/tutorials/understanding-antara-addresses/) + +```bash +./komodod -ac_supply=1000000 -ac_reward=10000 -ac_name=USDKTEST -ac_cc=2 -ac_import=PEGSCC -ac_end=1 -ac_perc=0 -ac_cbopret=5 -debug=pegscc-2 -debug=importcoin -debug=cctokens -debug=gatewayscc -printtoconsole=1 -addnode=116.203.17.140 -addnode=116.203.17.141 -earlytxid=a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 -pubkey= & +``` + +Import the private key corresponding to the pubkey used to start the `USDKTEST` chain. Note the text `` that must be replaced in the following command. + +```bash +./komodo-cli -ac_name=USDKTEST importprivkey +``` + +Allow the chain to sync. + +Check the sync status using the [getinfo](/smart-chains/api/control/#getinfo) method. When the keys `blocks` and `longestchain` have the same value, the chain is synced. Once the chain is synced, begin mining the `USDKTEST` chain. + +Mine until the balance returned from the [getinfo](/smart-chains/api/control/#getinfo) method is at least `30k` satoshis. This requires mining approximately `3` blocks. + +```bash +./komodo-cli -ac_name=USDKTEST setgenerate true 1 +``` + +#### Sync the KMD Smart Chain + +In a new terminal, change into the Komodo source directory and execute the following command. + +```bash +./komodod & +``` + +Use the getinfo method, as before, while waiting until the blockchain syncs. + +```bash +./komodo-cli getinfo +``` + +## Start Testing + + + Key Information for this Tutorial + + The following key information is used throughout this tutorial. Refer back to this content as often as needed. + + * KMD token (tokenid): 1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1 + * Oracle (oracletxid): a6a59fbdc0ba8b138a4d14ff334a533f0358144091aa999ef45fd7498ab4189a + * Gateways (bindtxid): 50384e7668bd6908d8e0b67f1450c56f017186d802b1065c3258302a30b5adb2 + * Faucet: 7bc2dafc4d71c7e178b3a2a89e7ddc894cb14dbeff5937fa869915adf1af5108 + * Pegs (pegstxid): a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 + + + + The types of transactions performed in this tutorial require at least one confirmation from the network before the user should proceed to the next step in the outline. + + When performing cross-chain operations, the user may need to wait for two or three confirmations on the source chain before any related activity will appear on the destination chain. + + +### Deposit KMD in the Associated USDKTEST Gateways Address + +Execute the following command to discover the address associated with the Gateways Module. + +```bash +./komodo-cli -ac_name=USDKTEST gatewaysinfo 50384e7668bd6908d8e0b67f1450c56f017186d802b1065c3258302a30b5adb2 +``` + +Response: + +```json +{ + "result": "success", + "name": "Gateways", + "M": 2, + "N": 2, + "pubkeys": [ + "038814d60d99a594b4b1092247df4384bc21a50733d3acd0e29499e5f03737374d", + "023a447741707e95bc889fbbb08295d402332217075752bd1bb3999b092e4753ab" + ], + "coin": "KMD", + "oracletxid": "a6a59fbdc0ba8b138a4d14ff334a533f0358144091aa999ef45fd7498ab4189a", + "taddr": 0, + "prefix": 60, + "prefix2": 85, + "wiftype": 188, + "deposit": "bPFkXSYYYDWBLbp8AxfY5KKGgxt5RPfN9p", + "tokenid": "1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1", + "totalsupply": "100000.00000000", + "remaining": "99999.86000000", + "issued": "0.14000000" +} +``` + +The `deposit` address is `bPFkXSYYYDWBLbp8AxfY5KKGgxt5RPfN9p`. + +Go to the `KMD` chain and execute one transaction that sends a few `KMD` coins to two addresses. + +The first address is the address above, and this should receive the majority of the `KMD` sent in this transaction. + +The second address is the address corresponding to the tutorial user's `pubkey` used to launch the `USDKTEST` Smart Chain. This second address requires only a small amount of `KMD` (a few satoshis); this part of the transaction creates a marker that indicates to the Gateways Module the owner of the `KMD` funds. + +The [z\_sendmany](/smart-chains/api/wallet/#z-sendmany) allows the user to send coins to two addresses in a single address, as follows. + +```bash +./komodo-cli z_sendmany "FROM_ADDRESS" '[{"address":"ADDRESS_CORRESPONDING_TO_USER_PUBLIC_KEY","amount":SMALL_MARKER_AMOUNT},{"address":"GATEWAYS_MULTISIG_ADDRESS","amount":MAIN_AMOUNT_TO_DEPOSIT}]' +``` + +Observe the following example. + +```bash +./komodo-cli z_sendmany "RSVF6SecrtU1ppBGPm3SyNw2D8nSpFcA57" '[{"address":"RFmQiF4Zbzxchv9AG6dw6ZaX8PbrA8FXAb","amount":0.0001},{"address":"bPFkXSYYYDWBLbp8AxfY5KKGgxt5RPfN9p","amount":0.01}]' +``` + +#### Obtain the txid of the Deposit Transaction + +The [z\_sendmany](/smart-chains/api/wallet/#z-sendmany) returns an operation id, `opid`. Use this `opid` to obtain the `txid` of the transaction. + +(Alternatively, check the website [explorer](https://kmdexplorer.io/) for the `txid` by searching for any of the addresses associated with the transaction and searching for the most recent transaction.) + +Use the `opid` as follows to obtain the `txid` of the transaction. + +```bash +./komodo-cli z_getoperationstatus '["opid-4b661588-9924-47ba-bbba-4884eff36395"]' +``` + +Output: + +```json +[ + { + "id": "opid-4b661588-9924-47ba-bbba-4884eff36395", + "status": "success", + "creation_time": 1573737131, + "result": { + "txid": "5569e66859a8269b3b7a512ac66a42b1a4d375bb404fc73abaf2faf3080ec4af" + }, + "execution_secs": 0.009735896000000001, + "method": "z_sendmany", + "params": { + "fromaddress": "RSVF6SecrtU1ppBGPm3SyNw2D8nSpFcA57", + "amounts": [ + { + "address": "RFmQiF4Zbzxchv9AG6dw6ZaX8PbrA8FXAb", + "amount": 0.0001 + }, + { + "address": "bPFkXSYYYDWBLbp8AxfY5KKGgxt5RPfN9p", + "amount": 0.01 + } + ], + "minconf": 1, + "fee": 0.0001 + } + } +] +``` + +## Wait for the Deposit Transaction to Reach the Oracle + +#### Wait for the Deposit Transaction to be Mined + +Before the transaction can reach the Oracle, a miner on the `KMD` chain must mine the transaction. + +Use the [getrawmempool](/smart-chains/api/blockchain/#getrawmempool) method to obtain a list of transactions waiting to be mined and search for the `txid` of the deposit transaction. If the `txid` is not there, a miner has mined the transaction. + +```bash +./komodo-cli getrawmempool +``` + +Once the transaction is mined, use the [getrawtransaction](/smart-chains/api/rawtransactions/#getrawtransaction) method to find the block height at which the transaction was mined. + +In the following command, replace the text `` with the deposit `txid` retrieved earlier. + +```bash +./komodo-cli getrawtransaction "" 1 +``` + +From the response, take note of the value associated with the `height` key. The `txid` transaction was mined at this height. + +#### Observe the txid Reach the Oracle + +Check whether the block header associated with the `KMD` block of height `height` has been submitted to the Oracle on the `USDKTEST` chain. + +Find the pubkey of the publisher associated with the Token, Gateway, and Peg using the [tokeninfo](/antara/api/tokens/#tokeninfo) method. + +```bash +./komodo-cli -ac_name=USDKTEST tokeninfo 1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1 +``` + +Take note of the value of the `owner` key in the response. This is the pubkey of the publisher. + +Use the [oraclesinfo](/antara/api/oracles/#oraclesinfo) method to find the baton address for this publiser. + +```bash +./komodo-cli -ac_name=USDKTEST oraclesinfo a6a59fbdc0ba8b138a4d14ff334a533f0358144091aa999ef45fd7498ab4189a +``` + +Among the registered publishers in the response, notice that there is a publisher whose pubkey matches the one we took note from the `tokeninfo` call. The value of the key named `baton` is needed to get the past samples published by this publisher. + +In the following command, replace the text `` with the `baton` from the previous step. + +```bash +./komodo-cli -ac_name=USDKTEST oraclessamples a6a59fbdc0ba8b138a4d14ff334a533f0358144091aa999ef45fd7498ab4189a 5 +``` + +This returns the `5` latest data points published by the publisher associated with the Peg system. + +Note the block height in the returned data points. Wait until the highest block height is `>=` greater than or equal to the block height of the deposit transaction discovered earlier in the tutorial. (This is the process of transferring information between the `KMD` and `USDKTEST` chains.) + +### Inform the Gateways Module and Claim the Tokenized KMD + +Use the [gatewaysdeposit](/antara/api/gateways/#gatewaysdeposit) method to inform the Gateways Module of the deposit. + +Structure of the command to be executed: + +`gatewaysdeposit bindtxid height coin cointxid claimvout deposithex proof destpub amount` + +#### Details + +* `gatewaysdeposit` — The name of the method, submitted as-is +* `bindtxid` — The Gateway's `bindtxid` (see above) +* `height` — The `height` of the block in which the deposit `txid` was confirmed in the earlier step +* `coin` — Ticker of the `coin` deposited (`KMD` in this example) +* `cointxid` — `txid` of the deposit +* `claimvout` — The marker utxo's vout number in the external deposit transaction; this value is always `0` when the `z_sendmany` method is used, as shown in this tutorial +* `deposithex` — The hex value from `gettransaction` call for the deposited `txid` (the method for retrieving this value is shown in the following section) +* `proof` — The `proof` value returned from the `gettxoutproof` method using the deposit `txid` (the method for retrieving this value is shown in the following section) +* `destpub` — The user's `pubkey` used to launch the `USDKTEST` Smart Chain +* `amount` — The `amount` of coin (`KMD`) deposited + +The following commands retrieve the missing information. + +#### deposithex + +The following command returns the `deposithex` value. + +```bash +./komodo-cli getrawtransaction 5569e66859a8269b3b7a512ac66a42b1a4d375bb404fc73abaf2faf3080ec4af +``` + +Response: + +``` +0400008085202f89010cacb0895bbd5cbbe12a13875c06dac59ad6154780df59d86b28d1da0d64c3c5000000006b483045022100cabf2fc63cebf2eecb186e92053da1d4cebf984980ca645ac050b1fb49e0fc43022070f59307d8f442c295dea500d93a4545a650f1b80d06dab9154562af7c3a28c1012102decc2e49c24ca9f06b96665e8e39836ea1d8c73671166fa6ee917b4bcb307b44ffffffff0310270000000000001976a9144726f2838fc4d6ac66615e10604e18926e9b556e88ac40420f000000000017a9147374f811b053e81a4b4e6e282a2421aaf170afaa8798db2d36000000001976a91408ba4152fe80ffc33f805b166ec9c03c288109b488ac6f52cd5d87b118000000000000000000000000 +``` + +#### proof + +Use the [gettxoutproof](/smart-chains/api/blockchain/#gettxoutproof) method with the deposit `txid`. This returns the `proof` as a hex value. + +```bash +./komodo-cli gettxoutproof '["5569e66859a8269b3b7a512ac66a42b1a4d375bb404fc73abaf2faf3080ec4af"]' +``` + +Response: + +``` +0400000012a703d96b522f36fe13711c96de92b3f17bdbd41eda1a6753e2cd22924c1b0e47dd0fb69db925741977975a5803d8c885c72651b5c0427685e20e16cba73a43a2d8a734eb73a4dc734072dbfd12406f1e7121bfe0e3d6c10922495c44e5cc1cba52cd5dddaf001dffef8831000000000000b22a0000000000000200000000000000000000000000fd40050029a91e2967f03d92e838d3bf73067ed2431bde7f23432431f5d41ef6bd4245f0216b3b9a389d3f8c0813f27547948aec070a0302892468513f07653a83ac3a8c9a373cf12a4ddcb473f92d350417081a7c3696027f82781522fd39ac95449a24bfebf30ae39c328913e777ddca29a3d5b6b15374e1b84e09c9d2af243404e800ed03c3ec32dee990fa10d2b61d43db9987760fb169841e6cc985c6d651a4be3cd9f60cded6232e03f610267e1ed8873a5580c40c07353b0440398032251401ad3063d117d1ba83e674782f65e6d7b525691637434d0c0a0cd758c26b8be9fce02afdc81b6d4a2733432193242135d58d9762874d2d26ac85fbe43d0d324b512ac8012756e68100ce76b9b8bb761053501ea99224b88b66f8c86f236c23d8e0b9ca1ad9000c0e5fbf34a583c245fd9942e94c547345a62731a61a17bf895d2c17dcbb647ce2b7f3e29e5264c01e6d7300d7b9c9881c08e7d5ec71e3adb47de2061513094f13d654d22c502f596225b22ff05d457e479e9895ad05eecb63f71697639b5510e79a9973b5d8561144e41773a8d3e40eb10d5fc352db2e31ed555a8beb8a830aea6e654414a9853dfab20d37300fb0a776d5ccef137cd379ce98204728d7f2117111a59ead081894330faa17677889216b4c3d54c8a97f189296465ebcb739f61b8f53cf8ad6ced60d924b78d0677c3d1d16ab0fa1e0b94c6176d5f12617f6de5e665a99dbd8e84814f53d3fa0ccc383afa5d1cd6ac664bd27c44f0f4620344aacd78b8f0e96b8c853a0ceeafe35d6b338b5338e959b26a710bb3cdc9347fae575da0fae720eb312416cee371cf827cf7875edeb71da95bf07d864a812ffa8c4ddec2b87cf60f3bd2f636306b040976d0f1591a401fecdc304bce3754bd8d8fea5649e93da601995138c8c0bc69d44bc96ad786dc30e5ea13698c900c553d2c01972ad1ffce071a2980271c3525e932508f1f955bca7dee3e94997f8f6c92e4ef1447a3c47053563940ea4b88987fdb0ce0a7ddd8ea2bf375922297947ea8bb18985f6bbe3eab2d03f12f6687f911b12c7ce2b9050995523f0f23a03984f15cfc6785bd92af3ad60daac650ff3a718183967665f92b17eaf5d1459d2eb8255b94b0bd1f279aa18a04a87339941ee4cf11f31c357f31b9ff54858fb43085ebfc7b9868001bbbcd126dfcfeff478063fccde8736c15d1bb16108f1d710aad0694dffb181cc4e57f2b5d00276c18c19ccbacd7096be13a8fdf2c280cd237cbc46466c2e33cd745b465c60c1fdae6399b326ccf9e6164ff24021fce569dc8b6df8dfd26406906f1b25656f37a10626f153ff3239a8cfd35664155cb92ac54205ae517731afa77a86627177435cf5cb4371ab3a35fc99d0fc4731db98fb2ac959dc3757053ff6c41e5db1dc6da501456734a6155287cdc50038f2c43b74acfb683436510e0c6b3e1a0acfbf00663978d88ede7802b5703b05107dfb90a05ae78c9bb62375c4c6e591d9b7a35d2430066e8f528af96c32c2645566305387023dcd4a091ec0ec1bd4a454cc87f17426a65c1543759a7b503129aab79ed9e4b6efcb951da7f00c42d31cda7e4511f164e037762a63ebd2c617195f455687197bdc9f51cc26126ae291d3b0a4578bb8d6d386ac65b5859403bfde32cb619bb7f63f9c100f6b29a771837e3e1f06c83eccd5c2b3ca4d5af1ee5fc42fa4de6aa778402cf72a55e64cd2c5768862f2a65ec24a63da1946092e5bc5789a91cfccd4a553a3eeff0620f3ba53622e1513b6d59babb509a21516a6e9bb5657a6c4ff9a9423a65d555b9236caa510879d3ce809572db65cefa31783a5b5fcf0e6b9e44662536877f96e5e7bfce6593f912611095e905dcb5ef443b626e585a9a056e1d70900000005752526306830c6259c1659fa8ca3bfd85fa782c17efd04ec51cf7b13cc93de02afc40e08f3faf2ba3ac74f40bb75d3a4b1426ac62a517a3b9b26a85968e66955227fdec6d08be9fa88128f0d3c0681a5ba271ae5e27cfa60daa95e938c02f80da2499fa7619612a9acc3398f993475d4b981579f881f39adc29d1beb976be1c02e4e1bb76d33a81fa5f9065c8945a6a7aa2ceed88276ea9723c80bbb314ef89f023700 +``` + +#### Call the gatewaysdeposit Method + +Execute the [gatewaysdeposit](/antara/api/gateways/#gatewaysdeposit) method using the acquired information. Observe the following example as necessary. + +```bash +./komodo-cli -ac_name=USDKTEST gatewaysdeposit 50384e7668bd6908d8e0b67f1450c56f017186d802b1065c3258302a30b5adb2 1618112 KMD 5569e66859a8269b3b7a512ac66a42b1a4d375bb404fc73abaf2faf3080ec4af 0 0400008085202f89010cacb0895bbd5cbbe12a13875c06dac59ad6154780df59d86b28d1da0d64c3c5000000006b483045022100cabf2fc63cebf2eecb186e92053da1d4cebf984980ca645ac050b1fb49e0fc43022070f59307d8f442c295dea500d93a4545a650f1b80d06dab9154562af7c3a28c1012102decc2e49c24ca9f06b96665e8e39836ea1d8c73671166fa6ee917b4bcb307b44ffffffff0310270000000000001976a9144726f2838fc4d6ac66615e10604e18926e9b556e88ac40420f000000000017a9147374f811b053e81a4b4e6e282a2421aaf170afaa8798db2d36000000001976a91408ba4152fe80ffc33f805b166ec9c03c288109b488ac6f52cd5d87b118000000000000000000000000 0400000012a703d96b522f36fe13711c96de92b3f17bdbd41eda1a6753e2cd22924c1b0e47dd0fb69db925741977975a5803d8c885c72651b5c0427685e20e16cba73a43a2d8a734eb73a4dc734072dbfd12406f1e7121bfe0e3d6c10922495c44e5cc1cba52cd5dddaf001dffef8831000000000000b22a0000000000000200000000000000000000000000fd40050029a91e2967f03d92e838d3bf73067ed2431bde7f23432431f5d41ef6bd4245f0216b3b9a389d3f8c0813f27547948aec070a0302892468513f07653a83ac3a8c9a373cf12a4ddcb473f92d350417081a7c3696027f82781522fd39ac95449a24bfebf30ae39c328913e777ddca29a3d5b6b15374e1b84e09c9d2af243404e800ed03c3ec32dee990fa10d2b61d43db9987760fb169841e6cc985c6d651a4be3cd9f60cded6232e03f610267e1ed8873a5580c40c07353b0440398032251401ad3063d117d1ba83e674782f65e6d7b525691637434d0c0a0cd758c26b8be9fce02afdc81b6d4a2733432193242135d58d9762874d2d26ac85fbe43d0d324b512ac8012756e68100ce76b9b8bb761053501ea99224b88b66f8c86f236c23d8e0b9ca1ad9000c0e5fbf34a583c245fd9942e94c547345a62731a61a17bf895d2c17dcbb647ce2b7f3e29e5264c01e6d7300d7b9c9881c08e7d5ec71e3adb47de2061513094f13d654d22c502f596225b22ff05d457e479e9895ad05eecb63f71697639b5510e79a9973b5d8561144e41773a8d3e40eb10d5fc352db2e31ed555a8beb8a830aea6e654414a9853dfab20d37300fb0a776d5ccef137cd379ce98204728d7f2117111a59ead081894330faa17677889216b4c3d54c8a97f189296465ebcb739f61b8f53cf8ad6ced60d924b78d0677c3d1d16ab0fa1e0b94c6176d5f12617f6de5e665a99dbd8e84814f53d3fa0ccc383afa5d1cd6ac664bd27c44f0f4620344aacd78b8f0e96b8c853a0ceeafe35d6b338b5338e959b26a710bb3cdc9347fae575da0fae720eb312416cee371cf827cf7875edeb71da95bf07d864a812ffa8c4ddec2b87cf60f3bd2f636306b040976d0f1591a401fecdc304bce3754bd8d8fea5649e93da601995138c8c0bc69d44bc96ad786dc30e5ea13698c900c553d2c01972ad1ffce071a2980271c3525e932508f1f955bca7dee3e94997f8f6c92e4ef1447a3c47053563940ea4b88987fdb0ce0a7ddd8ea2bf375922297947ea8bb18985f6bbe3eab2d03f12f6687f911b12c7ce2b9050995523f0f23a03984f15cfc6785bd92af3ad60daac650ff3a718183967665f92b17eaf5d1459d2eb8255b94b0bd1f279aa18a04a87339941ee4cf11f31c357f31b9ff54858fb43085ebfc7b9868001bbbcd126dfcfeff478063fccde8736c15d1bb16108f1d710aad0694dffb181cc4e57f2b5d00276c18c19ccbacd7096be13a8fdf2c280cd237cbc46466c2e33cd745b465c60c1fdae6399b326ccf9e6164ff24021fce569dc8b6df8dfd26406906f1b25656f37a10626f153ff3239a8cfd35664155cb92ac54205ae517731afa77a86627177435cf5cb4371ab3a35fc99d0fc4731db98fb2ac959dc3757053ff6c41e5db1dc6da501456734a6155287cdc50038f2c43b74acfb683436510e0c6b3e1a0acfbf00663978d88ede7802b5703b05107dfb90a05ae78c9bb62375c4c6e591d9b7a35d2430066e8f528af96c32c2645566305387023dcd4a091ec0ec1bd4a454cc87f17426a65c1543759a7b503129aab79ed9e4b6efcb951da7f00c42d31cda7e4511f164e037762a63ebd2c617195f455687197bdc9f51cc26126ae291d3b0a4578bb8d6d386ac65b5859403bfde32cb619bb7f63f9c100f6b29a771837e3e1f06c83eccd5c2b3ca4d5af1ee5fc42fa4de6aa778402cf72a55e64cd2c5768862f2a65ec24a63da1946092e5bc5789a91cfccd4a553a3eeff0620f3ba53622e1513b6d59babb509a21516a6e9bb5657a6c4ff9a9423a65d555b9236caa510879d3ce809572db65cefa31783a5b5fcf0e6b9e44662536877f96e5e7bfce6593f912611095e905dcb5ef443b626e585a9a056e1d70900000005752526306830c6259c1659fa8ca3bfd85fa782c17efd04ec51cf7b13cc93de02afc40e08f3faf2ba3ac74f40bb75d3a4b1426ac62a517a3b9b26a85968e66955227fdec6d08be9fa88128f0d3c0681a5ba271ae5e27cfa60daa95e938c02f80da2499fa7619612a9acc3398f993475d4b981579f881f39adc29d1beb976be1c02e4e1bb76d33a81fa5f9065c8945a6a7aa2ceed88276ea9723c80bbb314ef89f023700 0217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06 0.01 +``` + +This method returns a response that has a hex value that must be broadcast. + +Response: + +```json +{ + "hex": "0400008085202f890201cbaa60fc93f3e7005f6622999c4abb7258931c3869a6004282014e229358250000000049483045022100f75b4b3dd2a3cac01d389e2957f7337889129f31453a3bf67aa3a6b807417cf0022076ccbb1fd65a6606a2b1e8a816e90edd66d17e6e336755043ab109a1d6cc07f901ffffffff001f6f50578b79a46d6285d9b3c6668104bc1101b7763a33a5e0784b2933fbd7000000004847304402203a76e7c860454b47d653fe9c306a5c53c3b5bda3c68d3c58af89f3754c1d91f3022033c144d67703cd0a1313b31d241bba3eb925200806783cd2557ec18d4669401501ffffffff031027000000000000302ea22c80207f6d7586423d9d8f716988f94728224df39bb0c98bb75655d22a778aea922a208103120c008203000401cc1027000000000000232102afc40e08f3faf2ba3ac74f40bb75d3a4b1426ac62a517a3b9b26a85968e66955ac0000000000000000fd67096a4d6309f144034b4d44b2adb5302a3058325c06b102d88671016fc550147fb6e0d80869bd68764e38500121023a447741707e95bc889fbbb08295d402332217075752bd1bb3999b092e4753ab01524571b97a2bf1b546379e59479430ca188f274215b411e90d2cd51295b12b98c0b01800afc40e08f3faf2ba3ac74f40bb75d3a4b1426ac62a517a3b9b26a85968e6695500000000fd2a023034303030303830383532303266383930313063616362303839356262643563626265313261313338373563303664616335396164363135343738306466353964383662323864316461306436346333633530303030303030303662343833303435303232313030636162663266633633636562663265656362313836653932303533646131643463656266393834393830636136343561633035306231666234396530666334333032323037306635393330376438663434326332393564656135303064393361343534356136353066316238306430366461623931353435363261663763336132386331303132313032646563633265343963323463613966303662393636363565386533393833366561316438633733363731313636666136656539313762346263623330376234346666666666666666303331303237303030303030303030303030313937366139313434373236663238333866633464366163363636313565313036303465313839323665396235353665383861633430343230663030303030303030303031376139313437333734663831316230353365383161346234653665323832613234323161616631373061666161383739386462326433363030303030303030313937366139313430386261343135326665383066666333336638303562313636656339633033633238383130396234383861633666353263643564383762313138303030303030303030303030303030303030303030303030fd77060400000012a703d96b522f36fe13711c96de92b3f17bdbd41eda1a6753e2cd22924c1b0e47dd0fb69db925741977975a5803d8c885c72651b5c0427685e20e16cba73a43a2d8a734eb73a4dc734072dbfd12406f1e7121bfe0e3d6c10922495c44e5cc1cba52cd5dddaf001dffef8831000000000000b22a0000000000000200000000000000000000000000fd40050029a91e2967f03d92e838d3bf73067ed2431bde7f23432431f5d41ef6bd4245f0216b3b9a389d3f8c0813f27547948aec070a0302892468513f07653a83ac3a8c9a373cf12a4ddcb473f92d350417081a7c3696027f82781522fd39ac95449a24bfebf30ae39c328913e777ddca29a3d5b6b15374e1b84e09c9d2af243404e800ed03c3ec32dee990fa10d2b61d43db9987760fb169841e6cc985c6d651a4be3cd9f60cded6232e03f610267e1ed8873a5580c40c07353b0440398032251401ad3063d117d1ba83e674782f65e6d7b525691637434d0c0a0cd758c26b8be9fce02afdc81b6d4a2733432193242135d58d9762874d2d26ac85fbe43d0d324b512ac8012756e68100ce76b9b8bb761053501ea99224b88b66f8c86f236c23d8e0b9ca1ad9000c0e5fbf34a583c245fd9942e94c547345a62731a61a17bf895d2c17dcbb647ce2b7f3e29e5264c01e6d7300d7b9c9881c08e7d5ec71e3adb47de2061513094f13d654d22c502f596225b22ff05d457e479e9895ad05eecb63f71697639b5510e79a9973b5d8561144e41773a8d3e40eb10d5fc352db2e31ed555a8beb8a830aea6e654414a9853dfab20d37300fb0a776d5ccef137cd379ce98204728d7f2117111a59ead081894330faa17677889216b4c3d54c8a97f189296465ebcb739f61b8f53cf8ad6ced60d924b78d0677c3d1d16ab0fa1e0b94c6176d5f12617f6de5e665a99dbd8e84814f53d3fa0ccc383afa5d1cd6ac664bd27c44f0f4620344aacd78b8f0e96b8c853a0ceeafe35d6b338b5338e959b26a710bb3cdc9347fae575da0fae720eb312416cee371cf827cf7875edeb71da95bf07d864a812ffa8c4ddec2b87cf60f3bd2f636306b040976d0f1591a401fecdc304bce3754bd8d8fea5649e93da601995138c8c0bc69d44bc96ad786dc30e5ea13698c900c553d2c01972ad1ffce071a2980271c3525e932508f1f955bca7dee3e94997f8f6c92e4ef1447a3c47053563940ea4b88987fdb0ce0a7ddd8ea2bf375922297947ea8bb18985f6bbe3eab2d03f12f6687f911b12c7ce2b9050995523f0f23a03984f15cfc6785bd92af3ad60daac650ff3a718183967665f92b17eaf5d1459d2eb8255b94b0bd1f279aa18a04a87339941ee4cf11f31c357f31b9ff54858fb43085ebfc7b9868001bbbcd126dfcfeff478063fccde8736c15d1bb16108f1d710aad0694dffb181cc4e57f2b5d00276c18c19ccbacd7096be13a8fdf2c280cd237cbc46466c2e33cd745b465c60c1fdae6399b326ccf9e6164ff24021fce569dc8b6df8dfd26406906f1b25656f37a10626f153ff3239a8cfd35664155cb92ac54205ae517731afa77a86627177435cf5cb4371ab3a35fc99d0fc4731db98fb2ac959dc3757053ff6c41e5db1dc6da501456734a6155287cdc50038f2c43b74acfb683436510e0c6b3e1a0acfbf00663978d88ede7802b5703b05107dfb90a05ae78c9bb62375c4c6e591d9b7a35d2430066e8f528af96c32c2645566305387023dcd4a091ec0ec1bd4a454cc87f17426a65c1543759a7b503129aab79ed9e4b6efcb951da7f00c42d31cda7e4511f164e037762a63ebd2c617195f455687197bdc9f51cc26126ae291d3b0a4578bb8d6d386ac65b5859403bfde32cb619bb7f63f9c100f6b29a771837e3e1f06c83eccd5c2b3ca4d5af1ee5fc42fa4de6aa778402cf72a55e64cd2c5768862f2a65ec24a63da1946092e5bc5789a91cfccd4a553a3eeff0620f3ba53622e1513b6d59babb509a21516a6e9bb5657a6c4ff9a9423a65d555b9236caa510879d3ce809572db65cefa31783a5b5fcf0e6b9e44662536877f96e5e7bfce6593f912611095e905dcb5ef443b626e585a9a056e1d70900000005752526306830c6259c1659fa8ca3bfd85fa782c17efd04ec51cf7b13cc93de02afc40e08f3faf2ba3ac74f40bb75d3a4b1426ac62a517a3b9b26a85968e66955227fdec6d08be9fa88128f0d3c0681a5ba271ae5e27cfa60daa95e938c02f80da2499fa7619612a9acc3398f993475d4b981579f881f39adc29d1beb976be1c02e4e1bb76d33a81fa5f9065c8945a6a7aa2ceed88276ea9723c80bbb314ef89f023700210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0640420f0000000000000000006a9900000000000000000000000000", + "result": "success" +} +``` + +Use the [sendrawtransaction](/smart-chains/api/rawtransactions/#sendrawtransaction) method to broadcast the hex value from the response. + +```bash +./komodo-cli -ac_name=USDKTEST sendrawtransaction 0400008085202f890201cbaa60fc93f3e7005f6622999c4abb7258931c3869a6004282014e229358250000000049483045022100f75b4b3dd2a3cac01d389e2957f7337889129f31453a3bf67aa3a6b807417cf0022076ccbb1fd65a6606a2b1e8a816e90edd66d17e6e336755043ab109a1d6cc07f901ffffffff001f6f50578b79a46d6285d9b3c6668104bc1101b7763a33a5e0784b2933fbd7000000004847304402203a76e7c860454b47d653fe9c306a5c53c3b5bda3c68d3c58af89f3754c1d91f3022033c144d67703cd0a1313b31d241bba3eb925200806783cd2557ec18d4669401501ffffffff031027000000000000302ea22c80207f6d7586423d9d8f716988f94728224df39bb0c98bb75655d22a778aea922a208103120c008203000401cc1027000000000000232102afc40e08f3faf2ba3ac74f40bb75d3a4b1426ac62a517a3b9b26a85968e66955ac0000000000000000fd67096a4d6309f144034b4d44b2adb5302a3058325c06b102d88671016fc550147fb6e0d80869bd68764e38500121023a447741707e95bc889fbbb08295d402332217075752bd1bb3999b092e4753ab01524571b97a2bf1b546379e59479430ca188f274215b411e90d2cd51295b12b98c0b01800afc40e08f3faf2ba3ac74f40bb75d3a4b1426ac62a517a3b9b26a85968e6695500000000fd2a023034303030303830383532303266383930313063616362303839356262643563626265313261313338373563303664616335396164363135343738306466353964383662323864316461306436346333633530303030303030303662343833303435303232313030636162663266633633636562663265656362313836653932303533646131643463656266393834393830636136343561633035306231666234396530666334333032323037306635393330376438663434326332393564656135303064393361343534356136353066316238306430366461623931353435363261663763336132386331303132313032646563633265343963323463613966303662393636363565386533393833366561316438633733363731313636666136656539313762346263623330376234346666666666666666303331303237303030303030303030303030313937366139313434373236663238333866633464366163363636313565313036303465313839323665396235353665383861633430343230663030303030303030303031376139313437333734663831316230353365383161346234653665323832613234323161616631373061666161383739386462326433363030303030303030313937366139313430386261343135326665383066666333336638303562313636656339633033633238383130396234383861633666353263643564383762313138303030303030303030303030303030303030303030303030fd77060400000012a703d96b522f36fe13711c96de92b3f17bdbd41eda1a6753e2cd22924c1b0e47dd0fb69db925741977975a5803d8c885c72651b5c0427685e20e16cba73a43a2d8a734eb73a4dc734072dbfd12406f1e7121bfe0e3d6c10922495c44e5cc1cba52cd5dddaf001dffef8831000000000000b22a0000000000000200000000000000000000000000fd40050029a91e2967f03d92e838d3bf73067ed2431bde7f23432431f5d41ef6bd4245f0216b3b9a389d3f8c0813f27547948aec070a0302892468513f07653a83ac3a8c9a373cf12a4ddcb473f92d350417081a7c3696027f82781522fd39ac95449a24bfebf30ae39c328913e777ddca29a3d5b6b15374e1b84e09c9d2af243404e800ed03c3ec32dee990fa10d2b61d43db9987760fb169841e6cc985c6d651a4be3cd9f60cded6232e03f610267e1ed8873a5580c40c07353b0440398032251401ad3063d117d1ba83e674782f65e6d7b525691637434d0c0a0cd758c26b8be9fce02afdc81b6d4a2733432193242135d58d9762874d2d26ac85fbe43d0d324b512ac8012756e68100ce76b9b8bb761053501ea99224b88b66f8c86f236c23d8e0b9ca1ad9000c0e5fbf34a583c245fd9942e94c547345a62731a61a17bf895d2c17dcbb647ce2b7f3e29e5264c01e6d7300d7b9c9881c08e7d5ec71e3adb47de2061513094f13d654d22c502f596225b22ff05d457e479e9895ad05eecb63f71697639b5510e79a9973b5d8561144e41773a8d3e40eb10d5fc352db2e31ed555a8beb8a830aea6e654414a9853dfab20d37300fb0a776d5ccef137cd379ce98204728d7f2117111a59ead081894330faa17677889216b4c3d54c8a97f189296465ebcb739f61b8f53cf8ad6ced60d924b78d0677c3d1d16ab0fa1e0b94c6176d5f12617f6de5e665a99dbd8e84814f53d3fa0ccc383afa5d1cd6ac664bd27c44f0f4620344aacd78b8f0e96b8c853a0ceeafe35d6b338b5338e959b26a710bb3cdc9347fae575da0fae720eb312416cee371cf827cf7875edeb71da95bf07d864a812ffa8c4ddec2b87cf60f3bd2f636306b040976d0f1591a401fecdc304bce3754bd8d8fea5649e93da601995138c8c0bc69d44bc96ad786dc30e5ea13698c900c553d2c01972ad1ffce071a2980271c3525e932508f1f955bca7dee3e94997f8f6c92e4ef1447a3c47053563940ea4b88987fdb0ce0a7ddd8ea2bf375922297947ea8bb18985f6bbe3eab2d03f12f6687f911b12c7ce2b9050995523f0f23a03984f15cfc6785bd92af3ad60daac650ff3a718183967665f92b17eaf5d1459d2eb8255b94b0bd1f279aa18a04a87339941ee4cf11f31c357f31b9ff54858fb43085ebfc7b9868001bbbcd126dfcfeff478063fccde8736c15d1bb16108f1d710aad0694dffb181cc4e57f2b5d00276c18c19ccbacd7096be13a8fdf2c280cd237cbc46466c2e33cd745b465c60c1fdae6399b326ccf9e6164ff24021fce569dc8b6df8dfd26406906f1b25656f37a10626f153ff3239a8cfd35664155cb92ac54205ae517731afa77a86627177435cf5cb4371ab3a35fc99d0fc4731db98fb2ac959dc3757053ff6c41e5db1dc6da501456734a6155287cdc50038f2c43b74acfb683436510e0c6b3e1a0acfbf00663978d88ede7802b5703b05107dfb90a05ae78c9bb62375c4c6e591d9b7a35d2430066e8f528af96c32c2645566305387023dcd4a091ec0ec1bd4a454cc87f17426a65c1543759a7b503129aab79ed9e4b6efcb951da7f00c42d31cda7e4511f164e037762a63ebd2c617195f455687197bdc9f51cc26126ae291d3b0a4578bb8d6d386ac65b5859403bfde32cb619bb7f63f9c100f6b29a771837e3e1f06c83eccd5c2b3ca4d5af1ee5fc42fa4de6aa778402cf72a55e64cd2c5768862f2a65ec24a63da1946092e5bc5789a91cfccd4a553a3eeff0620f3ba53622e1513b6d59babb509a21516a6e9bb5657a6c4ff9a9423a65d555b9236caa510879d3ce809572db65cefa31783a5b5fcf0e6b9e44662536877f96e5e7bfce6593f912611095e905dcb5ef443b626e585a9a056e1d70900000005752526306830c6259c1659fa8ca3bfd85fa782c17efd04ec51cf7b13cc93de02afc40e08f3faf2ba3ac74f40bb75d3a4b1426ac62a517a3b9b26a85968e66955227fdec6d08be9fa88128f0d3c0681a5ba271ae5e27cfa60daa95e938c02f80da2499fa7619612a9acc3398f993475d4b981579f881f39adc29d1beb976be1c02e4e1bb76d33a81fa5f9065c8945a6a7aa2ceed88276ea9723c80bbb314ef89f023700210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0640420f0000000000000000006a9900000000000000000000000000 +``` + +Output: + +``` +9e08b1c5ac37cbce997ceaa68d4ca2d1368b815e8de275bb54d5e230a1341b5f +``` + +This is the deposit `txid`. + +#### Claim the Tokenized KMD + +Use the [gatewaysclaim](/antara/api/gateways/) method to claim the tokenized `KMD` on the `USDKTEST` Smart Chain. + +Method structure: + +`gatewaysclaim bindtxid coin deposittxid destpub amount` + +#### Details + +* `gatewaysclaim` — The name of the method, executed as-is +* `bindtxid` — This is the creation txid of the Gateway; supplied at the beginning of the tutorial +* `coin` — Ticker of the `coin` deposited +* `deposittxid` — The `txid` returned from the `gatewaysdeposit` transaction +* `destpubkey` — The user pubkey used to launch the `USDKTEST` daemon +* `amount` — The `amount` deposited + +Observe the following example structure. + +```bash +./komodo-cli -ac_name=USDKTEST gatewaysclaim 50384e7668bd6908d8e0b67f1450c56f017186d802b1065c3258302a30b5adb2 KMD 9e08b1c5ac37cbce997ceaa68d4ca2d1368b815e8de275bb54d5e230a1341b5f 0217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06 0.01 +``` + +Output: + +```json +{ + "hex": "0400008085202f89028a91efc8a0073e1d2fd879d71ee5b3771f16ad307cdcf69d477400de679c879801000000804c7ea27ba077a26ba067a565802103ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb408140edb95c621f7cc2a57447c230e2c8750941fb747bb80cee91dc6cdc9cdf57342042b01dbef69d7dd7600e3b129d423f11615173cfa2f3f3c0cb303e0918c75e5ca100af038001f1af038001f2a10001ffffffff5f1b34a130e2d554bb75e28d5e818b36d1a24c8da6ea7c99cecb37acc5b1089e000000007b4c79a276a072a26ba067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e068140dbba871356bd3241c73baafd98c134385e156813bdce9c864058de920c3a24d66eb808c4a329e38552756172c0bd1d93bcfb870eec246cd8dd97b08637edaa18a100af038001f1a10001ffffffff0240420f0000000000302ea22c8020d62369afdb9fbe16bae7a6ac394333e9337ecc0b7671cda491df2fa82e48a20d8103120c008203000401cc0000000000000000ba6a4cb7f2741a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf101210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e061370f143b2adb5302a3058325c06b102d88671016fc550147fb6e0d80869bd68764e3850034b4d445f1b34a130e2d554bb75e28d5e818b36d1a24c8da6ea7c99cecb37acc5b1089e210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0640420f000000000000000000a29900000000000000000000000000", + "result": "success" +} +``` + +Broadcast the returned hex value using sendrawtransaction. + +```bash +./komodo-cli -ac_name=USDKTEST sendrawtransaction 0400008085202f89028a91efc8a0073e1d2fd879d71ee5b3771f16ad307cdcf69d477400de679c879801000000804c7ea27ba077a26ba067a565802103ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb408140edb95c621f7cc2a57447c230e2c8750941fb747bb80cee91dc6cdc9cdf57342042b01dbef69d7dd7600e3b129d423f11615173cfa2f3f3c0cb303e0918c75e5ca100af038001f1af038001f2a10001ffffffff5f1b34a130e2d554bb75e28d5e818b36d1a24c8da6ea7c99cecb37acc5b1089e000000007b4c79a276a072a26ba067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e068140dbba871356bd3241c73baafd98c134385e156813bdce9c864058de920c3a24d66eb808c4a329e38552756172c0bd1d93bcfb870eec246cd8dd97b08637edaa18a100af038001f1a10001ffffffff0240420f0000000000302ea22c8020d62369afdb9fbe16bae7a6ac394333e9337ecc0b7671cda491df2fa82e48a20d8103120c008203000401cc0000000000000000ba6a4cb7f2741a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf101210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e061370f143b2adb5302a3058325c06b102d88671016fc550147fb6e0d80869bd68764e3850034b4d445f1b34a130e2d554bb75e28d5e818b36d1a24c8da6ea7c99cecb37acc5b1089e210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0640420f000000000000000000a29900000000000000000000000000 +``` + +Output: + +``` +e38b3f2022364cb0f0b9b60e9b2d89bad0a3974206e783ed78f1f1b09fa0299c +``` + +#### Verify the Returned Tokenized KMD + +Use the tokeninfo method to check that the above commands result in a deposit in the tutorial user's account of the appropriate amount of tokenized `KMD`. + +```bash +./komodo-cli -ac_name=USDKTEST tokeninfo 1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1 +``` + +Output: + +```json +{ + "result": "success", + "tokenid": "1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1", + "owner": "038814d60d99a594b4b1092247df4384bc21a50733d3acd0e29499e5f03737374d", + "name": "KMD", + "supply": 10000000000000, + "description": "KMD_BTC,BTC_USD,*,1" +} +``` + +The description `"KMD_BTC,BTC_USD,*,1"` indicates to the Pegs modules the price to be considered. + +{/* Sidd: I don't understand what this means specifically. Can we please get more information here? gcharang: it is an artifact from the Prices module, "KMD_BTC,BTC_USD,*,1" is a synthetic price; it means (KMD/BTC)*(BTC/USD) which is equal to KMD/USD this system should be clear once I add the prices doc */} + +```bash +./komodo-cli -ac_name=USDKTEST tokenbalance 1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1 +``` + +Output: + +```json +{ + "result": "success", + "CCaddress": "RTcbFr8dH9dPGgGephMoDevHefndQQehxq", + "tokenid": "1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1", + "balance": 1000000 +} +``` + +### Exchange Tokenized KMD for USDK Coins + +Use the [pegsfund](/antara/api/pegs/#pegsfund) method to lock the tokenized `KMD`. + +```bash +./komodo-cli -ac_name=USDKTEST pegsfund a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1 0.01 +``` + +Output: + +```json +{ + "hex": "0400008085202f89024c386ef60103e74f339867bd7c38b7f187ceee842b8e57ab9a42a16b0721be23040000007b4c79a276a072a26ba067a565802103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece8140213fbd380d7905f770709725fe462e5f0a731eca4e56435c4b2f7c96d5b6201433e7c780d313795ddf9ae1d0b689b4f950af6e0e07dd9bcbc293b46f2a349ef4a100af038001eea10001ffffffff9c29a09fb0f1f178ed83e7064297a3d0ba892d9b0eb6b9f0b04c3622203f8be3000000007b4c79a276a072a26ba067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0681409a7fa29976f948038b77573fb1103836340ebbcdfbbba8dc852186be1666811c034adf2ec9d9515eb58f14df81925f46fb152b2964e8f392b70bafdfe3a8af83a100af038001f2a10001ffffffff051027000000000000302ea22c8020e39343ebe1b40dcc747d145f140983b38f230dcf7963f2b58051265c765f2efa81031210008203000401cc1027000000000000302ea22c8020d77058bfd93eebe366e1c82fc1475690fd290214ed43b8c9dd25374077b35cbe81031210008203000401cc40420f0000000000302ea22c802002bc3497bdabeac3d0c40ac845fa105685724d1b70c84bd6c5cef2ff4c353e7881032214008203000401cc3cdf993b00000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc0000000000000000c86a4cc5f2741a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf102210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e062103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece175cee46f7711371604618bcb04458f01c829527a012f459da3c21ff44ee34dbc89e53a9210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0640420f000000000040420f0000000000000000000000000000000000a79900000000000000000000000000", + "result": "success" +} +``` + +Broadcast the hex value. + +```bash +./komodo-cli -ac_name=USDKTEST sendrawtransaction 0400008085202f89024c386ef60103e74f339867bd7c38b7f187ceee842b8e57ab9a42a16b0721be23040000007b4c79a276a072a26ba067a565802103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece8140213fbd380d7905f770709725fe462e5f0a731eca4e56435c4b2f7c96d5b6201433e7c780d313795ddf9ae1d0b689b4f950af6e0e07dd9bcbc293b46f2a349ef4a100af038001eea10001ffffffff9c29a09fb0f1f178ed83e7064297a3d0ba892d9b0eb6b9f0b04c3622203f8be3000000007b4c79a276a072a26ba067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0681409a7fa29976f948038b77573fb1103836340ebbcdfbbba8dc852186be1666811c034adf2ec9d9515eb58f14df81925f46fb152b2964e8f392b70bafdfe3a8af83a100af038001f2a10001ffffffff051027000000000000302ea22c8020e39343ebe1b40dcc747d145f140983b38f230dcf7963f2b58051265c765f2efa81031210008203000401cc1027000000000000302ea22c8020d77058bfd93eebe366e1c82fc1475690fd290214ed43b8c9dd25374077b35cbe81031210008203000401cc40420f0000000000302ea22c802002bc3497bdabeac3d0c40ac845fa105685724d1b70c84bd6c5cef2ff4c353e7881032214008203000401cc3cdf993b00000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc0000000000000000c86a4cc5f2741a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf102210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e062103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece175cee46f7711371604618bcb04458f01c829527a012f459da3c21ff44ee34dbc89e53a9210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0640420f000000000040420f0000000000000000000000000000000000a79900000000000000000000000000 +``` + +Output: + +``` +298cfa125e1a38a7aa2a8da8282b017a45cd0c1dc70935712692c00abf48ba3f +``` + +Use the [pegsget](/antara/api/pegs/#pegsget) method to retrieve the `USDK` coins. + +```bash +./komodo-cli -ac_name=USDKTEST pegsget a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1 0.001 +``` + +Output: + +```json +{ + "hex": "0400008085202f8903b68353f713e1d70cf2fe4fa538de32a8723e603d507c8ee2d42277f3fd7334ad00ca9a3b0201e2ffffffff3fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c2900000000a74ca5a281a1a0819ca28194a067a565802103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece81402e06d560cac761ee7d7720f6ed0f307520fda7c66b2ac0d16cd3c34a33f004393f735429a7ad445a1c970723a7a9d173e1fcc62b54ed164dfb40f23542c9627da129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eea10001ffffffff3fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c2901000000a74ca5a281a1a0819ca28194a067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e068140152ff019e1e4346d450ab149f1ef9115ea84c9ff7c3bb60444a7e48eda0784a46ecefbf1a35f0062513033d9c3fce45a083f70b7ccc41103763c267598bcadcca129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eea10001ffffffff041027000000000000302ea22c8020e39343ebe1b40dcc747d145f140983b38f230dcf7963f2b58051265c765f2efa81031210008203000401cc1027000000000000302ea22c8020d77058bfd93eebe366e1c82fc1475690fd290214ed43b8c9dd25374077b35cbe81031210008203000401cca08601000000000023210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06ac0000000000000000fd22016a4d1e01e211b68353f713e1d70cf2fe4fa538de32a8723e603d507c8ee2d42277f3fd7334ad00000400008085202f89013fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c290000000000ffffffff01a086010000000000ab6a4ca8e28efefefe7f065045475343433e140a06d1f028a3abce516bd5d08ebfd860da116dfb0c3a22003b57f0809b5400f7711371604618bcb04458f01c829527a012f459da3c21ff44ee34dbc89e53a9f1eb0ab5bb63b9b36cd1a44d0a30f35d1c113efb5cf5fd4e549ae7f11297451a210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06a08601000000000040420f0000000000a08601000000000000000000b0990000000000000000000000000000000000000000000000000000000000000000", + "result": "success" +} +``` + +Broadcast the returned hex value. + +```bash +./komodo-cli -ac_name=USDKTEST sendrawtransaction 0400008085202f8903b68353f713e1d70cf2fe4fa538de32a8723e603d507c8ee2d42277f3fd7334ad00ca9a3b0201e2ffffffff3fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c2900000000a74ca5a281a1a0819ca28194a067a565802103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece81402e06d560cac761ee7d7720f6ed0f307520fda7c66b2ac0d16cd3c34a33f004393f735429a7ad445a1c970723a7a9d173e1fcc62b54ed164dfb40f23542c9627da129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eea10001ffffffff3fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c2901000000a74ca5a281a1a0819ca28194a067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e068140152ff019e1e4346d450ab149f1ef9115ea84c9ff7c3bb60444a7e48eda0784a46ecefbf1a35f0062513033d9c3fce45a083f70b7ccc41103763c267598bcadcca129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eea10001ffffffff041027000000000000302ea22c8020e39343ebe1b40dcc747d145f140983b38f230dcf7963f2b58051265c765f2efa81031210008203000401cc1027000000000000302ea22c8020d77058bfd93eebe366e1c82fc1475690fd290214ed43b8c9dd25374077b35cbe81031210008203000401cca08601000000000023210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06ac0000000000000000fd22016a4d1e01e211b68353f713e1d70cf2fe4fa538de32a8723e603d507c8ee2d42277f3fd7334ad00000400008085202f89013fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c290000000000ffffffff01a086010000000000ab6a4ca8e28efefefe7f065045475343433e140a06d1f028a3abce516bd5d08ebfd860da116dfb0c3a22003b57f0809b5400f7711371604618bcb04458f01c829527a012f459da3c21ff44ee34dbc89e53a9f1eb0ab5bb63b9b36cd1a44d0a30f35d1c113efb5cf5fd4e549ae7f11297451a210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06a08601000000000040420f0000000000a08601000000000000000000b0990000000000000000000000000000000000000000000000000000000000000000 +``` + +Output: + +``` +8f18ab623cb91c94ea27b16c455d98df1e057dd120341e54b453090a2c9c9adf +``` + +Examine the tutorial user's account history using the [pegsaccounthistory](/antara/api/pegs/#pegsaccounthistory) method. + +```bash +./komodo-cli -ac_name=USDKTEST pegsaccounthistory a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 +``` + +Output: + +```json +{ + "result": "success", + "name": "pegsaccounthistory", + "account history": [ + { + "action": "fund", + "amount": 1000000, + "accounttxid": "298cfa125e1a38a7aa2a8da8282b017a45cd0c1dc70935712692c00abf48ba3f", + "token": "KMD", + "deposit": 1000000, + "debt": 0 + }, + { + "action": "get", + "amount": 100000, + "accounttxid": "8f18ab623cb91c94ea27b16c455d98df1e057dd120341e54b453090a2c9c9adf", + "token": "KMD", + "deposit": 1000000, + "debt": 100000 + } + { + "action": "get", + "amount": 600000, + "accounttxid": "8e79ed0a76f359ba048563a0fa2a29ab88ab86b1895e8eff9718f348a04dd1f3", + "token": "KMD", + "deposit": 1000000, + "debt": 700000 + } + { + "action": "get", + "amount": 30000, + "accounttxid": "9a10581ae047fabe91495cfe558961e3b7362a19b700b2fcea216d06c44d9720", + "token": "KMD", + "deposit": 1000000, + "debt": 730000 + } + ] +} +``` + +(If there are duplicate entries in the above call, please ignore them. This is a known bug and will be fixed.) + +Use [getbalance](/smart-chains/api/wallet/#getbalance) or [listunspent](/smart-chains/setup/nspv/#listunspent) methods to verify that the `USDKTEST` coins are in the tutorial user's account. + +At this point, a normal user may use the stablecoins (`USDKTEST` in this example) to buy, sell, and trade. + +#### Redeeming the Stablecoins for the Locked Funds + +When finished with the stablecoins, the user may send to the Pegs Module the precise amount of `USDKTEST` coins withdrawn in order to receive the locked `KMD` tokens. + +Use the [pegsredeem](/antara/api/pegs/#pegsredeem) method to redeem the tokens. + +```bash +./komodo-cli -ac_name=USDKTEST pegsredeem a9539ec8db34ee44ff213cda59f412a02795821cf05844b0bc184660711371f7 1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1 +``` + +Output: + +```json +{ + "hex": "0400008085202f891e045ffbf7d56aba87d1527a8bd50c7cbfb44f376b1c0a6815c741a5f6e107f02d00000000484730440220064f36926ed7d6975ad1ecb358df866897554d29d623447b95d0f9d1f575ff0a02203ca4d9ea407c2310cd49be1315887cde4e54619de93d6882f0c2fe871820ef3201ffffffff3fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c29030000007b4c79a276a072a26ba067a565802103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece81400301711d3ddb1753c3a004c250616ea580f0bf75c1c03f791f76327a6efa69792f19eae5fa3c73ab29a4b6754a91111935a46fa1c28d4cdaacdcb24ec571a45fa100af038001eea10001ffffffff20974dc4066d21eafcb200b7192a36b7e3618955fe5c4991befa47e01a58109a00000000a74ca5a281a1a0819ca28194a067a565802103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece81409ffd2bb29f40dbf7b3e741e00e3a97c7e66f49526ea9dd33ec724eb30a81b21b16cdac1ea840cbf902f36ef17b9ac81014a735e97377d6d5f07a6e8ac04556f8a129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eea10001ffffffff20974dc4066d21eafcb200b7192a36b7e3618955fe5c4991befa47e01a58109a01000000a74ca5a281a1a0819ca28194a067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e068140bbfdfb024c50111ed7184b3fd4c7c462ea5093ab9969bab386d54965e248184a00a5cb2a1f625116d3bd02b470f4b33dab11a38ffd4d050fcdbe01e8ae754e70a129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eea10001ffffffff3fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c2902000000ac4caaa281a6a081a1a28194a067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e068140bfb34bd8abc720bef5c13708ad9280893df2b9fb1e70eb6063c05614245f5d3538d3048b9f6e4fbfc3053e594df7e638dd22e42c833c75aa174edf010fb45419a129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eeaf038001f2a10001ffffffff0dfe7aecdaed2498f6a3c29bcd53f15913ae2b36bf7643efcb8d3eb93354fbad00000000484730440220403e6284a585ed11b58207279786396101ea442d79b9df44688ebdaa7467e04d0220474f38ecc4ff53f9d685538805d0f0b7eaf008c9736ddf677a4bb88919e5680e01ffffffff0491bd559806afc9638763c8fb8e550b5e13df6d18ed0eeb7209f8e7e6ccb90f0000000048473044022078b520bbaa03883e03321a98cfca3282f7f1d70d91a977ed81b50d0f91440b3402205d1f346312ffbe4b76c614fb8d9dfcfd38069eca55a8f7d2ae84d4cae6fb481901ffffffff0d5e3529d01acc37c5cfbac0a3321870a5097134029ed474db42023bcbf18bb50000000049483045022100e6ccd2403781c60d928fa090d78d3f42cfa812dcd37ca5c65c91969a81a6d8ab022067f917bd432c69a44fd338a4897462e294b40304ea44dfe544a826bdb75232b901ffffffff07c9ea3dcb2164a8b5e839b23f39e6d2e0d3b8a7848ea188dca6e61a9833a8d00000000048473044022061ffebbf638055097c9bfaf654135e65925e7107cdd86d553264df3c16eefd3f0220401de8c419a842ad1f72eab0eaeca0f63ff95419e222a94141b04b5eaa3e341701ffffffff0ac35ee065ed0090ef129c389f0b84c91feaf9bf8a4ae6c12480a4d435cd550400000000484730440220710f15cebed5631fdaee51b651456b2b56e1d83968526745241a4920c6719b2b022000abc38a4b9ae4f6a7c53c1e80049c7d9109f97e26daf76a27021ee805a21a1d01ffffffff0aee5de22398ff1a61bca8d95d3304337be9cb00d401afa088cf95d31f121b1d000000004847304402207e4c1793bb91c550e462d38531734dd9fece17bab40ad0d2e8c2e9cd741f342302202c4973b14c9a5768a72aa5a4ab752de8fb388fd208280b6e5ef529e918dcca4101ffffffff0bd4eeed3d68d4f361e4e65a06f1e437739d209c5b593adfb9c908a11e5c4b1e0000000049483045022100a3e1e8f18bdd72f3794d3e2bfef1d807f904c93c511d396d33f66a9a84ea988b02203954987e94629cf77982568f115a148d64b44f1619c285d9ea229ac81268a16c01ffffffff023035ddb47d6d6ba1a1e760a750325f912f66934130059313bd2460dd3626a80000000049483045022100be9bc941d1afcc3e816a70e2e49e0c0b5279d8c704b14e8ea6f0a5b8e644f999022016ac0c28af028149a3026eb3cbe266604809643b303ff3ae4c27f4a11ed7059901ffffffff0d0db11a4bfaeb4293d26d4f540f8ae7b8ac648998d32ee4902eb6445bf3b4f4000000004948304502210093896862f4c679d6db6eb57951b5117a6201eda285b257dd60c57a45a3254cbb02205a7d32b4ffbf0f8d90cf1fca8a0f4f09e36da21c536e32f7002a28d6d56d132b01ffffffff0623be2e2bd36d04b45df4fcb8349f0b10095ec1aac30613fd21ca40054361300000000049483045022100d24bb6d6720e876a57607c8e29348f29357181d4369e41b044be9a4ac699272c022046e536c70a5ae151c99cff8795b9a1a6fbf159cfdac0c36bbceced6f6c7cec6b01ffffffff0cc55d115db43ac735fef6a662896b24f288b2fbb7b793c1f96948f6820338ed00000000494830450221009d6ffacd7e7c167c254ad79e03184d30f3598a75baf5422f62a74fbee20f8d35022029c7348297580926f64d6f3dd69f54aaec45b428594fae57af252ccf2fb804e401ffffffff08230c57a73ae1167c7c99c5e135af4e52b21468c9ef6de6528e51700d611fcd00000000484730440220645c65d17a44532e80bec8c40fd683dfbf614a6d64acec64eb2567788bbf9ea402205976d7399e33d20e588230ff6d65cef4dde327ffbb42a15e2191400896b34a4a01ffffffff083ae311d476e71cbd214e90aa7065bc3f8e3735fccdb951e84be2f35dbe86e90000000049483045022100aedf51f885b813acbce5799f976dff5200658396d3c33dd36f5768d5225215e3022070faaccac58b8aee064a312d6ed01301ac947c9e5cfd6be3d81d5cabb48ddf0901ffffffff012f6500ac7ff9cf0a6a624ca7a49e684fc6d28b5646a47c1f65d693965b1c430000000049483045022100ea4eca020c79db8fe46ae1a970c15deda516180c875bbbdb7c43a73e884a60f202207278af9cd50ee2806f6e4f16a5f2e4454881deacbcade363289239fdd54a982d01ffffffff08359b7d0efb9eede36cf0a5d9fdc5f4a83308c8a11099a3fa4cbb1fadbfcfde0000000049483045022100d1c1ed48608d61ae88cd957281e9320311861dbdc3596136533f058313883b6a02200ba029992e819196fd7c83b51a8d108c1b3c9b1f03a7faf2290acfced66c113a01ffffffff083f857139d0711209eef17e2f6177cb4ed0f68c00f520038a587744262445b90000000049483045022100cd94b3dd563ad7a37bd531a89cb0d988f4ec92949df7302ba43e13bdb88082c1022003be0f619ae4b3de597f8716a9374d63becf81d3d3943b3c741ee636b7e5cd8401ffffffff09cb8b189715b655a0c07456648951c3c178a6c6270c484dd3cfad5b18f859880000000048473044022025b7fc3db1a0b33471e5eccd3cb54a71fec8c5366837388489f3d9c90ad80d070220485c4c79790e2cfac55566869a52dbd86426f4d1db9fa23314d82b26ffc8f06d01ffffffff070d10ba3a3bb2f50fbc88549ab14aea8424bfa5cf4932653a82b2af987a82200000000048473044022047ac9d547dbf96cebd1f6dc29aad99d752c60b316df54987b577b7cc04cb6a9302204ae6a4707e6f270a4bfdc1d55e31bbbaf95e233a6c26ae6823b3f592cb39656301ffffffff0be472c9362d31a026a7f22d0fa14f294c95b0457ae66cd7179bb29a1f30278d0000000049483045022100e54335c0b652f35a3ae2eda351638b3b5d1ff76bf256bfcfe6a3e8810fd131ad02202865894c90cdbea6e1f052a83a085236606da96afc03e47a79159c5f9ee1398401ffffffff051c297d636cc51d90a5996a23ffc7c5374a4e3df397f770b5113585749bb5480000000049483045022100d67d9b0c34aa8f8d6c4ed261af543ce4cd9b95fcae7bbbb94c0f2521982037be02207fa0b75e74f2c2e9a5009d160addb3b191cf751e0887f0186526023f7f79b80401ffffffff0b19234b25da56339d70722c5845e39a56513ce6b70c7c26486e7d3b8c5bd02c000000004948304502210086f6f6dc5005207cc4206ff43d29e1ca42fc6cf5ce30e870d6bfa39002264a9c02200be78b519d6d2f7448ded31e96077b00960532c7d7b1484c37fe6a1d6990237e01ffffffff0d628dfaece395d197c0b810668b7af212d083e5f441a4c729b164ab3df91b510000000049483045022100c6ca324eeaafc9bacae5c260981baf9ae8f5c0eb3f83533c8631ecbe592d470c022014d44bc921909246002d64e4c029af2a4abb26812a6902cf61f69782630ce9c901ffffffff039d71284b8643c45e14b5bfc8c9439a17474376a78cec7be3d6b688a40bc4fc000000004847304402206b8320f3ea3cdd73fa9e4ee43a62144076b6ffc6cf58fdb06233b542d6924db402205a2310f7fc382407c8466b5677691988a6dc2a0fe3f3b4c6bc1f1a01d1820e7901ffffffff02803fb66f0c03fa8211d4086ad2262e50ea5dd99f30603e9999603cdfac367c0000000049483045022100837fec21e7ba574c2283ec160bc418485f2dd6fbb5f5dd575156c41450e7deb6022058aefedcc08274f523c52981b69f124197a431580d5692c2a5f6e8af6bef594801ffffffff0af2f9ced5de00310114f70d6756db7df65205aeac26b5607bd71333812f68e40000000049483045022100d5fdd26ad4682b6aa2d522c1b75097f9cb3df94632e5cfc2454d79b76f9401660220193d741cc875e75cf04ad70de582915b14b41a6283967527e931c50565cdb62f01ffffffff071027000000000000302ea22c8020e39343ebe1b40dcc747d145f140983b38f230dcf7963f2b58051265c765f2efa81031210008203000401cc1027000000000000302ea22c8020d77058bfd93eebe366e1c82fc1475690fd290214ed43b8c9dd25374077b35cbe81031210008203000401cc40420f0000000000302ea22c8020d62369afdb9fbe16bae7a6ac394333e9337ecc0b7671cda491df2fa82e48a20d8103120c008203000401cc90230b0000000000232102f7711371604618bcb04458f01c829527a012f459da3c21ff44ee34dbc89e53a9ac2cb8993b00000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc102700000000000023210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06ac0000000000000000a66a4ca3f2741a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf101210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06175cee52f7711371604618bcb04458f01c829527a012f459da3c21ff44ee34dbc89e53a9210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0640420f00000000000000000000000000000000000000000000000000209d00000000000000000000000000", + "result": "success" +} +``` + +Broadcast the hex value. + +```bash +./komodo-cli -ac_name=USDKTEST sendrawtransaction 0400008085202f891e045ffbf7d56aba87d1527a8bd50c7cbfb44f376b1c0a6815c741a5f6e107f02d00000000484730440220064f36926ed7d6975ad1ecb358df866897554d29d623447b95d0f9d1f575ff0a02203ca4d9ea407c2310cd49be1315887cde4e54619de93d6882f0c2fe871820ef3201ffffffff3fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c29030000007b4c79a276a072a26ba067a565802103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece81400301711d3ddb1753c3a004c250616ea580f0bf75c1c03f791f76327a6efa69792f19eae5fa3c73ab29a4b6754a91111935a46fa1c28d4cdaacdcb24ec571a45fa100af038001eea10001ffffffff20974dc4066d21eafcb200b7192a36b7e3618955fe5c4991befa47e01a58109a00000000a74ca5a281a1a0819ca28194a067a565802103c75c1de29a35e41606363b430c08be1c2dd93cf7a468229a082cc79c7b77eece81409ffd2bb29f40dbf7b3e741e00e3a97c7e66f49526ea9dd33ec724eb30a81b21b16cdac1ea840cbf902f36ef17b9ac81014a735e97377d6d5f07a6e8ac04556f8a129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eea10001ffffffff20974dc4066d21eafcb200b7192a36b7e3618955fe5c4991befa47e01a58109a01000000a74ca5a281a1a0819ca28194a067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e068140bbfdfb024c50111ed7184b3fd4c7c462ea5093ab9969bab386d54965e248184a00a5cb2a1f625116d3bd02b470f4b33dab11a38ffd4d050fcdbe01e8ae754e70a129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eea10001ffffffff3fba48bf0ac09226713509c71d0ccd457a012b28a88d2aaaa7381a5e12fa8c2902000000ac4caaa281a6a081a1a28194a067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e068140bfb34bd8abc720bef5c13708ad9280893df2b9fb1e70eb6063c05614245f5d3538d3048b9f6e4fbfc3053e594df7e638dd22e42c833c75aa174edf010fb45419a129a52780209de43b2cf09dcb2107822237e0afba0b0917b1592457b6fbfddb34fff3d302ae8103020000af038001eeaf038001f2a10001ffffffff0dfe7aecdaed2498f6a3c29bcd53f15913ae2b36bf7643efcb8d3eb93354fbad00000000484730440220403e6284a585ed11b58207279786396101ea442d79b9df44688ebdaa7467e04d0220474f38ecc4ff53f9d685538805d0f0b7eaf008c9736ddf677a4bb88919e5680e01ffffffff0491bd559806afc9638763c8fb8e550b5e13df6d18ed0eeb7209f8e7e6ccb90f0000000048473044022078b520bbaa03883e03321a98cfca3282f7f1d70d91a977ed81b50d0f91440b3402205d1f346312ffbe4b76c614fb8d9dfcfd38069eca55a8f7d2ae84d4cae6fb481901ffffffff0d5e3529d01acc37c5cfbac0a3321870a5097134029ed474db42023bcbf18bb50000000049483045022100e6ccd2403781c60d928fa090d78d3f42cfa812dcd37ca5c65c91969a81a6d8ab022067f917bd432c69a44fd338a4897462e294b40304ea44dfe544a826bdb75232b901ffffffff07c9ea3dcb2164a8b5e839b23f39e6d2e0d3b8a7848ea188dca6e61a9833a8d00000000048473044022061ffebbf638055097c9bfaf654135e65925e7107cdd86d553264df3c16eefd3f0220401de8c419a842ad1f72eab0eaeca0f63ff95419e222a94141b04b5eaa3e341701ffffffff0ac35ee065ed0090ef129c389f0b84c91feaf9bf8a4ae6c12480a4d435cd550400000000484730440220710f15cebed5631fdaee51b651456b2b56e1d83968526745241a4920c6719b2b022000abc38a4b9ae4f6a7c53c1e80049c7d9109f97e26daf76a27021ee805a21a1d01ffffffff0aee5de22398ff1a61bca8d95d3304337be9cb00d401afa088cf95d31f121b1d000000004847304402207e4c1793bb91c550e462d38531734dd9fece17bab40ad0d2e8c2e9cd741f342302202c4973b14c9a5768a72aa5a4ab752de8fb388fd208280b6e5ef529e918dcca4101ffffffff0bd4eeed3d68d4f361e4e65a06f1e437739d209c5b593adfb9c908a11e5c4b1e0000000049483045022100a3e1e8f18bdd72f3794d3e2bfef1d807f904c93c511d396d33f66a9a84ea988b02203954987e94629cf77982568f115a148d64b44f1619c285d9ea229ac81268a16c01ffffffff023035ddb47d6d6ba1a1e760a750325f912f66934130059313bd2460dd3626a80000000049483045022100be9bc941d1afcc3e816a70e2e49e0c0b5279d8c704b14e8ea6f0a5b8e644f999022016ac0c28af028149a3026eb3cbe266604809643b303ff3ae4c27f4a11ed7059901ffffffff0d0db11a4bfaeb4293d26d4f540f8ae7b8ac648998d32ee4902eb6445bf3b4f4000000004948304502210093896862f4c679d6db6eb57951b5117a6201eda285b257dd60c57a45a3254cbb02205a7d32b4ffbf0f8d90cf1fca8a0f4f09e36da21c536e32f7002a28d6d56d132b01ffffffff0623be2e2bd36d04b45df4fcb8349f0b10095ec1aac30613fd21ca40054361300000000049483045022100d24bb6d6720e876a57607c8e29348f29357181d4369e41b044be9a4ac699272c022046e536c70a5ae151c99cff8795b9a1a6fbf159cfdac0c36bbceced6f6c7cec6b01ffffffff0cc55d115db43ac735fef6a662896b24f288b2fbb7b793c1f96948f6820338ed00000000494830450221009d6ffacd7e7c167c254ad79e03184d30f3598a75baf5422f62a74fbee20f8d35022029c7348297580926f64d6f3dd69f54aaec45b428594fae57af252ccf2fb804e401ffffffff08230c57a73ae1167c7c99c5e135af4e52b21468c9ef6de6528e51700d611fcd00000000484730440220645c65d17a44532e80bec8c40fd683dfbf614a6d64acec64eb2567788bbf9ea402205976d7399e33d20e588230ff6d65cef4dde327ffbb42a15e2191400896b34a4a01ffffffff083ae311d476e71cbd214e90aa7065bc3f8e3735fccdb951e84be2f35dbe86e90000000049483045022100aedf51f885b813acbce5799f976dff5200658396d3c33dd36f5768d5225215e3022070faaccac58b8aee064a312d6ed01301ac947c9e5cfd6be3d81d5cabb48ddf0901ffffffff012f6500ac7ff9cf0a6a624ca7a49e684fc6d28b5646a47c1f65d693965b1c430000000049483045022100ea4eca020c79db8fe46ae1a970c15deda516180c875bbbdb7c43a73e884a60f202207278af9cd50ee2806f6e4f16a5f2e4454881deacbcade363289239fdd54a982d01ffffffff08359b7d0efb9eede36cf0a5d9fdc5f4a83308c8a11099a3fa4cbb1fadbfcfde0000000049483045022100d1c1ed48608d61ae88cd957281e9320311861dbdc3596136533f058313883b6a02200ba029992e819196fd7c83b51a8d108c1b3c9b1f03a7faf2290acfced66c113a01ffffffff083f857139d0711209eef17e2f6177cb4ed0f68c00f520038a587744262445b90000000049483045022100cd94b3dd563ad7a37bd531a89cb0d988f4ec92949df7302ba43e13bdb88082c1022003be0f619ae4b3de597f8716a9374d63becf81d3d3943b3c741ee636b7e5cd8401ffffffff09cb8b189715b655a0c07456648951c3c178a6c6270c484dd3cfad5b18f859880000000048473044022025b7fc3db1a0b33471e5eccd3cb54a71fec8c5366837388489f3d9c90ad80d070220485c4c79790e2cfac55566869a52dbd86426f4d1db9fa23314d82b26ffc8f06d01ffffffff070d10ba3a3bb2f50fbc88549ab14aea8424bfa5cf4932653a82b2af987a82200000000048473044022047ac9d547dbf96cebd1f6dc29aad99d752c60b316df54987b577b7cc04cb6a9302204ae6a4707e6f270a4bfdc1d55e31bbbaf95e233a6c26ae6823b3f592cb39656301ffffffff0be472c9362d31a026a7f22d0fa14f294c95b0457ae66cd7179bb29a1f30278d0000000049483045022100e54335c0b652f35a3ae2eda351638b3b5d1ff76bf256bfcfe6a3e8810fd131ad02202865894c90cdbea6e1f052a83a085236606da96afc03e47a79159c5f9ee1398401ffffffff051c297d636cc51d90a5996a23ffc7c5374a4e3df397f770b5113585749bb5480000000049483045022100d67d9b0c34aa8f8d6c4ed261af543ce4cd9b95fcae7bbbb94c0f2521982037be02207fa0b75e74f2c2e9a5009d160addb3b191cf751e0887f0186526023f7f79b80401ffffffff0b19234b25da56339d70722c5845e39a56513ce6b70c7c26486e7d3b8c5bd02c000000004948304502210086f6f6dc5005207cc4206ff43d29e1ca42fc6cf5ce30e870d6bfa39002264a9c02200be78b519d6d2f7448ded31e96077b00960532c7d7b1484c37fe6a1d6990237e01ffffffff0d628dfaece395d197c0b810668b7af212d083e5f441a4c729b164ab3df91b510000000049483045022100c6ca324eeaafc9bacae5c260981baf9ae8f5c0eb3f83533c8631ecbe592d470c022014d44bc921909246002d64e4c029af2a4abb26812a6902cf61f69782630ce9c901ffffffff039d71284b8643c45e14b5bfc8c9439a17474376a78cec7be3d6b688a40bc4fc000000004847304402206b8320f3ea3cdd73fa9e4ee43a62144076b6ffc6cf58fdb06233b542d6924db402205a2310f7fc382407c8466b5677691988a6dc2a0fe3f3b4c6bc1f1a01d1820e7901ffffffff02803fb66f0c03fa8211d4086ad2262e50ea5dd99f30603e9999603cdfac367c0000000049483045022100837fec21e7ba574c2283ec160bc418485f2dd6fbb5f5dd575156c41450e7deb6022058aefedcc08274f523c52981b69f124197a431580d5692c2a5f6e8af6bef594801ffffffff0af2f9ced5de00310114f70d6756db7df65205aeac26b5607bd71333812f68e40000000049483045022100d5fdd26ad4682b6aa2d522c1b75097f9cb3df94632e5cfc2454d79b76f9401660220193d741cc875e75cf04ad70de582915b14b41a6283967527e931c50565cdb62f01ffffffff071027000000000000302ea22c8020e39343ebe1b40dcc747d145f140983b38f230dcf7963f2b58051265c765f2efa81031210008203000401cc1027000000000000302ea22c8020d77058bfd93eebe366e1c82fc1475690fd290214ed43b8c9dd25374077b35cbe81031210008203000401cc40420f0000000000302ea22c8020d62369afdb9fbe16bae7a6ac394333e9337ecc0b7671cda491df2fa82e48a20d8103120c008203000401cc90230b0000000000232102f7711371604618bcb04458f01c829527a012f459da3c21ff44ee34dbc89e53a9ac2cb8993b00000000302ea22c802039452b774825750cd9390c3f05c96e486ecf2f21779466efbcd214220a7f288a8103120c008203000401cc102700000000000023210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06ac0000000000000000a66a4ca3f2741a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf101210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06175cee52f7711371604618bcb04458f01c829527a012f459da3c21ff44ee34dbc89e53a9210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e0640420f00000000000000000000000000000000000000000000000000209d00000000000000000000000000 +``` + +Output: + +``` +ff95e70f0d551748f460e61b7e75b279b8de355cb37df6c5895dfb8a49ee348a +``` + +#### Verify that the Tokens are Redeemed + +Use the [tokenbalance](/antara/api/tokens/#tokenbalance) method to verify that the tokens are redeemed and available in the tutorial user's local wallet. + +```bash +./komodo-cli -ac_name=USDKTEST tokenbalance 1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1 +``` + +Output: + +```json +{ + "result": "success", + "CCaddress": "RTcbFr8dH9dPGgGephMoDevHefndQQehxq", + "tokenid": "1a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1", + "balance": 1000000 +} +``` + +### Retrieve the KMD Coins on the KMD Smart Chain + +Send the `KMD` tokens to the Gateways Module using the [gatewayswithdraw](/antara/api/gateways/#gatewayswithdraw) method. + +Method structure: + +`gatewayswithdraw bindtxid coin withdrawpub amount` + +#### Details + +* `gatewayswithdraw` — The name of the method, executed as-is +* `bindtxid` — The Gateway Module's `bindtxid` +* `coin` — Ticker of the `coin` deposited +* `withdrawpub` — The user's pubkey to which the `KMD` coins should be sent on the `KMD` chain +* `amount` — The `amount` to be sent + +```bash +./komodo-cli -ac_name=USDKTEST gatewayswithdraw 50384e7668bd6908d8e0b67f1450c56f017186d802b1065c3258302a30b5adb2 KMD 03fa41b540b99161257c3a51e7c1598666361b739dce6a171d2d426255c92fb0e1 0.01 +``` + +Output: + +```json +{ + "hex": "0400008085202f89020012559aaf7b951b3cd33a29051dc1a185018ba8f1ad8a3f7778b48fa4dff8e9000000004847304402202b5a8c854de0d17a7fa47c8afa1b2d52c306eda1b5e0bb97fae59365351a9ecf02202d0468c2692036444d00a8312b866fe90af502a7235b7ee6bfa027dca50dcee401ffffffff8a34ee498afb5d89c5f67db35c35deb879b2757e1be660f44817550d0fe795ff020000007b4c79a276a072a26ba067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06814054a28d2f23721da7e5406db542178cc451c1232a2ee485cb429b3638cac5bc5b0bc61f242371fec25746d599f5186e6c24f21da4389391439a785e3c83ac15afa100af038001f2a10001ffffffff031027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cc40420f0000000000302ea22c8020bed294e15cd2e327d2f1e6bcf55e2ebe571b7bc2e672363950ca680c8b89226381032210008203000401cc00000000000000009a6a4c97f2741a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1012103ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb401350f157b2adb5302a3058325c06b102d88671016fc550147fb6e0d80869bd68764e3850034b4d442103fa41b540b99161257c3a51e7c1598666361b739dce6a171d2d426255c92fb0e140420f000000000000000000cc9f00000000000000000000000000", + "result": "success" +} +``` + +Broadcast the hex value. + +```bash +./komodo-cli -ac_name=USDKTEST sendrawtransaction 0400008085202f89020012559aaf7b951b3cd33a29051dc1a185018ba8f1ad8a3f7778b48fa4dff8e9000000004847304402202b5a8c854de0d17a7fa47c8afa1b2d52c306eda1b5e0bb97fae59365351a9ecf02202d0468c2692036444d00a8312b866fe90af502a7235b7ee6bfa027dca50dcee401ffffffff8a34ee498afb5d89c5f67db35c35deb879b2757e1be660f44817550d0fe795ff020000007b4c79a276a072a26ba067a56580210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06814054a28d2f23721da7e5406db542178cc451c1232a2ee485cb429b3638cac5bc5b0bc61f242371fec25746d599f5186e6c24f21da4389391439a785e3c83ac15afa100af038001f2a10001ffffffff031027000000000000302ea22c802091abda62a548f9c7f5beb19d16f01714ae3d4e526f3266fc8d347d6123f3d77b8103120c008203000401cc40420f0000000000302ea22c8020bed294e15cd2e327d2f1e6bcf55e2ebe571b7bc2e672363950ca680c8b89226381032210008203000401cc00000000000000009a6a4c97f2741a459712f1e79a544efdf55cfb3e111c5df3300a4da4d16cb3b963bbb50aebf1012103ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb401350f157b2adb5302a3058325c06b102d88671016fc550147fb6e0d80869bd68764e3850034b4d442103fa41b540b99161257c3a51e7c1598666361b739dce6a171d2d426255c92fb0e140420f000000000000000000cc9f00000000000000000000000000 +``` + +Output: + +``` +62c6a41171cb428625c2d02d7e7077c4fea1e2b4aea839c549be54fc41150be5 +``` + +The user will now receive the requested `KMD` coins in the address of the chosen pubkey. + +### Liquidation + +A user that does not yet have a pegs account (obtained via the [pegsfund](/antara/api/pegs/#pegsfund) and [pegsexchange](/antara/api/pegs/#pegsexchange) methods) can exchange the Pegs-related Smart Chain's coins for deposited tokens of another user's account whose debt ratio is in the "yellow zone" (`80%` to `90%`). + +The [pegsworstaccounts](/antara/api/pegs/#pegsworstaccounts) method can be used to retrieve a list of all accounts that are in the "red zone" (where the debt ratio exceeds `90%`). + +The [pegsliquidate](/antara/api/pegs/#pegsliquidate) method can be used to liquidate any of these accounts by repaying the account's outstanding debt using the Pegs-related Smart Chain's coins. This gives the executor of the method an immediate `5%` profit. + +{/* Sidd: are we sure on the math here? If the executor sends 10% of the coins necessary to pay off the full debt, and receives 5% of the user's account's KMD, then that's a 50% profit. If the executor sends 90% of the coins necessary to pay off the full debt and receives 5% of the remaining coins in the KMD account, then that's a (5/90)% profit, which is heigher than 5% gcharang: similar comment in the Pegs doc; "The third-party user must deposit `USDK` to cover the user's whole debt (which is valued at 90% of the KMD tokens) according to current prices and will receive 95% of the KMD tokens which can be redeemed on the KMD chain and sold in an exchange for Profit" --> The remaining amount in the indebted user's account is disbursed to the Pegs Module for stablecoin price maintenance. */} +export const title = "Rogue Module Tutorial"; +export const description = + "The Rogue Antara module serves as a proof-of-concept to demonstrate Antara's capabilities as a blockchain-based gaming technology."; + +# Rogue Module Tutorial + +This tutorial documentation is associated with the Rogue API documentation. + +[Link to Rogue API documentation](/antara/api/rogue/) + +## Introduction + +The Rogue Antara module serves as a proof-of-concept to demonstrate Antara's capabilities as a blockchain-based gaming technology. + +The Rogue module is based on the classic [Rogue](https://www.pcjs.org/software/pcx86/game/other/1985/rogue/) game. As such, it can be categorized as a [Roguelike.](https://tvtropes.org/pmwiki/pmwiki.php/Main/Roguelike) + +The core aspects of Rogue gameplay occur on the blockchain. These aspects include such data as character health points, items, movement, attacks, and other relevant game states. + +Komodo's Rogue implementation makes use of the classic on-screen visual representation of gameplay. This interface relies on ASCII characters to represent characters, items, and other in-game objects and actions. + +The procedures to launch and finish a game require the execution of various methods (RPCs). To make the game more easy to start and finish for players who are not comfortable with the terminal, the Komodo team has created a Terminal User Interface (TUI). + +The following installation and walkthrough tutorials can assist the reader in testing Rogue. For more information, please reach out to our community on [Discord](https://komodoplatform.com/discord). The #cc-rogue channel is available for questions and assistance. + +## Installation + +### Requirements + +Rogue is available for modern MacOS, Linux, and Windows operating systems. + +### Download Software Bundles + +Komodo provides downloadable software bundles that contain all necessary components. The user need only download and unzip the contents for their appropriate operating system and they are ready for gameplay. + +Software bundles can be found in the link below: + +[Link to software bundles](https://github.com/tonymorony/komodo-cctools-python/releases) + +Please feel free to ask on our #cc-rogue channel on [Discord](https://komodoplatform.com/discord) for updates and assistance. + +### Compile Rogue Software Manually + +The following instructions are necessary only for users/developers who wish to compile Rogue software from source code. Users who have already downloaded the software bundles linked above do not need to compile source code manually. + +#### Install Dependencies + +##### Linux + +```bash +sudo apt-get update && sudo apt-get upgrade -y +sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libgtest-dev libqt4-dev libqrencode-dev libdb++-dev ntp ntpdate software-properties-common curl libcurl4-gnutls-dev cmake clang libsodium-dev -y +``` + +##### MacOS (OSX) + +Use the terminal to ensure the MacOS XCode tools are installed: + +```bash +xcode-select --install +``` + +Ensure the latest version of `brew` is installed. If necessary, execute the following command: + +```bash +/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +``` + +Once `brew` is installed, execute each of the following commands: + +```bash +brew update +brew upgrade +brew tap discoteq/discoteq; brew install flock +brew install autoconf autogen automake +brew install gcc@6 +brew install binutils +brew install protobuf +brew install coreutils +brew install wget +``` + +##### Windows + +Playing Rogue on Windows requires an installation of MinGW, which can be downloaded here: + +[Link to MinGW](https://www.mingw-w64.org/) + +Once installed, use a Debian cross-compilation setup and run the following commands in Linux: + +```bash +sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python python-zmq zlib1g-dev wget libcurl4-gnutls-dev bsdmainutils automake curl cmake mingw-w64 +curl https://sh.rustup.rs -sSf | sh +source $HOME/.cargo/env +rustup target add x86_64-pc-windows-gnu +``` + +#### Clone & Compile Komodo + +##### Linux + +```bash +cd ~ +git clone https://github.com/jl777/komodo +cd komodo +git checkout FSM +./zcutil/fetch-params.sh +./zcutil/build.sh -j$(nproc) +``` + +##### MacOS + +```bash +cd ~ +git clone https://github.com/jl777/komodo +cd komodo +git checkout FSM +./zcutil/fetch-params.sh +./zcutil/build-mac.sh -j8 +``` + +##### Windows + +```bash +git clone https://github.com/jl777/komodo +cd komodo +git checkout FSM +./zcutil/fetch-params.sh +./zcutil/build-win.sh -j8 +#This can take some time. +``` + + + Change the `8` in the `-j8` portion of the last command to any number of + processor threads desired and/or appropriate for your machine. + + +##### Update `komodod` + +```bash +cd ~/komodo +git checkout FSM +git pull +./zcutil/build.sh -j$(nproc) +``` + +#### Launch the `ROGUE` chain and Set `pubkey` Value + +##### Step 1 - Start the chain + +Start the ROGUE chain with the following command in a terminal window and wait for the daemon to sync. Keep this terminal open and the daemon running for the duration of your Rogue gameplay. + +```bash +cd ~/komodo/src +./komodod -ac_name=ROGUE -ac_supply=1000000 -addnode=5.9.102.210 -ac_cclib=rogue -ac_perc=10000000 -ac_reward=100000000 -ac_cc=60001 -ac_script=2ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc -daemon +``` + +##### Step 2 + +Open a new terminal. This terminal can be used to execute all remaining installation and gameplay commands. + +```bash +./komodo-cli -ac_name=ROGUE getnewaddress +``` + +The returned value is a ROGUE address. We need to find the associated pubkey for this address. + +##### Step 3 + +Use the `validateaddress` method with the address. + +```bash +./komodo-cli -ac_name=ROGUE validateaddress insert_address_here +``` + +The `validateaddress` method will return information similar to the following: + +```json +{ + "isvalid": true, + "address": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "scriptPubKey": "76a91498b5caa42ffe9868844c51ba6e085e5e7e92fc2588ac", + "segid": 13, + "ismine": true, + "iswatchonly": false, + "isscript": false, + "pubkey": "02f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2", + "iscompressed": true, + "account": "" +} +``` + +Look for the `pubkey` value: + +```bash +"pubkey": "02f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2", +``` + +This is the `pubkey` for our address. + +##### Step 4 + +Set the pubkey for the ROGUE Smart Chain. + +```bash +./komodo-cli -ac_name=ROGUE setpubkey 02f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2 +``` + + + ```json + { + "address": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92", + "ismine": true, + "pubkey": "02f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2" + } + ``` + + +The pubkey is now set. + +To reuse this pubkey in the future, include the pubkey as a [pubkey](/smart-chains/setup/common-runtime-parameters/#pubkey) launch parameter. + +Include the `pubkey` in the `-pubkey` launch parameter as follows: + +```bash +cd ~/komodo/src +./komodod -ac_name=ROGUE -pubkey=02f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2 -ac_supply=1000000 -addnode=5.9.102.210 -ac_cclib=rogue -ac_perc=10000000 -ac_reward=100000000 -ac_cc=60001 -ac_script=2ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc -daemon +``` + +#### Installing the TUI (Optional) + +Komodo offers an unofficial Terminal User Interface (TUI) to allow players to launch and conclude a game without having to interact with the module's API commands. The TUI software is provided for testing and ease-of-use purposes only. + +Use of the TUI is optional, but recommended for most players. + +The TUI software can be found in the downloadable software bundles: + +[Link to downloadable software bundles](https://github.com/tonymorony/komodo-cctools-python/releases) + +## Walkthrough for API + +Under normal circumstances, a user does not need to manually execute methods in the terminal to launch and conclude a game. Rather, the downloadable software bundles contain all necessary tools to play. + +For users/developers who need a reference for the manual process, the following walkthroughs provide detailed step-by-step instructions. + +* [Single-Player Mode Walkthrough](/antara/tutorials/rogue-module-tutorial/#single-player-mode-walkthrough) +* [Multi-Player Mode Walkthrough](/antara/tutorials/rogue-module-tutorial/#multi-player-mode-walkthrough) + +### Single-Player Mode Walkthrough + +#### Step 1 + +Open a new terminal and navigate to the `~/komodo/src` directory: + +```bash +cd ~/komodo/src +``` + +#### Step 2 + +Create a new game via the [newgame](/antara/api/rogue/#newgame) method. For this example, we choose to have a single player with a `0` buy-in requirement. + +Methods for ROGUE require the use of the [cclib](/smart-chains/api/cclib/#cclib) method. The Rogue module's required `EVALCODE` for the `cclib` method is `17`. + +Command: + +```bash +./komodo-cli -ac_name=ROGUE cclib newgame 17 "[1]" +``` + + + ```json + { + "name": "rogue", + "method": "newgame", + "maxplayers": 1, + "buyin": 0.0, + "type": "newbie", + "hex": "0400008085202f89010061c9741f0451fcbec05ff789eef49487f4e50dcfbe05534b3f37167e9be400010000007b4c79a276a072a26ba067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa883058140aa48a0604d4d2eb76efd21639b26897fa3c036edd8dd4ca3d91c1f9cce294ec55071aab6187326ee1b1e80a1a3d22f72dd393fb65f009a619e8cf7fb0632a52ca100af03800111a10001ffffffff061027000000000000302ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc1027000000000000302ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc40420f0000000000302ea22c80208958791fdd38bdf532c97f1691fd231a3f1f5c0c3cd28b68d7383c8b1078828e81031210008203000401cc1027000000000000302ea22c80208958791fdd38bdf532c97f1691fd231a3f1f5c0c3cd28b68d7383c8b1078828e81031210008203000401cc00b8880000000000302ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc0000000000000000106a0e114700000000000000000100000000000000341d00000000000000000000000000", + "txid": "09d702b9bf678ee9d4efc29354566b4453e2e4ebdf7bac3496e667e8d435fe70", + "result": "success" + } + ``` + + +The ROGUE software currently broadcasts the `hex` value automatically. It is not necessary to use the `sendrawtransaction` method. + +The returned transaction id `txid` is the `gametxid`. Save this for future use. + +#### Step 3 + +Check the game's state using the [gameinfo](/antara/api/rogue/#gameinfo) method: + +Command: + +```bash +./komodo-cli -ac_name=ROGUE cclib gameinfo 17 '["09d702b9bf678ee9d4efc29354566b4453e2e4ebdf7bac3496e667e8d435fe70"]' +``` + + + ```json + { + "name": "rogue", + "method": "gameinfo", + "gametxid": "09d702b9bf678ee9d4efc29354566b4453e2e4ebdf7bac3496e667e8d435fe70", + "result": "success", + "height": 7462, + "start": 7462, + "starthash": "0006b3ede92cd36bd50f7eca8bfffcb9a32254d1f24193517447752b004b582a", + "seed": 3767108440867690538, + "run": "./komodo-cli -ac_name=ROGUE cclib register 17 '["09d702b9bf678ee9d4efc29354566b4453e2e4ebdf7bac3496e667e8d435fe70"]'", + "alive": 0, + "numplayers": 0, + "maxplayers": 1, + "buyin": 0.00000000, + "players": [ + ] + } + ``` + + +In the returned json object, observe the `run` value. This lists the specific command that must be executed in the terminal to register the game. + +#### Step 4 + +Register the `gametxid` using the [register](/antara/api/rogue/#register) method: + +```bash +./komodo-cli -ac_name=ROGUE cclib register 17 '["09d702b9bf678ee9d4efc29354566b4453e2e4ebdf7bac3496e667e8d435fe70"]' +``` + + + ```json + { + "name": "rogue", + "method": "register", + "maxplayers": 1, + "buyin": 0.0, + "type": "newbie", + "hex": "0400008085202f890170fe35d4e867e69634ac7bdfebe4e253446b565493c2efd4e98e67bfb902d70902000000a74ca5a281a1a0819ca28194a067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa8830581407c0a8458a64c5653b279bbff6f50d23474819c720330510f80294a7a6789d6a11bbb49efb610c8402b67d7323be456bd0b7e787856882cb16a58409b05e42e6aa129a5278020446b52761bffb00eaa7a055c9994987ce2120a551fb4dfd01ffae1ffbee6b56b8103020000af03800111a10001ffffffff02301b0f0000000000302ea22c802039784572269885d080d1990f4eea2b3a93b285b10887d66ccc5f63e0026b0be781031210008203000401cc0000000000000000446a42115270fe35d4e867e69634ac7bdfebe4e253446b565493c2efd4e98e67bfb902d709000000000000000000000000000000000000000000000000000000000000000000000000401d00000000000000000000000000", + "txid": "0896bf6cdabb31d90aa470ba8b85b01193bbca07b44618f8cadc0ed12d4ea749", + "result": "success" + } + ``` + + +#### Step 5 + +Check the game's current state again using the [gameinfo](/antara/api/rogue/#gameinfo) method. Use the `gametxid` as an argument: + +```bash +./komodo-cli -ac_name=ROGUE cclib gameinfo 17 '["09d702b9bf678ee9d4efc29354566b4453e2e4ebdf7bac3496e667e8d435fe70"]' +``` + + + ```json + { + "name": "rogue", + "method": "gameinfo", + "gametxid": "09d702b9bf678ee9d4efc29354566b4453e2e4ebdf7bac3496e667e8d435fe70", + "result": "success", + "height": 7462, + "start": 7462, + "starthash": "0006b3ede92cd36bd50f7eca8bfffcb9a32254d1f24193517447752b004b582a", + "seed": 3767108440867690538, + "run": "cc/rogue/rogue 3767108440867690538 09d702b9bf678ee9d4efc29354566b4453e2e4ebdf7bac3496e667e8d435fe70", + "alive": 1, + "numplayers": 1, + "maxplayers": 1, + "buyin": 0.0, + "players": [ + { + "slot": 0, + "status": "alive", + "baton": "0896bf6cdabb31d90aa470ba8b85b01193bbca07b44618f8cadc0ed12d4ea749", + "batonaddr": "R9dCYMKsDQRCg5CLpvThRser1gbBTmkEHG", + "batonvout": 0, + "batonvalue": 0.0099, + "batonht": 7469 + } + ] + } + ``` + + +Note that the `gameinfo` method now returned a `seed` value, as well as player data. + +In the returned json object, find the `run` value. This is the exact command needed to start the game. + +#### Step 6 - Play + +Wait until the network mines the `register_txid`. Optionally, use the [getrawmempool](/smart-chains/api/blockchain/#getrawmempool) method to monitor the status of the transaction. + +Once the transaction is mined, execute the `run` command (found in the returned json object earlier) to start the game: + +```bash +cc/rogue/rogue 3767108440867690538 09d702b9bf678ee9d4efc29354566b4453e2e4ebdf7bac3496e667e8d435fe70 +``` + +The game is now running and should be visible on-screen. + +#### Step 7 - Play the Game + +For instructions on in-game controls and objectives, [read this linked section.](/antara/tutorials/rogue-module-tutorial/#introduction) + +#### Step 8 - Bailout + +If your character is still alive and you would like to leave the game while keeping your profits, follow this procedure to save your character: + +To quit the game, type the letter `Q` on the keyboard. This opens a context menu. Type the letter `n` and press `Enter`. + +This begins the process of leaving the game, but you are not finished yet. + +Wait for the ROGUE network to mine all [`keystrokes`](/antara/api/rogue/#keystrokes) transactions. To see a list of all `keystrokes` created, check the `keystrokes.log` file in the `~/komodo/src` directory, and use the [getrawmempool](/smart-chains/api/blockchain/#getrawmempool) method to verify when the last `keystrokes` are mined. + +When the last transactions are mined, execute the [bailout](/antara/api/rogue/#bailout) method to leave the game while keeping the character and items in your `pubkey`, and the method will also transfer your in-game gold to `ROGUE` coins. + +For example: + +```bash +./komodo-cli -ac_name=ROGUE cclib bailout 17 '["09d702b9bf678ee9d4efc29354566b4453e2e4ebdf7bac3496e667e8d435fe70"]' +``` + +After the `bailout` transaction is mined the player may view their surviving character(s) via the [players](/antara/api/rogue/#players) and [playerinfo](/antara/api/rogue/#playerinfo) methods. + +#### Step 9: Highlander Victory + +In this walkthrough we have used single-player mode. The following [highlander](/antara/api/rogue/#highlander) method is only available if the character manages to capture the `amulet` and safely exit the dungeon. In a normal multi-player game, the `highlander` method is available to either the first player to safely retrieve the `amulet`, or to the last player standing after all others have died. + +The player that successfully executes the `highlander` method receives a prize: the collective value of all `ROGUE` coins that were contributed during the buy-in stage. + +The `highlander` method is executed as follows: + +```bash +./komodo-cli -ac_name=ROGUE cclib highlander 17 '["4fd6f5cad0fac455e5989ca6eef111b00292845447075a802e9335879146ad5a"]' +``` + +After the `highlander` transaction is mined the player may view their surviving character(s) via the [players](/antara/api/rogue/#players) and [playerinfo](/antara/api/rogue/#playerinfo) methods. + +### Multi-Player Mode Walkthrough + +In this walktrough we use two nodes to play a multi-player game of Rogue. + +* Node 1 is `player1` +* Node 2 is `player2` + +For educational purposes, we execute all methods manually, as opposed to using the [TUI](/antara/tutorials/rogue-module-tutorial/#installing-the-tui-optional). + +#### Step 1: Create a Multi-Player Game + +Open a new terminal and navigate to the `~/komodo/src` directory: + +```bash +cd ~/komodo/src +``` + +For this game, we choose the following details: + +* the max number of players: `2` +* the cost in `ROGUE` coins of the game `buyin`: `0.1` + +Execute the [newgame](/antara/api/rogue/#newgame) method on `player1` as follows: + +```bash +./komodo-cli -ac_name=ROGUE cclib newgame 17 '["2","0.1"]' +``` + + + ```json + { + "name": "rogue", + "method": "newgame", + "maxplayers": 2, + "buyin": 0.1, + "type": "buyin", + "hex": "0400008085202f89010806e5efe696da16723dc894c191db31a78184a6d1e2f49d1be11baf5a711d15010000007b4c79a276a072a26ba067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa883058140166b7641979bb086181d30a5e0c9a84591dc8a3455f77858735fc75aa087b7dd4d0745fac898e547a069b5e75273bf0b28c29466b7f41c5800cb888bfff96f52a100af03800111a10001ffffffff081027000000000000302ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc40420f0000000000302ea22c80208958791fdd38bdf532c97f1691fd231a3f1f5c0c3cd28b68d7383c8b1078828e81031210008203000401cc40420f0000000000302ea22c80208958791fdd38bdf532c97f1691fd231a3f1f5c0c3cd28b68d7383c8b1078828e81031210008203000401cc1027000000000000302ea22c80208958791fdd38bdf532c97f1691fd231a3f1f5c0c3cd28b68d7383c8b1078828e81031210008203000401cc1027000000000000302ea22c80208958791fdd38bdf532c97f1691fd231a3f1f5c0c3cd28b68d7383c8b1078828e81031210008203000401ccb04e790000000000302ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc10270000000000002321027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e85ac0000000000000000106a0e1147809698000000000002000000000000000dd400000000000000000000000000", + "txid": "4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde", + "result": "success" + } + ``` + + +Save the returned `txid` value for future use. This is our `gametxid`. + +Use the [gameinfo](/antara/api/rogue/#gameinfo) method to check information about the game: + +```bash +./komodo-cli -ac_name=ROGUE cclib gameinfo 17 '["4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde"]' +``` + + + ```json + { + "name": "rogue", + "method": "gameinfo", + "gametxid": "4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde", + "result": "success", + "gameheight": 54265, + "height": 54265, + "start": 54270, + "alive": 0, + "openslots": 2, + "numplayers": 0, + "maxplayers": 2, + "buyin": 0.1, + "seed": 0, + "players": [] + } + ``` + + +As shown in the returned json object, the game has a `maxplayers` value of `2` and an `openslots` value of `0`, as no players have joined. + +Note that the `gameheight` value is `54265`. This is the block height at which the `gametxid` was created. + +Also note that the `start` value is `54270`. This is the block height at which the `seed` value will be revealed, allowing players to generate the level design and begin the game. + +#### Step 2: Register for the Game + +For our example, `player1` would like to use an existing character that survived a previous game. This allows `player1` to start with all the advantages this character achieved previously, including character statistics and items. + +To activate the existing character, `player1` includes the associated `playertxid` for the character when executing the [register](/antara/api/rogue/#register) method. (The `playertxid` values of any `pubkey` can be found using the [players](/antara/api/rogue/#players) method.) + +The player also includes the `gametxid` as the first argument of the `register` method. + +```bash +./komodo-cli -ac_name=ROGUE cclib register 17 '["4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde","8005f81a604df6bbfae91dc8252505df43edbdf06492a2201362cb42dba4d8f2"]' +``` + + + ```json + { + "name": "rogue", + "method": "register", + "maxplayers": 2, + "buyin": 0.1, + "type": "buyin", + "hex": "0400008085202f8903deab2890124b47fee4c4e47640c443b248966b6c12c78db4358b19b1a89ccf4c01000000a74ca5a281a1a0819ca28194a067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa883058140d68dba89573f717140a84471f1056bc783996ed45b39218425eb0b9dd2f51f2563c8779e21ed4aa62defee170920cd760a5f80dc7a184414a12dec27d6e39990a129a5278020446b52761bffb00eaa7a055c9994987ce2120a551fb4dfd01ffae1ffbee6b56b8103020000af03800111a10001fffffffff2d8a4db42cb621320a29264f0bded43df052525c81de9fabbf64d601af8058001000000804c7ea27ba077a26ba067a5658021027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e858140ba62fa04393766f2a39bc23c1cded3ac8fa940e2f47747b03376ecf467f2307737812e2927cbbd9787f8632979d5f7575e5f603d0dbaafc8905605b836014b0da100af03800111af038001f2a10001ffffffff0d45d807c5f96bbf021e7186e5632c4ff37cda13f4fbc0861e76d32ae078985a000000004847304402206a20289df3b06cec3154ab48d4a3cb62eb7c27ddbaacd24938307a3a003bb8cf02207f658d0c442b81ced5b44031c76d548185fa33f810fa1a3209d5181e2e46e16a01ffffffff04b0b1a70000000000302ea22c80202ba0b269f75c72a0ce23e03812814b1e76a8fd57b3e75fee8b37bfef2b4ebf3581031210008203000401cc0100000000000000302ea22c80207f0205ad6b02be91baf2a56dcc77381e7b0e19cb9a83dfb9530316958f5b706781032210008203000401cc804a5d05000000002321027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e85ac00000000000000008c6a4c89f2748005f81a604df6bbfae91dc8252505df43edbdf06492a2201362cb42dba4d8f2012102deaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead16421152deab2890124b47fee4c4e47640c443b248966b6c12c78db4358b19b1a89ccf4cf2d8a4db42cb621320a29264f0bded43df052525c81de9fabbf64d601af805800000000014d400000000000000000000000000", + "txid": "20b5cf8249dda9e532d93d63e0b7fc3e28b15fdc606dbf04e06b3afd2cbb023d", + "result": "success" + } + ``` + + +In our example, the `player2` node does not have a character from a previous game, and therefore `player2` executes the `register` method with only the `gametxid`. + +```bash +./komodo-cli -ac_name=ROGUE cclib register 17 '["4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde"]' +``` + + + ```json + { + "name": "rogue", + "method": "register", + "maxplayers": 2, + "buyin": 0.1, + "type": "buyin", + "hex": "0400008085202f8902deab2890124b47fee4c4e47640c443b248966b6c12c78db4358b19b1a89ccf4c02000000a74ca5a281a1a0819ca28194a067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa883058140d6ba58b1f908127a08975c2b894908a5394e17752f3f4fc42f62a84854a6a34e7d36b9b0f5a9e8331b0b763fccd9c751c9768f494a160ba0c173253c598d3459a129a5278020446b52761bffb00eaa7a055c9994987ce2120a551fb4dfd01ffae1ffbee6b56b8103020000af03800111a10001ffffffff0d47edc39292bc46274460312302e9f5fbc7ff8e9e03dfc26fde0c9137030661000000004847304402204b8bb25641221d02db0af6319044c7249fe6e1e3aacf3430f296444bd00780a7022046a53d377dd1746b32ad38482fc3d88aa485fad2e1a7da634d46a753000b3bc601ffffffff04b0b1a70000000000302ea22c8020dab28a48d54ca8ae474d7ff8fefa29aa38739f873f9a2488d5260e481c4d924381031210008203000401cc0100000000000000302ea22c80207f0205ad6b02be91baf2a56dcc77381e7b0e19cb9a83dfb9530316958f5b706781032210008203000401cc7f4a5d05000000002321030c16387fda9c2c3e1b90b272a938424f9eecf16e859887874fb843892c3572abac0000000000000000446a421152deab2890124b47fee4c4e47640c443b248966b6c12c78db4358b19b1a89ccf4c00000000000000000000000000000000000000000000000000000000000000000000000017d400000000000000000000000000", + "txid": "8c595f0fd053d140bb1449b962ffb31fc983c7de9e19c44fd4b1c3e908d99efa", + "result": "success" + } + ``` + + +Wait until the `txid` values returned on both nodes are mined. (Use the [getrawmempool](/smart-chains/api/blockchain/#getrawmempool) method to check the transaction's status.) + +After the transactions are mined, use the [gameinfo](/antara/api/rogue/#gameinfo) method to check the game's status again: + +```bash +./komodo-cli -ac_name=ROGUE cclib gameinfo 17 '["4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde"]' +``` + + + ```json + { + "name": "rogue", + "method": "gameinfo", + "gametxid": "4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde", + "result": "success", + "gameheight": 54265, + "height": 54265, + "start": 54270, + "starthash": "0009fb977f5d34ff8fbaf5393e17ecc6c590d9f6db120c69b684959922b31fbd", + "seed": 3928429259918614461, + "run": "cc/rogue/rogue 3928429259918614461 4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde", + "alive": 2, + "openslots": 0, + "numplayers": 2, + "maxplayers": 2, + "buyin": 0.1, + "seed": 3928429259918614461, + "players": [ + { + "slot": 0, + "status": "registered", + "baton": "20b5cf8249dda9e532d93d63e0b7fc3e28b15fdc606dbf04e06b3afd2cbb023d", + "tokenid": "8005f81a604df6bbfae91dc8252505df43edbdf06492a2201362cb42dba4d8f2", + "batonaddr": "RVuzXY65FyJiPPWSBc9efATh6nb4M9MceR", + "ismine": false, + "batonvout": 0, + "batonvalue": 0.1099, + "batonht": 54273, + "player": { + "gametxid": "4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde", + "batontxid": "20b5cf8249dda9e532d93d63e0b7fc3e28b15fdc606dbf04e06b3afd2cbb023d", + "playertxid": "8005f81a604df6bbfae91dc8252505df43edbdf06492a2201362cb42dba4d8f2", + "tokenid": "8005f81a604df6bbfae91dc8252505df43edbdf06492a2201362cb42dba4d8f2", + "data": "250000000e00000010001000020000000b0000000700000002000000000000003a0000000000000001000000000000000000000000000000000000001000000000000000000000000000000000000000000000005d00000000000000010000000100000000000000000000000600000012000000000000000000000000000000000000000000000029000000ffffffff010000000000000001000000010000000000000012000000000000003278340000000000317833000000000029000000ffffffff010000000200000001000000000000000000000012000000000000003178310000000000317831000000000029000000020000001f000000030000000000000000000000000000001e00000000000000317831000000000032783300000000002f0000000000000001000000080000000000000000000000060000001000000000000000317831000000000031783100000000003d00000000000000010000000200000000000000000000000b000000100000000000000030783000000000003078300000000000", + "pack": [ + "Some food", + "+1 ring mail [protection 4]", + "A +1,+1 mace", + "A +1,+0 short bow", + "31 +0,+0 arrows", + "A staff of slow monster [6 charges](kukui wood)", + "A ring of sustain strength(obsidian)" + ], + "packsize": 7, + "hitpoints": 14, + "strength": 16, + "maxstrength": 16, + "level": 2, + "experience": 11, + "dungeonlevel": 2, + "chain": "ROGUE", + "pname": "tester02" + } + }, + { + "slot": 1, + "status": "registered", + "baton": "8c595f0fd053d140bb1449b962ffb31fc983c7de9e19c44fd4b1c3e908d99efa", + "tokenid": "0000000000000000000000000000000000000000000000000000000000000000", + "batonaddr": "RMYAWp4qQ2RQRAeBHeW3GdD79GjGHkNwE6", + "ismine": true, + "batonvout": 0, + "batonvalue": 0.1099, + "batonht": 54276 + } + ] + } + ``` + + +The `openslots` value is now `0`, as `2` players have joined. + +Note also that the `start` block height has past, and therefore the `seed` value is available. + +Also note that the response includes information about the `playertxid` character provided by `player1` during registration. + +The game is prepared. Both players may begin the game using the command found in the returned `run` value. + +```bash +cc/rogue/rogue 3928429259918614461 4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde +``` + +#### Step 3: Play and Finish the Game + +[View this linked section for instructions on gameplay.](/antara/tutorials/rogue-module-tutorial/#introduction) + +In our example, `player1` decides to bail out of the game without waiting until `player2` dies, and without retrieving the `amulet` from the dungeon. + +To exit, `player1` executes the [bailout](/antara/api/rogue/#bailout) method: + +```bash +./komodo-cli -ac_name=ROGUE cclib bailout 17 '["4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde"]' +``` + + + ```json + { + "name": "rogue", + "method": "bailout", + "myrogueaddr": "RVuzXY65FyJiPPWSBc9efATh6nb4M9MceR", + "gametxid": "4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde", + "hex": "0400008085202f8903bafcee9bbe5536b0a5dc2bdff72f34ceedc4f6dae07cdf9eef973339a095845900000000a74ca5a281a1a0819ca28194a067a5658021027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e858140542c935c9812a93c4b304123f86f3b71b5a2236edbc7d080dbf9fec1ddd683397935d5990eb2617e304be1560740ff80fdc3d7524c68adfc70cf57e2376b3666a129a5278020446b52761bffb00eaa7a055c9994987ce2120a551fb4dfd01ffae1ffbee6b56b8103020000af03800111a10001ffffffffdeab2890124b47fee4c4e47640c443b248966b6c12c78db4358b19b1a89ccf4c03000000a74ca5a281a1a0819ca28194a067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa8830581403f6df06683f5788ee5ea9113af44d0d76753e619be4b1ead6a56c9fbabaa5c1e25a26f2c6097398c1f3eb98578eff8c05315d9f49a30f1006b6d8dc72a7d45c2a129a5278020446b52761bffb00eaa7a055c9994987ce2120a551fb4dfd01ffae1ffbee6b56b8103020000af03800111a10001ffffffff04e14b45dfd8f96da57b4cd7207b8349085a9c58e617f559b6a633dc751a83d3010000007b4c79a276a072a26ba067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa8830581400d139c3302c33098fca9d25e3072ab9ccedb07bb82f79e8f97d35078183cf69c230d64ce52c4f9ba5c1f8f26affeb8ff4646a77240cc38f2af7d24be627c6fb8a100af03800111a10001ffffffff061027000000000000302ea22c8020432de388aabcb6b4e3326351d1d815cee8be9a8d37b055cd1c0cf8782e5c50c08103120c008203000401cc0100000000000000302ea22c8020f29dbf12dea61586c1c7a8c6fe99eaa82a32298686bac7d0f698e91e896f48d481032210008203000401cca04b0000000000002321027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e85ac50603f0100000000302ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc1f4e0000000000002321027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e85ac0000000000000000fdcf026a4dcb02f26321027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e851333393238343239323539393138363134343631403463636639636138623131393862333562343864633731323663366239363438623234336334343037366534633465346665343734623132393032386162646511fd4e021151deab2890124b47fee4c4e47640c443b248966b6c12c78db4358b19b1a89ccf4c05524f4755450874657374657230320000000021027d28d7d59ac499fac55f89b9e06933d66aaf74435c48326d83f8fbc6a7b14e85fdf4012c0000000e0000001000100002000000110000000900000001000000000000003a0000000000000001000000000000000000000000000000000000001200000000000000000000000000000000000000000000005d0000000000000001000000010000000000000000000000060000001200000000000000000000000000000000000000000000005d00000000000000010000000000000000000000000000000800000010000000000000003078300000000000307830000000000029000000ffffffff010000000000000001000000010000000000000012000000000000003278340000000000317833000000000029000000ffffffff010000000200000001000000000000000000000012000000000000003178310000000000317831000000000029000000020000001f000000030000000000000000000000000000001e00000000000000317831000000000032783300000000002f0000000000000001000000080000000000000000000000060000001200000000000000317831000000000031783100000000003d00000000000000010000000200000000000000000000000b0000001200000000000000307830000000000030783000000000003f00000000000000010000000800000000000000000000000b000000100000000000000030783000000000003078300000000000000000002dd400000000000000000000000000", + "txid": "5184b9d50cb70eb3b2f92e53e66ff90777a650e9167f8a133eb13a2da2ae999c", + "result": "success" + } + ``` + + +With the `bailout` transaction mined, the `gameinfo` method now returns updated information: + +Command: + +```bash +./komodo-cli -ac_name=ROGUE cclib gameinfo 17 '["4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde"]' +``` + + + ```json + { + "name": "rogue", + "method": "gameinfo", + "gametxid": "4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde", + "result": "success", + "gameheight": 54265, + "height": 54265, + "start": 54270, + "starthash": "0009fb977f5d34ff8fbaf5393e17ecc6c590d9f6db120c69b684959922b31fbd", + "seed": 3928429259918614461, + "run": "cc/rogue/rogue 3928429259918614461 4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde", + "alive": 1, + "openslots": 0, + "numplayers": 2, + "maxplayers": 2, + "buyin": 0.10000000, + "seed": 3928429259918614461, + "players": [ + { + "slot": 0, + "status": "finished", + "baton": "5184b9d50cb70eb3b2f92e53e66ff90777a650e9167f8a133eb13a2da2ae999c", + "tokenid": "0000000000000000000000000000000000000000000000000000000000000000", + "batonaddr": "RVuzXY65FyJiPPWSBc9efATh6nb4M9MceR", + "ismine": true, + "batonvout": 0, + "batonvalue": 0.00010000, + "batonht": 54297, + + ... (omitted for brevity) ... + + ``` + + +Note that the `alive` property has a value of `1`, indicating that the `player1` character has left and the `player2` character remains. Also note that in the `players` array, the first json object (which describes the `player1` node) has a `status` of `finished`. + +Since `player1` left early, `player2` is the last character standing. The [highlander](/antara/api/rogue/#highlander) method is now available to him. + +`player2` first begins the exit procedure by entering `Q`, then `y + Enter`. + +With the exit process in motion, `player2` executes the `highlander` method: + +```bash +./komodo-cli -ac_name=ROGUE cclib highlander 17 '["4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde"]' +``` + + + ```json + { + "name": "rogue", + "method": "highlander", + "myrogueaddr": "RMYAWp4qQ2RQRAeBHeW3GdD79GjGHkNwE6", + "gametxid": "4ccf9ca8b1198b35b48dc7126c6b9648b243c44076e4c4e4fe474b129028abde", + "hex": "0400008085202f8906fb01b5159bd9eb16c969a274573312a870eaec6ca921d45cfea828cf4bfdce7400000000a74ca5a281a1a0819ca28194a067a5658021030c16387fda9c2c3e1b90b272a938424f9eecf16e859887874fb843892c3572ab814040b427395fa60eec5d645994bdf49f56479913f76af9a0143a1cedba51bdf40604db488e5f16c22738d007832cce6f5694e0b72a59934af01283241eabfb04f4a129a5278020446b52761bffb00eaa7a055c9994987ce2120a551fb4dfd01ffae1ffbee6b56b8103020000af03800111a10001ffffffffdeab2890124b47fee4c4e47640c443b248966b6c12c78db4358b19b1a89ccf4c04000000a74ca5a281a1a0819ca28194a067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa8830581401b629f9b61eef6513f07b351a2a3c3ece554204fc355bc5d22cb2df7fa86355908e4d443783f998fdaa98818078a9644f8147391e2b96f53aa025619deab057ba129a5278020446b52761bffb00eaa7a055c9994987ce2120a551fb4dfd01ffae1ffbee6b56b8103020000af03800111a10001ffffffffdeab2890124b47fee4c4e47640c443b248966b6c12c78db4358b19b1a89ccf4c000000007b4c79a276a072a26ba067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa88305814077ca033d18a0125a269abdacb825d399f950e564eb9ad38f53eadd30213d158349952d30e109b7bfd5f47165e3e05b849c919f028bf447813a006fb76cf8fafba100af03800111a10001ffffffff09d702382f7d9bb899b5c935ec85f17da65df496c0898d5466e852235a99a529010000007b4c79a276a072a26ba067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa883058140f9885eba23b5f7ce803cd6256afdfda72cdac6e3112c448c9752e378310b4f8e66f18a1a9309d9c848680c0e1656cabb63857426a5e34c831ee7ba8883478d23a100af03800111a10001ffffffff0b295c8f2da505fd2fd76a23e742976855de3476381ea54ea2f4741398f9c8e5010000007b4c79a276a072a26ba067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa8830581402adefb3329c07c992aa0e5217ec129bbbdea0b60a9ef4dd65a8788833f764012673e9888b28a6cd61e438c95703c93becd0344d59e8b4af0800289b8539e104ca100af03800111a10001ffffffff0b473035d1618096e7856167a47a80e440b05884c2a6f9cc51545ea9bf22477b010000007b4c79a276a072a26ba067a56580210223b2b9d35fb6383bbbc0dd6668825c91713bc21081b9ce33df3d7edbafa883058140586da282bd1f1038c2f34f9bf93543cb0bc315d37d3572d262a6b7d9133533920fdb65118b702435bdbb62e41c4d873e79cc9ce6786ea74686f5c49413358c36a100af03800111a10001ffffffff061027000000000000302ea22c8020432de388aabcb6b4e3326351d1d815cee8be9a8d37b055cd1c0cf8782e5c50c08103120c008203000401cc0100000000000000302ea22c8020b3004eceb8c0082eae35418495dc48c6785dc23d0176e82514c90a41d93198ea81032210008203000401cc343a3101000000002321030c16387fda9c2c3e1b90b272a938424f9eecf16e859887874fb843892c3572abacbc9e3f0100000000302ea22c80203d1579313abe7d8ea85f48c65ea66fc512c878c0d0e6f6d54036669de940febf8103120c008203000401cc2f750000000000002321030c16387fda9c2c3e1b90b272a938424f9eecf16e859887874fb843892c3572abac0000000000000000fd2b026a4d2702f26321030c16387fda9c2c3e1b90b272a938424f9eecf16e859887874fb843892c3572ab1333393238343239323539393138363134343631403463636639636138623131393862333562343864633731323663366239363438623234336334343037366534633465346665343734623132393032386162646511fdaa011148deab2890124b47fee4c4e47640c443b248966b6c12c78db4358b19b1a89ccf4c05524f475545000100000021030c16387fda9c2c3e1b90b272a938424f9eecf16e859887874fb843892c3572abfd58010d0000000c0000001000100001000000020000000600000001000000000000003a0000000000000001000000000000000000000000000000000000001000000000000000000000000000000000000000000000005d00000000000000010000000100000000000000000000000600000012000000000000000000000000000000000000000000000029000000ffffffff010000000000000001000000010000000000000012000000000000003278340000000000317833000000000029000000ffffffff0100000002000000010000000000000000000000120000000000000031783100000000003178310000000000290000000200000022000000030000000000000000000000000000001e00000000000000317831000000000032783300000000003f00000000000000010000000800000000000000000000000b0000001000000000000000307830000000000030783000000000000000000030d400000000000000000000000000", + "txid": "fc86d6b5f5d3ab98de97d50fbd3853c726197d28a9436aeba66e70dadd541065", + "result": "success" + } + ``` + + +The multi-player game is now finished. The `player2` node received the `highlander` prize, including the total `buyin` amount and an increased conversion rate of in-game gold to `ROGUE` coins. + +After the `bailout` and `highlander` transactions are mined, the players may view their surviving character via the [players](/antara/api/rogue/#players) and [playerinfo](/antara/api/rogue/#playerinfo) methods. + +## Gameplay Documentation + +As Komodo's Rogue implementation is based off of the classic Rogue game, the classic manual provides the basic instructions for the game: + +[Link to Classic Rogue Manual Here](https://docs-archive.freebsd.org/44doc/usd/30.rogue/paper.pdf) + +After reading the linked manual, there are additional aspects to keep in mind for Komodo's unique implementation. + +### Gameplay Modes + +Komodo's Rogue features two different game modes. There is one mode for single-player gameplay, where the `maxplayer` value is set to `1`, and one mode for multi-player gameplay, where the `maxplayer` value is greater than `1`. + +#### Single-Player Mode + +The single-player mode is more limited in nature. In general, this mode is for practicing or farming purposes. + +There are no time limits. + +As soon as the `register_txid` is confirmed the player may begin to play. + +When concluding the game, the conversion of in-game gold to `ROGUE` coins is halved. See the [highlander](/antara/api/rogue/#highlander) and [bailout](/antara/api/rogue/#bailout) methods for further details. + +#### Multi-Player Mode + +If more than one player is allowed in the game parameters, the game goes into "Highlander" mode. In this mode, there can be only one winner of each game. The winner is either the last player standing, or the first player to retrieve the `amulet` and successfully exit the dungeon. + +Multi-player mode also adds a time limit that is based on the frequency of keystrokes. So long as the players are frequently entering commands, the time limit will expire in approximately one hour. If players are not frequently entering keystrokes, the time limit can vary. + +There is a waiting period after the `gametxid` is confirmed. This ensures that no player receives an unfair advantage via advanced knowledge of the start time. The delay is `5` blocks. On a default Smart Chain, this creates a `5` minute wait period. Once the `5` blocks are mined, the Smart Chain automatically reveals a `seed` that is created using blockchain-based provable randomization. The `seed` provides the basis for level-design generation. After the level is generated, the players may begin to play. + +Due to the fact that the entropy (based on the `seed`) was the same for both players during level generation, both players will begin at dungeon-level `1`. However, the generation of levels greater than `1` take into account the gameplay of the characters, and therefore the level designs will be different for each player. + +There are two methods for winning the game. The most direct way to win the game is to obtain the `amulet` and return from the dungeon. Alternatively, the player also may win by having the last surviving character. The winner receives all of the `buyin` coins that were originally contributed, as well as an increased conversion ratio for their in-game gold to `ROGUE` reward. + +See the [highlander](/antara/api/rogue/#highlander) method for further details. + +### The Mechanics of Saving, Trading, and Reusing Characters + + + Due to the nature of saving and reusing characters, the Komodo implementation + of Rogue changes the manner in which the user saves characters. Instead of + typing `s` on the keyboard, type `Q + y + Enter`, then execute the + [bailout](/antara/api/rogue/#bailout) method to conclude the game. + + +If a player successfully uses either the [highlander](/antara/api/rogue/#highlander) or [bailout](/antara/api/rogue/#bailout) method to conclude a game, the player may save their character, items, and achieved characteristics. They also convert the character's in-game gold to `ROGUE` coins. The ratio of conversion depends upon the game conditions; see the `highlander` and `bailout` methods for further details. + +#### Recalling an Existing Character + +When either of these methods are executed, the returned response includes a `playertxid` transaction id. The `playertxid` represents the state of this character at the completion of the game. It is used as an argument for the [register](/antara/api/rogue/#register) method when recalling the character, items, and achieved characteristics into a future game. + +The `playertxid` value changes with each game, and therefore only the most recent `playertxid` for a character should be used. To see a complete list of current `playertxid` values belonging to the user's `pubkey`, use the [playerinfo](/antara/api/rogue/#playerinfo) method. + +When the user registers an existing character, the game dungeon's difficulty begins at level `1`, and the character has no gold (as it was converted to `ROGUE` coins). Also, even if the character has armor and a wielded weapon in their item list, these items are not equipped by default. The player must equip them at the start of the game by typing the letters `w` for weapon and `W` for armor. + +One gameplay element that the Komodo team has changed from classic Rogue is the ability to scale the amount of inventory the character may carry according to the character's strength. The formula is as follows: + +``` +current max inventory = character strength * 2 +``` + +The highest `max inventory` value is `23` unique letters. Throwable-object packages count as a single item. + +If the user bails out of a game while holding more items than they are allowed to carry, the game will automatically flush items from the character's inventory as a part of the `bailout` method. + +#### Trading an Existing Character + +A character that survived a game is also a non-fungible asset and can be traded on the blockchain. When trading a character, the user does not use the `playertxid` value. Rather, the user employs the `tokentxid` value. This `tokentxid` is used in coordination with the [Tokens Antara Module](/antara/api/tokens/#introduction) module for on-chain trading. + +The `tokentxid` can be found by using the [playerinfo](/antara/api/rogue/#playerinfo) method and submitting the known `playertxid` as an argument. For more information, see the `playerinfo` method. + +The `tokentxid` is created at the character's initial creation and does not change throughout the character's life. When the character dies, the `tokentxid` is sent to a burn address, making the character permanently unplayable. +export const title = "Understanding Antara Addresses"; +export const description = "In this guide learn about the different types of addresses used in Antara transactions, including the CC Addresses."; + +# Understanding Antara Addresses + +The method of transferring module-related assets is often slightly different than the typical Smart Chain transaction. + +When making a transaction on a Smart Chain, you normally deal with a sending address and a receiving address. To move coins, you might use methods such as sendtoaddress or z\_sendmany. + +When using Antara, however, there are a few new types of addresses to keep in mind when working with transactions. It is not necessary to fully understand all of the address types; only a general understanding is needed. + +## Creating and Launching With a Pubkey + +The first address you must understand is the pubkey. Any user using an Antara based module must have a pubkey indicated in their daemon. This forms the basis for all addresses related to various modules. + +{/* Sidd: We can cut this below, I believe. */} + +{/* Typically, each module will take the pubkey, combine it with a unique and module-specific number called the `EVAL code`, and create a new [Base58Check](https://en.bitcoin.it/wiki/Base58Check_encoding) encoded address from it. This `Base58Check` encoded address will be the address you use for interacting with the specific Antara-based modules. */} + +To get a pubkey, launch the chain with the normal launch parameters and execute the [getnewaddress](/smart-chains/api/wallet/#getnewaddress) API command. + +```bash +./komodo-cli -ac_name=HELLOWORLD getnewaddress +``` + +This will return a new address: + +```bash +DO_NOT_USE_ADDRESSgg2ionaes1J5L786 +``` + +Now, execute the [validateaddress](/smart-chains/api/util/#validateaddress) command. + +```bash +./komodo-cli -ac_name=HELLOWORLD validateaddress DO_NOT_USE_ADDRESSgg2ionaes1J5L786 +``` + +This will return a json object with many properties. In the properties you will see: + +```bash +"pubkey": "DO_NOT_USE_ADDRESS019a79b0921a1be6d3ca6f9e8a050feb14eb845fe46b9d756" +``` + +This is will be your module pubkey; you must now indicate it to the daemon. + +To do this, first stop the daemon. + +```bash +./komodo-cli -ac_name=HELLOWORLD stop +``` + +Then relaunch your daemon using the required parameters, and make sure to include your pubkey as an additional parameter. For example: + +```bash +./komodod -ac_name=HELLOWORLD -ac_supply=777777 -ac_cc=777 -pubkey=DO_NOT_USE_ADDRESS019a79b0921a1be6d3ca6f9e8a050feb14eb845fe46b9d756 +``` + +#### CC Addresses + +The daemon will now use the above pubkey as the basis for all addresses used for the different modules. + +To discover the addresses the pubkey provides, you will typically use an `address` related API command from the list of available commands of your chosen module. For example, the [faucetaddress](/antara/api/faucet/#faucetaddress) command would return a response like this: + +```json +{ + "result": "success", + "FaucetCCaddress": "R9zHrofhRbub7ER77B7NrVch3A63R39GuC", + "Faucetmarker": "RKQV4oYs4rvxAWx1J43VnT73rSTVtUeckk", + "GatewaysPubkey": "03ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb40", + "FaucetCCassets": "RQ3ZQycSBM5MPPEopxoEC6R7VLRo1Fmk6f", + "myCCaddress": "RReGLfH2MTrkeLSepkVy5vnQPE29g7KofS", + "myaddress": "RJYiWn3FRCSSLf9Pe5RJcbrKQYosaMburP" +} +``` + +`FaucetCCaddress` is the address that corresponds to the default Faucet module. + +{/* Sidd: Is the above the same as the global CC address? */} + +`myCCaddress` is the address your node uses for interacting with the Faucet module. This is the user address for managing funds in an Antara module. + +The `myaddress` property is the normal address that corresponds to your pubkey. This is the user's address for the Smart Chain's main coin. + + + For readers who are curious, the letters "CC" are an abbreviation of an internal technology that all Antara modules use while creating unique addresses. + + +The use-cases of the different addresses depends on the functionality in question, and the desired outcome. + +Also, each module has its own API commands for moving coins or tokens. For example, the Tokens module offers the [tokentransfer](/antara/api/tokens/#tokentransfer) method. +export const title = "Komodo DeFi SDK Common Structures: Activation"; +export const description = "The Komodo DeFi SDK uses a variety of activation methods, depending on the type of coin."; + +# Activation Structures + +### ActivationParams + +The `ActivationParams` object defines additional parameters used for activation. These params may vary depending on the coin type. + +The following methods use this structure: + +* TBA + +| Parameter | Type | Description | +| ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | +| requires\_notarization | boolean | Optional, defaults to `false`. For [dPoW](https://komodoplatform.com/en/blog/dpow-demystified/) protected coins, a `true` value will wait for transactions to be notarised when doing swaps. Overrides value if set in `coins` file. | +| priv\_key\_policy | string | Defaults to `ContextPrivkey`. Set as `Trezor` to activate in Trezor mode. | +| min\_addresses\_number | integer | HD wallets only. How many additional addreesses to generate at a minimum. | +| scan\_policy | string | HD wallets only. Whether or not to scan for new addresses. Select from `do_not_scan`, `scan_if_new_wallet` or `scan`. Note that `scan` will result in multple requests to the Komodo DeFi SDK. | +| gap\_limit | integer | HD wallets only. The max number of empty addresses in a row. If transactions were sent to an address outside the `gap_limit`, they will not be identified when scanning. | +| zcash\_params\_path | string | ZHTLC coins only. Path to folder containing Zcash parameters. Optional, defaults to standard location as defined in [this guide](https://forum.komodoplatform.com/t/installing-zcash-params/603) | +| scan\_blocks\_per\_iteration | integer | ZHTLC coins only. Sets the number of scanned blocks per iteration during `BuildingWalletDb` state. Optional, default value is 1000. | +| scan\_interval\_ms | integer | ZHTLC coins only. Sets the interval in milliseconds between iterations of `BuildingWalletDb` state. Optional, default value is 0. | +| mode | object | QTUM, UTXO & ZHTLC coins only. A standard [ActivationMode](/atomicdex/api/common_structures/activation/#activation-mode) object. | + + + For ZHTLC coins, older wallets need to set the `sync_params` field to a date before its + first transaction to see all balance and history. This may take a long time on the first + activation, but subsequent activations will be much faster. + Using a smaller `scan_blocks_per_iteration` and larger `scan_interval_ms`, + will reduce the average CPU load during ZHTLC coin activation (at the cost of a + longer activation time). These optional fields are recommended when developing + for iOS, where a high CPU load may kill the activation process. Android & + desktop operating systems do not appear to have any problems with high CPU + load during ZHTLC coin activation. + + +### ActivationMode + +Defines the activation mode for QTUM, BCH, UTXO & ZHTLC coins. + +The following methods use this structure: + +* TBA + +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------- | +| rpc | string | `Native` if running a native blockchain node, `Electrum` if using electrum servers or `Light` for ZHTLC coins. | +| rpc\_data | object | `Electrum` or `Light` mode only. A standard [ActivationRpcData](/atomicdex/api/common_structures/activation/#activation-rpc-data) object. | + +### ActivationRpcData + +Contains information about electrum & lightwallet\_d servers for coins being used in `Electrum` or `Light` mode. + +| Parameter | Type | Description | +| ------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| light\_wallet\_d\_servers | list | ZHTLC only. A list of urls which are hosting lightwallet\_d servers for a coin. | +| electrum\_servers | list of objects | ZHTLC only. A list of standard [ActivationServers](/atomicdex/api/common_structures/activation/#activation-servers) objects. | +| electrum | list of objects | QTUM, BCH & UTXO coins only. A list of standard [ActivationServers](/atomicdex/api/common_structures/activation/#activation-servers) objects. | +| sync\_params | integer or string | ZHTLC coins only. Optional, defaults to two days ago. Defines where to start scanning blockchain data upon initial activation. Options: `"earliest"` (the coin's sapling\_activation\_height), `height` (a specific block height) or `date` (a unix timestamp). | + + + `electrum` and `electrum_servers` are both used for the same purpose. This should be consolidated in the API. + + +### ActivationServers + +The following methods use this structure: + +* TBA + +Contains information electrum servers for coins being used in `Electrum` or `Light` mode. + +| Parameter | Type | Description | +| --------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| url | string | The URL and port for an electrum server. | +| ws\_url | string | Optional, for WSS only. The URL and port for an electrum server's WSS port. | +| protocol | string | Optional, defaults to `TCP`. Transport protocol used to connect to the server. Options: `TCP` or `SSL` | +| disable\_cert\_verification | boolean | Optional, defaults to `false`. If `true`, this disables server SSL/TLS certificate verification (e.g. for self-signed certificates). Use at your own risk! | + + + #### ZHTLC Example + + ```json + { + "activation_params": { + "mode": { + "rpc": "Light", + "rpc_data": { + "electrum_servers": [ + { + "url":"zombie.dragonhound.info:10033" + } + ], + "light_wallet_d_servers": [ + "http://zombie.dragonhound.info:443" + ] + }, + "sync_params": { + "height": 2528700 + } + }, + "zcash_params_path": "/home/username/path_to/.zcash-params", + "scan_blocks_per_iteration": 100, + "scan_interval_ms": 200 + } + } + ``` + + #### HD UTXO Activation (v2) + + ```json + { + "activation_params": { + "mode": { + "rpc": "Electrum", + "rpc_data": { + "servers": [ + { + "url": "electrum2.cipig.net:10001" + }, + { + "url": "electrum3.cipig.net:20001", + "ws_url": "electrum3.cipig.net:30001", + "protocol": "SSL" + } + ] + } + }, + "scan_policy": "scan_if_new_wallet", + "priv_key_policy": "Trezor", + "min_addresses_number": 3, + "gap_limit": 20 + } + } + ``` + + +### CoinProtocol + +| Parameter | Type | Description | +| -------------- | ------- | ------------------------------------------------------------------------------------------------------ | +| type | integer | One of the supported \[coin types]\(link TBA) | +| protocol\_data | object | A standard [CoinProtocolData](/atomicdex/api/common_structures/activation/#coin-protocol-data) object. | + +### CoinProtocolData + +| Parameter | Type | Description | +| --------------------- | ------ | ---------------------------------------------------------------------------------------------------------- | +| platform | string | Indicates the platform parent coin for EMV-like protocols, or the coin used for lightning nodes. | +| network | string | Either `mainnet` or \`testnet | +| confirmation\_targets | object | A standard [ConfirmationTargets](/atomicdex/api/common_structures/lightning/#confirmation-targets) object. | + +### EvmNode + +The `EvmNode` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------------------------------------------------------------------- | +| url | string | URL of an RPC node | +| gui\_auth | boolean | Optional, defaults to `false`. Must be set to `true` to access RPC nodes run officially by the Komodo Platform team | + + + ```json + { + "url": "http://eth1.cipig.net:8555", + "gui_auth": false + } + ``` + + +### UtxoMergeParams + +The `UtxoMergeParams` object defines how often and at which thresholds to merge UTXOs. This is useful for wallets which have been used for a long time, and have many small UTXOs from mining activity. + +| Parameter | Type | Description | +| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| merge\_at | integer | Mamimum UTXO count before merge loop is initiated. | +| check\_every | integer | How frequently (in blocks) the wallet UTXO count is evaluated. | +| max\_merge\_at\_once | integer | The maximum nouber of UTXOs to inlude as inputs for a merge transaction. Note that more input UTXOs means a larger transaction and greater fees, and that each blockchain has a limit to the maximum size of a transaction. | + + + ```json + { + "merge_at": 50, + "check_every": 10, + "max_merge_at_once": 25 + } + ``` + +export const title = "Komodo DeFi SDK RPC Protocol v2.0"; +export const description = "Starting with version beta-2.1.3434, the Komodo DeFi SDK supports the standardized protocol format called mmrpc 2.0."; + +# Komodo DeFi SDK Common Structures + +The objects are in the request or response of multiple Komodo DeFi SDK methods have been grouped into the following sections: + +* [Activation](/atomicdex/api/common_structures/activation) +* [Swaps](/atomicdex/api/common_structures/swaps/) +* [Lightning Network](/atomicdex/api/common_structures/lightning/) +* [Non-fungible Tokens](/atomicdex/api/common_structures/nfts/) + +Structures which are used in more than one section are listed below: + +## AddressFormat + +| Structure | Type | Description | +| --------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| format | string (enum) | address format to which the input address should be converted. Possible values: `mixedcase` for ETH/ERC20 coins; `cashaddress` or `standard` for UTXO coins; `contract` or `wallet` for QTUM/QRC20 | +| network | string (enum) | Optional, only used for UTXO coins. Network prefix for `cashaddress` format. Possible values: `bitcoincash` for BCH mainnet; `bchtest` for BCH testnet; `bchreg` for BCH regtest | + + + #### Example + + ```json + { + "format": "mixedcase" + } + ``` + + ```json + { + "format": "cashaddress", + "network": "bitcoincash" + } + ``` + + +### AddressInfo + +The `AddressInfo` object includes the following items for a given address: + +| Parameter | Type | Description | +| ------------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- | +| balances | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. Not included in responses where `get_balances` is `false` | +| derivation\_method | object | A standard [DerivationMethod](/atomicdex/api/common_structures/#derivation-method) object | +| pubkey | string | The public key associated with the seed used to launch AtomicDEX | +| tickers | array | A list of tokens which were successfully activated. Only included in responses where `get_balances` is `false` | + + + #### Example with balances + + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "balances": { + "spendable": "0.11398301", + "unspendable": "0.00001" + } + } + ``` + + #### Example without balances + + ```json + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "tickers": ["ASLP-SLP"] + } + ``` + + +### BalanceInfos + +The `balanceInfos` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | +| spendable | string (numeric) | The available amount of a coin or token which is ready to be traded or withdrawn. | +| unspendable | string (numeric) | The amount of a coin or token which is awaiting confirmation on the block chain for an incoming or outgoing transaction. | + + + ```json + { + "spendable": "12.11398301", + "unspendable": "0.53" + } + ``` + + +### DerivationMethod + +The `DerivationMethod` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------------------- | +| type | string | Defines how keypairs will be generated. Possible values: `Iguana` or `HDWallet` | + + + Using the same seed or private key to generate keypairs using different derivation methods will result in a different address and private key for each method. + + +Where the value indicates: + +* `Iguana`: The coin or token is was activated using Iguana derivation (default). +* `HDWallet`: The coin or token is was activated using a Heirarchical Deterministic (HD) Wallet derivation path. + + + ```json + { + "type": "Iguana" + } + ``` + + +### NumericFormatsValue + +The `NumericFormatsValue` returns a price or amount in three different formats: `fraction`, `rational`, and `decimal`. + +| Parameter | Type | Description | +| --------- | -------------- | ---------------------------------------------------------------------------------------- | +| decimal | numeric string | A decimal number as a string. | +| rational | object | A standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| fraction | object | A standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | + + + ```json + { + "decimal": "0.0001", + "rational": [ + [1, [1]], + [1, [10000]] + ], + "fraction": { + "numer": "1", + "denom": "10000" + } + } + ``` + + +### FeeInfo + +The `FeeInfo` response object includes the following items for [withdraw (v2)](/atomicdex/api/v20/withdraw/) requests: + +| Parameter | Type | Description | +| ---------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | Type of transaction fee; possible values: `UtxoFixed`, `UtxoPerKbyte`, `EthGas` | +| amount | string (numeric) | Fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) | +| gas\_price | string (numeric) | Used only when fee type is EthGas; sets the gas price in `gwei` units | +| gas | number (integer) | Used only when fee type is EthGas; sets the gas limit for transaction | + +### ExtendedFeeInfo + +| Structure | Type | Description | +| ------------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | the fee is paid from the user's balance of this coin. This coin name may differ from the `base` or `rel` coins. For example, ERC20 fees are paid by ETH (gas) | +| amount | string (numeric) | fee amount (in decimal representation) | +| amount\_rat | rational | fee amount (in rational representation) | +| amount\_fraction | fraction | fee amount (in fraction representation) | +| amount\_fraction | fraction | fee amount (in fraction representation) | +| paid\_from\_trading\_vol | bool | whether the fee is paid from trading volume and not use actual `coin` balance | + +### TotalFeeInfo + +| Structure | Type | Description | +| --------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | the fee is paid from the user's balance of this coin. This coin name may differ from the `base` or `rel` coins. For example, ERC20 fees are paid by ETH (gas) | +| amount | string (numeric) | fee amount (in decimal representation) | +| amount\_rat | rational | fee amount (in rational representation) | +| amount\_fraction | fraction | fee amount (in fraction representation) | +| required\_balance | string (numeric) | the required `coin` balance to pay the fee | +| required\_balance\_rat | rational | `required_balance` in rational representation | +| required\_balance\_fraction | fraction | `required_balance` in fraction representation | + +### FractionalValue + +The `FractionalValue` object includes a [numerator and denominator](https://www.freemathhelp.com/numerator-denominator/) values for a given price or amount: + +| Parameter | Type | Description | +| --------- | ---------------- | ---------------------------------------- | +| numer | string (numeric) | The numerator of the fractional value. | +| denom | string (numeric) | The denominator of the fractional value. | + + + ```json + { + "numer": "4561782244811", + "denom": "4000000" + } + ``` + + +### Pagination + +For requests which return many results, pagination offsets may be applied. \*\* Use either value, not both. \*\* + +| Parameter | Type | Description | +| ---------- | ------- | ------------------------------------------------------- | +| PageNumber | integer | Optional, defaults to `1`. Offset for paginated results | +| FromId | integer | Optional. Ignores any results prior to this UUID | + + + #### Example + + ```json + { + "PageNumber": 1 + } + ``` + + ```json + { + "FromId": 4 + } + ``` + + +### RationalValue + +The Komodo DeFi SDK now offers the [num-rational crate](https://crates.io/crates/num-rational) feature which allows for higher precision numeric values to represent order volumes and prices in a unique format as explained below: + +```json +[ + [1, [0, 1]], + [1, [1]] +] +``` + +In the above unique format, the first item `[1,[0,1]]` is the `numerator` and the second item `[1,[1]]` is the `denominator`. + +The `numerator` and `denominator` are BigInteger numbers represented as a sign and a uint32 array (where numbers are 32-bit parts of big integer in little-endian order). + +`[1,[0,1]]` represents `+0000000000000000000000000000000010000000000000000000000000000000` = `4294967296` + +`[-1,[1,1]]` represents `-1000000000000000000000000000000010000000000000000000000000000000` = `-4294967297` + +### SyncStatus + +| Parameter | Type | Description | +| ---------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| state | string | current state of sync; possible values: `NotEnabled`, `NotStarted`, `InProgress`, `Error`, `Finished` | +| additional\_info | object | A standard [SyncStatusExtended](/atomicdex/api/common_structures/#sync-status-extended/) object. Additional info that helps to track the progress; present for `InProgress` and `Error` states only. | + +### SyncStatusExtended + +| Parameter | Type | Description | +| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------ | +| blocks\_left | number | present for ETH/ERC20 coins only; displays the number of blocks left to be processed for `InProgress` state | +| transactions\_left | number | present for UTXO coins only; displays the number of transactions left to be processed for `InProgress` state | +| code | number | displays the error code for `Error` state | +| message | number | displays the error message for `Error` state | + + + #### Example + + ```json + { + "sync_status": { + "state": "NotStarted" + } + } + ``` + + ```json + { + "sync_status": { + "additional_info": { + "transactions_left": 126 + }, + "state": "InProgress" + } + } + ``` + + ```json + { + "sync_status": { + "state": "Finished" + } + } + ``` + +export const title = "Komodo DeFi SDK Common Structures: Lightning"; +export const description = "Lightning network functionality is now available in the Komodo DeFi SDK!"; + +# Lightning Network Structures + +### ConfirmationTargets + +This object represents the number of blocks required for an on-chain lightning-related transaction to be confirmed. +It is used for estimating the transaction fee rate (`feerate`) for different transaction types in the context of permissionless transactions performed by the node. Different target types are `background`, `normal`, and `high_priority`. + +| Parameter | Type | Description | +| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| background | integer | Used for transactions that can tolerate slower confirmation times when the transaction fee rate decreases. These transactions are not time-sensitive and can afford to wait longer for confirmation. The recommended range is `12` to `144` blocks to ensure a low `feerate`. | +| normal | integer | Used for transactions that we want to confirm promptly, without significant delay (e.g, transactions for opening payment channels). These transactions are important but not critical. Suggested value is `6` blocks to ensure a moderate `feerate`. | +| high\_priority | integer | Used for transactions that require quick confirmation to prevent potential loss of funds (e.g. redeeming a Hashed Time Lock Contract (HTLC) on the blockchain before it times out). These transactions are time-critical and must be confirmed promptly to ensure the security of funds. Recommended value for `high_priority` is 1-2 blocks to ensure a high `feerate`. | + + + Using the recommended values in the above table with a coin that has a block time of 10 minutes, the equivalent time in minutes is: + + * `background`: 120 minutes to 1440 minutes (2 hours to 1 day). + * `normal`: 60 minutes (one hour). + * `high_priority`: 10 to 20 minutes. + + +### CounterpartyChannelConfig + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| allow\_outbound\_0conf | boolean | Optional, defaults to `true`. When setting an outbound channel, it can be used straight away [without waiting](https://docs.rs/lightning/latest/lightning/util/config/struct.ChannelHandshakeLimits.html#structfield.trust_own_funding_0conf) for any on-chain confirmations. | +| force\_announced\_channel\_preference | boolean | Optional, defaults to `true`. Set to force an incoming channel to match our announced channel preference in ChannelOptions announced\_channel. | +| outbound\_channels\_confirmations | integer | Optional, defaults to `144`. Confirmations we will wait for before considering an inbound channel locked in. | +| our\_locktime\_limit | boolean | Optional, defaults to `2016`. Set to the amount of blocks we're willing to wait to claim money back to us. | +| min\_funding\_sats | boolean | Optional, defaults to `0`. Minimum allowed satoshis when an inbound channel is funded. | +| max\_funding\_sats | boolean | Optional, defaults to `16777215`. Maximum allowed satoshis when an inbound channel is funded. | +| max\_htlc\_minimum\_msat | boolean | Optional, defaults to `18446744073709551615`. The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows us to limit the maximum minimum-size they can require. | +| min\_max\_htlc\_value\_in\_flight\_msat | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum value of pending HTLCs to them at any given time to limit their funds exposure to [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract). This allows us to set a minimum such value. | +| max\_channel\_reserve\_sats | boolean | Optional, defaults to `18446744073709551615`. The remote node will require us to keep a certain amount in direct payment to ourselves at all time, ensuring that we are able to be punished if we broadcast an old state. This allows us to limit the amount which we will have to keep to ourselves (and cannot use for [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract)). | +| min\_max\_accepted\_htlcs | boolean | Optional, defaults to `0`. The remote node sets a limit on the maximum number of pending HTLCs to them at any given time. This allows us to set a minimum such value. | + +### LightningActivationParams + +| Parameter | Type | Description | +| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | string | The name of the node that will be used in [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | +| listening port | integer | Optional, defaults to `9735`. The port that this node listens for incoming connections on. | +| color | string | Optional, defaults to `2b6680`. A hexidecimal color string which will be used in network graphs on [lightning explorers](https://mempool.space/testnet/lightning/node/024e2a940e0cbeda84a0d5e00fa8e83b3f4e7f98382eedb488d058e0f5636dd164/r/n) | +| payment\_retries | integer | Optional, defaults to `5`. Number of times a payment will be retried if it fails. | +| backup\_path | string | Optional. The backup path for channel backups, preferably on an external drive. | + +### LightningChannelAmount + +| Parameter | Type | Description | +| --------- | ------ | -------------------------------------------------------------------------------------- | +| type | string | `Exact` for a specific amount or `Max` for whole balance. | +| value | object | Only required if type is `Exact`. The amount in BTC you want to open the channel with. | + +### LightningChannelConfig + + + The values in this object are only used if the channel is being opened by the user. If the channel is being opened by the counterparty, the values in this object are ignored. + If not specified when using the [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) methods, the values in this object will default to the values set in the `coins` configuration file. + + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| inbound\_channels\_confirmations | string | Optional, defaults to `6`. Should be set in coins file, and applies to all channels. Confirmations we will wait for before considering an inbound channel locked in. | +| max\_inbound\_in\_flight\_htlc\_percent | integer | Optional, defaults to `10`. Should be set in coins file, and applies to all channels. Sets the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. | +| our\_htlc\_minimum\_msat | integer | Optional, defaults to `1`. The smallest value HTLC we will accept to process. The channel gets closed any time our counterparty misbehaves by sending us an HTLC with a value smaller than this. | +| announced\_channel | boolean | Optional, defaults to `false`. Set to announce the channel publicly and notify all nodes that they can route via this channel. GUIs and wallet apps should be set to `false`. | +| commit\_upfront\_shutdown\_pubkey | boolean | Optional, defaults to `true`. When `true` (and the counterparty agrees), the user must use the same key for cooperative closing. This prevents a user from changing the destination address in a cooperative close, which slightly increases security (however, this option is not required if the counterparty does not support it and a channel can be accepted regardless). **Note that the key for forced closing is always fixed when opening a channel and is different from shutdown\_pubkey.** | +| counterparty\_locktime | integer | Optional, defaults to `144`. The number of blocks we require our counterparty to wait to claim their money on chainif they broadcast a revoked transaction. We have to be online at least once during this time to punish our counterparty for broadcasting a revoked transaction. We have to account also for the time to broadcast and confirm our transaction, possibly with time in between to [RBF (Replace-By-Fee)](https://bitcoinops.org/en/topics/replace-by-fee/) the spending transaction. | +| negotiate\_scid\_privacy | integer | Optional, defaults to `false`. If `true`, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the [BOLTs](https://github.com/lightning/bolts)) option for outbound private channels. This provides better privacy by not including our real on-chain channel UTXO in each invoice and requiring that our counterparty only relay HTLCs to us using the channel's SCID alias. | +| their\_channel\_reserve\_sats | boolean | Optional, defaults to `10000` or 1% of channel value. The minimum balance that the other node has to maintain on their side, at all times. This ensures that if our counterparty broadcasts a revoked state, we can punish them by claiming at least this value on chain. | + + + For GUIs and wallet apps, it is recommended to set `announced_channel` to `false` (the default value), as the node is not expected to be reliably online. + + +### LightningChannelOptions + +| Parameter | Type | Description | +| --------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| proportional\_fee\_in\_millionths\_sats | integer | Optional, defaults to `0`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | +| base\_fee\_msat | integer | Optional, defaults to `1000`. Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of proportional\_fee\_in\_millionths\_sats. | +| cltv\_expiry\_delta | integer | Optional, defaults to `72`. Blocks until [CheckLockTimeVerify (CLTV)](https://academy.bit2me.com/en/que-es-cltv-bitcoin/) expiry. | +| max\_dust\_htlc\_exposure\_msat | integer | Optional, defaults to `5000000`. Limit our total exposure to in-flight [HTLCs](https://academy.binance.com/en/glossary/hashed-timelock-contract) which are burned to fees as they are too small to claim on-chain. | +| force\_close\_avoidance\_max\_fee\_sats | integer | Optional, defaults to `1000`. The additional fee we're willing to pay to avoid waiting for the counterparty's locktime to reclaim funds. | + +### LightningClosedChannelsFilter + +| Parameter | Type | Description | +| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| channel\_id | string | Optional. Unique string identifying a channel by its ID. | +| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | +| funding\_tx | string | Optional. A transaction ID which added funds. | +| from\_funding\_value | integer | Optional. The minimum value of channel funding in satoshis. | +| to\_funding\_value | integer | Optional. The maximum value of channel funding in satoshis. | +| channel\_type | string | Optional. `Inbound` or `Outbound`. | +| closing\_tx | integer | Optional. A transaction ID which closed the channel. | +| closure\_reason | integer | Optional. The reason a channel was closed. | +| claiming\_tx | integer | Optional. The ID of the transaction that returned the remaining outbound funds when the channel was closed to our on-chain address. | +| from\_claimed\_balance | integer | Optional. The minimum balance of channel funds claimed in satoshis. | +| to\_claimed\_balance | integer | Optional. The maximum balance of channel funds claimed in satoshis. | +| channel\_visibility | integer | Optional. `Public` or `Private`. | + + + Response may change to be more consistent in future. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206446309](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206446309) + + +### LightningOpenChannelsFilter + +| Parameter | Type | Description | +| ------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| channel\_id | string | Optional. Unique string identifying a channel by its ID. | +| counterparty\_node\_id | string | Optional. A hexidecimal string identifying a counterparty node. | +| funding\_tx | string | Optional. A transaction ID which added funds. | +| from\_funding\_value\_sats | integer | Optional. The minimum value of channel funding in satoshis. | +| to\_funding\_value\_sats | integer | Optional. The maximum value of channel funding in satoshis. | +| is\_outbound | boolean | Optional. If `true`, limits the response to outbound channels only. | +| from\_balance\_msat | integer | Optional. The minimum channel balance in millisatoshis. | +| to\_balance\_msat | integer | Optional. The maximum channel balance in millisatoshis. | +| from\_outbound\_capacity\_msat | integer | Optional. The minimum outbound capacity of the channel balance in millisatoshis. | +| to\_outbound\_capacity\_msat | integer | Optional. The maximum outbound capacity of the channel balance in millisatoshis. | +| from\_inbound\_capacity\_msat | integer | Optional. The minimum inbound capacity of the channel balance in millisatoshis. | +| to\_inbound\_capacity\_msat | integer | Optional. The maximum inbound capacity of the channel balance in millisatoshis. | +| confirmed | boolean | Optional. If `true`, only channels with channel opening transactions that passed the number of confirmations required for the channel to be usable will be returned. | +| is\_usable | boolean | Optional. If `true`, only channels that are confirmed and the counterparty is online, meaning that these channels can be used for payments will be returned. | +| is\_public | boolean | Optional. If `true`, only channels that our node announces to the lightning network, these channels are visible on lightning explorers will be returned. | + +### LightningPayment + +| Parameter | Type | Description | +| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | The payment type. Accepted values are `invoice` or [`keysend`](https://cdecker-lightning.readthedocs.io/lightning-keysend.7.html). | +| invoice | string | Only used if `type` is `invoice`. An identifying string which represents the invoice. | +| destination | string | Only used if `type` is `keysend`. A `node_pubkey` (which is also the node address in lightning context). Not to be confused with an onchain address. | +| amount\_in\_msat | string | Only used if `type` is `keysend`. Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin). | +| expiry | string | Only used if `type` is `keysend`. Optional, defaults to `3600`. Seconds until the payment expires. | + +### LightningPaymentFilter + +| Parameter | Type | Description | +| --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------- | +| payment\_type | object | A standard `LightningPaymentType` object. | +| description | string | Optional. A note to indicate the purpose of the invoice. | +| status | string | Optional. Accepted values: `pending`, `succeeded`, `failed`. | +| from\_amount\_msat | integer | Optional. Minimum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | +| to\_amount\_msat | integer | Optional. Maximum amount sent in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | +| from\_fee\_paid\_msat | integer | Optional. Minimum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | +| to\_fee\_paid\_msat | integer | Optional. Maximum transaction fee paid in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) | +| from\_timestamp | string | Optional. Minimum timestamp (in milliseconds) of payment results to return. | +| to\_timestamp | string | Optional. Maximum timestamp (in milliseconds) of payment results to return. | + +### LightningPaymentType + +| Parameter | Type | Description | +| ----------- | ------ | ----------------------------------------------------------------------------------- | +| type | object | Accepted values are `Outbound Payment` or `Inbound Payment`. | +| destination | string | Only used if `type` is `Outbound Payment`. A pubkey which will receive the payment. | + + + Response may change in future. + See [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206176530](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206176530) + +export const title = "Komodo DeFi SDK Common Structures: Non-Fungible Tokens"; +export const description = "Starting with version beta-2.1.3434, the Komodo DeFi SDK supports the standardized protocol format called mmrpc 2.0."; + +# Non-Fungible Token Structures + +### TokensRequest + +The `TokensRequest` object includes the following items for a given coin or token: + +| Parameter | Type | Description | +| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ | +| ticker | string | Ticker of the token to be enabled | +| required\_confirmations | integer | How many confirmations to wait during the transaction steps of an atomic swap. Overwrites value in coins file; defaults to `3` | + + + ```json + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + } + ``` + +export const title = "Komodo DeFi SDK Common Structures: Orders"; +export const description = "Each order on the Komodo Defi oderbook can be queried to view full details of each order for a pair, or the best orders for a ticker."; + +# Order Structures + +### CancelBy + +| Structure | Type | Description | +| ----------- | ------ | -------------------------------------------------------------------------------------------------------------------------------- | +| Type | string | `All` to cancel all orders; `Pair` to cancel all orders for specific coin pairs; `Coin` to cancel all orders for a specific coin | +| data | object | additional data the cancel condition; present with `Pair` and `Coin` types | +| data.base | string | base coin of the pair; `Pair` type only | +| data.rel | string | rel coin of the pair; `Pair` type only | +| data.ticker | string | order is cancelled if it uses `ticker` as base or rel; `Coin` type only | + + + To cancel all orders for a specific coin: + + ```json + { + "type": "Coin", + "data": { + "ticker": "DOC" + } + } + ``` + + To cancel all orders for a specific pair: + + ```json + { + "type": "Pair", + "data": { + "base": "DOC", + "rel": "MARTY" + } + } + ``` + + +### ConfSettings + +| Structure | Type | Description | +| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| base\_confs | number | Number of required confirmations on the base coin's blockchain for a transaction to complete an atomic swap event. | +| base\_nota | bool | Whether [dPoW notarization](https://komodoplatform.com/en/blog/dpow-demystified/) is required on the base coin's blockchain for a transaction to complete an atomic swap event. | +| rel\_confs | number | Number of required confirmations on the rel coin's blockchain for a transaction to complete an atomic swap event. | +| rel\_nota | bool | Whether [dPoW notarization](https://komodoplatform.com/en/blog/dpow-demystified/) is required on the rel coin's blockchain for a transaction to complete an atomic swap event. | + + + ```json + { + "conf_settings": { + "base_confs": 2, + "base_nota": true, + "rel_confs": 5, + "rel_nota": false + } + } + ``` + + +### RequestBy + +| Structure | Type | Description | | +| --------- | ------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | integer | Defines whether requesting by `volume` or by `number`. | | +| value | numeric | string | If `type` is `volume`, the amount of `coin` (defined in the parent object) the user is willing to buy or sell. If `type` is `number`, the number of best price trades to return. | + + + Filter response to return the best trades for up to 20 of the coin defined in the parent object: + + ```json + { + "request_by": { + "type": "volume", + "value": 20 + } + } + ``` + + Filter response to return the 10 best priced trades: + + ```json + { + "type": "number", + "value": 10 + } + ``` + + +## OrderAddress + +| Structure | Type | Description | +| ------------- | ------ | -------------------------------------------------------------------- | +| address\_type | string | Generally `Transparent`, but may be `Shielded` for supporting coins. | +| address\_data | string | The actual address text for sending and receiving funds. | + + + ```json + { + "address_type": "Transparent", + "address_data": "DEsCggcN3WNmaTkF2WpqoMQqx4JGQrLbPS" + } + ``` + + +### OrderType + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Type | string | There are two types from which to choose: `GoodTillCancelled` and `FillOrKill`. The `GoodTillCancelled` order is automatically converted to a `maker` order if the order is not matched in 30 seconds, and this `maker` order stays in the orderbook until explicitly cancelled. On the other hand, a `FillOrKill` order is cancelled if it is not matched within 30 seconds. The default type is `GoodTillCancelled` | + + + `GoodTillCancelled` orders will remain on the orderbook until they are exhausted or explicitly cancelled. + + ```json + { + "order_type": { + "type": "GoodTillCancelled" + } + } + ``` + + `FillOrKill` orders will be automatically cancelled if they are not matched within 60 seconds. + + ```json + { + "order_type": { + "type": "FillOrKill" + } + } + ``` + + +### OrderStatusData + +| Structure | Type | Description | +| ----------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| base | string | base currency | +| rel | string | rel currency | +| price | number | order price as decimal number | +| price\_rat | rational number | order price as rational number | +| max\_base\_vol | number | Maximum trade volume | +| max\_base\_vol\_rat | rational number | Maximum trade volume as rational number | +| min\_base\_vol | number | Minimum trade volume | +| min\_base\_vol\_rat | rational number | Minimum trade volume as rational number | +| created\_at | number | Timestamp of order creation | +| updated\_at | number | Timestamp of last order update | +| matches | list | UUIDS of matching orders | +| started\_swaps | list | UUIDS of swaps started | +| uuid | string | UUID of this order | +| conf\_settings | object | Confirmation / Notarisation settings for order | +| base\_orderbook\_ticker | string | The ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | +| rel\_orderbook\_ticker | string | The ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | +| cancellable | boolean | `true` if order is in a state which it can be cancelled. `false` if not (e.g. swap is in progress) | +| cancellation\_reason | string | `Cancelled` indicates order was withdrawn by user. `Fulfilled` indicates order was swapped successfully. `TimedOut` indicates a taker order with type `FillOrKill` expired before matching. | +| available\_amount | string | Funds available for order to be matched against, taking into account current spendable balance and `max_volume` | + + + ```json + { + "available_amount": "1", + "base": "BEER", + "cancellable": true, + "created_at": 1568808684710, + "matches": { + "60aaacca-ed31-4633-9326-c9757ea4cf78": { + "connect": { + "dest_pub_key": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "maker_order_uuid": "fedd5261-a57e-4cbf-80ac-b3507045e140", + "method": "connect", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "taker_order_uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + }, + "connected": { + "dest_pub_key": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "maker_order_uuid": "fedd5261-a57e-4cbf-80ac-b3507045e140", + "method": "connected", + "sender_pubkey": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "taker_order_uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + }, + "last_updated": 1560529572571, + "request": { + "action": "Buy", + "base": "BEER", + "base_amount": "1", + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000", + "method": "request", + "rel": "PIZZA", + "rel_amount": "1", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + }, + "reserved": { + "base": "BEER", + "base_amount": "1", + "dest_pub_key": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "maker_order_uuid": "fedd5261-a57e-4cbf-80ac-b3507045e140", + "method": "reserved", + "rel": "PIZZA", + "rel_amount": "1", + "sender_pubkey": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "taker_order_uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + } + } + }, + "max_base_vol": "1", + "max_base_vol_rat": [ + [1, [1]], + [1, [1]] + ], + "min_base_vol": "0", + "min_base_vol_rat": [ + [0, []], + [1, [1]] + ], + "price": "1", + "price_rat": [ + [1, [1]], + [1, [1]] + ], + "rel": "ETOMIC", + "started_swaps": ["60aaacca-ed31-4633-9326-c9757ea4cf78"], + "uuid": "ea77dcc3-a711-4c3d-ac36-d45fc5e1ee0c" + } + ``` + + +### OrderDataV1 + + + Compare and confirm the differences between this object in v1 and v2 methods. + + +| Structure | Type | Description | +| --------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin | +| address | string | The address offering the trade | +| price | string (decimal) | The price the user is willing to buy or sell per one unit of the coin from request | +| price\_rat | rational | The price represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| price\_fraction | object | The price represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| maxvolume | string (decimal) | The maximum amount of `base` the offer provider is willing to sell | +| max\_volume\_rat | rational | The max volume represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| max\_volume\_fraction | object | The max volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| min\_volume | string (decimal) | The minimum amount of `base` coin the offer provider is willing to sell | +| min\_volume\_rat | rational | The min volume represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| min\_volume\_fraction | object | The min volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| pubkey | string | The pubkey of the offer provider | +| age | number | The age of the offer (in seconds) | +| zcredits | number | The zeroconf deposit amount (deprecated) | +| netid | number | The id of the network on which the request is made (default is `0`) | +| uuid | string | The uuid of order | +| is\_mine | bool | Whether the order is placed by me | +| base\_max\_volume | string (decimal) | The maximum amount of `base` coin the offer provider is willing to buy or sell | +| base\_max\_volume\_rat | rational | The `base_max_volume` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| base\_max\_volume\_fraction | object | The `base_max_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| base\_min\_volume | string (decimal) | The minimum amount of `base` coin the offer provider is willing to buy or sell | +| base\_min\_volume\_rat | rational | The `base_min_volume` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| base\_min\_volume\_fraction | object | The `base_min_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| base\_confs | number | The confirmations settings of `base` coin set by the offer provider | +| base\_nota | bool | The notarisation settings of `base` coin set by the offer provider | +| rel\_max\_volume | string (decimal) | The maximum amount of `rel` coin the offer provider is willing to buy or sell | +| rel\_max\_volume\_rat | rational | The `rel_max_volume` max volume represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| rel\_max\_volume\_fraction | object | The `rel_max_volume` max volume represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| rel\_min\_volume | string (decimal) | The minimum amount of `rel` coin the offer provider is willing to buy or sell | +| rel\_min\_volume\_rat | rational | The `rel_min_volume` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| rel\_min\_volume\_fraction | object | The `rel_min_volume` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| rel\_confs | number | The confirmations settings of `rel` coin set by the offer provider | +| rel\_nota | bool | The notarisation settings of `rel` coin set by the offer provider | +| original\_tickers | list (string) | Tickers included in response when `orderbook_ticker` is configured for the queried coin in `coins` file | + +### OrderDataV2 + + + Compare and confirm the differences between this object in v1 and v2 methods. + + +| Structure | Type | Description | +| ----------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin | +| address | object | A standard [OrderAddress](/atomicdex/api/common_structures/orders/#order-address) object. | +| price | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the coin price. | +| base\_min\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the minimum base volume. | +| base\_max\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the maximum base volume. | +| base\_max\_volume\_aggr | object | Orderbook (v2) only. A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the maximum aggregated base amount at the specified price. The sum of max base volumes of the current order and all orders with a worse price. | +| rel\_min\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the minimum rel volume. | +| rel\_max\_volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the maximum rel volume. | +| rel\_max\_volume\_aggr | object | Orderbook (v2) only. A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the maximum aggregated rel amount at the specified price. The sum of max rel volumes of the current order and all orders with a worse price. | +| pubkey | string | The pubkey of the offer provider | +| uuid | string | The uuid of order | +| is\_mine | bool | Whether the order is placed by me | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | + +## OrderSummaryData + +| Structure | Type | Description | +| ------------- | ---------------- | --------------------------------------------------------------------------------- | +| uuid | string | uuid of the order | +| order\_type | string | Type of the order; "Maker" or "Taker" | +| base | string | base coin of the order | +| rel | string | rel coin of the order | +| price | number (decimal) | price of the order | +| volume | number (decimal) | volume of the order | +| created\_at | number | unix timestamp in milliseconds, indicating the order creation time | +| last\_updated | number | unix timestamp in milliseconds, indicating the time the order was last updated | +| Was\_taker | number | `1` if the order was a "Taker" order that got converted to "Maker", `0` otherwise | +| status | string | status of the Order | + +## MatchBy + +| Structure | Type | Description | +| --------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| Type | string | `Any` to match with any other order; `Orders` to select specific uuids; `Pubkeys` to select specific nodes; default is `Any` | +| data | array of strings | A list of order uuids (to match for `Orders` type) or pubkeys of nodes (to match for `Pubkeys` type) | + + + ```json + "match_by": { + "type": "Pubkeys", + "data": [ + "0261eef15cbc141f555aff1aa40fb21de17a0a9e6897eee18c14c6032586b456b3", + "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c" + ] + } + ``` + + Match by order uuids: + + ```json + "match_by": { + "type": "Orders", + "data": [ + "6f65968f-e3c6-4978-98c5-5cec2bb5aa5b", + "07ce08bf-3db9-4dd8-a671-854affc1b7a3" + ] + } + ``` + +export const title = "Komodo DeFi SDK Common Structures: Swaps"; +export const description = "Each active or completed trade from the Komodo DeFi SDK includes an unique identifier (UUID), a summary of the trade and detailed information relating to each swap event."; + +# Swap Structures + +### SwapEvent + +There are a variety if swap events which may occur during a trade. See [Maker Events](/atomicdex/api/common_structures/swaps/maker_events/) and [Taker Events](/atomicdex/api/common_structures/swaps/maker_events/) for more info. + +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | See [Maker Events](/atomicdex/api/common_structures/swaps/maker_events/) and [Taker Events](/atomicdex/api/common_structures/swaps/maker_events/) for more info. | +| data | varies | The data field may contain contextual information (e.g. txids) releated to a swap event. In some cases, it will be `null`. | + + + #### Example + + ```json + { + "type": "TakerFeeSent", + "data": { + "tx_hex": "0400008085202f89014b9e44ba75ed80361776ac385feee7bba13b6c2d3147a3d9b5d71362a4624219000000006b483045022100a45de07b5d211c62e8ecf90cd5bee5076f6b6f20715f5618d7d0d93a6209ad870220596ca01682d2dbd4efeba3a0e90a373fd61b619471747df26afc2e2bb167de4c012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88acf4979600000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88acaf73d363000000000000000000000000000000", + "tx_hash": "b2ee0e692523c5ca081f62e36325d09a629004850be8b86df149fc979e9e3e87" + } + } + ``` + + +### SwapEvents + +For each step of a trade, a `SwapEvent` will be created, alongside the timestamp of the event. See [Maker Events](/atomicdex/api/common_structures/swaps/maker_events/) and [Taker Events](/atomicdex/api/common_structures/swaps/maker_events/) for more info. + +| Parameter | Type | Description | +| --------- | ------- | ---------------------------------------------------------------------------------- | +| timestamp | integer | Timestamp for the `SwapEvent` in UNIX format. | +| event | object | A standard [SwapEvent](/atomicdex/api/common_structures/swaps/#swap-event) object. | + + + #### Example + + ```json + { + "event": { + "type": "MakerPaymentWaitConfirmStarted" + }, + "timestamp": 1564050588178 + } + ``` + + +### SwapStatus + +Each swap status will be nested under its associated UUID. + + + We should add a "maker" resonse example also. Unsure if `uuid` on maker side is swap or order uuid in response. + + +| Parameter | Type | Description | +| --------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | `Maker` or `Taker`. Indicates if the user created the order (maker), or matched with an existing order (taker). | +| uuid | string | A unique identifier for the swap. | +| events | list | A list of swap events. The structure of each event varies depending on its type, as detailed in the [SwapEvents](/atomicdex/api/common_structures/swaps) section. | +| maker\_coin | string | The coin being sent by the maker and received by the taker. | +| taker\_coin | string | The coin being sent by the taker and received by the maker. | +| maker\_amount | numeric string | The amount of `maker_coin` being traded. | +| taker\_amount | numeric string | The amount of `taker_coin` being traded. | +| gui | string | An identifier for the GUI used to initiate the swap, as defined in a user's MM2.json file. May be `null` if not defined. | +| mm\_version | string | The release version and/or commit hash of the Komodo DeFi SDK used to initiate the swap. | +| success\_events | list | A list of possible swap event types for a successful swap, for [makers](/atomicdex/api/common_structures/swaps/maker_events/#maker-success-events) and [takers](/atomicdex/api/common_structures/swaps/taker_events#taker-success-events). | +| error\_events | list | A list of possible swap event types which may appear in a failed swap, for [makers](/atomicdex/api/common_structures/swaps/maker_events/#maker-error-events) and [takers](/atomicdex/api/common_structures/swaps/taker_events#taker-error-events). | + + + #### Example + + ```json + { + "type": "Taker", + "uuid": "5d02843e-d1b4-488d-aad0-114d82020453", + "events": [ + ... + ], + "maker_amount": "1", + "maker_coin": "DOC", + "taker_amount": "1", + "taker_coin": "MARTY", + "gui": null, + "mm_version": "23c89ced5", + "success_events": [ + ... + ], + "error_events": [ + ... + ] + } + ``` + + ```json + { + "FromId": 4 + } + ``` + +export const title = "Komodo Defi SDK Swaps: Maker Events"; +export const description = "A description of events and outcomes for each step of an atomic swap from the maker's perspective."; + +# Maker Swap Events + + + Needs update for watchtower events + + +## Maker Success Events + +Click on the Events below to view thier structure: + +* [Started](/atomicdex/api/common_structures/swaps/maker_events/#started) +* [Negotiated](/atomicdex/api/common_structures/swaps/maker_events/#negotiated) +* [TakerFeeValidated](/atomicdex/api/common_structures/swaps/maker_events/#taker-fee-validated) +* [MakerPaymentSent](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-sent) +* [TakerPaymentReceived](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-received) +* [TakerPaymentWaitConfirmStarted](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-wait-confirm-started) +* [TakerPaymentValidatedAndConfirmed](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-validated-and-confirmed) +* [TakerPaymentSpent](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-spent) +* [TakerPaymentSpendConfirmStarted](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-spend-confirm-started) +* [TakerPaymentSpendConfirmed](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-spend-confirmed) +* [Finished](/atomicdex/api/common_structures/swaps/maker_events/#finished) + +## Maker Error Events + +Click on the Events below to view thier structure: + +* [StartFailed](/atomicdex/api/common_structures/swaps/maker_events/#start-failed) +* [NegotiateFailed](/atomicdex/api/common_structures/swaps/maker_events/#negotiate-failed) +* [TakerFeeValidateFailed](/atomicdex/api/common_structures/swaps/maker_events/#taker-fee-validate-failed) +* [MakerPaymentTransactionFailed](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-transaction-failed) +* [MakerPaymentDataSendFailed](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-data-send-failed) +* [MakerPaymentWaitConfirmFailed](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-wait-confirm-failed) +* [TakerPaymentValidateFailed](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-validate-failed) +* [TakerPaymentWaitConfirmFailed](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-wait-confirm-failed) +* [TakerPaymentSpendFailed](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-spend-failed) +* [TakerPaymentSpendConfirmFailed](/atomicdex/api/common_structures/swaps/maker_events/#taker-payment-spend-confirm-failed) +* [MakerPaymentWaitRefundStarted](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-wait-refund-started) +* [MakerPaymentRefunded](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-refunded) +* [MakerPaymentRefundFailed](/atomicdex/api/common_structures/swaps/maker_events/#maker-payment-refund-failed) + + + #### Started + + The `Started` event indicates that mandatory pre-checks passed, such as "available balance," and that the swap started successfully. + + The swap goes to the negotiation stage after this event occurs. + + | Structure | Type | Description | + | ------------------------------ | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | + | taker\_coin | string | the ticker of the taker coin | + | maker\_coin | string | the ticker of the maker coin | + | taker | string (hexadecimal) | the p2p ID of taker node | + | secret | string (hexadecimal) | a random secret, the hash of which is used to lock atomic-swap payments | + | secret\_hash | string (hexadecimal) | the hash of the swap secret | + | my\_persistent\_pub | string (hexadecimal) | a persistent secp256k1 public key of maker node | + | lock\_duration | number (integer) | the lock duration of swap payments in seconds. The sender can refund the transaction when the lock duration is passed. The taker payment is locked for the lock duration. The maker payment is locked for lock duration \* 2 | + | maker\_amount | string (numeric) | the amount of coins to be swapped by maker | + | taker\_amount | string (numeric) | the amount of coins to be swapped by taker | + | maker\_payment\_confirmations | number (integer) | the required number of blockchain confirmations for maker payment | + | maker\_payment\_requires\_nota | bool | whether dPoW notarization is required for maker payment; can be null; available since `beta-2.0.1738` | + | taker\_payment\_confirmations | number (integer) | the required number of blockchain confirmations for taker payment | + | taker\_payment\_requires\_nota | bool | whether dPoW notarization is required for taker payment; can be null; available since `beta-2.0.1738` | + | maker\_payment\_lock | number (UTC timestamp in seconds) | the maker payment is locked until this timestamp | + | uuid | string | the swap uuid | + | started\_at | number (UTC timestamp in seconds) | the timestamp at the start of the swap | + | maker\_coin\_start\_block | number (integer) | the maker coin block number at the start of the swap | + | taker\_coin\_start\_block | number (integer) | the taker coin block number at the start of the swap | + + + ```json + TODO: Example TBA + ``` + + + #### StartFailed + + The `StartFailed` event indicates that some of the pre-checks did not pass, and therefore the swap did not start. + + The swap finishes immediately when this event occurs. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + + #### Negotiated + + The `Negotiated` event indicates that maker has received and validated swap negotiation data from taker. + + Maker starts waiting for taker to send the dex fee after this event occurs. + + | Structure | Type | Description | + | ------------------------ | --------------------------------- | ------------------------------------------------ | + | taker\_payment\_locktime | number (UTC timestamp in seconds) | the taker payment is locked until this timestamp | + | taker\_pubkey | string (hexadecimal) | a persistent secp256k1 public key of taker node | + + + ```json + { + "data": { + "lock_duration": 7800, + "maker_amount": "1", + "maker_coin": "BEER", + "maker_coin_start_block": 154221, + "maker_payment_confirmations": 1, + "maker_payment_lock": 1561545442, + "my_persistent_pub": "02031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3", + "secret": "ea774bc94dce44c138920c6e9255e31d5645e60c0b64e9a059ab025f1dd2fdc6", + "started_at": 1561529842, + "taker": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "taker_amount": "1", + "taker_coin": "PIZZA", + "taker_coin_start_block": 141363, + "taker_payment_confirmations": 1, + "uuid": "6bf6e313-e610-4a9a-ba8c-57fc34a124aa" + }, + "type": "Started" + } + ``` + + + #### NegotiateFailed + + The `NegotiateFailed` event indicates that taker negotiation data was not received or did not pass validation. + + The swap finishes immediately when this event occurs. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + { + "data": { + "error": "taker_swap:547] \"taker_swap:543] timeout (180.0 > 180.0)\"" + }, + "type": "NegotiateFailed" + } + ``` + + + #### TakerFeeValidated + + The `TakerFeeValidated` event indicates that maker received and validated dex fee data from taker. + + Maker sends their payment after this event occurs. + + | Structure | Type | Description | + | --------- | ------ | --------------------------------------- | + | tx\_hash | string | the hash of the transaction | + | tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "data": { + "tx_hash": "a59203eb2328827de00bed699a29389792906e4f39fdea145eb40dc6b3821bd6", + "tx_hex": "f8690284ee6b280082520894d8997941dd1346e9231118d5685d866294f59e5b865af3107a4000801ca0743d2b7c9fad65805d882179062012261be328d7628ae12ee08eff8d7657d993a07eecbd051f49d35279416778faa4664962726d516ce65e18755c9b9406a9c2fd" + }, + "type": "TakerFeeValidated" + } + ``` + + + #### TakerFeeValidateFailed + + The `TakerFeeValidateFailed` event indicates that taker dex fee data was not received or did not pass validation. + + The swap finishes immediately when this event occurs. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + + #### MakerPaymentTransactionFailed + + The `MakerPaymentTransactionFailed` event indicates that maker was not able to broadcast his payment transaction to maker coin blockchain. + + The swap finishes immediately when this event occurs. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + { + "data": { + "error": "lp_swap:1888] eth:654] RPC error: Error { code: ServerError(-32010), message: \"Transaction with the same hash was already imported.\", data: None }" + }, + "type": "MakerPaymentTransactionFailed" + } + ``` + + + #### MakerPaymentSent + + The `MakerPaymentSent` event indicates that maker has broadcast the maker payment transaction. + + Maker starts waiting for taker to send his payment after this event occurs. + + | Structure | Type | Description | + | --------- | ------ | --------------------------------------- | + | tx\_hash | string | the hash of the transaction | + | tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "data": { + "tx_hash": "efa90a2918e6793c8a2725c06ee34d0fa76c43bc85e680be195414e7aee36154", + "tx_hex": "0400008085202f890cdcd071edda0d5f489b0be9c8b521ad608bb6d7f43f6e7a491843e7a4d0078f85000000006b483045022100fbc3bd09f8e1821ed671d1b1d2ed355833fb42c0bc435fef2da5c5b0a980b9a002204ef92b35576069d640ca0ac08f46645e5ade36afd5f19fb6aad19cfc9fb221fb012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffe6ae2a3ce221a6612d9e640bdbe10a2e477b3bc68a1aeee4a6784cb18648a785010000006a47304402202000a7e60ae2ce1529247875623ef2c5b42448dcaeac8de0f8f0e2f8e5bd8a6b0220426321a004b793172014f522efbca77a3dc92e86ce0a75330d8ceb83072ad4e7012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff9335553edcbac9559cae517a3e25b880a48fabf661c4ac338394972eef4572da000000006b4830450221008ded7230f2fb37a42b94f96174ec192baf4cd9e9e68fb9b6cf0463a36a6093e00220538de51ceda1617f3964a2350802377940fdfa018cc1043d77c66081b1cab0c4012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3fffffffff91b5d3733877f84108de77fec46bee156766e1a6837fa7b580ccbc3905acb14000000006b483045022100d07cf1fd20e07aafdc942ba56f6b45baee61b93145a2bdba391e2cdb8024bf15022056ea8183990703ef05018df2fe8bd5ec678ec0f9207b0283292b2cdafc5e1e0c012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff147870387ca938b2b6e7daa96ba2496014f125c0e4e576273ef36ee8186c415a000000006a47304402204c5b15b641d7e34444456d2ea6663bdc8bd8216e309a7220814474f346b8425e0220634d1dd943b416b7a807704d7f7a3d46a60d88ef4e20734588a0b302c55fa82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffd2b954ae9b4a61fad9f7bc956d24e38d7b6fe313da824bd3bd91287d5a6b49d9000000006b483045022100a7387d9ab7b2c92d3cbce525e96ffac5ae3ef14f848661741ada0db17715c4a002202c1417d5e3e04b1a2d1774a83bb8d5aa1c0536c100138123089fa69921b5d976012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff28792a2e26d9d7be0467fac52b12ece67410b23eea845008257979bd87d083e3000000006a473044022027c40517c33cd3202d4310cfd2c75f38e6d7804b255fc3838a32ea26e5a3cb0002202b4399e1d7e655b64f699318f2bfbdced49f064ee54e9d6a678668fce51caf96012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffa8bf797bacd213b74a9977ae1b956afe3af33a1ee94324e010a16db891a07441000000006a473044022004cbb1d970b9f02c578b5c1d7de33361581eebc19c3cd8d2e50b0211ca4ef13702200c93b9fe5428055b6274dc8e52073c3e87f5b5e4206134d745928ccfc9393919012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff2b6fd82c9a68111b67ad85a614a6ecb50f7b6eac3d21d8ebefd9a6065cdf5729000000006b483045022100fdff16c595c7b4a9b4fc1e445b565f7b29fe5b7a08f79291b0ff585c7b72ac2902200c694aa124013bd419ce2349f15d10435827868d35db939b9d3c344d16e78420012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff6a5468dd8c83553dc51022f2a2fb772cf91c8607dc2ca1b8f203ac534612ab29000000006b483045022100ba7cc79e7ae3720238bfc5caa225dc8017d6a0d1cb1ec66abaf724fd20b3b7ab02206e8c942756604af0f63b74af495a9b3b7f4a44c489267f69a14cf2b1b953f46e012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff5f9f48a91d343fd5aef1d85f00850070931459ab256697afb728d1c81c1fa1d2000000006a47304402200ec85fc66f963e7504eb27361a4b4bb17de60e459da414fdc3962476de636134022056b62c15cf7f9b4e7d4e11c03e4e541dd348919b8c55efa4f1927e2fdd5ae8ea012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffee1f455924d3167e7f7abf452c1856e9abdcfe27dc889942dd249cb376169d38000000006b48304502210089274eed807c5d23d819f6dfa8a358a9748e56f2080be4396ef77bb19d91b17402207fc7b22c879534fffe0eeaaec8fc284e22c2756f380c05ea57b881a96b09f3af012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f5050000000017a9144eb3a361d8a15d7f6a8ef9d1cf44962a90c44d548702912b00000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac490e135d000000000000000000000000000000" + }, + "type": "MakerPaymentSent" + } + ``` + + + #### MakerPaymentDataSendFailed + + The `MakerPaymentDataSendFailed` event indicates that maker was not able to send his payment data to taker due to a network error. + When this event occurs, maker starts waiting for **maker payment lock time expiration** to issue a refund. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + + #### MakerPaymentWaitConfirmFailed + + The `MakerPaymentWaitConfirmFailed` event indicates that maker payment transaction did not reach the required number of confirmations before the internal timeout expiration. + + When this event occurs maker starts waiting for **maker payment lock time expiration** to issue a refund. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + { + "type": "MakerPaymentWaitConfirmFailed", + "data": { + "error": "An error" + } + } + ``` + + + #### TakerPaymentReceived + + The `TakerPaymentReceived` event indicates that maker received the taker payment transaction data. + + Maker starts waiting for taker payment confirmation after this event occurs. + + | Structure | Type | Description | + | --------- | ------ | --------------------------------------- | + | tx\_hash | string | the hash of the transaction | + | tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "data": { + "tx_hash": "7e0e38e31dbe80792ef320b8c0a7cb9259127427ef8c2fca1d796f24484046a5", + "tx_hex": "0400008085202f892082f6916932f9bf674a3fb00c3d5d765303ab68461f4abe0f91cc1162546914a9010000006b483045022100999b8bb0224476b5c344a466d0051ec7a8c312574ad8956a4177a42625cb86e302205a6664396bff3f2e6fe57adb7e082a26d1b8da9ee77b3fc24aa4148fdd5c84db012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffcad29a146b81bcaa44744efbec5149b6e3ca32bace140f75ad5794288d5bff6c000000006b483045022100b4dbfe88561c201fb8fbaf5bbf5bc0985893c909429c579425da84b02d23cc12022075f1e1e3eba38d167a6e84aac23faee5a2eb0799511e647213cee168529d4e5d012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffa13eeacd04b3e26ae3f41530b560c615dafa0fd4235cc5b22d48ab97e7c3399c000000006a47304402201158306fe668cbf56ad3f586dc83c1cda9efab44cef46da6bc0fe242292c85ed02201d622fe283410320e760233ae81dc53df65406b09fd07f8649f1775689219c35012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff4352b9f1f01dde4209b9e91076a3cfcabdaa23d9d5a313abfe7edb67ee4273e3000000006b483045022100825242fb3c6d460580016e93718ae1f43917e53abcc1558a64a6ab6f406763dd0220543936ce4c725e5e9f03831274a8475b535171bb29e1919fcf52ba2a9c85a553012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffcc0fa94b5973c893e61d470ae3982b0bedfd29cb0da2c60a362de438598f108c000000006b4830450221008c70a8e10ca37819e5a4d9783366e729e690d78f2fdd8a1f4812ddc14ec7d6ad022035ba8cb4d4e50684107f8af5c184582687b5d7dfda5d9be1bd45e45749c77f08012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffb0bd3bb9fedb7bbf49ca1612c955ba6095202186cef5be6952aed3dd32da4268000000006a4730440220592216d63c199faa587a4a6cbe11ca26027368a116b50818ce30eced59ca887202201bcafcf88f9f2632151596732f839d77cbe2f2243822c8551faffecc90b5dc19012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff65cf2831fc200e55aaacbe0881ad0edfb298ee6d4421b08b048aecc151716bd1000000006a47304402202032eb1ccebc3be4b94bae343d1d168e87040d2d20977c47d073d6bf490ef6c00220067656e00c4b8930167c54078609925cec7b893a52bcb9304e6b2602f564413e012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffeaf67880bee214acecc74b12f648c1014d6394c4abf99832d408981bb460e999000000006b483045022100b9ae1cc824149220ac517298e6f21c26939485b31d0ae19d97d986c5f8f34e4502200a90578cf2c1835dbea00484af1f225711c255f1d0a3208f2e4f1154f0db2c9a012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffad089c3fe7987a44f150f34b7ac66972de76dd84c739bdeddf360ab029dfd4d6000000006a473044022015f0386ed67a61626fbe5ae79e0d39d38e7b4072b648e8a26e23adadc0a8e5bc02202398188fa2feb26994e5c1e7e758788de3d5f0f0096f956a0cd58804710bea6a012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffd6c66730546c62dd003b5af1f1e5ecfd339c62db0169c1d499584e09a8a9b288000000006b4830450221008d4c73f0e3c9d913ba32fd864167649242e3e891412ab80bdd3f7ff43a238ee20220602738e98008b146256b51d0df99e222aa165f2ce351241ebc23d8a098e2b0db012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff12d9eff354f46cbd4446a0bff27a6a635ff5b1dc8a5dd8b0178bb5f89c9ec080000000006b48304502210098d3349ba9b13560748949933d2704663a5ab52cdc804afa1ac4da3e5992e0a002201525d7ad8466ad260219f3873fb7781addbd363f91e8063bfa86c7ed4e385b84012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff69e16767806ea5f069b7d46674f7aa747fcc6e541189ce7fcf92edcfd7642ff4000000006b4830450221008a5ebfe904c87f21947a44d8418190be5893993a683fde0f96df8a9487923da002205be1bbd8b518ba2f303cae23bc20806e84ffbba6a03f032385b15edb8df107f4012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640fffffffff4fbabd508178f553e676d67ce325796b03aa249b41a23c681c1ad9dedb45ae7000000006a47304402207cea6824abe1ce35e18954b858d45243e2cb57d27d782adc5b6b07ebd21a02d7022007ba0469b298c4b1a7c4a148fa16bae93d28593b34e197c10ac0d1faf9cc1bfa012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff14867aa59932d895be607fb7398f5594e39d9fa2e1c7daaed7b1390dbfdddcab000000006b4830450221009fb6e1885a3658c593809f95ecd2049f8ef9e00379686ac236b17312c9613d4c0220709fc50c9a920a19254389944db366c354708c19885d2479d9968fda0848f9f7012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff75777c692daaa21d216a1a2a7059203becfcdcf6793aa1259cdd7aadec957ab6000000006a47304402202945019860abf9b80e71f340320d114846efa4d2780ce12513e3983fb4d3f15b022019be008fb7368e3f1f022924dc7af1138b94041f46084dd27768bc8cacd1529f012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffca037b85742e93df4eef8e8ac3b8531321c8a8e21a4a941360866ea57a973665000000006a4730440220760283a7828edcc53671fc73e29c30cdc64d60d300292761d39730f0d09f94c202201e026293e3891a6fe46e40cd21778a41e21641a261a7fbf3bf75b034d9c788d9012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffa68edd030b4307ad87bfeff96a6db5b3ddd1a0901c488a4fe4d2093531896d75000000006b48304502210091a41e16b2c27d7ef6077e8de9df692b6013e61d72798ff9f7eba7fc983cdb65022034de29a0fb22a339e8044349913915444ab420772ab0ab423e44cfe073cb4e70012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff8c952791181993a7512e48d098a06e6197c993b83241a4bf1330c0e95f2c304d000000006b483045022100fa14b9301feb056f6e6b10446a660525cc1ff3e191b0c45f9e12dcd4f142422c02203f4a94f2a9d3ec0b74fac2156dd9b1addb8fa5b9a1cfc9e34b0802e88b1cbfa3012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff32bc4d014542abf328fecff29b9f4c243c3dd295fe42524b20bf591a3ddc26a1000000006a47304402206f92c4da6651c8959f7aed61608d26b9e46f5c1d69f4fc6e592b1f552b6067f102201c8cc221eac731867d15d483cc83322dba2f14f31d3efb26be937a68ad772394012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffbb3877248c26b23023d7dbb83a5f8293c65c5bff4ac47935a4a31248cefffd91000000006a47304402205bab19ad082a1918e18ccb6462edc263196fb88c8fdfd6bd07a0cf031a4637810220371a621c1bdc6b957db2447a92dcf87b0309653a2db480c9ed623f34a6e6d8a9012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff6415b7356c94609b9a7a7eb06e4c306896767abbc11399779f952fb9ae197059000000006b483045022100e2d038dbb9a873f5a58ec7901d6a7e79f1b404afea3d852056f4d0746cfb821102207fb274947b10d467cd71aa948e9a50f5f4430b661b27afc347efd9d6cc409d9c012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff1aeefdf80ec8a07d657ca64a2c0aa465f58e6284755c9a263c5a807be43b4b81000000006a47304402206e7ff765ba47a8785008f64f49c8e73232d582b2b2d0a49be0880c2557de8f8602206448423a6a37ad9740eb316513b31f73599ae14f65623709fb5443ae609f3e2e012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff3c091681df17b46f280bc9d8011c1bb31397637ce945b393f70380f8cd0a8b0d010000006a47304402206ca8717000f3086d364318f56d52e2369c40b88a1cb86455a8db262b4816698a02206711caf453bfda6b1b3542e27e68c3180f92f0548326d74e30b3ed18cd2c2353012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff91f32d98b581def165495aff6b69530e1f3de7f68fabfeb93730cf9793bbcd2a000000006a47304402200a8cd5e29ee7ff136772ea1789a39a027eaa1cd92f90f9d57fd8cf77202251f402203dd2bc282a838a5730e840a0d22b4f0edbe3cb2da00466c66bc2b5c66fc8b032012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff854d9226c28a1f5fe440e08f41000f3547f304ecf9cc010d0b5bc845ef1f039a000000006b483045022100fe6cce49975cc78af1c394bc02d995710833ba08cf7f8dd5f99add2cc7db26c40220793491309c215d8314a1c142bef7ec6b9a397249bec1c00a0a5ab47dfc1208b6012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff593bc907aa71f3b0f7aa8c48bb5f650595e65a5a733a9601a8374ed978eec9a7000000006a47304402206362ae3c4cf1a19ba0e43424b03af542077b49761172c1ad26d802f54b1b6ca602206bc7edb655bb0024c0e48c1f4c18c8864f8d1ce59ae55cd81dc0bd1234430691012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff3b9da8c5ab0c0cd6b40f602ea6ed8e36a48034b182b9d1a77ffebd15fe203b94000000006b483045022100f8610eae25899663cb5fa9a4575d937da57cdfd41958794bbb4c02f8bed75da40220262d40e019ec3a57b252f4150d509cce6f8a2dbd83184a9fc2ed56aba8018b15012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff0897c8a57e15e7f3893b195d65cf6c6001b29c8c9734213d7a3131f57b9eca2e000000006b483045022100c485cbd6408cf0759bcf23c4154249882934b522a93c6b49e62412305bf7646902201cc4b668af4bb22fe57c32c4d34e822bceb12f6bd6923afdabf4894752a56ec3012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffffdc7000f7c45b62960623fa3a277e8a55348a4fe4936fef1224b6953434a249000000006b4830450221008a51a9c26f475d5c0838afe9d51524f95adfb21a9b0a02eae31cb01dc0a31fab022071c5492fbc7270731d4a4947a69398bf99dd28c65bb69d19910bf53a515274c8012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff10ec2af7e31ca28e27177215904d9a59abf80f0652b24e3f749f14fb7b2264ec000000006b483045022100fe4269f8f5ca53ebcff6fb782142a6228f0e50498a531b7a9c0d54768af9854102207cc740a9ea359569b49d69a94215ce3e23aeda5779cebc434ad3d608e1752990012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff5e3830c088dd6ea412d778b0a700ef27c183cf03e19f3d6f71bc5eaf53b2c22e000000006b4830450221009788a7e7f2407ba2f7c504091fbdf8f8498367781e8a357616d68e2a6770b4e70220518c92f5fb21e6bfd7d870a783b2a5572ce003f2dbb237ec59df419c9a148966012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff51630ccb0ad32b24cc7ae1b3602950ba518dca6aa65ef560e57f08c23eed8d80000000006a47304402201aa556153ffeb13aa674353bf88c04a7af15c7eb32e1a835464e4b613c31dc2802200395858c29a46e9108de1f90b401ee26c296388b4073143b63f849b2cce461af012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff0200e1f5050000000017a914ab802c4d644be63fd1a72834ff63b650d6b5353987bb7e1e00000000001976a91464ae8510aac9546d5e7704e31ce177451386455588ac680e135d000000000000000000000000000000" + }, + "type": "TakerPaymentReceived" + } + ``` + + + #### TakerPaymentWaitConfirmStarted + + The `TakerPaymentReceived` event indicates that maker started waiting for taker payment confirmation. + + This event does not have additional data. + + #### TakerPaymentValidateFailed + + The `TakerPaymentValidateFailed` event indicates that taker payment did not pass validation. For example, taker payment may have an invalid amount or the payment might be locked with a non-matching hash or timestamp. + + When this event occurs maker starts waiting for **maker payment lock time expiration** to issue a refund. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + { + "type": "TakerPaymentValidateFailed", + "data": { + "error": "Origin Taker error event: MakerPaymentWaitConfirmFailed(SwapError { error: \"An error\" })" + } + } + ``` + + + #### TakerPaymentWaitConfirmFailed + + The `MakerPaymentWaitConfirmFailed` event indicates that the taker payment transaction did not reach the required number of confirmations before the internal timeout expiration. + + When this event occurs maker starts waiting for **maker payment lock time expiration** to issue a refund. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + + #### TakerPaymentValidatedAndConfirmed + + The `TakerPaymentValidatedAndConfirmed` event indicates that maker validated taker payment and payment was confirmed the required number of times. + + Maker attempts to spend the taker payment after this event occurs. + + This event does not have additional data. + + #### TakerPaymentSpendFailed + + The `TakerPaymentSpendFailed` event indicates that maker payment was not able to spend taker payment. + + When this event occurs maker starts waiting for **maker payment lock time expiration** to issue a refund. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + { + "type": "TakerPaymentValidatedAndConfirmed" + } + ``` + + + #### TakerPaymentSpent + + The `TakerPaymentSpent` event indicates that maker has broadcast the **taker payment spend** transaction. + + Maker starts waiting for **taker payment spend** confirmation after this event occurs. + + | Structure | Type | Description | + | --------- | ------ | --------------------------------------- | + | tx\_hash | string | the hash of the transaction | + | tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "data": { + "secret": "fb968d5460399f20ffd09906dc8f65c21fbb5cb8077a8e6d7126d0526586ca96", + "transaction": { + "tx_hash": "68f5ec617bd9a4a24d7af0ce9762d87f7baadc13a66739fd4a2575630ecc1827", + "tx_hex": "0400008085202f890161394fc7f1ddcf732f838d7d74e59ed7d968117ac170b3adde9e0404b26a929500000000d8483045022100a33d976cf509d6f9e66c297db30c0f44cced2241ee9c01c5ec8d3cbbf3d41172022039a6e02c3a3c85e3861ab1d2f13ba52677a3b1344483b2ae443723ba5bb1353f0120fb968d5460399f20ffd09906dc8f65c21fbb5cb8077a8e6d7126d0526586ca96004c6b63049858835db1752102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ac6782012088a914eba736c5cc9bb33dee15b4a9c855a7831a484d84882102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ac68ffffffff011880d717000000001976a91464ae8510aac9546d5e7704e31ce177451386455588ac942c835d000000000000000000000000000000" + } + }, + "type": "TakerPaymentSpent" + } + ``` + + + #### TakerPaymentSpendConfirmStarted + + The `TakerPaymentSpendConfirmStarted` event indicates that maker started waiting for **taker payment spend** transaction confirmation. + + This event does not have additional data. + + #### TakerPaymentSpendConfirmFailed + + The `TakerPaymentSpendConfirmFailed` event indicates that the **taker payment spend** transaction did not reach the required number of confirmations before the **maker payment lock time expiration** or the **taker payment spend** transaction rejected for some reason. + + Maker attempts to refund the maker payment. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + + #### TakerPaymentSpendConfirmed + + The `TakerPaymentSpendConfirmed` event indicates that the taker payment spend transaction was confirmed the required number of times. + + The swap finishes immediately when this event occurs. + + This event does not have additional data. + + #### MakerPaymentWaitRefundStarted + + The `MakerPaymentWaitRefundStarted` event indicates that maker started waiting for lock time expiration to refund the payment. + + | Structure | Type | Description | + | ----------- | ---------------------- | ------------------------------------------ | + | wait\_until | number (UTC timestamp) | the timestamp at which a refund will occur | + + + ```json + { + "type": "TakerPaymentSpendConfirmed" + } + ``` + + + #### MakerPaymentRefundFailed + + The `MakerPaymentRefundFailed` event indicates that maker was not able to broadcast a refund transaction to the maker coin blockchain. + + The swap finishes immediately when this event occurs. + + | Structure | Type | Description | + | --------- | ------ | ---------------------------------- | + | error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + + #### MakerPaymentRefunded + + The `MakerPaymentRefunded` event indicates that maker has broadcast the maker payment refund transaction. + + The swap finishes immediately when this event occurs. + + | Structure | Type | Description | + | --------- | ------ | --------------------------------------- | + | tx\_hash | string | the hash of the transaction | + | tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + TODO: Example TBA + ``` + + + #### Finished + + The `Finished` event indicates that the swap finished. + + This event does not have additional data. + +export const title = "Komodo Defi SDK Swaps: Taker Events"; +export const description = "A description of events and outcomes for each step of an atomic swap from the taker's perspective."; + +# Taker Swap Events + + + Needs update for watchtower events + + +## Taker Success Events + +Click on an Event below to view its structure: + +* [Started](/atomicdex/api/common_structures/swaps/taker_events/#started) +* [Negotiated](/atomicdex/api/common_structures/swaps/taker_events/#negotiated) +* [TakerFeeSent](/atomicdex/api/common_structures/swaps/taker_events/#taker-fee-sent) +* [TakerPaymentInstructionsReceived](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-instructions-received) +* [MakerPaymentReceived](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-received) +* [MakerPaymentWaitConfirmStarted](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-wait-confirm-started) +* [MakerPaymentValidatedAndConfirmed](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-validated-and-confirmed) +* [TakerPaymentSent](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-sent) +* [TakerPaymentSpent](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-spent) +* [MakerPaymentSpent](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-spent) +* [Finished](/atomicdex/api/common_structures/swaps/taker_events/#finished) + +## Taker Error Events + +Click on an Event below to view its structure: + +* [StartFailed](/atomicdex/api/common_structures/swaps/taker_events/#start-failed) +* [NegotiateFailed](/atomicdex/api/common_structures/swaps/taker_events/#negotiate-failed) +* [TakerFeeSendFailed](/atomicdex/api/common_structures/swaps/taker_events/#taker-fee-send-failed) +* [MakerPaymentValidateFailed](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-validate-failed) +* [MakerPaymentWaitConfirmFailed](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-wait-confirm-failed) +* [TakerPaymentTransactionFailed](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-transaction-failed) +* [TakerPaymentWaitConfirmFailed](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-wait-confirm-failed) +* [TakerPaymentDataSendFailed](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-data-send-failed) +* [TakerPaymentWaitForSpendFailed](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-wait-for-spend-failed) +* [MakerPaymentSpendFailed](/atomicdex/api/common_structures/swaps/taker_events/#maker-payment-spend-failed) +* [TakerPaymentWaitRefundStarted](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-wait-refund-started) +* [TakerPaymentRefundStarted](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-refund-started) +* [TakerPaymentRefunded](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-refunded) +* [TakerPaymentRefundFailed](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-refund-failed) +* [TakerPaymentRefundFinished](/atomicdex/api/common_structures/swaps/taker_events/#taker-payment-refund-finished) + + #### Started + + The `Started` event indicates that mandatory pre-checks, such as "available balance," passed and the swap started successfully. + + The swap goes to negotiation stage after this event occurs. + + | Structure | Type | Description | + | ------------------------------ | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | + | taker\_coin | string | the ticker of taker coin | + | maker\_coin | string | the ticker of maker coin | + | maker | string (hexadecimal) | the p2p ID of maker node | + | my\_persistent\_pub | string (hexadecimal) | a persistent secp256k1 public key of taker node | + | lock\_duration | number (integer) | the lock duration of swap payments in seconds. The sender can refund the transaction when the lock duration is passed. The taker payment is locked for the lock duration. The maker payment is locked for lock duration \* 2 | + | maker\_amount | string (numeric) | the amount of coins to be swapped by maker | + | taker\_amount | string (numeric) | the amount of coins to be swapped by taker | + | maker\_payment\_confirmations | number (integer) | the required number of blockchain confirmations for maker payment | + | maker\_payment\_requires\_nota | bool | whether dPoW notarization is required for maker payment; can be null; available since `beta-2.0.1738` | + | taker\_payment\_confirmations | number (integer) | the required number of blockchain confirmations for taker payment | + | taker\_payment\_requires\_nota | bool | whether dPoW notarization is required for taker payment; can be null; available since `beta-2.0.1738` | + | taker\_payment\_lock | number (UTC timestamp in seconds) | the taker payment is locked until this timestamp | + | uuid | string | the swap uuid | + | started\_at | number (UTC timestamp in seconds) | the timestamp at the start of the swap | + | maker\_payment\_wait | number (UTC timestamp in seconds) | taker will wait for maker payment confirmation until this timestamp | + | maker\_coin\_start\_block | number (integer) | the maker coin block number at the start of the swap | + | taker\_coin\_start\_block | number (integer) | the taker coin block number at the start of the swap | + + + ```json + { + "type": "Started", + "data": { + "taker_coin": "MARTY", + "maker_coin": "DOC", + "maker": "7310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5", + "my_persistent_pub": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2", + "lock_duration": 7800, + "maker_amount": "1", + "taker_amount": "1", + "maker_payment_confirmations": 1, + "maker_payment_requires_nota": false, + "taker_payment_confirmations": 0, + "taker_payment_requires_nota": false, + "taker_payment_lock": 1674809878, + "uuid": "0d72c435-821e-4278-b2a7-e36ab1ba8cb7", + "started_at": 1674802078, + "maker_payment_wait": 1674805198, + "maker_coin_start_block": 1800637, + "taker_coin_start_block": 1813161, + "fee_to_send_taker_fee": { + "coin": "MARTY", + "amount": "0.00001", + "paid_from_trading_vol": false + }, + "taker_payment_trade_fee": { + "coin": "MARTY", + "amount": "0.00002", + "paid_from_trading_vol": false + }, + "maker_payment_spend_trade_fee": { + "coin": "DOC", + "amount": "0.00001", + "paid_from_trading_vol": true + }, + "maker_coin_htlc_pubkey": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2", + "taker_coin_htlc_pubkey": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2", + "p2p_privkey": null + } + } + ``` + + +#### StartFailed + +The `StartFailed` event indicates that some of the pre-checks did not pass, and therefore the swap did not start. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### Negotiated + +The `Negotiated` event indicates that taker has received and validated swap negotiation data from maker. + +Taker sends dex fee after this event occurs. + +| Structure | Type | Description | +| ------------------------ | --------------------------------- | ----------------------------------------------------------------- | +| maker\_payment\_locktime | number (UTC timestamp in seconds) | the maker payment is locked until this timestamp | +| maker\_pubkey | string (hexadecimal) | a persistent secp256k1 public key of maker node | +| secret\_hash | string (hexadecimal) | the swap payments are expected to be locked with this secret hash | + + + ```json + { + "type": "Negotiated", + "data": { + "maker_payment_locktime": 1639000040, + "maker_pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "secret_hash": "4da9e7080175e8e10842e0e161b33cd298cab30b", + "maker_coin_swap_contract_addr": null, + "taker_coin_swap_contract_addr": null + } + } + ``` + + +#### NegotiateFailed + +The `NegotiateFailed` event indicates that maker negotiation data was not received or did not pass validation. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + { + "data": { + "error": "taker_swap:547] \"taker_swap:543] timeout (180.0 > 180.0)\"" + }, + "type": "NegotiateFailed" + } + ``` + + +#### TakerFeeSent + +The `TakerFeeSent` event indicates that taker broadcast the dex fee transaction. + +Taker starts waiting for maker payment after this event occurs. + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| tx\_hash | string | the hash of the transaction | +| tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "type": "TakerFeeSent", + "data": { + "tx_hex": "0400008085202f8901f425fbefe21f33ccb7b487df251191b27dfa7b639b04f60e5493c7ea41dbf149000000006b483045022100d5ec3e542175479bd4bd011e19b76a75e99f19cc49867e5bca9541950322c33a02207a4d1ffd674fb9760de79bb4929af44d66344b5e182de3c377186deebf6bf376012103ad6f89abc2e5beaa8a3ac28e22170659b3209fe2ddf439681b4b8f31508c36faffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac5ce6f305000000001976a914d55f0df6cb82630ad21a4e6049522a6f2b6c9d4588ac7c152160000000000000000000000000000000", + "tx_hash": "75323ab7acd64bd35242611fabaec560d9acf2e1f9ca28d3a4aba47a79fb49c4" + } + } + ``` + + +#### TakerFeeSendFailed + +The `TakerFeeSendFailed` event indicates that the taker dex fee transaction failed to broadcast to the taker coin blockchain, or that the taker failed to send the transaction data to maker. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### TakerPaymentInstructionsReceived + +The `TakerPaymentInstructionsReceived` event indicates that the taker has received payment instructions. + +This event does not have additional data. + + + ```json + { + "type": "TakerPaymentInstructionsReceived", + "data": null + } + ``` + + +#### MakerPaymentValidateFailed + +The `MakerPaymentValidateFailed` event indicates that taker was not able to receive or validate the maker payment transaction. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### MakerPaymentReceived + +The `MakerPaymentReceived` event indicates that taker received the maker payment transaction data. + +Taker starts waiting for transaction confirmation after this event occurs. + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| tx\_hash | string | the hash of the transaction | +| tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "type": "MakerPaymentReceived", + "data": { + "tx_hex": "0400008085202f89028bef955e42107c562e4e02421f25c455723a701573f86c17b4d82e35a7d8f9f7020000006b483045022100b12fc9d95acca76bf5fd8d5c6acc288b454032ba4561b1c2b1f5f33b2cf2926d022017e561bc2cd93308848674b47b2e8ebd8f074ea78e32454d5fea6f08c0b1f1e40121037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ffffffff5dfd0b24c0f7c3cf235868cf9a26ec49574764d135796fc4e7d20e95d55a8653000000006a47304402207c752d14601d1c99892f9d6c88c8ff2f93211640a65b2ee69172a16b908b21e402206f0b66684158445888271a849ab46258ad722496ee64fde055a6f44e36ed2ccc0121037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ffffffff0300e1f5050000000017a9141b85c1a277f44f7d77d52b78e2ba70a0becc2ff9870000000000000000166a14026bebc2e19c243d0940dd583c9573bf10377afda7d26301000000001976a91486f747b28c60ad1130bdd3f84f48eeaf1801ca9888ac87152160000000000000000000000000000000", + "tx_hash": "27dafe553246553d54f909fbbded80e6d490fdb95ca7b6807d73eca45f0d7a22" + } + } + ``` + + +#### MakerPaymentWaitConfirmStarted + +The `MakerPaymentWaitConfirmStarted` event indicates that taker started waiting for maker payment confirmation. + +This event does not have additional data. + +#### MakerPaymentWaitConfirmFailed + +The `MakerPaymentWaitConfirmFailed` event indicates that the maker payment transaction did not reach the required number of confirmations before the internal timeout expiration. + +Taker swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + { + "type": "MakerPaymentWaitConfirmStarted" + } + ``` + + +#### MakerPaymentValidatedAndConfirmed + +The `MakerPaymentValidatedAndConfirmed` event indicates that taker validated maker payment and the payment was confirmed the required number of times. + +Taker sends his payment after this event occurs. + +This event does not have additional data. + + + ```json + { + "type": "MakerPaymentValidatedAndConfirmed" + } + ``` + + +#### TakerPaymentSent + +The `TakerPaymentSent` event indicates that taker broadcast taker payment transaction to taker coin blockchain. + +Taker starts waiting for maker to spend this transaction. + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| tx\_hash | string | the hash of the transaction | +| tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "data": { + "tx_hash": "95926ab204049edeadb370c17a1168d9d79ee5747d8d832f73cfddf1c74f3961", + "tx_hex": "0400008085202f8902875f5e5428c8ecfeb58c558dce6353f5127ef2a06a497453d7d888da4dbe070c010000006a4730440220416059356dc6dde0ddbee206e456698d7e54c3afa92132ecbf332e8c937e5383022068a41d9c208e8812204d4b0d21749b2684d0eea513467295e359e03c5132e719012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff46b98696761d5e8667ffd665b73e13a8400baab4b22230a7ede0e4708597ee9c010000006b483045022100a990c798d0f96fd5ff7029fd5318f3c742837400d9f09a002e7f5bb1aeaf4e5a0220517dbc16713411e5c99bb0172f295a54c97aaf4d64de145eb3c5fa0fc38b67ff012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff020084d7170000000017a9144d57b4930e6c86493034f17aa05464773625de1c877bd0de03010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8c3a835d000000000000000000000000000000" + }, + "type": "TakerPaymentSent" + } + ``` + + +#### TakerPaymentTransactionFailed + +The `TakerPaymentTransactionFailed` event indicates that taker failed to broadcast transaction to taker coin blockchain. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### TakerPaymentWaitConfirmFailed + +The `TakerPaymentWaitConfirmFailed` event indicates that the taker payment transaction did not reach the required number of confirmations before the internal timeout expiration. + +When this event occurs taker starts waiting for taker payment lock time expiration to issue a refund. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### TakerPaymentDataSendFailed + +The `TakerPaymentDataSendFailed` event indicates that taker was not able to send his payment data to maker due to a network error. + +When this event occurs taker starts waiting for taker payment lock time expiration to issue a refund. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### TakerPaymentSpent + +The `TakerPaymentSpent` event indicates that maker spent taker payment and taker discovered the transaction. + +When this event occurs taker extracts the secret from the transaction and attempts to spend maker payment. + +| Structure | Type | Description | +| -------------------- | ------ | ---------------------------------------------------------- | +| secret | string | the atomic swap secret extracted from spending transaction | +| transaction | object | transaction object | +| transaction.tx\_hash | string | the hash of the transaction | +| transaction.tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "data": { + "secret": "fb968d5460399f20ffd09906dc8f65c21fbb5cb8077a8e6d7126d0526586ca96", + "transaction": { + "tx_hash": "68f5ec617bd9a4a24d7af0ce9762d87f7baadc13a66739fd4a2575630ecc1827", + "tx_hex": "0400008085202f890161394fc7f1ddcf732f838d7d74e59ed7d968117ac170b3adde9e0404b26a929500000000d8483045022100a33d976cf509d6f9e66c297db30c0f44cced2241ee9c01c5ec8d3cbbf3d41172022039a6e02c3a3c85e3861ab1d2f13ba52677a3b1344483b2ae443723ba5bb1353f0120fb968d5460399f20ffd09906dc8f65c21fbb5cb8077a8e6d7126d0526586ca96004c6b63049858835db1752102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ac6782012088a914eba736c5cc9bb33dee15b4a9c855a7831a484d84882102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ac68ffffffff011880d717000000001976a91464ae8510aac9546d5e7704e31ce177451386455588ac942c835d000000000000000000000000000000" + } + }, + "type": "TakerPaymentSpent" + } + ``` + + +#### TakerPaymentWaitForSpendFailed + +The `TakerPaymentWaitForSpendFailed` event indicates that maker did not spend taker payment before lock time expiration. + +When this event occurs taker attempts to refund the payment. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### MakerPaymentSpendFailed + +The `MakerPaymentSpendFailed` event indicates that taker failed to broadcast **maker payment spend** transaction to the maker coin blockchain. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + { + "data": { + "error": "taker_swap:798] utxo:950] utxo:950] error" + }, + "type": "MakerPaymentSpendFailed" + } + ``` + + +#### MakerPaymentSpent + +The `MakerPaymentSpent` event indicates that taker spent maker payment. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| tx\_hash | string | the hash of the transaction | +| tx\_hex | string | transaction bytes in hexadecimal format | + + + ```json + { + "type": "MakerPaymentSpent", + "data": { + "tx_hex": "0400008085202f890180cf0d2057acf781f5854b576080842641ff56d6f0457258f2a15710fa35958700000000d74730440220159ac3c574bed4473bd6da6eb4b37a3c073dbe5311a4648795f2b0c02b68ef8d022034bc743cbe656b3d335a138f21093fcc9039f50bff40cf56e2654eb9eb225ca901201e2e0289634d42865e0f82ff0546ce2a384ae3548fb3f927c4aa1faefb0aa5d4004c6b63048cb0d363b17521037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ac6782012088a9149af6a305578518d693fca3f1e4c529224a81f654882103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ac68ffffffff0118ddf505000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88ac8cb0d363000000000000000000000000000000", + "tx_hash": "02c6bc927712478b866c3303cfdfacb868545a6730513605d4d7b5b2dbe97b09" + } + } + ``` + + +#### TakerPaymentWaitRefundStarted + +`TakerPaymentWaitRefundStarted` event indicates that taker started waiting for lock time expiration to refund the payment. + +| Structure | Type | Description | +| ----------- | ---------------------- | ------------------------------------------ | +| wait\_until | number (UTC timestamp) | the timestamp at which a refund will occur | + + + ```json + ``` + + +#### TakerPaymentRefundStarted + +`TakerPaymentRefundStarted` event indicates that taker was has initiated the refund process. + + + ```json + TODO: Table and Example TBA + ``` + + +#### TakerPaymentRefundFailed + +`TakerPaymentRefundFailed` event indicates that taker was not able to broadcast a refund transaction to taker coin blockchain. +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------- | +| error | string | error description with stack trace | + + + ```json + TODO: Example TBA + ``` + + +#### TakerPaymentRefunded + +The `TakerPaymentRefunded` event indicates that taker broadcast the taker payment refund transaction. + +The swap finishes immediately when this event occurs. + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| tx\_hash | string | the hash of the transaction | +| tx\_hex | string | transaction bytes in hexadecimal format | + +#### TakerPaymentRefundFinished + +The `TakerPaymentRefundFinished` event indicates that taker refund process is complete. + +The swap finishes immediately when this event occurs. This event does not have additional data. + + + ```json + TODO: Example TBA + ``` + + +#### Finished + +The `Finished` event indicates that the swap finished. + +This event does not have additional data. +export const title = "AtomicDEX RPC Methods"; +export const description = "This document lists all available RPC methods of the AtomicDEX API."; + +# AtomicDEX RPC Methods + +Legacy methods are in the process of a migration to AtomicDEX API v2.0 (and will also remain backwards compatible). +During development, some newer AtomicDEX API methods are not available in the latest release. + +To test the methods in v2.0 (Dev), you will need to [build the AtomicDEX API](../atomicdex/setup/) from the `dev` branch. + +Below is a table of the currently available legacy, v2.0 and v2.0 (Dev) methods: + +| Legacy | v2.0 (release) | v2.0 (dev) | +| ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| [active\_swaps](/atomicdex/api/legacy/active_swaps/#active-swaps) | | | +| | [add\_delegation](/atomicdex/api/v20/add_delegation/#add-delegation) | | +| | [add\_node\_to\_version\_stat](/atomicdex/api/v20/add_node_to_version_stat/#add-node-to-version-stat) | | +| [all\_swaps\_uuids\_by\_filter](/atomicdex/api/legacy/all_swaps_uuids_by_filter/#all-swaps-uuids-by-filter) | | | +| [ban\_pubkey](/atomicdex/api/legacy/ban_pubkey/#ban-pubkey) | | | +| [best\_orders](/atomicdex/api/legacy/best_orders/#best-orders) | [best\_orders](/atomicdex/api/v20/best_orders/#best-orders) | | +| [buy](/atomicdex/api/legacy/buy/#buy) | | | +| | | [can\_get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#can-get-new-address) | +| [cancel\_all\_orders](/atomicdex/api/legacy/cancel_all_orders/#cancel-all-orders) | | | +| [cancel\_order](/atomicdex/api/legacy/cancel_order/#cancel-order) | | | +| | | [close\_channel](/atomicdex/api/v20-dev/lightning/channels/#close-channel) | +| [coins\_needed\_for\_kick\_start](/atomicdex/api/legacy/coins_needed_for_kick_start/#coins-needed-for-kick-start) | | | +| [convert\_utxo\_address](/atomicdex/api/legacy/convert_utxo_address/#convert-utxo-address) | | | +| [convertaddress](/atomicdex/api/legacy/convertaddress/#convertaddress) | | | +| [disable\_coin](/atomicdex/api/legacy/disable_coin/#disable-coin) | | | +| [electrum](/atomicdex/api/legacy/coin_activation/#electrum-method) | | | +| [enable](/atomicdex/api/legacy/coin_activation/#enable-method) | | | +| | [enable\_bch\_with\_tokens](/atomicdex/api/v20/enable_bch_with_tokens/#enable-bch-with-tokens) | | +| | [enable\_erc20](/atomicdex/api/v20/enable_erc20/#enable-erc20) | | +| | [enable\_eth\_with\_tokens](/atomicdex/api/v20/enable_eth_with_tokens/#enable-eth-with-tokens) | | +| | [enable\_slp](/atomicdex/api/v20/enable_slp/#enable-slp) | | +| | [enable\_tendermint\_token](/atomicdex/api/v20/enable_tendermint_token/#enable-tendermint-token) | | +| | [enable\_tendermint\_with\_assets](/atomicdex/api/v20/enable_tendermint_with_assets/#enable-tendermint-with-assets) | | +| | | [get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) | +| | | [get\_claimable\_balances](/atomicdex/api/v20-dev/lightning/channels/#get-claimable-balances) | +| | | [get\_current\_mtp](/atomicdex/api/v20-dev/get_current_mtp/#get-current-mtp) | +| [get\_enabled\_coins](/atomicdex/api/legacy/get_enabled_coins/#get-enabled-coins) | | | +| [get\_gossip\_mesh](/atomicdex/api/legacy/get_gossip_mesh/#get-gossip-mesh) | | | +| [get\_gossip\_peer\_topics](/atomicdex/api/legacy/get_gossip_peer_topics/#get-gossip-peer-topics) | | | +| [get\_gossip\_topic\_peers](/atomicdex/api/legacy/get_gossip_topic_peers/#get-gossip-topic-peers) | | | +| | | [get\_locked\_amount](/atomicdex/api/v20-dev/get_locked_amount/#get-locked-amount) | +| [get\_my\_peer\_id](/atomicdex/api/legacy/get_my_peer_id/#get-my-peer-id) | | | +| | | [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) | +| [get\_peers\_info](/atomicdex/api/legacy/get_peers_info/#get-peers-info) | | | +| | [get\_public\_key](/atomicdex/api/v20/get_public_key/#get-public-key) | | +| | [get\_public\_key\_hash](/atomicdex/api/v20/get_public_key_hash/#get-public-key-hash) | | +| | [get\_raw\_transaction](/atomicdex/api/v20/get_raw_transaction/#get-raw-transaction) | | +| [get\_relay\_mesh](/atomicdex/api/legacy/get_relay_mesh/#get-relay-mesh) | | | +| | [get\_staking\_infos](/atomicdex/api/v20/get_staking_infos/#get-staking-infos) | | +| [get\_trade\_fee](/atomicdex/api/legacy/get_trade_fee/#get-trade-fee) | | | +| [import\_swaps](/atomicdex/api/legacy/import_swaps/#import-swaps) | | | +| [kmd\_rewards\_info](/atomicdex/api/legacy/kmd_rewards_info/#kmd-rewards-info) | | | +| | | [lightning::nodes::add\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#add-trusted-node) | +| | | [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) | +| | | [lightning::nodes::list\_trusted\_nodes](/atomicdex/api/v20-dev/lightning/nodes/#list-trusted-nodes) | +| | | [lightning::nodes::remove\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#remove-trusted-node) | +| | | [lightning::payments::generate\_invoice](/atomicdex/api/v20-dev/lightning/payments/#generate-invoice) | +| | | [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) | +| | | [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) | +| | | [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) | +| [list\_banned\_pubkeys](/atomicdex/api/legacy/list_banned_pubkeys/#list-banned-pubkeys) | | | +| | | [list\_closed\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-closed-channels-by-filter) | +| | | [list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter) | +| | | [max\_maker\_vol](/atomicdex/api/v20-dev/max_maker_vol/#max-maker-vol) | +| [max\_taker\_vol](/atomicdex/api/legacy/max_taker_vol/#max-taker-vol) | | | +| [metrics](/atomicdex/api/legacy/metrics/#metrics) | | | +| [min\_trading\_vol](/atomicdex/api/legacy/min_trading_vol/#min-trading-vol) | | | +| [my\_balance](/atomicdex/api/legacy/my_balance/#my-balance) | | | +| [my\_orders](/atomicdex/api/legacy/my_orders/#my-orders) | | | +| [my\_recent\_swaps](/atomicdex/api/legacy/my_recent_swaps/#my-recent-swaps) | | | +| [my\_swap\_status](/atomicdex/api/legacy/my_swap_status/#my-swap-status) | | | +| [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) | [my\_tx\_history](/atomicdex/api/v20/my_tx_history/#my-tx-history) | | +| | | [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) | +| [order\_status](/atomicdex/api/legacy/order_status/#order-status) | | | +| [orderbook](/atomicdex/api/legacy/orderbook/#orderbook) | [orderbook](/atomicdex/api/v20/orderbook/#orderbook) | | +| [orderbook\_depth](/atomicdex/api/legacy/orderbook_depth/#orderbook-depth) | | | +| [orders\_history\_by\_filter](/atomicdex/api/legacy/orders_history_by_filter/#orders-history-by-filter) | | | +| [recover\_funds\_of\_swap](/atomicdex/api/legacy/recover_funds_of_swap/#recover-funds-of-swap) | | | +| | [recreate\_swap\_data](/atomicdex/api/v20/recreate_swap_data/#recreate-swap-data) | | +| | [remove\_delegation](/atomicdex/api/v20/remove_delegation/#remove-delegation) | | +| | [remove\_node\_from\_version\_stat](/atomicdex/api/v20/remove_node_from_version_stat/#remove-node-from-version-stat) | | +| [sell](/atomicdex/api/legacy/sell/#sell) | | | +| [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/#send-raw-transaction) | | | +| [set\_required\_confirmations](/atomicdex/api/legacy/set_required_confirmations/#set-required-confirmations) | | | +| [set\_requires\_notarization](/atomicdex/api/legacy/set_requires_notarization/#set-requires-notarization) | | | +| [setprice](/atomicdex/api/legacy/setprice/#setprice) | | | +| [show\_priv\_key](/atomicdex/api/legacy/show_priv_key/#show-priv-key) | | | +| | [sign\_message](/atomicdex/api/v20/message_signing/#sign-message) | | +| | [start\_simple\_market\_maker\_bot](/atomicdex/api/v20/start_simple_market_maker_bot/#start-simple-market-maker-bot) | | +| | [start\_version\_stat\_collection](/atomicdex/api/v20/start_version_stat_collection/#start-version-stat-collection) | | +| | [stop\_simple\_market\_maker\_bot](/atomicdex/api/v20/stop_simple_market_maker_bot/#stop-simple-market-maker-bot) | | +| | [stop\_version\_stat\_collection](/atomicdex/api/v20/stop_version_stat_collection/#stop-version-stat-collection) | | +| | | [task::account\_balance::cancel](/atomicdex/api/v20-dev/task_account_balance/#cancel) | +| | | [task::account\_balance::init](/atomicdex/api/v20-dev/task_account_balance/#init) | +| | | [task::account\_balance::status](/atomicdex/api/v20-dev/task_account_balance/#status) | +| | | [task::enable\_lightning::cancel](/atomicdex/api/v20-dev/lightning/activation/#cancel-initialization) | +| | | [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) | +| | | [task::enable\_lightning::status](/atomicdex/api/v20-dev/lightning/activation/#initialization-status) | +| | | [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) | +| | | [task::enable\_qtum::status](/atomicdex/api/v20-dev/task_enable_qtum/#status) | +| | | [task::enable\_qtum::user\_action](/atomicdex/api/v20-dev/task_enable_qtum/#user-action) | +| | | [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) | +| | | [task::enable\_utxo::status](/atomicdex/api/v20-dev/task_enable_utxo/#status) | +| | | [task::enable\_utxo::user\_action](/atomicdex/api/v20-dev/task_enable_utxo/#user-action) | +| | | [task::enable\_z\_coin::cancel](/atomicdex/api/v20-dev/task_enable_z_coin/#cancel-initialization) | +| | | [task::enable\_z\_coin::init](/atomicdex/api/v20-dev/task_enable_z_coin/#initialize-z-coin-activation) | +| | | [task::enable\_z\_coin::status](/atomicdex/api/v20-dev/task_enable_z_coin/#activation-status) | +| | | [task::init\_trezor::cancel](/atomicdex/api/v20-dev/task_init_trezor/#cancel) | +| | | [task::init\_trezor::init](/atomicdex/api/v20-dev/task_init_trezor/#init) | +| | | [task::init\_trezor::status](/atomicdex/api/v20-dev/task_init_trezor/#status) | +| | | [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action) | +| | | [task::withdraw::cancel](/atomicdex/api/v20-dev/task_withdraw/#cancel) | +| | | [task::withdraw::init](/atomicdex/api/v20-dev/task_withdraw/#init) | +| | | [task::withdraw::status](/atomicdex/api/v20-dev/task_withdraw/#status) | +| [trade\_preimage](/atomicdex/api/legacy/trade_preimage/#trade-preimage) | [trade\_preimage](/atomicdex/api/v20/trade_preimage/#trade-preimage) | | +| [unban\_pubkeys](/atomicdex/api/legacy/unban_pubkeys/#unban-pubkeys) | | | +| | | [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) | +| [update\_maker\_order](/atomicdex/api/legacy/update_maker_order/#update-maker-order) | | | +| | [update\_version\_stat\_collection](/atomicdex/api/v20/update_version_stat_collection/#update-version-stat-collection) | | +| [validateaddress](/atomicdex/api/legacy/validateaddress/#validateaddress) | | | +| | [verify\_message](/atomicdex/api/v20/message_signing/#verify-message) | | +| [version](/atomicdex/api/legacy/version/#version) | | | +| [withdraw](/atomicdex/api/legacy/withdraw/#withdraw) | [withdraw](/atomicdex/api/v20/withdraw/#withdraw) | | +| | | [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) | +export const title = "AtomicDEX Method: Active Swaps"; +export const description = + "The active_swaps method returns all the swaps that are currently running on the AtomicDEX API node."; + +# active\_swaps + +**active\_swaps (include\_status)** + +The `active_swaps` method returns all the swaps that are currently running on the AtomicDEX API node. + +## Arguments + +| Structure | Type | Description | +| --------------- | ---- | ---------------------------------------------------------------------------- | +| include\_status | bool | Optional, defaults to `false`. Whether to include swap statuses in response; | + +## Response + +| Structure | Type | Description | +| --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| uuids | array of strings | A list of currently active swap UUIDs. | +| statuses | object (map) | Only visible if `include_status` request parameter is `true`. A map of standard [SwapStatus](/atomicdex/api/common_structures/swaps/#swap-status) objects, delineated by the related UUID. | + +#### 📌 Examples + +#### Command (without include\_status) + + + ```json + { + "userpass": "testpsw", + "method": "active_swaps" + } + ``` + + + + #### Response (uuids only) + + ```json + { + "result": { + "uuids": [ + "015c13bc-da79-43e1-a6d4-4ac8b3099b34", + "7592a07a-2805-4050-8ab8-984480e812f0", + "82cbad96-ea9f-40fb-9225-07496323e35d", + "177f7fa5-c9f3-4673-a2fa-28451a123e61" + ] + } + } + ``` + + +#### Command (include\_status = true) + + + ```json + { + "userpass": "testpsw", + "method": "active_swaps", + "include_status": true + } + ``` + + + + #### Response (statuses included) + + ```json + { + "uuids": ["5d02843e-d1b4-488d-aad0-114d82020453"], + "statuses": { + "5d02843e-d1b4-488d-aad0-114d82020453": { + "type": "Taker", + "uuid": "5d02843e-d1b4-488d-aad0-114d82020453", + "events": [ + { + "timestamp": 1612780908698, + "event": { + "type": "Started", + "data": { + "taker_coin": "MARTY", + "maker_coin": "DOC", + "maker": "7310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5", + "my_persistent_pub": "03ad6f89abc2e5beaa8a3ac28e22170659b3209fe2ddf439681b4b8f31508c36fa", + "lock_duration": 7800, + "maker_amount": "1", + "taker_amount": "1", + "maker_payment_confirmations": 1, + "maker_payment_requires_nota": false, + "taker_payment_confirmations": 1, + "taker_payment_requires_nota": false, + "taker_payment_lock": 1612788708, + "uuid": "5d02843e-d1b4-488d-aad0-114d82020453", + "started_at": 1612780908, + "maker_payment_wait": 1612784028, + "maker_coin_start_block": 793472, + "taker_coin_start_block": 797356, + "fee_to_send_taker_fee": { + "coin": "MARTY", + "amount": "0.00001" + }, + "taker_payment_trade_fee": { + "coin": "MARTY", + "amount": "0.00001" + }, + "maker_payment_spend_trade_fee": { + "coin": "DOC", + "amount": "0" + } + } + } + }, + { + "timestamp": 1612780924704, + "event": { + "type": "Negotiated", + "data": { + "maker_payment_locktime": 1612796508, + "maker_pubkey": "037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5", + "secret_hash": "026bebc2e19c243d0940dd583c9573bf10377afd" + } + } + }, + { + "timestamp": 1612780924962, + "event": { + "type": "TakerFeeSent", + "data": { + "tx_hex": "0400008085202f8901f425fbefe21f33ccb7b487df251191b27dfa7b639b04f60e5493c7ea41dbf149000000006b483045022100d5ec3e542175479bd4bd011e19b76a75e99f19cc49867e5bca9541950322c33a02207a4d1ffd674fb9760de79bb4929af44d66344b5e182de3c377186deebf6bf376012103ad6f89abc2e5beaa8a3ac28e22170659b3209fe2ddf439681b4b8f31508c36faffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac5ce6f305000000001976a914d55f0df6cb82630ad21a4e6049522a6f2b6c9d4588ac7c152160000000000000000000000000000000", + "tx_hash": "75323ab7acd64bd35242611fabaec560d9acf2e1f9ca28d3a4aba47a79fb49c4" + } + } + }, + { + "timestamp": 1612780935966, + "event": { + "type": "MakerPaymentReceived", + "data": { + "tx_hex": "0400008085202f89028bef955e42107c562e4e02421f25c455723a701573f86c17b4d82e35a7d8f9f7020000006b483045022100b12fc9d95acca76bf5fd8d5c6acc288b454032ba4561b1c2b1f5f33b2cf2926d022017e561bc2cd93308848674b47b2e8ebd8f074ea78e32454d5fea6f08c0b1f1e40121037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ffffffff5dfd0b24c0f7c3cf235868cf9a26ec49574764d135796fc4e7d20e95d55a8653000000006a47304402207c752d14601d1c99892f9d6c88c8ff2f93211640a65b2ee69172a16b908b21e402206f0b66684158445888271a849ab46258ad722496ee64fde055a6f44e36ed2ccc0121037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ffffffff0300e1f5050000000017a9141b85c1a277f44f7d77d52b78e2ba70a0becc2ff9870000000000000000166a14026bebc2e19c243d0940dd583c9573bf10377afda7d26301000000001976a91486f747b28c60ad1130bdd3f84f48eeaf1801ca9888ac87152160000000000000000000000000000000", + "tx_hash": "27dafe553246553d54f909fbbded80e6d490fdb95ca7b6807d73eca45f0d7a22" + } + } + }, + { + "timestamp": 1612780935967, + "event": { + "type": "MakerPaymentWaitConfirmStarted" + } + } + ], + "maker_amount": "1", + "maker_coin": "DOC", + "taker_amount": "1", + "taker_coin": "MARTY", + "gui": null, + "mm_version": "23c89ced5", + "success_events": [ + "Started", + "Negotiated", + "TakerFeeSent", + "MakerPaymentReceived", + "MakerPaymentWaitConfirmStarted", + "MakerPaymentValidatedAndConfirmed", + "TakerPaymentSent", + "TakerPaymentSpent", + "MakerPaymentSpent", + "Finished" + ], + "error_events": [ + "StartFailed", + "NegotiateFailed", + "TakerFeeSendFailed", + "MakerPaymentValidateFailed", + "MakerPaymentWaitConfirmFailed", + "TakerPaymentTransactionFailed", + "TakerPaymentWaitConfirmFailed", + "TakerPaymentDataSendFailed", + "TakerPaymentWaitForSpendFailed", + "MakerPaymentSpendFailed", + "TakerPaymentWaitRefundStarted", + "TakerPaymentRefunded", + "TakerPaymentRefundFailed" + ] + } + } + } + ``` + +export const title = "AtomicDEX Method: All Swaps UUIDs by Filter"; +export const description = "The all_swaps_uuids_by_filter method returns all uuids of swaps that match the selected filters."; + +# all\_swaps\_uuids\_by\_filter + +**all\_swaps\_uuids\_by\_filter (my\_coin other\_coin from\_timestamp to\_timestamp)** + +The `all_swaps_uuids_by_filter` method returns all uuids of swaps that match the selected filters. Please note that all filters (my\_coin, from\_timestamp, etc.) are combined using logical AND. + +## Arguments + +| Structure | Type | Description | +| --------------- | ----------------------------- | -------------------------------------------------------------------------------------- | +| my\_coin | string | return only swaps that match the `swap.my_coin = request.my_coin` condition | +| other\_coin | string | return only swaps that match the `swap.other_coin = request.other_coin` condition | +| from\_timestamp | number (timestamp in seconds) | return only swaps that match the `swap.started_at >= request.from_timestamp` condition | +| to\_timestamp | number (timestamp in seconds) | return only swaps that match the `swap.started_at < request.to_timestamp` condition | + +## Response + +| Structure | Type | Description | +| --------------- | ---------------- | ---------------------------------------------- | +| uuids | array of strings | uuids of swaps that match the selected filters | +| my\_coin | string | my\_coin that was set in request | +| other\_coin | string | other\_coin that was set in request | +| from\_timestamp | number | from\_timestamp that was set in request | +| to\_timestamp | number | to\_timestamp that was set in request | +| records\_found | number | the number of found uuids | + +#### 📌 Examples + +#### Command (select swaps uuids that have my\_coin = DOC and other\_coin = MARTY) + + + ```json + { + "userpass": "testpsw", + "method": "all_swaps_uuids_by_filter", + "my_coin": "DOC", + "other_coin": "MARTY" + } + ``` + + +#### Command (select swaps uuids that have my\_coin = DOC and started\_at >= 1611705600 (January 27, 2021 0:00:00 GMT)) + + + ```json + { + "userpass": "testpsw", + "method": "all_swaps_uuids_by_filter", + "my_coin": "DOC", + "from_timestamp": 1611705600 + } + ``` + + +#### Command (select swaps uuids that have started\_at >= 1611705600 (January 27, 2021 0:00:00 GMT) and started\_at \< 1611792001 (January 28, 2021 0:00:01 GMT)) + + + ```json + { + "userpass": "testpsw", + "method": "all_swaps_uuids_by_filter", + "my_coin": "DOC", + "from_timestamp": 1611705600, + "to_timestamp": 1611792001 + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "uuids": [ + "015c13bc-da79-43e1-a6d4-4ac8b3099b34", + "7592a07a-2805-4050-8ab8-984480e812f0", + "82cbad96-ea9f-40fb-9225-07496323e35d", + "177f7fa5-c9f3-4673-a2fa-28451a123e61" + ], + "my_coin": "MARTY", + "other_coin": null, + "from_timestamp": null, + "to_timestamp": null, + "found_records": 4 + } + } + ``` + +export const title = "AtomicDEX Method: Ban Pubkey"; +export const description = "The ban_pubkey method bans the selected pubkey ignoring its order matching messages and preventing its orders from displaying in the orderbook."; + +# ban\_pubkey + +**ban\_pubkey pubkey reason** + +The `ban_pubkey` method bans the selected pubkey ignoring its order matching messages and preventing its orders from displaying in the orderbook. + + + Use the secp256k1 pubkey without prefix for this method input. E.g. if pubkey is `022cd3021a2197361fb70b862c412bc8e44cff6951fa1de45ceabfdd9b4c520420` you should submit `2cd3021a2197361fb70b862c412bc8e44cff6951fa1de45ceabfdd9b4c520420`. + + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | --------------------- | +| pubkey | string | the pubkey to ban | +| reason | string | the reason of banning | + +## Response + +| Structure | Type | Description | +| --------- | ------ | ------------------------------ | +| result | string | whether the ban was successful | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "ban_pubkey", + "pubkey": "2cd3021a2197361fb70b862c412bc8e44cff6951fa1de45ceabfdd9b4c520420", + "reason": "test" + } + ``` + + + + #### Response (success) + + ```json + { + "result": "success" + } + ``` + + #### Response (error) + + ```json + { + "error": "rpc:208] dispatcher_legacy:160] pubkey_banning:58] Pubkey is banned already" + } + ``` + +export const title = "AtomicDEX Method: Batch Requests"; +export const description = "A batch request is a method for sending several unique requests to the network all at once."; + +# batch requests + +A batch request is a method for sending several unique requests to the network all at once. + +The requests are sent as an array filled with request objects. Results are returned in the order of received requests. + + + Avoid sending requests that depend on each other. For example, do not send a coin activation and a balance request to that coin in the same batch. + + Such requests result in non-deterministic behavior, as the AtomicDEX API may or may not execute the requests in the desired order. + + +## Arguments + +| Structure | Type | Description | +| --------- | ---------------- | ------------------------------------------ | +| (none) | array of objects | request objects to be executed in parallel | + +#### Response + +| Structure | Type | Description | +| --------- | ---------------- | --------------------------------------------------------------------------------------- | +| (none) | array of objects | the results, provided in the order of received requests; this may contain null elements | + +#### 📌 Examples + +#### Command + +```bash +curl --url "http://127.0.0.1:7783" --data "[ +{\"method\":\"electrum\",\"coin\":\"DOC\",\"servers\":[{\"url\":\"electrum1.cipig.net:10017\"},{\"url\":\"electrum2.cipig.net:10017\"},{\"url\":\"electrum3.cipig.net:10017\"}],\"userpass\":\"testpsw\",\"mm2\":1}, +{\"method\":\"electrum\",\"coin\":\"MARTY\",\"servers\":[{\"url\":\"electrum1.cipig.net:10018\"},{\"url\":\"electrum2.cipig.net:10018\"},{\"url\":\"electrum3.cipig.net:10018\"}],\"userpass\":\"testpsw\",\"mm2\":1}, +{\"method\":\"electrum\",\"coin\":\"DOC\",\"servers\":[{\"url\":\"electrum1.cipig.net:10017\"},{\"url\":\"electrum2.cipig.net:10017\"},{\"url\":\"electrum3.cipig.net:10017\"}],\"userpass\":\"invalid userpass\",\"mm2\":1} +]" +``` + + + #### Response + + ```json + [ + { + "address": "RR5ecgYgykX8NCjR5zjiHMLy7F62LZUecQ", + "balance": "9.8688213", + "coin": "DOC", + "locked_by_swaps": "0", + "required_confirmations": 1, + "requires_notarization": false, + "result": "success" + }, + { + "address": "RR5ecgYgykX8NCjR5zjiHMLy7F62LZUecQ", + "balance": "4.40662368", + "coin": "MARTY", + "locked_by_swaps": "0", + "required_confirmations": 1, + "requires_notarization": false, + "result": "success" + }, + { + "error": "rpc:295] Userpass is invalid!" + } + ] + ``` + +export const title = "AtomicDEX Method: Best Orders"; +export const description = "The best_orders method returns the best price orders that can fill the volume for all existing pairs with selected coin."; + +# best\_orders + +**best\_orders coin action volume** + +The `best_orders` method returns the best price orders that can fill the volume for all existing pairs with selected coin. + + + The response of this method can contain coins that are not activated on the AtomicDEX API instance. + Activation will be required to proceed with the trade. + + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------------- | +| coin | string | the ticker of the coin to get best orders | +| action | string | whether to `buy` or `sell` the selected coin | +| volume | string | the amount of `coin` user is willing to buy or sell | + +## Response + +| Structure | Type | Description | +| --------- | ------------ | ----------------------------------------------------------------------------------------------------------- | +| result | object (map) | A map of standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects (by ticker) | + +where order entry has the following structure + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "best_orders", + "coin": "BTC", + "action": "buy", + "volume": "1" + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "MARTY": [ + { + "coin": "MARTY", + "address": "RMaprYNUp8ErJ9ZAKcxMfpC4ioVycYCCCc", + "price": "1", + "price_rat": [ + [1, [1]], + [1, [1]] + ], + "price_fraction": { + "numer": "1", + "denom": "1" + }, + "maxvolume": "2", + "max_volume_rat": [ + [1, [2]], + [1, [1]] + ], + "max_volume_fraction": { + "numer": "2", + "denom": "1" + }, + "min_volume": "0.00777", + "min_volume_rat": [ + [1, [777]], + [1, [100000]] + ], + "min_volume_fraction": { + "numer": "777", + "denom": "100000" + }, + "pubkey": "037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5", + "age": 1618306280, + "zcredits": 0, + "uuid": "09a61d61-9352-42f3-ae64-03e832aca07f", + "is_mine": false, + "base_confs": 1, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false, + "base_max_volume": "2", + "base_max_volume_fraction": { + "numer": "2", + "denom": "1" + }, + "base_max_volume_rat": [ + [1, [2]], + [1, [1]] + ], + "base_min_volume": "0.00777", + "base_min_volume_fraction": { + "numer": "777", + "denom": "100000" + }, + "base_min_volume_rat": [ + [1, [777]], + [1, [100000]] + ], + "rel_max_volume": "2", + "rel_max_volume_fraction": { + "numer": "2", + "denom": "1" + }, + "rel_max_volume_rat": [ + [1, [2]], + [1, [1]] + ], + "rel_min_volume": "0.00777", + "rel_min_volume_fraction": { + "numer": "777", + "denom": "100000" + }, + "rel_min_volume_rat": [ + [1, [777]], + [1, [100000]] + ] + }, + { + "coin": "MARTY", + "address": "RB8yufv3YTfdzYnwz5paNnnDynGJG6WsqD", + "price": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "price_rat": [ + [1, [10]], + [1, [11]] + ], + "price_fraction": { + "numer": "10", + "denom": "11" + }, + "base_confs": 1, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false, + "maxvolume": "56210.95940853", + "max_volume_rat": [ + [1, [3278717685, 1308]], + [1, [100000000]] + ], + "max_volume_fraction": { + "numer": "5621095940853", + "denom": "100000000" + }, + "min_volume": "0.0001", + "min_volume_rat": [ + [1, [1]], + [1, [10000]] + ], + "min_volume_fraction": { + "numer": "1", + "denom": "10000" + }, + "pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "age": 1618306280, + "zcredits": 0, + "uuid": "7b5fc790-cbe1-4714-812c-2e307818f258", + "is_mine": false, + "base_max_volume": "61832.055349383", + "base_max_volume_fraction": { + "numer": "61832055349383", + "denom": "1000000000" + }, + "base_max_volume_rat": [ + [1, [1706156167, 14396]], + [1, [1000000000]] + ], + "base_min_volume": "0.00011", + "base_min_volume_fraction": { + "numer": "11", + "denom": "100000" + }, + "base_min_volume_rat": [ + [1, [11]], + [1, [100000]] + ], + "rel_max_volume": "56210.95940853", + "rel_max_volume_fraction": { + "numer": "5621095940853", + "denom": "100000000" + }, + "rel_max_volume_rat": [ + [1, [3278717685, 1308]], + [1, [100000000]] + ], + "rel_min_volume": "0.0001", + "rel_min_volume_fraction": { + "numer": "1", + "denom": "10000" + }, + "rel_min_volume_rat": [ + [1, [1]], + [1, [10000]] + ] + } + ], + "OOT": [ + { + "coin": "OOT", + "address": "RMaprYNUp8ErJ9ZAKcxMfpC4ioVycYCCCc", + "price": "0.01", + "price_rat": [ + [1, [1]], + [1, [100]] + ], + "price_fraction": { + "numer": "1", + "denom": "100" + }, + "base_confs": 1, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false, + "maxvolume": "1140445.56120275", + "max_volume_rat": [ + [1, [526976459, 1062]], + [1, [4000000]] + ], + "max_volume_fraction": { + "numer": "4561782244811", + "denom": "4000000" + }, + "min_volume": "0.00777", + "min_volume_rat": [ + [1, [777]], + [1, [100000]] + ], + "min_volume_fraction": { + "numer": "777", + "denom": "100000" + }, + "pubkey": "037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5", + "age": 1618306280, + "zcredits": 0, + "uuid": "8ea62e1d-0df5-4807-9ee6-c6367ac4e8ce", + "is_mine": false, + "base_max_volume": "114044556.120275", + "base_max_volume_fraction": { + "numer": "4561782244811", + "denom": "40000" + }, + "base_max_volume_rat": [ + [1, [526976459, 1062]], + [1, [40000]] + ], + "base_min_volume": "0.777", + "base_min_volume_fraction": { + "numer": "777", + "denom": "1000" + }, + "base_min_volume_rat": [ + [1, [777]], + [1, [1000]] + ], + "rel_max_volume": "1140445.56120275", + "rel_max_volume_fraction": { + "numer": "4561782244811", + "denom": "4000000" + }, + "rel_max_volume_rat": [ + [1, [526976459, 1062]], + [1, [4000000]] + ], + "rel_min_volume": "0.00777", + "rel_min_volume_fraction": { + "numer": "777", + "denom": "100000" + }, + "rel_min_volume_rat": [ + [1, [777]], + [1, [100000]] + ] + } + ] + }, + "original_tickers": { + "BTC": ["BTC-segwit"] + } + } + ``` + +export const title = "AtomicDEX Method: Buy"; +export const description = "The buy method issues a buy request and attempts to match an order from the orderbook based on the provided arguments."; + +# buy + +**buy base rel price volume (match\_by order\_type base\_confs base\_nota rel\_confs rel\_nota min\_volume)** + +The `buy` method issues a buy request and attempts to match an order from the orderbook based on the provided arguments. + + + * Buy and sell methods always create the `taker` order first. A `taker` order must pay a `dexfee` during the swap as it is taking liquidity from the market. The `dexfee` is calculated as "the greater of either `Minimum transaction amount (dust) TAKER COIN` or `0.0001 TAKER COIN` or `1/777th` the size of the desired order". If your `GoodTillCancelled` order is not matched in 30 seconds, the order is automatically converted to a `maker` request and stays on the orderbook until the request is matched or cancelled. To always act as a maker, please use the [setprice](/atomicdex/api/legacy/setprice/) method. + * To prevent a user from making trades in which the transaction fees may end up costing a significant portion of the value of the trade, we have set a lower limit to the value of a trade. See the description of the `volume` and `min_volume` arguments for more info. + + +## Arguments + +| Structure | Type | Description | +| ----------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| base | string | The name of the coin the user desires to receive | +| rel | string | The name of the coin the user desires to sell | +| price | varies | The price in `rel` the user is willing to pay per one unit of the `base` coin. Can be a numeric string, expressed using standard [RationalValue](/atomicdex/api/common_structures/#rational-value) or [FractionalValue](/atomicdex/api/common_structures/#fractional-value) objects. | +| volume | varies | The amount of coins the user is willing to receive of the `base` coin; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin:
  • the argument `volume`
  • the product of the arguments `volume` and `price`
. . Can be a numeric string, expressed using standard [RationalValue](/atomicdex/api/common_structures/#rational-value) or [FractionalValue](/atomicdex/api/common_structures/#fractional-value) objects. | +| min\_volume | varies (optional) | The amount of `base` coin that will be used as `min_volume` of `GoodTillCancelled` order after conversion to maker; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin:
  • the argument `min_volume`
  • the product of the arguments `min_volume` and `price`
. . Can be a numeric string, expressed using standard [RationalValue](/atomicdex/api/common_structures/#rational-value) or [FractionalValue](/atomicdex/api/common_structures/#fractional-value) objects. | +| match\_by | object | Optional. A standard [MatchBy](/atomicdex/api/common_structures/orders/#match-by) object, to filter to include only matches by pubkey or uuid. *Important:* This condition is not applied after a `GoodTillCancelled` order is converted to a `maker` request. | +| order\_type | object | Optional. A standard [OrderType](/atomicdex/api/common_structures/orders/#order-type) object. | +| base\_confs | number | Number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set | +| base\_nota | boolean | Whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set | +| rel\_confs | number | Number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set | +| rel\_nota | boolean | Whether dPoW notarization is required for rel coin atomic swap transaction; default to rel coin configuration if not set | +| save\_in\_history | boolean | Defaults to `true`. If set to `false` no order history will be saved (though order status will be temporarily stored while in progress). If `true`, each order's short record history is stored in a local SQLite database table, and when the order is cancelled or fully matched, it's history will be saved as a json file | + +## Response + +| Structure | Type | Description | +| ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| action | string | The action of the request (`Buy`) | +| base | string | The base currency of request | +| base\_amount | string | The resulting amount of base currency that is received if the order matches (in decimal representation) | +| base\_amount\_rat | rational | The resulting amount of base currency that is received if the order matches, represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| rel | string | The rel currency of the request | +| rel\_amount | string | The maximum amount of `rel` coin that is spent in order to buy the `base_amount` (according to `price`, in decimal representation) | +| rel\_amount\_rat | rational | The maximum amount of `rel` coin that is spent in order to buy the `base_amount` (according to `price`, represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object). | +| method | string | This field is used for internal P2P interactions; the value is always equal to "request | +| dest\_pub\_key | string | Reserved for future use. `dest_pub_key` allows the user to choose the P2P node that is eligible to match with the request. This value defaults to a "zero pubkey", which means `anyone` can be a match | +| sender\_pubkey | string | The public key of this node | +| uuid | string | The request uuid | +| match\_by | object | A standard [MatchBy](/atomicdex/api/common_structures/orders/#match-by) object, to filter to include only matches by pubkey or uuid. | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | +| base\_orderbook\_ticker | string | The ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | +| rel\_orderbook\_ticker | string | The ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | + +#### 📌 Examples + +#### Command (decimal representation) + + + ```json + { + "userpass": "testpsw", + "method": "buy", + "base": "HELLO", + "rel": "WORLD", + "volume": "1", + "price": "1" + } + ``` + + +#### Command (rational representation in num-rational crate format) + + + ```json + { + "userpass": "testpsw", + "method": "buy", + "base": "HELLO", + "rel": "WORLD", + "volume": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ] + } + ``` + + +#### Command (rational representation as fraction object) + + + ```json + { + "userpass": "testpsw", + "method": "buy", + "base": "HELLO", + "rel": "WORLD", + "volume": { + "numer": "3", + "denom": "2" + }, + "price": { + "numer": "2", + "denom": "1" + } + } + ``` + + +#### Command (with confirmations and notarization settings) + + + ```json + { + "userpass": "testpsw", + "method": "buy", + "base": "HELLO", + "rel": "WORLD", + "volume": { + "numer": "3", + "denom": "2" + }, + "price": { + "numer": "2", + "denom": "1" + }, + "base_confs": 2, + "base_nota": true, + "rel_confs": 5, + "rel_nota": false + } + ``` + + +#### Command (set to not save order history) + + + ```json + { + "userpass": "testpsw", + "method": "buy", + "base": "HELLO", + "rel": "WORLD", + "volume": { + "numer": "3", + "denom": "2" + }, + "price": { + "numer": "2", + "denom": "1" + }, + "save_in_history": false + } + ``` + + +#### Command (GoodTillCancelled type) + + + ```json + { + "userpass": "testpsw", + "method": "buy", + "base": "BASE", + "rel": "REL", + "volume": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "order_type": { + "type": "GoodTillCancelled" + } + } + ``` + + +#### Command (FillOrKill type) + + + ```json + { + "userpass": "testpsw", + "method": "buy", + "base": "BASE", + "rel": "REL", + "volume": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "order_type": { + "type": "FillOrKill" + } + } + ``` + + +#### Command (match by Any) + + + ```json + { + "userpass": "testpsw", + "method": "buy", + "base": "BASE", + "rel": "REL", + "volume": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "match_by": { + "type": "Any" + } + } + ``` + + +#### Command (match by Pubkeys) + + + ```json + { + "userpass": "testpsw", + "method": "buy", + "base": "BASE", + "rel": "REL", + "volume": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "match_by": { + "type": "Pubkeys", + "data": [ + "1ab7edc96abaefb358b52c583048eaaeb8ea42609d096d6cddfafa02fa510c6a" + ] + } + } + ``` + + +#### Command (match by Orders) + + + ```json + { + "userpass": "testpsw", + "method": "buy", + "base": "BASE", + "rel": "REL", + "volume": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "match_by": { + "type": "Orders", + "data": [ + "d14452bb-e82d-44a0-86b0-10d4cdcb8b24" + ] + } + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "action": "Buy", + "base": "HELLO", + "base_amount": "1", + "base_amount_rat": [ + [1, [1]], + [1, [1]] + ], + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000", + "method": "request", + "rel": "WORLD", + "rel_amount": "1", + "rel_amount_rat": [ + [1, [1]], + [1, [1]] + ], + "sender_pubkey": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "uuid": "288743e2-92a5-471e-92d5-bb828a2303c3", + "match_by": { + "data": [ + "1ab7edc96abaefb358b52c583048eaaeb8ea42609d096d6cddfafa02fa510c6a" + ], + "type": "Pubkeys" + }, + "conf_settings": { + "base_confs": 2, + "base_nota": true, + "rel_confs": 5, + "rel_nota": false + }, + "base_orderbook_ticker": null, + "rel_orderbook_ticker": null + } + } + ``` + + #### Response (error) + + ```json + { + "error": "rpc:278] utxo:884] REL balance 12.88892991 is too low, required 21.15" + } + ``` + + #### Response (error) + + ```json + { + "error": "rpc:275] lp_ordermatch:665] The WORLD amount 40000/3 is larger than available 47.60450107, balance: 47.60450107, locked by swaps: 0.00000000" + } + ``` + +export const title = "AtomicDEX Method: Cancel all Orders"; +export const description = "The cancel_all_orders cancels the active orders created by the AtomicDEX API node by specified condition."; + +# cancel\_all\_orders + +**cancel\_all\_orders cancel\_by** + +The `cancel_all_orders` cancels the active orders created by the AtomicDEX API node by specified condition. + +## Arguments + +| Structure | Type | Description | +| ---------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- | +| cancel\_by | object | A standard [CancelBy](/atomicdex/api/common_structures/orders/#cancel-by) object. Orders matching this filter are cancelled. | + +## Response + +| Structure | Type | Description | +| ------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------- | +| cancelled | array of strings (uuids) | uuids of cancelled orders | +| currently\_matching | array of strings (uuids) | uuids of the orders being matched with other orders; these are not cancelled even if they fit cancel condition | + +#### 📌 Examples + +#### Command (All orders) + + + ```json + { + "userpass": "testpsw", + "method": "cancel_all_orders", + "cancel_by": { + "type": "All" + } + } + ``` + + +#### Command (Cancel by pair) + + + ```json + { + "userpass": "testpsw", + "method": "cancel_all_orders", + "cancel_by": { + "type": "Pair", + "data": { + "base": "DOC", + "rel": "MARTY" + } + } + } + ``` + + +#### Command (Cancel by coin) + + + ```json + { + "userpass": "testpsw", + "method": "cancel_all_orders", + "cancel_by": { + "type": "Coin", + "data": { + "ticker": "DOC" + } + } + } + ``` + + + + #### Response (1 order cancelled) + + ```json + { + "result": { + "cancelled": ["2aae69d1-0167-493e-ad15-c6a8b43546d6"], + "currently_matching": [] + } + } + ``` + + #### Response (1 order cancelled and 1 is currently matching) + + ```json + { + "result": { + "cancelled": ["2aae69d1-0167-493e-ad15-c6a8b43546d6"], + "currently_matching": ["e9a6f422-e378-437f-bb74-ba4307a90e68"] + } + } + ``` + +export const title = "AtomicDEX Method: Cancel Order"; +export const description = "The cancel_order cancels the active order created by the AtomicDEX API node."; + +# cancel\_order + +**cancel\_order uuid** + +The `cancel_order` cancels the active order created by the AtomicDEX API node. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------ | +| uuid | string | the uuid of the order the user desires to cancel | + +## Response + +| Structure | Type | Description | +| --------- | ------ | --------------------------------- | +| result | string | indicates the status of operation | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "cancel_order", + "uuid": "6a242691-6c05-474a-85c1-5b3f42278f41" + } + ``` + + + + #### Response (success) + + ```json + { "result": "success" } + ``` + + #### Response (error) + + ```json + { "error": "Order with uuid 6a242691-6c05-474a-85c1-5b3f42278f42 is not found" } + ``` + +export const title = "KomoDeFi: Coin Activation"; +export const description = + "Learn about the two methods of coin activation, enable and electrum."; + +# Coin Activation + +There are two methods of coin activation: + +* `enable` - Connects to a native daemon, or a url which handles RPCs for Platform coins (e.g. ETH, MATIC, FTM, BNB, ONE) +* `electrum` - Connects to an [electrum server](https://github.com/kyuupichan/electrumx) for UTXO based coins and QTUM/QRC20 tokens. + +A coin can only be activated once per session, and must be activated before it can be used in trading or wallet functions. + + + The KomoDeFi API requires an `mm2` parameter to be set for each `coin`. This can be added to the enable/electrum command, or defined in your [coins file](/atomicdex/tutorials/atomicdex-walkthrough/#setting-up-the-coin-list). + + The value of the `mm2` parameter informs the software as to whether the `coin` is expected to be compatible for atomic swaps. + + * `0` = `non-compatible` + * `1` = `compatible` + + + + Many examples of activation commands are available at [kmd.stats.io](https://stats.kmd.io/atomicdex/activation_commands/) + + +## Native mode activation + +If you are running a UTXO based coin daemon locally and the blockchain is synchronised, you can connect the local daemon to the KomoDeFi API by using the `enable` method, though some additional configuration is required. The KomoDeFi API requires the following options to be added to the native chain's [.conf file](https://bitcoincoredocs.com/bitcoin-conf.html). + +```ini +logevents=1 +txindex=1 +addressindex=1 +``` + + + The KomoDeFi API node's coin address needs to be imported manually into the coin daemon using the [importaddress](/smart-chains/api/wallet/#importaddress) method. + + +## Lite mode activation + +Activating coins in 'lite mode' means you don't need to have a native coin daemon installed, or keep a local blockchain synchronised. In this mode, the KomoDeFi API communicates with an external node to perform transactions and query the blockchain. UTXO based coins and QTUM/QRC20 tokens communicate via electrum servers, while other platform coins communicate via JSON RPC urls. + +KomoDeFi is a true cross chain, cross protocol Decentralized Exchange (DEX), allowing for trades between coins and tokens across many platforms and ecosystems, such as: + +* UTXO based coins (e.g. DOGE, BTC, ZEC, LTC, DASH, DGB) +* [Ethereum (ETH)](https://ethereum.org/en/) & [ERC20 tokens](https://etherscan.io/tokens) +* [Binance Coin (BNB)](https://coinmarketcap.com/currencies/bnb/) & [BEP20](https://www.coingecko.com/en?asset_platform_id=binance-coin) tokens +* [QTUM](https://qtum.org) & [QRC20 tokens](https://qtum.info/qrc20) +* [Polygon (MATIC)](https://polygon.technology/) & [PLG20 tokens](https://polygonscan.com/tokens) +* [Harmony (ONE)](https://www.harmony.one/) & [HRC20 tokens](https://www.coingecko.com/en/categories/harmony-ecosystem) +* [Fantom (FTM)](https://fantom.foundation/) & [FTM20 tokens](https://ftmscan.com/tokens) +* [Avalanche (AVAX)](https://www.avax.network/) & [AVX20 tokens](https://avascan.info/) +* [Moonriver (MOVR)](https://moonbeam.network/networks/moonriver/) & [MVR20 tokens](https://moonriver.moonscan.io/tokens) +* And more! + +## Electrum Method + + + Electrum mode is only available for UTXO based coins and QTUM/QRC20 tokens. + + +#### Arguments + +| Structure | Type | Description | +| ---------------------------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| coin | string | Ticker of coin to activate | +| servers | array of objects | List of [Electrum servers](https://github.com/KomodoPlatform/coins/tree/master/electrums) | +| servers.url | string | Electrum server URL | +| servers.protocol | string (optional, defaults to `TCP`) | Transport protocol used by KomoDeFi API to connect to the electrum server (`TCP` or `SSL`) | +| servers.disable\_cert\_verification | bool (optional, defaults to `false`.) | If `true`, this disables server SSL/TLS certificate verification (e.g. to use self-signed certificate). Use at your own risk | +| mm2 | integer | Required if not set in `coins` file. Informs the KomoDeFi API whether or not the coin is expected to function. Accepted values are `0` or `1` | +| tx\_history | bool | If `true` the KomoDeFi API will preload trasaction history as a background process. Must be set to `true` to use the [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method | +| required\_confirmations | integer (optional, defaults to `3`) | Number of confirmations for the KomoDeFi API to wait during the transaction steps of an atomic swap. | +| requires\_notarization | boolean (optional, defaults to `false`) | If `true`, coins protected by [Komodo Platform's dPoW security](https://satindergrewal.medium.com/delayed-proof-of-work-explained-9a74250dbb86) will wait for a notarization before progressing to the next atomic swap transactions step. | +| swap\_contract\_address | string (required for QRC20 only) | address of etomic swap smart contract | +| fallback\_swap\_contract | string (required for QRC20 only) | address of backup etomic swap smart contract | +| utxo\_merge\_params | object (optional) | If set, will consolidate excessive UTXOs (e.g. from mining) | +| utxo\_merge\_params.merge\_at | integer | Number of UTXOs in wallet required before merging | +| utxo\_merge\_params.check\_every | integer | How often to check the UTXO count, in seconds. Ideally should be at least 3x the coins block time. | +| utxo\_merge\_params.max\_merge\_at\_once | integer | Maximum number of UTXOs to merge in each consolidation transaction. Should be less that `merge_at` value, but will fail if so high the transaction becomes too large. Suggested maximum is 250. | + +#### Response + +| Structure | Type | Description | +| ----------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| address | string | the address of the user's `coin` wallet, based on the user's passphrase | +| balance | string (numeric) | the amount of `coin` the user holds in their wallet; does not include `unspendable_balance` | +| unspendable\_balance | string (numeric) | the `coin` balance that is unspendable at the moment (e.g. if the address has immature UTXOs) | +| coin | string | the ticker of the enabled coin | +| required\_confirmations | number | the number of transaction confirmations for which the KomoDeFi API must wait during the atomic swap process | +| mature\_confirmations | number (optional) | the number of coinbase transaction confirmations required to become mature; UTXO coins only | +| requires\_notarization | bool | whether the node must wait for a notarization of the selected coin that is performing the atomic swap transactions; applicable only for coins using Komodo dPoW | +| result | string | the result of the request; this value either indicates `success`, or an error, or another type of failure | + +#### 📌 Examples + +#### UTXO coin activation {{label : 'electrum', tag : 'legacy'}} + + + ```json + { + "coin": "LTC", + "method": "electrum", + "servers": [ + { + "url": "electrum1.cipig.net:10063" + }, + { + "url": "electrum2.cipig.net:10063" + }, + { + "url": "electrum3.cipig.net:10063" + } + ], + "userpass": "testpsw" + } + ``` + + + + #### Response (Success) + + ```json + { + "coin": "LTC", + "address": "Lh2zFS66gP5qF1bRxoCXT6bMw8YShjoRry", + "balance": "7.62", + "unspendable_balance": "0", + "mature_confirmations": 100, + "required_confirmations": 3, + "requires_notarization": false, + "result": "success" + } + ``` + + +#### UTXO coin activation with `required_confirmations`, `requires_notarization` and `mm2` arguments {{label : 'electrum', tag : 'legacy'}} + + + ```json + { + "coin": "KMD", + "method": "electrum", + "servers": [ + { + "url": "electrum1.cipig.net:10001" + }, + { + "url": "electrum2.cipig.net:10001" + }, + { + "url": "electrum3.cipig.net:10001" + } + ], + "required_confirmations": 10, + "requires_notarization": true, + "mm2": 1, + "userpass": "testpsw" + } + ``` + + + + #### Response (Success) + + ```json + { + "coin": "KMD", + "address": "RQNUR7qLgPUgZxYbvU9x5Kw93f6LU898CQ", + "balance": "762", + "unspendable_balance": "0", + "mature_confirmations": 100, + "required_confirmations": 10, + "requires_notarization": true, + "result": "success" + } + ``` + + +#### QTUM/QRC20 coin activation {{label : 'electrum', tag : 'legacy'}} + + + ```json + { + "coin": "QTUM", + "method": "electrum", + "servers": [ + { + "url": "electrum1.cipig.net:10050" + }, + { + "url": "electrum2.cipig.net:10050" + }, + { + "url": "electrum3.cipig.net:10050" + } + ], + "swap_contract_address": "0x2f754733acd6d753731c00fee32cb484551cc15d", + "userpass": "testpsw" + } + ``` + + + + #### Response (Success) + + ```json + { + "coin": "QTUM", + "address": "QjXkGgoiycYRm2NbiMpkEHuQt7SB9BKHjz", + "balance": "7.77", + "required_confirmations": 3, + "requires_notarization": false, + "unspendable_balance": "0", + "mature_confirmations": 100, + "result": "success" + } + ``` + + #### Response (Error, `mm2` is not set) + + If mm2 is not set in either the command or your `coins` file, you will see the following error: + + ```json + { + "error": "lp_coins:943] lp_coins:693] mm2 param is not set neither in coins config nor enable request, assuming that coin is not supported" + } + ``` + + +## Enable Method + +#### Arguments + +| Structure | Type | Description | +| --------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | the name of the coin the user desires to enable | +| urls | array of strings (required for ETH/ERC20 and other gas model chains) | urls of Ethereum RPC nodes to which the user desires to connect | +| swap\_contract\_address | string (required for QRC20 only) | address of etomic swap smart contract | +| fallback\_swap\_contract | string (required for QRC20 only) | address of backup etomic swap smart contract | +| gas\_station\_decimals | integer (optional for ETH/ERC20 and other gas model chains) | Defines the decimals used to denominate the gas station response to gwei units. For example, the ETH gas station uses 8 decimals, which means that "average": 860 is equal to 86 gwei. While the Matic gas station uses 9 decimals, so 860 would mean 860 gwei exactly. Defaults to `8` | +| gas\_station\_policy.policy | string (optional for ETH/ERC20 and other gas model chains) | Defines the method of gas price calculation from the station response. `"MeanAverageFast"` will use the mean between average and fast fields. `"Average"` will return a simple average value. Defaults to `"MeanAverageFast"`. | +| mm2 | integer | Required if not set in `coins` file. Informs the KomoDeFi API whether or not the coin is expected to function. Accepted values are `0` or `1` | +| tx\_history | bool | If `true` the KomoDeFi API will preload transaction history as a background process. Must be set to `true` to use the [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method | +| required\_confirmations | integer (optional, defaults to `3`) | Number of confirmations for the KomoDeFi API to wait during the transaction steps of an atomic swap. | +| requires\_notarization | boolean (optional, defaults to `false`) | If `true`, coins protected by [Komodo Platform's dPoW security](https://satindergrewal.medium.com/delayed-proof-of-work-explained-9a74250dbb86) will wait for a notarization before progressing to the next atomic swap transactions step. | + +#### Response + +| Structure | Type | Description | +| ----------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------ | +| address | string | the address of the user's `coin` wallet, based on the user's passphrase | +| balance | string (numeric) | the amount of `coin` the user holds in their wallet; does not include `unspendable_balance` | +| unspendable\_balance | string (numeric) | the `coin` balance that is unspendable at the moment (e.g. if the address has immature UTXOs) | +| coin | string | the ticker of enabled coin | +| required\_confirmations | number | KomoDeFi API will wait for the this number of coin's transaction confirmations during the swap | +| requires\_notarization | bool | whether the node must wait for a notarization of the selected coin that is performing the atomic swap transactions | +| mature\_confirmations | number (optional) | the number of coinbase transaction confirmations required to become mature; UTXO coins only | +| result | string | the result of the request; this value either indicates `success`, or an error or other type of failure | + +#### 📌 Examples + +#### Native UTXO coin activation {{label : 'enable', tag : 'legacy'}} + + + ```json + { + "userpass": "testpsw", + "method": "enable", + "coin": "TKL" + } + ``` + + + + #### Response + + ```json + { + "coin": "TKL", + "address": "RQNUR7qLgPUgZxYbvU9x5Kw93f6LU898CQ", + "balance": "333", + "required_confirmations": 1, + "requires_notarization": false, + "unspendable_balance": "0", + "mature_confirmations": 100, + "result": "success" + } + ``` + + +#### Command (With `required_confirmations`, `requires_notarization` and `mm2` arguments) + + + ```json + { + "userpass": "testpsw", + "method": "enable", + "coin": "TKL", + "mm2": 1, + "required_confirmations": 10, + "requires_notarization": true + } + ``` + + + + #### Response + + ```json + { + "coin": "TKL", + "address": "RQNUR7qLgPUgZxYbvU9x5Kw93f6LU898CQ", + "balance": "777", + "required_confirmations": 10, + "requires_notarization": true, + "unspendable_balance": "0", + "mature_confirmations": 100, + "result": "success" + } + ``` + + +#### Command (for Ethereum and ERC20-based blockchains) + + + ```json + { + "coin": "ETH", + "method": "enable", + "urls": [ + "http://eth1.cipig.net:8555", + "http://eth2.cipig.net:8555", + "http://eth3.cipig.net:8555" + ], + "swap_contract_address": "0x24ABE4c71FC658C91313b6552cd40cD808b3Ea80", + "fallback_swap_contract": "0x8500AFc0bc5214728082163326C2FF0C73f4a871", + "userpass": "testpsw" + } + ``` + + + + #### Response + + ```json + { + "coin": "ETH", + "address": "0x3c7aad7b693e94f13b61d4be4abaeaf802b2e3b5", + "balance": "50", + "required_confirmations": 1, + "requires_notarization": false, + "unspendable_balance": "0", + "result": "success" + } + ``` + + +#### EVM coin activation with gas\_station\_url and policy {{label : 'enable', tag : 'legacy'}} + + + ```json + { + "coin": "ETH", + "userpass": "testpsw", + "method": "enable", + "urls": [ + "http://eth1.cipig.net:8555", + "http://eth2.cipig.net:8555", + "http://eth3.cipig.net:8555" + ], + "swap_contract_address": "0x24ABE4c71FC658C91313b6552cd40cD808b3Ea80", + "fallback_swap_contract": "0x8500AFc0bc5214728082163326C2FF0C73f4a871", + "gas_station_url": "https://ethgasstation.info/json/ethgasAPI.json", + "gas_station_decimals": 8, + "gas_station_policy": { + "policy": "MeanAverageFast" + } + } + ``` + + + + #### Response + + ```json + { + "coin": "ETH", + "address": "0x3c7aad7b693e94f13b61d4be4abaeaf802b2e3b5", + "balance": "50", + "required_confirmations": 1, + "requires_notarization": false, + "unspendable_balance": "0", + "result": "success" + } + ``` + + +#### Polygon (MATIC) and PLG20 activation {{label : 'enable', tag : 'legacy'}} + + + ```json + { + "coin": "NZDS-PLG20", + "method": "enable", + "swap_contract_address": "0x9130b257D37A52E52F21054c4DA3450c72f595CE", + "fallback_swap_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE", + "urls": [ + "https://polygon-rpc.com" + ], + "userpass": "testpsw" + } + ``` + + + + #### Response + + ```json + { + "coin": "NZDS-PLG20", + "address": "0x3c7aad7b693e94f13b61d4be4abaeaf802b2e3b5", + "balance": "350", + "required_confirmations": 1, + "requires_notarization": false, + "unspendable_balance": "0", + "result": "success" + } + ``` + + +#### Binance Coin (BNB) and BEP20 activation {{label : 'enable', tag : 'legacy'}} + + + ```json + { + "coin": "BUSD-BEP20", + "method": "enable", + "swap_contract_address": "0xeDc5b89Fe1f0382F9E4316069971D90a0951DB31", + "fallback_swap_contract": "0xeDc5b89Fe1f0382F9E4316069971D90a0951DB31", + "urls": [ + "http://bsc1.cipig.net:8655", + "http://bsc2.cipig.net:8655", + "http://bsc3.cipig.net:8655" + ], + "userpass": "testpsw" + } + ``` + + + + #### Response + + ```json + { + "coin": "BUSD-BEP20", + "address": "0x3c7aad7b693e94f13b61d4be4abaeaf802b2e3b5", + "balance": "45", + "required_confirmations": 1, + "requires_notarization": false, + "unspendable_balance": "0", + "result": "success" + } + ``` + + +For enabling Z coins, refer to the [Z coin tasks](/atomicdex/api/v20-dev/task_enable_z_coin/#initialize-z-coin-activation) in the v2.0 Dev API. + +To see more examples for other platforms like Fantom, Avalanche & Harmony, you can search the [KomoDeFi API Coin Activation Commands List +](https://stats.kmd.io/atomicdex/activation_commands/) or build a single `batch` command to enable a set of selected coins via the +[Batch Coin Activation Form](https://stats.kmd.io/atomicdex/batch_activation_form/) + + + We welcome volunteers to test new coins for KomoDeFi API compatibility! Follow the [Submitting Coin Test Results guide](https://github.com/KomodoPlatform/coins#about-this-repository) for more information, or drop into the [Komodo Platform Discord Server](https://komodoplatform.com/discord) for a chat if you need some help. + +export const title = "AtomicDEX Method: Coins needed for kick Start"; +export const description = "Learn how to kick-start interrupted swaps on the AtomicDEX API by activating the necessary coins using the coins_needed_for_kick_start method."; + +# coins\_needed\_for\_kick\_start + +**coins\_needed\_for\_kick\_start()** + +If the AtomicDEX API is stopped while making a swap/having the active order it will attempt to kick-start them on next launch and continue from the point where it's stopped. `coins_needed_for_kick_start` returns the tickers of coins that should be activated ASAP after the AtomicDEX API is started to continue the interrupted swaps. Consider calling this method on AtomicDEX API startup and activate the returned coins using `enable` or `electrum` methods. + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| --------- | ---------------- | ------------------------------------------------------------------------ | +| result | array of strings | tickers of coins that should be activated to kick-start swaps and orders | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "coins_needed_for_kick_start" + } + ``` + + + + #### Response (BTC and KMD should be activated ASAP in this case) + + ```json + { "result": ["BTC", "KMD"] } + ``` + + #### Response (no swaps and orders waiting to be started) + + ```json + { "result": [] } + ``` + +export const title = "AtomicDEX Method: Convert utxo Address"; +export const description = "The convert_utxo_address method takes a UTXO address as input, and returns the equivalent address for another UTXO coin."; + +# convert\_utxo\_address + +**convert\_utxo\_address address to\_coin** + +The `convert_utxo_address` method takes a UTXO address as input, and returns the equivalent address for another UTXO coin (e.g. from BTC address to RVN address) + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ----------------------------- | +| address | string | Input UTXO address | +| to\_coin | string | Input address to convert from | + +## Response + +| Structure | Type | Description | +| --------- | ------ | ----------------- | +| result | string | Converted address | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "convert_utxo_address", + "coin": "BTC", + "address": "1DmFp16U73RrVZtYUbo2Ectt8mAnYScpqM", + "to_coin": "RVN" + } + ``` + + + + #### Response (success) + + ```json + { + "result": "RN3StWykhsERZaFjwmn9L9E5u2dPAt3YTS" + } + ``` + + + + #### Response (error - coin not enabled) + + ```json + { + "error": "rpc:174] dispatcher_legacy:155] lp_coins:1668] Coin RVN is not activated" + } + ``` + + + + #### Response (error - input address checksum failed) + + ```json + { + "error": "rpc:174] dispatcher_legacy:155] lp_coins:1665] Invalid Checksum" + } + ``` + +export const title = "AtomicDEX Method: Convert Address"; +export const description = "The convertaddress method converts an input address to a specified address format."; + +# convertaddress + +**convertaddress coin from to\_address\_format** + +The `convertaddress` method converts an input address to a specified address format. + +For example, this method can be used to convert a BCH address from legacy to cash address format and vice versa. + +Or this can be used to convert an ETH address from single to mixed case checksum format. + +## Arguments + +| Structure | Type | Description | +| ------------------- | ------ | ----------------------------------------------------------------------------------- | +| coin | string | the name of the coin address context | +| from | string | input address | +| to\_address\_format | object | A standard [AddressFormat](/atomicdex/api/common_structures/#address-format) object | + +## Response + +| Structure | Type | Description | +| --------- | ------ | -------------------------------- | +| address | string | the result of address conversion | + + + #### 📌 Examples + + #### Command (ETH single case address to mixed checksum) + + + ```json + { + "userpass": "testpsw", + "method": "convertaddress", + "coin": "ETH", + "from": "0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359", + "to_address_format": { + "format": "mixedcase" + } + } + ``` + + + #### Response + + ```json + { + "result": { + "address": "0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359" + } + } + ``` + + #### Command (BCH legacy to cash address) + + + ```json + { + "userpass": "testpsw", + "method": "convertaddress", + "coin": "BCH", + "from": "1DmFp16U73RrVZtYUbo2Ectt8mAnYScpqM", + "to_address_format": { + "format": "cashaddress", + "network": "bitcoincash" + } + } + ``` + + + #### Response + + ```json + { + "result": { + "address": "bitcoincash:qzxqqt9lh4feptf0mplnk58gnajfepzwcq9f2rxk55" + } + } + ``` + + #### Command (BCH cash address to legacy) + + + ```json + { + "userpass": "testpsw", + "method": "convertaddress", + "coin": "BCH", + "from": "bitcoincash:qzxqqt9lh4feptf0mplnk58gnajfepzwcq9f2rxk55", + "to_address_format": { + "format": "standard" + } + } + ``` + + + #### Response: + + ```json + { + "result": { + "address": "1DmFp16U73RrVZtYUbo2Ectt8mAnYScpqM" + } + } + ``` + + #### Command (Qtum wallet address to QRC20 contract address) + + + ```json + { + "userpass": "testpsw", + "method": "convertaddress", + "coin": "QRC20", + "from": "qKVvtDqpnFGDxsDzck5jmLwdnD2jRH6aM8", + "to_address_format": { + "format": "contract" + } + } + ``` + + + #### Response + + ```json + { + "result": { + "address": "0x1549128bbfb33b997949b4105b6a6371c998e212" + } + } + ``` + + #### Command (QRC20 contract address to Qtum wallet address) + + + ```json + { + "userpass": "testpsw", + "method": "convertaddress", + "coin": "QRC20", + "from": "0x1549128bbfb33b997949b4105b6a6371c998e212", + "to_address_format": { + "format": "wallet" + } + } + ``` + + + #### Response + + ```json + { + "result": { + "address": "qKVvtDqpnFGDxsDzck5jmLwdnD2jRH6aM8" + } + } + ``` + +export const title = "AtomicDEX Method: Convert Address"; +export const description = "The disable_coin method deactivates the previously enabled coin, and also cancels all active orders that use the selected coin."; + +# disable\_coin + +**disable\_coin coin** + +The `disable_coin` method deactivates the previously enabled coin, and also cancels all active orders that use the selected coin. The method will return an error in the following cases: + +* The coin is not enabled +* The coin is used by active swaps +* The coin is used by a currently matching order. In this case, other orders might still be cancelled + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ----------------------------- | +| coin | string | the ticker of coin to disable | + +#### Response + +| Structure | Type | Description | +| ----------------- | ---------------- | -------------------------------------------------------------------------------- | +| coin | string | the ticker of deactivated coin | +| cancelled\_orders | array of strings | uuids of cancelled orders | +| swaps | array of strings | uuids of active swaps that use the selected coin; present only in error cases | +| orders.matching | array of strings | uuids of matching orders that use the selected coin; present only in error cases | +| orders.cancelled | array of strings | uuids of orders that were successfully cancelled despite the error | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "disable_coin", + "coin": "DOC" + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "cancelled_orders": ["e5fc7c81-7574-4d3f-b64a-47227455d62a"], + "coin": "DOC" + } + } + ``` + + #### Response (error - coin is not enabled) + + ```json + { + "error": "No such coin: DOC" + } + ``` + + #### Response (error - active swap is using the coin) + + ```json + { + "error": "There're active swaps using DOC", + "swaps": ["d88d0a0e-f8bd-40ab-8edd-fe20801ef349"] + } + ``` + + #### Response (error - the order is matched at the moment, but another order is cancelled) + + ```json + { + "error": "There're currently matching orders using DOC", + "orders": { + "matching": ["d88d0a0e-f8bd-40ab-8edd-fe20801ef349"], + "cancelled": ["c88d0a0e-f8bd-40ab-8edd-fe20801ef349"] + } + } + ``` + +export const title = "AtomicDEX Method: Get Enabled Coins"; +export const description = "The get_enabled_coins method returns data of coins that are currently enabled on the user's AtomicDEX API node."; + +# get\_enabled\_coins + +**get\_enabled\_coins** + +The `get_enabled_coins` method returns data of coins that are currently enabled on the user's AtomicDEX API node. + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| -------------- | ---------------- | -------------------------------------- | +| result | array of objects | tickers and addresses of enabled coins | +| result.address | string | the user's address for this coin | +| result.ticker | string | the ticker name of this coin | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "get_enabled_coins" + } + ``` + + + + #### Response + + ```json + { + "result": [ + { + "address": "1WxswvLF2HdaDr4k77e92VjaXuPQA8Uji", + "ticker": "BTC" + }, + { + "address": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "ticker": "PIZZA" + }, + { + "address": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "ticker": "BEER" + }, + { + "address": "0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29", + "ticker": "ETH" + }, + { + "address": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "ticker": "ETOMIC" + }, + { + "address": "0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29", + "ticker": "DEC8" + }, + { + "address": "0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29", + "ticker": "BAT" + } + ] + } + ``` + +export const title = "AtomicDEX Method: Get Gossip Mesh"; +export const description = "The get_gossip_mesh method returns an array of peerIDs added to a topics' mesh for each known gossipsub topic."; + +# get\_gossip\_mesh + +**get\_gossip\_mesh** + +The `get_gossip_mesh` method returns an array of peerIDs added to a topics' mesh for each known gossipsub topic. + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| ---------------- | ----- | ---------------------------------------------------------------- | +| Topic-PeerID map | Array | PeerIDs added to a topics' mesh (for each known gossipsub topic) | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "get_gossip_mesh" + } + ``` + + + + #### Response (success) + + ```json + { + "result": {} + } + ``` + +export const title = "AtomicDEX Method: Get Gossip Peer Topics"; +export const description = "The get_gossip_peer_topics method returns a map of peerIDs to an array of the topics to which they are subscribed."; + +# get\_gossip\_peer\_topics + +**get\_gossip\_peer\_topics** + +The `get_gossip_peer_topics` method returns a map of peerIDs to an array of the topics to which they are subscribed. + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| ---------------- | ----- | ------------------------------- | +| PeerID-Topic map | Array | Topics subscribed to by PeerIDs | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "get_gossip_peer_topics" + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "12D3KooWJDoV9vJdy6PnzwVETZ3fWGMhV41VhSbocR1h2geFqq9Y": [], + "12D3KooWM8BrDBXc1TVw2vswoqYcQVn7fFvpAvcCfaV2Uqg2L9jU": [], + "12D3KooWPR2RoPi19vQtLugjCdvVmCcGLP2iXAzbDfP3tp81ZL4d": [], + "12D3KooWDbBdifGp3viDR4dCECEFKepjhwhd2YwAqgNVdXpEeewu": [] + } + } + ``` + +export const title = "AtomicDEX Method: Get Gossip Topic Peers"; +export const description = "The get_gossip_topic_peers method returns a map of topics to an array of the PeerIDs which are subscribers."; + +# get\_gossip\_topic\_peers + +**get\_gossip\_topic\_peers** + +The `get_gossip_topic_peers` method returns a map of topics to an array of the PeerIDs which are subscribers. + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| ---------------- | ----- | ----------------------------- | +| Topic-PeerID map | Array | PeerIDs subscribed to a topic | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "get_gossip_topic_peers" + } + ``` + + + + #### Response (success) + + ```json + { + "result": "12D3KooWS9MeuFZhJCfQTntwbTVnXMAJpz9Tvd1XYFuURrGqnJVR" + } + ``` + +export const title = "AtomicDEX Method: Get My Peer ID"; +export const description = "The get_my_peer_id method returns your unique identifying Peer ID on the network."; + +# get\_my\_peer\_id + +**get\_my\_peer\_id** + +The `get_my_peer_id` method returns your unique identifying Peer ID on the network + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| --------- | ------ | -------------------------------------- | +| PeerID | string | The PeerID of your node on the network | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "get_my_peer_id" + } + ``` + + + + #### Response (success) + + ```json + { + "result": "12D3KooWS9MeuFZhJCfQTntwbTVnXMAJpz9Tvd1XYFuURrGqnJVR" + } + ``` + +export const title = "AtomicDEX Method: Get Peers Info"; +export const description = "The get_peers_info method all connected peers with their multiaddresses."; + +# get\_peers\_info + +**get\_peers\_info** + +The `get_peers_info` method all connected peers with their multiaddresses. See [https://docs.libp2p.io/concepts/addressing/](https://docs.libp2p.io/concepts/addressing/) for more information. + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| --------------------- | ----- | ---------------------------------------------- | +| PeerID-Multiaddresses | Array | All connected peers with their multiaddresses. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "get_peers_info" + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "12D3KooWM8BrDBXc1TVw2vswoqYcQVn7fFvpAvcCfaV2Uqg2L9jU": [ + "/ip4/89.248.168.39/tcp/38890" + ], + "12D3KooWJ3dEWK7ym1uwc5SmwbmfFSRmELrA9aPJYxFRrQCCNdwF": [ + "/ip4/188.124.46.112/tcp/38890/p2p/12D3KooWJ3dEWK7ym1uwc5SmwbmfFSRmELrA9aPJYxFRrQCCNdwF" + ], + "12D3KooWL6yrrNACb7t7RPyTEPxKmq8jtrcbkcNd6H5G2hK7bXaL": [ + "/ip4/168.119.236.233/tcp/38890/p2p/12D3KooWL6yrrNACb7t7RPyTEPxKmq8jtrcbkcNd6H5G2hK7bXaL" + ], + "12D3KooWPR2RoPi19vQtLugjCdvVmCcGLP2iXAzbDfP3tp81ZL4d": [ + "/ip4/168.119.237.13/tcp/38890/p2p/12D3KooWPR2RoPi19vQtLugjCdvVmCcGLP2iXAzbDfP3tp81ZL4d" + ], + "12D3KooWKxavLCJVrQ5Gk1kd9m6cohctGQBmiKPS9XQFoXEoyGmS": [ + "/ip4/168.119.236.249/tcp/38890/p2p/12D3KooWKxavLCJVrQ5Gk1kd9m6cohctGQBmiKPS9XQFoXEoyGmS" + ], + "12D3KooWDbBdifGp3viDR4dCECEFKepjhwhd2YwAqgNVdXpEeewu": [ + "/ip4/80.82.76.214/tcp/38890" + ], + "12D3KooWJDoV9vJdy6PnzwVETZ3fWGMhV41VhSbocR1h2geFqq9Y": [ + "/ip4/89.248.173.231/tcp/38890" + ] + } + } + ``` + +export const title = "AtomicDEX Method: Get Relay Mesh"; +export const description = "The get_relay_mesh method returns a list of peerIDs included in our local relay mesh."; + +# get\_relay\_mesh + +**get\_relay\_mesh** + +The `get_relay_mesh` method returns a list of peerIDs included in our local relay mesh. + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| --------- | ---- | ------------------------------------ | +| PeerIDs | List | PeerIDs within your local relay mesh | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "get_relay_mesh" + } + ``` + + + + #### Response (success) + + ```json + { + "result": [ + "12D3KooWM8BrDBXc1TVw2vswoqYcQVn7fFvpAvcCfaV2Uqg2L9jU", + "12D3KooWJDoV9vJdy6PnzwVETZ3fWGMhV41VhSbocR1h2geFqq9Y" + ] + } + ``` + +export const title = "AtomicDEX Method: Get Trade Fee"; +export const description = + "The get_trade_fee method returns the approximate amount of the miner fee that is paid per swap transaction."; + +# get\_trade\_fee {{label : 'get_trade_fee', tag : 'deprecated'}} + +**get\_trade\_fee coin (deprecated)** + +The `get_trade_fee` method returns the approximate amount of the miner fee that is paid per swap transaction. + +This amount should be multiplied by 2 and deducted from the volume on `buy/sell` calls when the user is about to trade the entire balance of the selected coin. This aspect is currently under development. + + + This function is deprecated. Please consider using [trade\_preimage v2.0](/atomicdex/api/v20/trade_preimage/) instead. + + + + To send QRC20 Maker/Taker payment, you may need to allow the [Etomic Swap](https://github.com/artemii235/etomic-swap/) smart contract to withdraw amounts from your account using the [approve](https://docs.openzeppelin.com/contracts/2.x/api/token/erc20#IERC20-approve-address-uint256-) call. + In the worst case, you should call the `approve` twice (reduce allowance to 0 and set it to a required value) before the [erc20Payment](https://github.com/artemii235/etomic-swap/blob/1.0/contracts/EtomicSwap.sol#L51) is called. + + Gas Limit `100000` and Gas Price `40` are sufficient for one smart contract call. + + As a result, the value returned by the `get_trade_fee` for a QRC20 token includes gas fee `3 * 100000 * 40 = 12000000` that can be used in the worst case. + + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------ | +| coin | string | the name of the coin for the requested trade fee | + +#### Response + +| Structure | Type | Description | +| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| coin | string | the fee is paid from the user's balance of this coin. This coin name may differ from the requested coin. For example, ERC20 fees are paid by ETH (gas) | +| amount | string (numeric) | the approximate fee amount to be paid per swap transaction in decimal representation | +| amount\_rat | rational | the approximate fee amount to be paid per swap transaction, represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object | +| amount\_fraction | fraction | the approximate fee amount to be paid per swap transaction, represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object | + +#### 📌 Examples + +#### Command (BTC) + + + ```json + { + "userpass": "testpsw", + "method": "get_trade_fee", + "coin": "BTC" + } + ``` + + + + #### Response + + ```json + { + "result": { + "amount": "0.00042049", + "amount_fraction": { + "denom": "100000000", + "numer": "42049" + }, + "amount_rat": [ + [1, [42049]], + [1, [100000000]] + ], + "coin": "BTC" + } + } + ``` + + +#### Command (ETH) + + + ```json + { + "userpass": "testpsw", + "method": "get_trade_fee", + "coin": "ETH" + } + ``` + + + + #### Response + + ```json + { + "result": { + "amount": "0.00594", + "amount_fraction": { + "denom": "50000", + "numer": "297" + }, + "amount_rat": [ + [1, [297]], + [1, [50000]] + ], + "coin": "ETH" + } + } + ``` + + +#### Command (ERC20) + + + ```json + { + "userpass": "testpsw", + "method": "get_trade_fee", + "coin": "BAT" + } + ``` + + + + #### Response + + ```json + { + "result": { + "amount": "0.00594", + "amount_fraction": { + "denom": "50000", + "numer": "297" + }, + "amount_rat": [ + [1, [297]], + [1, [50000]] + ], + "coin": "ETH" + } + } + ``` + +export const title = "AtomicDEX Method: Help"; +export const description = "The help method returns the full API documentation in the terminal."; + +# help + +**help()** + +The `help` method returns the full API documentation in the terminal. + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| --------------------------------------- | ---- | ----------- | +| (returns the documentation in terminal) | | | +export const title = "AtomicDEX Method: Import Swaps"; +export const description = "The import_swaps method imports to the local database the swaps data that was exported from another AtomicDEX API instance."; + +# import\_swaps + +**import\_swaps swaps** + +The `import_swaps` method imports to the local database the `swaps` data that was exported from another AtomicDEX API instance. + +Use this method in combination with `my_swap_status` or `my_recent_swaps` to copy the swap history between different devices. + +## Arguments + +| Structure | Type | Description | +| --------- | ---------------- | -------------------------------------------------------------------------------------------- | +| swaps | array of objects | A map of standard [SwapStatus](/atomicdex/api/common_structures/swaps/#swap-status) objects. | + +#### Response + +| Structure | Type | Description | +| --------------- | ---------------- | ------------------------------------------------------------ | +| result.imported | array of strings | uuids of swaps that were successfully imported | +| result.imported | map | uuids of swaps that failed to import; includes error message | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "import_swaps", + "swaps": [ + { + "error_events": [ + "StartFailed", + "NegotiateFailed", + "TakerFeeSendFailed", + "MakerPaymentValidateFailed", + "TakerPaymentTransactionFailed", + "TakerPaymentDataSendFailed", + "TakerPaymentWaitForSpendFailed", + "MakerPaymentSpendFailed", + "TakerPaymentRefunded", + "TakerPaymentRefundFailed" + ], + "events": [ + { + "event": { + "data": { + "lock_duration": 7800, + "maker": "631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640", + "maker_amount": "3", + "maker_coin": "BEER", + "maker_coin_start_block": 156186, + "maker_payment_confirmations": 0, + "maker_payment_wait": 1568883784, + "my_persistent_pub": "02031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3", + "started_at": 1568881184, + "taker_amount": "4", + "taker_coin": "ETOMIC", + "taker_coin_start_block": 175041, + "taker_payment_confirmations": 1, + "taker_payment_lock": 1568888984, + "uuid": "07ce08bf-3db9-4dd8-a671-854affc1b7a3" + }, + "type": "Started" + }, + "timestamp": 1568881185316 + }, + { + "event": { + "data": { + "maker_payment_locktime": 1568896784, + "maker_pubkey": "02631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640", + "secret_hash": "eba736c5cc9bb33dee15b4a9c855a7831a484d84" + }, + "type": "Negotiated" + }, + "timestamp": 1568881246025 + }, + { + "event": { + "data": { + "tx_hash": "0c07be4dda88d8d75374496aa0f27e12f55363ce8d558cb5feecc828545e5f87", + "tx_hex": "0400008085202f890146b98696761d5e8667ffd665b73e13a8400baab4b22230a7ede0e4708597ee9c000000006a473044022077acb70e5940dfe789faa77e72b34f098abbf0974ea94a0380db157e243965230220614ec4966db0a122b0e7c23aa0707459b3b4f8241bb630c635cf6e943e96362e012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff02f0da0700000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac68630700000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac5e3a835d000000000000000000000000000000" + }, + "type": "TakerFeeSent" + }, + "timestamp": 1568881250689 + }, + { + "event": { + "data": { + "tx_hash": "31d97b3359bdbdfbd241e7706c90691e4d7c0b7abd27f2b22121be7f71c5fd06", + "tx_hex": "0400008085202f8901b4679094d4bf74f52c9004107cb9641a658213d5e9950e42a8805824e801ffc7010000006b483045022100b2e49f8bdc5a4b6c404e10150872dbec89a46deb13a837d3251c0299fe1066ca022012cbe6663106f92aefce88238b25b53aadd3522df8290ced869c3cc23559cc23012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff0200a3e1110000000017a91476e1998b0cd18da5f128e5bb695c36fbe6d957e98764c987c9bf0000001976a91464ae8510aac9546d5e7704e31ce177451386455588ac753a835d000000000000000000000000000000" + }, + "type": "MakerPaymentReceived" + }, + "timestamp": 1568881291571 + }, + { + "event": { + "type": "MakerPaymentWaitConfirmStarted" + }, + "timestamp": 1568881291571 + }, + { + "event": { + "type": "MakerPaymentValidatedAndConfirmed" + }, + "timestamp": 1568881291985 + }, + { + "event": { + "data": { + "tx_hash": "95926ab204049edeadb370c17a1168d9d79ee5747d8d832f73cfddf1c74f3961", + "tx_hex": "0400008085202f8902875f5e5428c8ecfeb58c558dce6353f5127ef2a06a497453d7d888da4dbe070c010000006a4730440220416059356dc6dde0ddbee206e456698d7e54c3afa92132ecbf332e8c937e5383022068a41d9c208e8812204d4b0d21749b2684d0eea513467295e359e03c5132e719012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff46b98696761d5e8667ffd665b73e13a8400baab4b22230a7ede0e4708597ee9c010000006b483045022100a990c798d0f96fd5ff7029fd5318f3c742837400d9f09a002e7f5bb1aeaf4e5a0220517dbc16713411e5c99bb0172f295a54c97aaf4d64de145eb3c5fa0fc38b67ff012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff020084d7170000000017a9144d57b4930e6c86493034f17aa05464773625de1c877bd0de03010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8c3a835d000000000000000000000000000000" + }, + "type": "TakerPaymentSent" + }, + "timestamp": 1568881296904 + }, + { + "event": { + "data": { + "secret": "fb968d5460399f20ffd09906dc8f65c21fbb5cb8077a8e6d7126d0526586ca96", + "transaction": { + "tx_hash": "68f5ec617bd9a4a24d7af0ce9762d87f7baadc13a66739fd4a2575630ecc1827", + "tx_hex": "0400008085202f890161394fc7f1ddcf732f838d7d74e59ed7d968117ac170b3adde9e0404b26a929500000000d8483045022100a33d976cf509d6f9e66c297db30c0f44cced2241ee9c01c5ec8d3cbbf3d41172022039a6e02c3a3c85e3861ab1d2f13ba52677a3b1344483b2ae443723ba5bb1353f0120fb968d5460399f20ffd09906dc8f65c21fbb5cb8077a8e6d7126d0526586ca96004c6b63049858835db1752102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ac6782012088a914eba736c5cc9bb33dee15b4a9c855a7831a484d84882102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ac68ffffffff011880d717000000001976a91464ae8510aac9546d5e7704e31ce177451386455588ac942c835d000000000000000000000000000000" + } + }, + "type": "TakerPaymentSpent" + }, + "timestamp": 1568881328643 + }, + { + "event": { + "data": { + "error": "taker_swap:798] utxo:950] utxo:950] error" + }, + "type": "MakerPaymentSpendFailed" + }, + "timestamp": 1568881328645 + }, + { + "event": { + "type": "Finished" + }, + "timestamp": 1568881328648 + } + ], + "my_info": { + "my_amount": "4", + "my_coin": "ETOMIC", + "other_amount": "3", + "other_coin": "BEER", + "started_at": 1568881184 + }, + "recoverable": true, + "success_events": [ + "Started", + "Negotiated", + "TakerFeeSent", + "MakerPaymentReceived", + "MakerPaymentWaitConfirmStarted", + "MakerPaymentValidatedAndConfirmed", + "TakerPaymentSent", + "TakerPaymentSpent", + "MakerPaymentSpent", + "Finished" + ], + "type": "Taker", + "uuid": "07ce08bf-3db9-4dd8-a671-854affc1b7a3" + } + ] + } + ``` + + + + #### Response + + ```json + { + "result": { + "imported": ["07ce08bf-3db9-4dd8-a671-854affc1b7a3"], + "skipped": { + "1af6bb5e-e131-4b06-b235-36fae8daab0a": "lp_swap:424] File already exists" + } + } + } + ``` + +export const title = "AtomicDEX API (Legacy Methods)"; +export const description = "This section contains the Legacy AtomicDEX methods that are currently being ported to the 2.0 version"; + +# AtomicDEX API RPC (Legacy) + +This section of the documentation contains the Legacy AtomicDEX methods that are currently being ported to the 2.0 version +export const title = "AtomicDEX Method: KMD Rewards Info"; +export const description = "The kmd_rewards_info method returns information about the active user rewards that can be claimed by an address's unspent outputs."; + +# kmd\_rewards\_info + +**kmd\_rewards\_info** + +The `kmd_rewards_info` method returns information about the active user rewards that can be claimed by an address's unspent outputs. + + + This method only works when the KMD coin is activated. + + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| ----------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | array of objects | the rewards info; each element corresponds to an unspent output and contains detailed information about the active user rewards corresponding to it | +| tx\_hash | string | the hash of the transaction | +| height | number (integer, optional) | the height of the block in which the transaction was included (empty if the tx is not mined yet) | +| output\_index | number (integer) | the zero-based index of the output in the transaction’s list of outputs | +| amount | string (numeric) | the transaction output’s value | +| locktime | number (integer) | the transaction output's locktime | +| accrued\_rewards | object | the amount of accrued rewards if they exist or the reason for their non existence | +| accrue\_start\_at | number (integer, optional) | the rewards start to accrue at this time for the given transaction (empty if the rewards will never accrue to it) | +| accrue\_stop\_at | number (integer, optional) | the rewards stop to accrue at this time for the given transaction (empty if the tx is not mined yet or if rewards will never accrue to it) | + +Where the `accrued_rewards` has either + +| Structure | Type | Description | +| --------- | ---------------- | ----------------------------- | +| Accrued | string (numeric) | the amount of accrued rewards | + +or + +| Structure | Type | Description | +| ---------------- | ------ | -------------------------------------- | +| NotAccruedReason | string | the reason why rewards are not accrued | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "kmd_rewards_info" + } + ``` + + + + #### Response + + ```json + { + "result": [ + { + "accrue_stop_at": 1596144028, + "accrued_rewards": { + "Accrued": "0.00450984" + }, + "amount": "47.99897112", + "height": 1986467, + "input_index": 1, + "locktime": 1596099388, + "tx_hash": "016bfb8fcf8704a30b5daf6b4bcce9d7e848141b53df44a5eae3db4279227401" + }, + { + "accrue_stop_at": 1596142801, + "accrued_rewards": { + "NotAccruedReason": "UtxoAmountLessThanTen" + }, + "amount": "0.5", + "height": 1986481, + "input_index": 0, + "locktime": 1596098161, + "tx_hash": "762d02d9d52faf365b55375da5e61ce34bb0ea391fbcb23e74b2adf8165f1bbb" + } + ] + } + ``` + +export const title = "AtomicDEX Method: List Banned Pubkeys"; +export const description = "The list_banned_pubkeys method returns a list of public keys of nodes that are banned from interacting with the node executing the method."; + +# list\_banned\_pubkeys + +**list\_banned\_pubkeys** + +The `list_banned_pubkeys` method returns a list of public keys of nodes that are banned from interacting with the node executing the method. + +Banned nodes cannot complete orders and order matching requests with the node executing the method. + + + Some cases of swap failures give cause for banning a node. For example, a market taker may not follow the atomic-swap protocol by not sending the dex fee. The list\_banned\_pubkeys method is useful in these circumstances. + + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| --------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------- | +| result | map of objects (key - pubkey in hexadecimal representation) | the list of pubkeys banned by current node | +| result.\*.type | string | the type of the ban; possible values: `Manual` or `FailedSwap` | +| result.\*.caused\_by\_swap | string (optional) | the uuid of the swap that triggered the ban; present only for the `FailedSwap` type | +| result.\*.caused\_by\_event | object (optional) | the swap event that triggered the ban; present only for the `FailedSwap` type | +| result.\*.reason | string (optional) | the reason for the `Manual` ban | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "list_banned_pubkeys" + } + ``` + + + + #### Response + + ```json + { + "result": { + "15d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732": { + "type": "FailedSwap", + "caused_by_event": { + "event": { + "data": { + "error": "taker_swap:547] \"taker_swap:543] timeout (180.0 > 180.0)\"" + }, + "type": "NegotiateFailed" + }, + "type": "Taker" + }, + "caused_by_swap": "e8400870-e85a-42af-bb4f-9658ac86ffdf" + }, + "15d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044730": { + "type": "Manual", + "reason": "test" + } + } + } + ``` + +export const title = "AtomicDEX Method: Max Taker Vol"; +export const description = "The max_taker_vol method returns the maximum available volume for buy/sell methods for selected coin."; + +# max\_taker\_vol + +**max\_taker\_vol coin** + +The `max_taker_vol` method returns the maximum available volume for buy/sell methods for selected `coin`. +This takes the dex fee and blockchain miner fees into account. The result should be used as is for `sell` method or divided by price for `buy` method. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------------------------- | +| coin | string | the name of the coin to retrieve the max available taker volume | + +#### Response + +| Structure | Type | Description | +| --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| result | fraction | the max available taker volume, represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | + +#### 📌 Examples + +#### Command + + + ```json + { + "method": "max_taker_vol", + "coin": "DOC", + "userpass": "testpsw", + "mm2": 1 + } + ``` + + + + #### Response + + ```json + { + "result": { + "denom": "38900000000", + "numer": "309786160299" + } + } + ``` + +export const title = "AtomicDEX Method: Metrics"; +export const description = + "The metrics method returns a snapshot of the current AtomicDEX API metrics used in Prometheus and Grafana."; + +# metrics + +The `metrics` method returns a snapshot of the current AtomicDEX API metrics used in [Prometheus](https://prometheus.io/) and [Grafana](https://grafana.com/). +For more information check out the [AtomicDEX metrics guide](/atomicdex/tutorials/atomicdex-metrics/) + +### Request Parameters + +The `metrics` method does not take any additional parameters, and does not require authentication with your `rpc_password`. + +### Response Parameters + +| Parameter | Type | Description | +| --------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| metrics | list of objects | There are a variety of metrics returned, with each metrics object havine a `type`, `key`, `label`, and some values which vary by `type`. | + +### Metrics object + +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------------- | +| type | string | A metric type which indicates how it should be displayed in visualisation. | +| key | string | A descriptive name assigned to the metric. | +| labels | object | Labels can be used to group similar metrics together or provide additional context. | +| value | float | Returned if `type` is `gauge`. A numeric value which indicates the magnitude of the metric being measured. | +| count | float | Returned if `type` is `histogram`. How many values were measured. | +| min | float | Returned if `type` is `histogram`. The smallest value measured. | +| max | float | Returned if `type` is `histogram`. The highest value measured. | + +#### 📌 Example(s) + +#### Command + + + ```json + { + "method": "metrics", + "userpass": "testpsw" + } + ``` + + + + #### Response + + ```json + { + "metrics": [ + { + "type": "counter", + "key": "tx.history.response.count", + "labels": { + "coin": "MARTY", + "method": "tx_detail_by_hash" + }, + "value": 25 + }, + { + "type": "counter", + "key": "rpc_client.request.count", + "labels": { + "client": "electrum", + "coin": "DOC" + }, + "value": 1224 + }, + { + "type": "counter", + "key": "tx.history.response.count", + "labels": { + "method": "tx_detail_by_hash", + "coin": "DOC" + }, + "value": 27 + }, + { + "type": "counter", + "key": "tx.history.request.count", + "labels": { + "coin": "DOC", + "method": "tx_detail_by_hash" + }, + "value": 27 + }, + { + "type": "counter", + "key": "rpc_client.traffic.in", + "labels": { + "client": "electrum", + "coin": "DOC" + }, + "value": 823841 + }, + { + "type": "counter", + "key": "rpc_client.traffic.out", + "labels": { + "coin": "MARTY", + "client": "electrum" + }, + "value": 139396 + }, + { + "type": "counter", + "key": "tx.history.response.total_length", + "labels": { + "client": "electrum", + "coin": "MARTY", + "method": "blockchain.scripthash.get_history" + }, + "value": 1041 + }, + { + "type": "counter", + "key": "tx.history.response.count", + "labels": { + "client": "electrum", + "coin": "MARTY", + "method": "blockchain.scripthash.get_history" + }, + "value": 11 + }, + { + "type": "counter", + "key": "tx.history.response.count", + "labels": { + "method": "blockchain.scripthash.get_history", + "client": "electrum", + "coin": "DOC" + }, + "value": 6 + }, + { + "type": "counter", + "key": "tx.history.request.count", + "labels": { + "coin": "MARTY", + "method": "tx_detail_by_hash" + }, + "value": 25 + }, + { + "type": "counter", + "key": "rpc_client.response.count", + "labels": { + "coin": "DOC", + "client": "electrum" + }, + "value": 1351 + }, + { + "type": "counter", + "key": "rpc_client.request.count", + "labels": { + "client": "electrum", + "coin": "MARTY" + }, + "value": 1237 + }, + { + "type": "counter", + "key": "rpc_client.traffic.in", + "labels": { + "client": "electrum", + "coin": "MARTY" + }, + "value": 772964 + }, + { + "type": "counter", + "key": "tx.history.response.total_length", + "labels": { + "coin": "DOC", + "client": "electrum", + "method": "blockchain.scripthash.get_history" + }, + "value": 767 + }, + { + "type": "counter", + "key": "tx.history.request.count", + "labels": { + "coin": "DOC", + "client": "electrum", + "method": "blockchain.scripthash.get_history" + }, + "value": 6 + }, + { + "type": "counter", + "key": "rpc_client.traffic.out", + "labels": { + "coin": "DOC", + "client": "electrum" + }, + "value": 136368 + }, + { + "type": "counter", + "key": "tx.history.request.count", + "labels": { + "coin": "MARTY", + "client": "electrum", + "method": "blockchain.scripthash.get_history" + }, + "value": 11 + }, + { + "type": "counter", + "key": "rpc_client.response.count", + "labels": { + "client": "electrum", + "coin": "MARTY" + }, + "value": 1361 + }, + { + "type": "gauge", + "key": "p2p.connected_peers.count", + "labels": {}, + "value": 8.0 + }, + { + "type": "gauge", + "key": "p2p.received_messages.count", + "labels": {}, + "value": 24.0 + }, + { + "type": "gauge", + "key": "p2p.connected_relays.len", + "labels": {}, + "value": 8.0 + }, + { + "type": "gauge", + "key": "p2p.relay_mesh.len", + "labels": {}, + "value": 2.0 + }, + { + "type": "gauge", + "key": "orderbook.memory_db", + "labels": {}, + "value": 297800390224.0 + }, + { + "type": "gauge", + "key": "orderbook.len", + "labels": {}, + "value": 15.0 + }, + { + "type": "gauge", + "key": "p2p.received_messages.period_in_secs", + "labels": {}, + "value": 60.0 + }, + { + "type": "histogram", + "key": "peer.outgoing_request.timing", + "labels": { + "peer": "12D3KooWJDoV9vJdy6PnzwVETZ3fWGMhV41VhSbocR1h2geFqq9Y" + }, + "count": 2.0, + "max": 0.801318629, + "min": 0.699428848 + } + ] + } + ``` + +export const title = "AtomicDEX Method: Min Trading Vol"; +export const description = "The min_trading_vol method returns the minimum required volume for buy/sell/setprice methods for the selected coin."; + +# min\_trading\_vol + +**min\_trading\_vol coin** + +The `min_trading_vol` method returns the minimum required volume for buy/sell/setprice methods for the selected `coin`. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ----------------------------------------------------------- | +| coin | string | the name of the coin to retrieve the minimum trading volume | + +#### Response + +| Structure | Type | Description | +| --------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| result | object | result object | +| coin | string | the coin ticker from the request | +| min\_trading\_vol | string (decimal) | the minimum trading volume threshold in decimal representation | +| min\_trading\_vol\_rat | rational | the minimum trading volume threshold represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object | +| min\_trading\_vol\_fraction | fraction | the minimum trading volume threshold represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "min_trading_vol", + "coin": "DOC" + } + ``` + + + + #### Response + + ```json + { + "result": { + "coin": "DOC", + "min_trading_vol": "0.0001", + "min_trading_vol_fraction": { + "numer": "1", + "denom": "10000" + }, + "min_trading_vol_rat": [ + [1, [1]], + [1, [10000]] + ] + } + } + ``` + +export const title = "AtomicDEX Method: My Balance"; +export const description = "The my_balance method returns the current balance of the specified coin."; + +# my\_balance + +**my\_balance coin** + +The `my_balance` method returns the current balance of the specified `coin`. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | -------------------------------------------- | +| coin | string | the name of the coin to retrieve the balance | + +#### Response + +| Structure | Type | Description | +| -------------------- | ---------------- | --------------------------------------------------------------------------------------------- | +| address | string | the address that holds the coins | +| balance | string (numeric) | the number of coins in the address; does not include `unspendable_balance` | +| unspendable\_balance | string (numeric) | the `coin` balance that is unspendable at the moment (e.g. if the address has immature UTXOs) | +| coin | string | the name of the coin | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "my_balance", + "coin": "HELLOWORLD" + } + ``` + + + + #### Response + + ```json + { + "address": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "balance": "60.00253836", + "unspendable_balance": "0.1", + "coin": "HELLOWORLD" + } + ``` + +export const title = "AtomicDEX Method: My Orders"; +export const description = "The my_orders method returns the data of all active orders created by the AtomicDEX API node."; + +# my\_orders + +**my\_orders()** + +The `my_orders` method returns the data of all active orders created by the AtomicDEX API node. + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| ------------- | -------------- | ----------------------------------------------------- | +| maker\_orders | map of objects | orders that are currently active in market-maker mode | +| taker\_orders | map of objects | orders that are currently active in market-taker mode | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "my_orders" + } + ``` + + + + #### Response + + ```json + { + "result": { + "maker_orders": { + "ea77dcc3-a711-4c3d-ac36-d45fc5e1ee0c": { + "available_amount": "1", + "base": "BEER", + "cancellable": true, + "created_at": 1568808684710, + "matches": { + "60aaacca-ed31-4633-9326-c9757ea4cf78": { + "connect": { + "dest_pub_key": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "maker_order_uuid": "fedd5261-a57e-4cbf-80ac-b3507045e140", + "method": "connect", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "taker_order_uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + }, + "connected": { + "dest_pub_key": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "maker_order_uuid": "fedd5261-a57e-4cbf-80ac-b3507045e140", + "method": "connected", + "sender_pubkey": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "taker_order_uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + }, + "last_updated": 1560529572571, + "request": { + "action": "Buy", + "base": "BEER", + "base_amount": "1", + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000", + "method": "request", + "rel": "PIZZA", + "rel_amount": "1", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + }, + "reserved": { + "base": "BEER", + "base_amount": "1", + "dest_pub_key": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "maker_order_uuid": "fedd5261-a57e-4cbf-80ac-b3507045e140", + "method": "reserved", + "rel": "PIZZA", + "rel_amount": "1", + "sender_pubkey": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "taker_order_uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + } + } + }, + "max_base_vol": "1", + "max_base_vol_rat": [ + [1, [1]], + [1, [1]] + ], + "min_base_vol": "0", + "min_base_vol_rat": [ + [0, []], + [1, [1]] + ], + "price": "1", + "price_rat": [ + [1, [1]], + [1, [1]] + ], + "rel": "ETOMIC", + "started_swaps": ["60aaacca-ed31-4633-9326-c9757ea4cf78"], + "uuid": "ea77dcc3-a711-4c3d-ac36-d45fc5e1ee0c" + } + }, + "taker_orders": { + "ea199ac4-b216-4a04-9f08-ac73aa06ae37": { + "cancellable": true, + "created_at": 1568811351456, + "matches": { + "15922925-cc46-4219-8cbd-613802e17797": { + "connect": { + "dest_pub_key": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "maker_order_uuid": "15922925-cc46-4219-8cbd-613802e17797", + "method": "connect", + "sender_pubkey": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "taker_order_uuid": "45252de5-ea9f-44ae-8b48-85092a0c99ed" + }, + "connected": { + "dest_pub_key": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "maker_order_uuid": "15922925-cc46-4219-8cbd-613802e17797", + "method": "connected", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "taker_order_uuid": "45252de5-ea9f-44ae-8b48-85092a0c99ed" + }, + "last_updated": 1560529049477, + "reserved": { + "base": "BEER", + "base_amount": "1", + "dest_pub_key": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "maker_order_uuid": "15922925-cc46-4219-8cbd-613802e17797", + "method": "reserved", + "rel": "ETOMIC", + "rel_amount": "1", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "taker_order_uuid": "45252de5-ea9f-44ae-8b48-85092a0c99ed" + } + } + }, + "request": { + "action": "Buy", + "base": "BEER", + "base_amount": "1", + "base_amount_rat": [ + [1, [1]], + [1, [1]] + ], + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000", + "method": "request", + "rel": "ETOMIC", + "rel_amount": "1", + "rel_amount_rat": [ + [1, [1]], + [1, [1]] + ], + "sender_pubkey": "031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3", + "uuid": "ea199ac4-b216-4a04-9f08-ac73aa06ae37", + "match_by": { + "type": "Any" + } + }, + "order_type": { + "type": "GoodTillCancelled" + }, + "base_orderbook_ticker": null, + "rel_orderbook_ticker": null + } + } + } + } + ``` + +export const title = "AtomicDEX Method: My Recent Swaps"; +export const description = "The my_recent_swaps method returns the data of the most recent atomic swaps executed by the AtomicDEX API node."; + +# my\_recent\_swaps + +**my\_recent\_swaps (from\_uuid page\_number=1 limit=10 my\_coin other\_coin from\_timestamp to\_timestamp)** + +The `my_recent_swaps` method returns the data of the most recent atomic swaps executed by the AtomicDEX API node. Please note that all filters (my\_coin, from\_timestamp, etc.) are combined using logical AND. + +## Arguments + +| Structure | Type | Description | +| --------------- | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| limit | number | limits the number of returned swaps. The default is `10`. | +| from\_uuid | string | AtomicDEX API will skip records until this uuid, skipping the `from_uuid` as well; The `from_uuid` approach is convenient for infinite scrolling implementation | +| page\_number | number | AtomicDEX API will return `limit` swaps from the selected page; This param will be ignored if `from_uuid` is set. | +| my\_coin | string | return only swaps that match the `swap.my_coin = request.my_coin` condition | +| other\_coin | string | return only swaps that match the `swap.other_coin = request.other_coin` condition | +| from\_timestamp | number (timestamp in seconds) | return only swaps that match the `swap.started_at >= request.from_timestamp` condition | +| to\_timestamp | number (timestamp in seconds) | return only swaps that match the `swap.started_at < request.to_timestamp` condition | + +#### Response + +| Structure | Type | Description | +| -------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| swaps | array of objects | A list of standard [SwapStatus](/atomicdex/api/common_structures/swaps/#swap-status) objects | +| from\_uuid | string | the from\_uuid that was set in the request; this value is null if nothing was set | +| skipped | number | the number of skipped records (i.e. the position of `from_uuid` in the list + 1 or `(page_number - 1) * limit`; the value is 0 if `from_uuid` or `page_number` were not set or `page_number` is 1) | +| limit | number | the limit that was set in the request; note that the actual number of swaps can differ from the specified limit (e.g. on the last page) | +| total | number | total number of swaps available with the selected filters | +| page\_number | number | the page\_number that was set in the request; if both `page_number` and `from_uuid` are not set in request it will default to `1`; if `from_uuid` is present in request this value will be always null | +| total\_pages | number | total pages available with the selected filters and limit | +| found\_records | number | the number of returned swaps | + +#### 📌 Examples + +#### Command (limit + from\_uuid) + + + ```json + { + "userpass": "testpsw", + "method": "my_recent_swaps", + "from_uuid": "e299c6ece7a7ddc42444eda64d46b163eaa992da65ce6de24eb812d715184e4c", + "limit": 2 + } + ``` + + +#### Command (limit + page\_number) + + + ```json + { + "userpass": "testpsw", + "method": "my_recent_swaps", + "page_number": 3, + "limit": 2 + } + ``` + + +#### Command (select swaps that have my\_coin = DOC and other\_coin = MARTY) + + + ```json + { + "userpass": "testpsw", + "method": "my_recent_swaps", + "limit": 2, + "my_coin": "DOC", + "other_coin": "MARTY" + } + ``` + + +#### Command (select swaps that have my\_coin = DOC and started\_at >= 1611705600 (January 27, 2021 0:00:00 GMT)) + + + ```json + { + "userpass": "testpsw", + "method": "my_recent_swaps", + "limit": 2, + "my_coin": "DOC", + "from_timestamp": 1611705600 + } + ``` + + +#### Command (select swaps that have started\_at >= 1611705600 (January 27, 2021 0:00:00 GMT) and started\_at \< 1611792001 (January 28, 2021 0:00:01 GMT)) + + + ```json + { + "userpass": "testpsw", + "method": "my_recent_swaps", + "limit": 2, + "my_coin": "DOC", + "from_timestamp": 1611705600, + "to_timestamp": 1611792001 + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "from_uuid": "e299c6ece7a7ddc42444eda64d46b163eaa992da65ce6de24eb812d715184e4c", + "limit": 2, + "skipped": 1, + "total": 49, + "found_records": 2, + "page_number": null, + "total_pages": 25, + "swaps": [ + { + "error_events": [ + "StartFailed", + "NegotiateFailed", + "TakerFeeValidateFailed", + "MakerPaymentTransactionFailed", + "MakerPaymentDataSendFailed", + "MakerPaymentWaitConfirmFailed", + "TakerPaymentValidateFailed", + "TakerPaymentWaitConfirmFailed", + "TakerPaymentSpendFailed", + "TakerPaymentSpendConfirmFailed", + "MakerPaymentWaitRefundStarted", + "MakerPaymentRefunded", + "MakerPaymentRefundFailed" + ], + "events": [ + { + "event": { + "data": { + "lock_duration": 7800, + "maker_amount": "1", + "maker_coin": "BEER", + "maker_coin_start_block": 154221, + "maker_payment_confirmations": 1, + "maker_payment_requires_nota": false, + "maker_payment_lock": 1561545442, + "my_persistent_pub": "02031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3", + "secret": "ea774bc94dce44c138920c6e9255e31d5645e60c0b64e9a059ab025f1dd2fdc6", + "started_at": 1561529842, + "taker": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "taker_amount": "1", + "taker_coin": "PIZZA", + "taker_coin_start_block": 141363, + "taker_payment_confirmations": 1, + "taker_payment_requires_nota": true, + "uuid": "6bf6e313-e610-4a9a-ba8c-57fc34a124aa" + }, + "type": "Started" + }, + "timestamp": 1561529842866 + }, + { + "event": { + "data": { + "taker_payment_locktime": 1561537641, + "taker_pubkey": "02631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640" + }, + "type": "Negotiated" + }, + "timestamp": 1561529883208 + }, + { + "event": { + "data": { + "tx_hash": "a91469546211cc910fbe4a1f4668ab0353765d3d0cb03f4a67bff9326991f682", + "tx_hex": "0400008085202f89021c7eeec33f8eb5ff2ed6c3d09e40e04b05a9674ea2feefcc12de3f9dcc16aff8000000006b483045022100e18e3d1afa8a24ecec82c92bfc05c119bfacdbb71b5f5663a4b96cc2a41ab269022017a79a1a1f6e0220d8fa1d2cf3b1c9788272f1ad18e4987b8f1cd4418acaa5b0012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff6a0d321eb52c3c7165adf80f83b15b7a5caa3a0dfa87746239021600d47fb43e000000006b483045022100937ed900e084d57d5e3341499fc66c5574884ca71cd4331fa696c8b7a517591b02201f5f851f94c3ca0ffb4789f1af22cb95dc83564e127ed7d23f1129eb2b981a2f012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac9c120100000000001976a91464ae8510aac9546d5e7704e31ce177451386455588ac2f0e135d000000000000000000000000000000" + }, + "type": "TakerFeeValidated" + }, + "timestamp": 1561529927879 + }, + { + "event": { + "data": { + "tx_hash": "efa90a2918e6793c8a2725c06ee34d0fa76c43bc85e680be195414e7aee36154", + "tx_hex": "0400008085202f890cdcd071edda0d5f489b0be9c8b521ad608bb6d7f43f6e7a491843e7a4d0078f85000000006b483045022100fbc3bd09f8e1821ed671d1b1d2ed355833fb42c0bc435fef2da5c5b0a980b9a002204ef92b35576069d640ca0ac08f46645e5ade36afd5f19fb6aad19cfc9fb221fb012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffe6ae2a3ce221a6612d9e640bdbe10a2e477b3bc68a1aeee4a6784cb18648a785010000006a47304402202000a7e60ae2ce1529247875623ef2c5b42448dcaeac8de0f8f0e2f8e5bd8a6b0220426321a004b793172014f522efbca77a3dc92e86ce0a75330d8ceb83072ad4e7012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff9335553edcbac9559cae517a3e25b880a48fabf661c4ac338394972eef4572da000000006b4830450221008ded7230f2fb37a42b94f96174ec192baf4cd9e9e68fb9b6cf0463a36a6093e00220538de51ceda1617f3964a2350802377940fdfa018cc1043d77c66081b1cab0c4012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3fffffffff91b5d3733877f84108de77fec46bee156766e1a6837fa7b580ccbc3905acb14000000006b483045022100d07cf1fd20e07aafdc942ba56f6b45baee61b93145a2bdba391e2cdb8024bf15022056ea8183990703ef05018df2fe8bd5ec678ec0f9207b0283292b2cdafc5e1e0c012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff147870387ca938b2b6e7daa96ba2496014f125c0e4e576273ef36ee8186c415a000000006a47304402204c5b15b641d7e34444456d2ea6663bdc8bd8216e309a7220814474f346b8425e0220634d1dd943b416b7a807704d7f7a3d46a60d88ef4e20734588a0b302c55fa82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffd2b954ae9b4a61fad9f7bc956d24e38d7b6fe313da824bd3bd91287d5a6b49d9000000006b483045022100a7387d9ab7b2c92d3cbce525e96ffac5ae3ef14f848661741ada0db17715c4a002202c1417d5e3e04b1a2d1774a83bb8d5aa1c0536c100138123089fa69921b5d976012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff28792a2e26d9d7be0467fac52b12ece67410b23eea845008257979bd87d083e3000000006a473044022027c40517c33cd3202d4310cfd2c75f38e6d7804b255fc3838a32ea26e5a3cb0002202b4399e1d7e655b64f699318f2bfbdced49f064ee54e9d6a678668fce51caf96012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffa8bf797bacd213b74a9977ae1b956afe3af33a1ee94324e010a16db891a07441000000006a473044022004cbb1d970b9f02c578b5c1d7de33361581eebc19c3cd8d2e50b0211ca4ef13702200c93b9fe5428055b6274dc8e52073c3e87f5b5e4206134d745928ccfc9393919012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff2b6fd82c9a68111b67ad85a614a6ecb50f7b6eac3d21d8ebefd9a6065cdf5729000000006b483045022100fdff16c595c7b4a9b4fc1e445b565f7b29fe5b7a08f79291b0ff585c7b72ac2902200c694aa124013bd419ce2349f15d10435827868d35db939b9d3c344d16e78420012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff6a5468dd8c83553dc51022f2a2fb772cf91c8607dc2ca1b8f203ac534612ab29000000006b483045022100ba7cc79e7ae3720238bfc5caa225dc8017d6a0d1cb1ec66abaf724fd20b3b7ab02206e8c942756604af0f63b74af495a9b3b7f4a44c489267f69a14cf2b1b953f46e012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff5f9f48a91d343fd5aef1d85f00850070931459ab256697afb728d1c81c1fa1d2000000006a47304402200ec85fc66f963e7504eb27361a4b4bb17de60e459da414fdc3962476de636134022056b62c15cf7f9b4e7d4e11c03e4e541dd348919b8c55efa4f1927e2fdd5ae8ea012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffee1f455924d3167e7f7abf452c1856e9abdcfe27dc889942dd249cb376169d38000000006b48304502210089274eed807c5d23d819f6dfa8a358a9748e56f2080be4396ef77bb19d91b17402207fc7b22c879534fffe0eeaaec8fc284e22c2756f380c05ea57b881a96b09f3af012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f5050000000017a9144eb3a361d8a15d7f6a8ef9d1cf44962a90c44d548702912b00000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac490e135d000000000000000000000000000000" + }, + "type": "MakerPaymentSent" + }, + "timestamp": 1561529938879 + }, + { + "event": { + "data": { + "tx_hash": "7e0e38e31dbe80792ef320b8c0a7cb9259127427ef8c2fca1d796f24484046a5", + "tx_hex": "0400008085202f892082f6916932f9bf674a3fb00c3d5d765303ab68461f4abe0f91cc1162546914a9010000006b483045022100999b8bb0224476b5c344a466d0051ec7a8c312574ad8956a4177a42625cb86e302205a6664396bff3f2e6fe57adb7e082a26d1b8da9ee77b3fc24aa4148fdd5c84db012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffcad29a146b81bcaa44744efbec5149b6e3ca32bace140f75ad5794288d5bff6c000000006b483045022100b4dbfe88561c201fb8fbaf5bbf5bc0985893c909429c579425da84b02d23cc12022075f1e1e3eba38d167a6e84aac23faee5a2eb0799511e647213cee168529d4e5d012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffa13eeacd04b3e26ae3f41530b560c615dafa0fd4235cc5b22d48ab97e7c3399c000000006a47304402201158306fe668cbf56ad3f586dc83c1cda9efab44cef46da6bc0fe242292c85ed02201d622fe283410320e760233ae81dc53df65406b09fd07f8649f1775689219c35012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff4352b9f1f01dde4209b9e91076a3cfcabdaa23d9d5a313abfe7edb67ee4273e3000000006b483045022100825242fb3c6d460580016e93718ae1f43917e53abcc1558a64a6ab6f406763dd0220543936ce4c725e5e9f03831274a8475b535171bb29e1919fcf52ba2a9c85a553012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffcc0fa94b5973c893e61d470ae3982b0bedfd29cb0da2c60a362de438598f108c000000006b4830450221008c70a8e10ca37819e5a4d9783366e729e690d78f2fdd8a1f4812ddc14ec7d6ad022035ba8cb4d4e50684107f8af5c184582687b5d7dfda5d9be1bd45e45749c77f08012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffb0bd3bb9fedb7bbf49ca1612c955ba6095202186cef5be6952aed3dd32da4268000000006a4730440220592216d63c199faa587a4a6cbe11ca26027368a116b50818ce30eced59ca887202201bcafcf88f9f2632151596732f839d77cbe2f2243822c8551faffecc90b5dc19012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff65cf2831fc200e55aaacbe0881ad0edfb298ee6d4421b08b048aecc151716bd1000000006a47304402202032eb1ccebc3be4b94bae343d1d168e87040d2d20977c47d073d6bf490ef6c00220067656e00c4b8930167c54078609925cec7b893a52bcb9304e6b2602f564413e012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffeaf67880bee214acecc74b12f648c1014d6394c4abf99832d408981bb460e999000000006b483045022100b9ae1cc824149220ac517298e6f21c26939485b31d0ae19d97d986c5f8f34e4502200a90578cf2c1835dbea00484af1f225711c255f1d0a3208f2e4f1154f0db2c9a012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffad089c3fe7987a44f150f34b7ac66972de76dd84c739bdeddf360ab029dfd4d6000000006a473044022015f0386ed67a61626fbe5ae79e0d39d38e7b4072b648e8a26e23adadc0a8e5bc02202398188fa2feb26994e5c1e7e758788de3d5f0f0096f956a0cd58804710bea6a012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffd6c66730546c62dd003b5af1f1e5ecfd339c62db0169c1d499584e09a8a9b288000000006b4830450221008d4c73f0e3c9d913ba32fd864167649242e3e891412ab80bdd3f7ff43a238ee20220602738e98008b146256b51d0df99e222aa165f2ce351241ebc23d8a098e2b0db012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff12d9eff354f46cbd4446a0bff27a6a635ff5b1dc8a5dd8b0178bb5f89c9ec080000000006b48304502210098d3349ba9b13560748949933d2704663a5ab52cdc804afa1ac4da3e5992e0a002201525d7ad8466ad260219f3873fb7781addbd363f91e8063bfa86c7ed4e385b84012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff69e16767806ea5f069b7d46674f7aa747fcc6e541189ce7fcf92edcfd7642ff4000000006b4830450221008a5ebfe904c87f21947a44d8418190be5893993a683fde0f96df8a9487923da002205be1bbd8b518ba2f303cae23bc20806e84ffbba6a03f032385b15edb8df107f4012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640fffffffff4fbabd508178f553e676d67ce325796b03aa249b41a23c681c1ad9dedb45ae7000000006a47304402207cea6824abe1ce35e18954b858d45243e2cb57d27d782adc5b6b07ebd21a02d7022007ba0469b298c4b1a7c4a148fa16bae93d28593b34e197c10ac0d1faf9cc1bfa012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff14867aa59932d895be607fb7398f5594e39d9fa2e1c7daaed7b1390dbfdddcab000000006b4830450221009fb6e1885a3658c593809f95ecd2049f8ef9e00379686ac236b17312c9613d4c0220709fc50c9a920a19254389944db366c354708c19885d2479d9968fda0848f9f7012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff75777c692daaa21d216a1a2a7059203becfcdcf6793aa1259cdd7aadec957ab6000000006a47304402202945019860abf9b80e71f340320d114846efa4d2780ce12513e3983fb4d3f15b022019be008fb7368e3f1f022924dc7af1138b94041f46084dd27768bc8cacd1529f012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffca037b85742e93df4eef8e8ac3b8531321c8a8e21a4a941360866ea57a973665000000006a4730440220760283a7828edcc53671fc73e29c30cdc64d60d300292761d39730f0d09f94c202201e026293e3891a6fe46e40cd21778a41e21641a261a7fbf3bf75b034d9c788d9012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffa68edd030b4307ad87bfeff96a6db5b3ddd1a0901c488a4fe4d2093531896d75000000006b48304502210091a41e16b2c27d7ef6077e8de9df692b6013e61d72798ff9f7eba7fc983cdb65022034de29a0fb22a339e8044349913915444ab420772ab0ab423e44cfe073cb4e70012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff8c952791181993a7512e48d098a06e6197c993b83241a4bf1330c0e95f2c304d000000006b483045022100fa14b9301feb056f6e6b10446a660525cc1ff3e191b0c45f9e12dcd4f142422c02203f4a94f2a9d3ec0b74fac2156dd9b1addb8fa5b9a1cfc9e34b0802e88b1cbfa3012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff32bc4d014542abf328fecff29b9f4c243c3dd295fe42524b20bf591a3ddc26a1000000006a47304402206f92c4da6651c8959f7aed61608d26b9e46f5c1d69f4fc6e592b1f552b6067f102201c8cc221eac731867d15d483cc83322dba2f14f31d3efb26be937a68ad772394012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffbb3877248c26b23023d7dbb83a5f8293c65c5bff4ac47935a4a31248cefffd91000000006a47304402205bab19ad082a1918e18ccb6462edc263196fb88c8fdfd6bd07a0cf031a4637810220371a621c1bdc6b957db2447a92dcf87b0309653a2db480c9ed623f34a6e6d8a9012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff6415b7356c94609b9a7a7eb06e4c306896767abbc11399779f952fb9ae197059000000006b483045022100e2d038dbb9a873f5a58ec7901d6a7e79f1b404afea3d852056f4d0746cfb821102207fb274947b10d467cd71aa948e9a50f5f4430b661b27afc347efd9d6cc409d9c012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff1aeefdf80ec8a07d657ca64a2c0aa465f58e6284755c9a263c5a807be43b4b81000000006a47304402206e7ff765ba47a8785008f64f49c8e73232d582b2b2d0a49be0880c2557de8f8602206448423a6a37ad9740eb316513b31f73599ae14f65623709fb5443ae609f3e2e012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff3c091681df17b46f280bc9d8011c1bb31397637ce945b393f70380f8cd0a8b0d010000006a47304402206ca8717000f3086d364318f56d52e2369c40b88a1cb86455a8db262b4816698a02206711caf453bfda6b1b3542e27e68c3180f92f0548326d74e30b3ed18cd2c2353012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff91f32d98b581def165495aff6b69530e1f3de7f68fabfeb93730cf9793bbcd2a000000006a47304402200a8cd5e29ee7ff136772ea1789a39a027eaa1cd92f90f9d57fd8cf77202251f402203dd2bc282a838a5730e840a0d22b4f0edbe3cb2da00466c66bc2b5c66fc8b032012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff854d9226c28a1f5fe440e08f41000f3547f304ecf9cc010d0b5bc845ef1f039a000000006b483045022100fe6cce49975cc78af1c394bc02d995710833ba08cf7f8dd5f99add2cc7db26c40220793491309c215d8314a1c142bef7ec6b9a397249bec1c00a0a5ab47dfc1208b6012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff593bc907aa71f3b0f7aa8c48bb5f650595e65a5a733a9601a8374ed978eec9a7000000006a47304402206362ae3c4cf1a19ba0e43424b03af542077b49761172c1ad26d802f54b1b6ca602206bc7edb655bb0024c0e48c1f4c18c8864f8d1ce59ae55cd81dc0bd1234430691012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff3b9da8c5ab0c0cd6b40f602ea6ed8e36a48034b182b9d1a77ffebd15fe203b94000000006b483045022100f8610eae25899663cb5fa9a4575d937da57cdfd41958794bbb4c02f8bed75da40220262d40e019ec3a57b252f4150d509cce6f8a2dbd83184a9fc2ed56aba8018b15012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff0897c8a57e15e7f3893b195d65cf6c6001b29c8c9734213d7a3131f57b9eca2e000000006b483045022100c485cbd6408cf0759bcf23c4154249882934b522a93c6b49e62412305bf7646902201cc4b668af4bb22fe57c32c4d34e822bceb12f6bd6923afdabf4894752a56ec3012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffffdc7000f7c45b62960623fa3a277e8a55348a4fe4936fef1224b6953434a249000000006b4830450221008a51a9c26f475d5c0838afe9d51524f95adfb21a9b0a02eae31cb01dc0a31fab022071c5492fbc7270731d4a4947a69398bf99dd28c65bb69d19910bf53a515274c8012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff10ec2af7e31ca28e27177215904d9a59abf80f0652b24e3f749f14fb7b2264ec000000006b483045022100fe4269f8f5ca53ebcff6fb782142a6228f0e50498a531b7a9c0d54768af9854102207cc740a9ea359569b49d69a94215ce3e23aeda5779cebc434ad3d608e1752990012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff5e3830c088dd6ea412d778b0a700ef27c183cf03e19f3d6f71bc5eaf53b2c22e000000006b4830450221009788a7e7f2407ba2f7c504091fbdf8f8498367781e8a357616d68e2a6770b4e70220518c92f5fb21e6bfd7d870a783b2a5572ce003f2dbb237ec59df419c9a148966012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff51630ccb0ad32b24cc7ae1b3602950ba518dca6aa65ef560e57f08c23eed8d80000000006a47304402201aa556153ffeb13aa674353bf88c04a7af15c7eb32e1a835464e4b613c31dc2802200395858c29a46e9108de1f90b401ee26c296388b4073143b63f849b2cce461af012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff0200e1f5050000000017a914ab802c4d644be63fd1a72834ff63b650d6b5353987bb7e1e00000000001976a91464ae8510aac9546d5e7704e31ce177451386455588ac680e135d000000000000000000000000000000" + }, + "type": "TakerPaymentReceived" + }, + "timestamp": 1561529998938 + }, + { + "event": { + "type": "TakerPaymentWaitConfirmStarted" + }, + "timestamp": 1561529998941 + }, + { + "event": { + "type": "TakerPaymentValidatedAndConfirmed" + }, + "timestamp": 1561530000859 + }, + { + "event": { + "data": { + "tx_hash": "235f8e7ab3c9515a17fe8ee721ef971bbee273eb90baf70788edda7b73138c86", + "tx_hex": "0400008085202f8901a5464048246f791dca2f8cef2774125992cba7c0b820f32e7980be1de3380e7e00000000d8483045022100beca668a946fcad98da64cc56fa04edd58b4c239aa1362b4453857cc2e0042c90220606afb6272ef0773185ade247775103e715e85797816fbc204ec5128ac10a4b90120ea774bc94dce44c138920c6e9255e31d5645e60c0b64e9a059ab025f1dd2fdc6004c6b6304692c135db1752102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ac6782012088a914eb78e2f0cf001ed7dc69276afd37b25c4d6bb491882102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ac68ffffffff0118ddf505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8000135d000000000000000000000000000000" + }, + "type": "TakerPaymentSpent" + }, + "timestamp": 1561530003429 + }, + { + "event": { + "type": "TakerPaymentSpendConfirmStarted" + }, + "timestamp": 1561530003430 + }, + { + "event": { + "type": "TakerPaymentSpendConfirmed" + }, + "timestamp": 1561530003522 + }, + { + "event": { + "type": "Finished" + }, + "timestamp": 1561530003525 + } + ], + "my_info": { + "my_amount": "1", + "my_coin": "BEER", + "other_amount": "1", + "other_coin": "PIZZA", + "started_at": 1561529842 + }, + "maker_coin": "BEER", + "maker_amount": "1", + "taker_coin": "PIZZA", + "taker_amount": "1", + "gui": null, + "mm_version": "unknown", + "success_events": [ + "Started", + "Negotiated", + "TakerFeeValidated", + "MakerPaymentSent", + "TakerPaymentReceived", + "TakerPaymentWaitConfirmStarted", + "TakerPaymentValidatedAndConfirmed", + "TakerPaymentSpent", + "TakerPaymentSpendConfirmStarted", + "TakerPaymentSpendConfirmed", + "Finished" + ], + "type": "Maker", + "uuid": "6bf6e313-e610-4a9a-ba8c-57fc34a124aa", + "my_order_uuid": "3447b727-fe93-4357-8e5a-8cf2699b7e86" + }, + { + "error_events": [ + "StartFailed", + "NegotiateFailed", + "TakerFeeSendFailed", + "MakerPaymentValidateFailed", + "MakerPaymentWaitConfirmFailed", + "TakerPaymentTransactionFailed", + "TakerPaymentWaitConfirmFailed", + "TakerPaymentDataSendFailed", + "TakerPaymentWaitForSpendFailed", + "MakerPaymentSpendFailed", + "TakerPaymentWaitRefundStarted", + "TakerPaymentRefunded", + "TakerPaymentRefundFailed" + ], + "events": [ + { + "event": { + "data": { + "lock_duration": 31200, + "maker": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "maker_amount": "0.01", + "maker_coin": "BEER", + "maker_coin_start_block": 154187, + "maker_payment_confirmations": 1, + "maker_payment_wait": 1561492367, + "my_persistent_pub": "02031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3", + "started_at": 1561481967, + "taker_amount": "0.01", + "taker_coin": "BCH", + "taker_coin_start_block": 588576, + "taker_payment_confirmations": 1, + "taker_payment_lock": 1561513167, + "uuid": "491df802-43c3-4c73-85ef-1c4c49315ac6" + }, + "type": "Started" + }, + "timestamp": 1561481968393 + }, + { + "event": { + "data": { + "maker_payment_locktime": 1561544367, + "maker_pubkey": "02631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640", + "secret_hash": "ba5128bcca5a2f7d2310054fb8ec51b80f352ef3" + }, + "type": "Negotiated" + }, + "timestamp": 1561482029079 + }, + { + "event": { + "data": { + "tx_hash": "9dd7c0c8124315d7884fb0c7bf8dbfd3f3bd185c62a2ee42dfbc1e3b74f21a0e", + "tx_hex": "0100000001f1beda7feba9fa5c52aa38027587db50b6428bbbcc053cd4ab17461fb00b89d1000000006a473044022004ad0330210e20dea416c3ff442e50dc59970c5d1a8b4d0a7d5cc61a2edc701602204459e1ee6774f1ba8258322fff72e1e1acddeb7aed2f75657458aa3deecc9465412102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0207050000000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac64b61700000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac2d53125d" + }, + "type": "TakerFeeSent" + }, + "timestamp": 1561482032294 + }, + { + "event": { + "data": { + "tx_hash": "ba36c890785e3e9d4b853310ad4d79ce8175e7c4184a398128b37339321672f4", + "tx_hex": "0400008085202f890197f703d245127e5b88471791f2820d29152046f4be133907afa8ac5542911190000000006b48304502210090e1c52aa2eba12b7c71fceab83b77f1456830a3dee1b956a831ecee5b5b353602205353a48c0129eae44b7c06a1f1651b9ceb8642374a1d5224a1e907240a978ad2012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff0240420f000000000017a914192f34528c6c8cd11eefebec27f195f3894eb11187f096e605000000001976a91464ae8510aac9546d5e7704e31ce177451386455588ac4353125d000000000000000000000000000000" + }, + "type": "MakerPaymentReceived" + }, + "timestamp": 1561482073479 + }, + { + "event": { + "type": "MakerPaymentWaitConfirmStarted" + }, + "timestamp": 1561482073482 + }, + { + "event": { + "type": "MakerPaymentValidatedAndConfirmed" + }, + "timestamp": 1561482074296 + }, + { + "event": { + "data": { + "tx_hash": "bc98def88d93c270ae3cdb8a098d1b939ca499bf98f7a22b97be36bca13cdbc7", + "tx_hex": "01000000010e1af2743b1ebcdf42eea2625c18bdf3d3bf8dbfc7b04f88d7154312c8c0d79d010000006a4730440220030266d6d6435a4772cce2cebd91b6d4afffb920e23e9bc761434f105349cda002202335a050e2f28e4ca28862868141d3d7b553f3d30bceb83724ad70a32d04b0bd412102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0240420f000000000017a9140094798ed4100852f10a9ad85990f19b364f4c2d873c700800000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac5a53125d" + }, + "type": "TakerPaymentSent" + }, + "timestamp": 1561482078908 + }, + { + "event": { + "data": { + "secret": "66ed6c24bbb4892634eac4ce1e1ad0627d6379da4443b8d656b64d49ef2aa7a3", + "transaction": { + "tx_hash": "eec643315d4495aa5feb5062344fe2474223dc0f231b610afd336f908ae99ebc", + "tx_hex": "0100000001c7db3ca1bc36be972ba2f798bf99a49c931b8d098adb3cae70c2938df8de98bc00000000d747304402202e344f8c61f2f49f4d620d687d02448cfba631a8ce8c0f8ee774da177230a75902201f4a175e7fa40f26896f522b5c51c7c0485e0ad18d3221c885e8b96b52ed1cab412066ed6c24bbb4892634eac4ce1e1ad0627d6379da4443b8d656b64d49ef2aa7a3004c6b6304cfcc125db1752102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ac6782012088a914ba5128bcca5a2f7d2310054fb8ec51b80f352ef3882102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ac68ffffffff01583e0f00000000001976a91464ae8510aac9546d5e7704e31ce177451386455588acfd49125d" + } + }, + "type": "TakerPaymentSpent" + }, + "timestamp": 1561483355081 + }, + { + "event": { + "data": { + "tx_hash": "858f07d0a4e74318497a6e3ff4d7b68b60ad21b5c8e90b9b485f0ddaed71d0dc", + "tx_hex": "0400008085202f8901f47216323973b32881394a18c4e77581ce794dad1033854b9d3e5e7890c836ba00000000d8483045022100847a65faed4bea33c5cbccff2bee7c1292871a3b130bd2f23e696bd80c07365f02202039ea02b4463afd4f1e2b20b348d64b40aaea165f8dfb483293e2b368d536fe012066ed6c24bbb4892634eac4ce1e1ad0627d6379da4443b8d656b64d49ef2aa7a3004c6b6304af46135db1752102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ac6782012088a914ba5128bcca5a2f7d2310054fb8ec51b80f352ef3882102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ac68ffffffff01583e0f00000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac4b4a125d000000000000000000000000000000" + }, + "type": "MakerPaymentSpent" + }, + "timestamp": 1561483358319 + }, + { + "event": { + "type": "Finished" + }, + "timestamp": 1561483358321 + } + ], + "my_info": { + "my_amount": "0.01", + "my_coin": "BCH", + "other_amount": "0.01", + "other_coin": "BEER", + "started_at": 1561481967 + }, + "maker_coin": "BEER", + "maker_amount": "0.01", + "taker_coin": "BCH", + "taker_amount": "0.01", + "gui": null, + "mm_version": "unknown", + "success_events": [ + "Started", + "Negotiated", + "TakerFeeSent", + "MakerPaymentReceived", + "MakerPaymentWaitConfirmStarted", + "MakerPaymentValidatedAndConfirmed", + "TakerPaymentSent", + "TakerPaymentSpent", + "MakerPaymentSpent", + "Finished" + ], + "type": "Taker", + "uuid": "491df802-43c3-4c73-85ef-1c4c49315ac6" + } + ] + } + } + ``` + + Response (error) + + ```json + { + "error": "lp_swap:1454] from_uuid e299c6ece7a7ddc42444eda64d46b163eaa992da65ce6de24eb812d715184e41 swap is not found" + } + ``` + +export const title = "AtomicDEX Method: My Swap Status"; +export const description = "The my_swap_status method returns the data of an atomic swap executed on an AtomicDEX API node."; + +# my\_swap\_status + +**uuid** + +The `my_swap_status` method returns the data of an atomic swap executed on an AtomicDEX API node. + +## Arguments + +| Structure | Type | Description | +| ----------- | ------ | ----------------------------------------------------------- | +| params uuid | string | the uuid of swap, typically received from the buy/sell call | + +## Response + +| Structure | Type | Description | +| --------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| events | array of objects | A standard [SwapEvent](/atomicdex/api/common_structures/swaps/#swap-event) object. Events which occurred for a swap. See [Maker Events](/atomicdex/api/common_structures/swaps/maker_events/) and [Taker Events](/atomicdex/api/common_structures/swaps/maker_events/) for more info. | +| success\_events | array of strings | a list of events that gained a `success` swap state; the contents are listed in the order in which they should occur in the `events` array | +| error\_events | array of strings | a list of events that fell into an `error` swap state; if at least 1 of the events happens, the swap is considered a failure | +| type | string | whether the node acted as a market `Maker` or `Taker` | +| uuid | string | swap uuid | +| gui | string (optional) | information about gui; copied from AtomicDEX API configuration (MM2.json) | +| mm\_version | string (optional) | AtomicDEX API version | +| maker\_coin | string (optional) | ticker of maker coin | +| taker\_coin | string (optional) | ticker of taker coin | +| maker\_amount | string (numeric, optional) | the amount of coins to be swapped by maker | +| taker\_amount | string (numeric, optional) | the amount of coins to be swapped by taker | +| my\_info | object (optional) | this object maps event data to make displaying swap data in a GUI simpler (`my_coin`, `my_amount`, etc.) | +| recoverable | bool | whether the swap can be recovered using the `recover_funds_of_swap` API command. Important note: The AtomicDEX API does not record the state regarding whether the swap was recovered or not. The AtomicDEX API allows as many calls to the `recover_funds_of_swap` method as necessary, in case of errors | +| my\_order\_uuid | string (uuid, optional) | the uuid of order that matched to start the swap | + +#### 📌 Examples + +#### Command + + + ```json + { + "method": "my_swap_status", + "params": { + "uuid": "d14452bb-e82d-44a0-86b0-10d4cdcb8b24" + }, + "userpass": "testpsw" + } + ``` + + + + #### Successful Taker Swap + + ```json + { + "result": { + "type": "Taker", + "uuid": "0d72c435-821e-4278-b2a7-e36ab1ba8cb7", + "my_order_uuid": "0d72c435-821e-4278-b2a7-e36ab1ba8cb7", + "events": [ + { + "timestamp": 1674802079095, + "event": { + "type": "Started", + "data": { + "taker_coin": "MARTY", + "maker_coin": "DOC", + "maker": "7310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5", + "my_persistent_pub": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2", + "lock_duration": 7800, + "maker_amount": "1", + "taker_amount": "1", + "maker_payment_confirmations": 1, + "maker_payment_requires_nota": false, + "taker_payment_confirmations": 0, + "taker_payment_requires_nota": false, + "taker_payment_lock": 1674809878, + "uuid": "0d72c435-821e-4278-b2a7-e36ab1ba8cb7", + "started_at": 1674802078, + "maker_payment_wait": 1674805198, + "maker_coin_start_block": 1800637, + "taker_coin_start_block": 1813161, + "fee_to_send_taker_fee": { + "coin": "MARTY", + "amount": "0.00001", + "paid_from_trading_vol": false + }, + "taker_payment_trade_fee": { + "coin": "MARTY", + "amount": "0.00002", + "paid_from_trading_vol": false + }, + "maker_payment_spend_trade_fee": { + "coin": "DOC", + "amount": "0.00001", + "paid_from_trading_vol": true + }, + "maker_coin_htlc_pubkey": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2", + "taker_coin_htlc_pubkey": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2", + "p2p_privkey": null + } + } + }, + { + "timestamp": 1674802095105, + "event": { + "type": "Negotiated", + "data": { + "maker_payment_locktime": 1674817676, + "maker_pubkey": "000000000000000000000000000000000000000000000000000000000000000000", + "secret_hash": "9af6a305578518d693fca3f1e4c529224a81f654", + "maker_coin_swap_contract_addr": null, + "taker_coin_swap_contract_addr": null, + "maker_coin_htlc_pubkey": "037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5", + "taker_coin_htlc_pubkey": "037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5" + } + } + }, + { + "timestamp": 1674802095885, + "event": { + "type": "TakerFeeSent", + "data": { + "tx_hex": "0400008085202f89014b9e44ba75ed80361776ac385feee7bba13b6c2d3147a3d9b5d71362a4624219000000006b483045022100a45de07b5d211c62e8ecf90cd5bee5076f6b6f20715f5618d7d0d93a6209ad870220596ca01682d2dbd4efeba3a0e90a373fd61b619471747df26afc2e2bb167de4c012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88acf4979600000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88acaf73d363000000000000000000000000000000", + "tx_hash": "b2ee0e692523c5ca081f62e36325d09a629004850be8b86df149fc979e9e3e87" + } + } + }, + { + "timestamp": 1674802097888, + "event": { + "type": "TakerPaymentInstructionsReceived", + "data": null + } + }, + { + "timestamp": 1674802097890, + "event": { + "type": "MakerPaymentReceived", + "data": { + "tx_hex": "0400008085202f89036aefd7ae1e6933ef997ad44adf5d0c19bc2bbede499a3421eb2022d06fa772f7000000006b4830450221009ad555b27ee9d0e2044bfc14aec47c160819d79dfaacc36e0426b4c35b5626aa02207624ef91881e42b210f16ce96bca00ce3d7cde46e7aaca76bd39f3aa64489e940121037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ffffffff66f0d84da9abf07914969af7479934a518a5363353e0968efebc78eac561f07e020000006a4730440220597126d39bb86ce6f6e478eeae7714daa08d05d57df69e641293d70cfe78f510022037bdff2a77ead08b8a60cafff9524beacf28513499e57a15615e66955e51636e0121037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ffffffffffe65f8d99d56844f9f5c94a590bf4d6cca116b170fee21e6c04c1a4ab39f4a7000000006a47304402202f2ab19d0f70bfbbc649e78eeda8c14afc72e41a80c9f81c25466307cef619440220466ed647fe07cc75dba20176c05aef671c04cb929e30ce4988014e1c553fe84b0121037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ffffffff0300e1f5050000000017a914252fe9c1a8b61a9ca1da6bcbc017e4677e89c480870000000000000000166a149af6a305578518d693fca3f1e4c529224a81f654798b0306000000001976a91486f747b28c60ad1130bdd3f84f48eeaf1801ca9888acb173d363000000000000000000000000000000", + "tx_hash": "879535fa1057a1f2587245f0d656ff4126848060574b85f581f7ac57200dcf80" + } + } + }, + { + "timestamp": 1674802097894, + "event": { + "type": "MakerPaymentWaitConfirmStarted" + } + }, + { + "timestamp": 1674802191003, + "event": { + "type": "MakerPaymentValidatedAndConfirmed" + } + }, + { + "timestamp": 1674802192167, + "event": { + "type": "TakerPaymentSent", + "data": { + "tx_hex": "0400008085202f8908873e9e9e97fc49f16db8e80b850490629ad02563e3621f08cac52325690eeeb2010000006a47304402204208734d38019ab1940348bd5091b392cab57565591f26447cdb5396e006dba50220365770af3714083901571635407d43dc87e9abfc05b382c8fde598f624eae2d1012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffffc895dd30ec91dafeb8023af40625a367aaf2a835141c537a4c746fe27e8160b8000000006a4730440220432cb8c44befb2fb076979f275aa205ddd9853a296f7b6df0bfb15dcd7e659fd0220741262c04a3697e474474cdb1e18c908511a7edfec9a7d350403bd8c90039a93012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffffaad904fafd259e9d5960866964c2e2752853b36dcd7bf205196e443f1f611453000000006b483045022100982d3ffb1a0bab130fc51071c0e60de08354161f8ba29593cbb849de31152da502200d74a8edbadf816b2076b14c74b5236b6d98ced09f6700b7411f008726b7d570012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffff354c776ffd2c883236d9135ea72e5991adf27f10f5fdc39e42be9be0d748539b000000006a4730440220742fa6411298f2c02edb690327860729d6a90c74b35f529065f6c15d29e609c20220008b68bd92a7f3c8ac8f00d161658a315103c3e2783c62e57172202c3db6016c012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2fffffffff191e32dca5ace0ca52c8d4dfa59a1e12e5c32968e08c7289fb7e4823fd119c2000000006b483045022100d1ba0bf5aadc658f61d6a348cfd3edaf2341ebafb12209d1da375130d8d17a8602201b09147377c70fead7f8dba9d9d0f2335c85b960e76affeb05cc7bff6cbb7aff012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffffd3cfdb64be12f201fa3ae27871f200f395c014864f87b9744e51540a769ab58c000000006a473044022030214231517e3787c9bf6f85695401d5923ec3d69a5eead708986bc0490bcab302201073be01e5298baaa65f80d6e35dfde54ff81469439e27d741719c31779065f6012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffffa945e0db62d26072c2b20b1e7a959e9cdf09ad840584ae1467264e2658b1f1ca010000006b483045022100aa0f00f2f60dac8ab5944183804a6a92c8b4f6a8cd29a027cac20e6a494a6c3d0220457ff0d4ca023e1f311485c42088043fa5f9a0c37c583ffb510f9caa2fe6b210012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffff1a95c4f75da608bc81f39bed78dc6658da2042ecf1d2cd4da1980a0cc404e2f1010000006b483045022100e933ef22abfb3c6832ecda2b7465a8e218fb2ce7fb4cef2733e7424e6cc5e41f022001e8a9635b5377fe211fb4821557afb7eabe45b04028526e017c8e615a5d4320012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffff0300e1f5050000000017a9144a8ff1f3c9a654f6ef8b4b12773c8d242ef3cfaa870000000000000000166a149af6a305578518d693fca3f1e4c529224a81f6546761eb02000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88ac0f74d363000000000000000000000000000000", + "tx_hash": "c6536056800b211635c4f64dbe941a967361fbe92c0c4d4c575f157f922a080a" + } + } + }, + { + "timestamp": 1674802203724, + "event": { + "type": "TakerPaymentSpent", + "data": { + "transaction": { + "tx_hex": "0400008085202f89010a082a927f155f574c4d0c2ce9fb6173961a94be4df6c43516210b80566053c600000000d747304402202ad8f7c2319e6097f5d28953bf45b02ec4501cf82b849d3f2286c8e98aa1ab6d02205e631875f0ff327c24665213195d29f86ba015a0d7c3e134e14b9109331375fc01201e2e0289634d42865e0f82ff0546ce2a384ae3548fb3f927c4aa1faefb0aa5d4004c6b63041692d363b1752103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ac6782012088a9149af6a305578518d693fca3f1e4c529224a81f6548821037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ac68ffffffff0118ddf505000000001976a91486f747b28c60ad1130bdd3f84f48eeaf1801ca9888ac1692d363000000000000000000000000000000", + "tx_hash": "9a72b62bb99bee92f9e3a047c65fcf7cdd3fc8443286c97647550df42f0f81d4" + }, + "secret": "1e2e0289634d42865e0f82ff0546ce2a384ae3548fb3f927c4aa1faefb0aa5d4" + } + } + }, + { + "timestamp": 1674802205274, + "event": { + "type": "MakerPaymentSpent", + "data": { + "tx_hex": "0400008085202f890180cf0d2057acf781f5854b576080842641ff56d6f0457258f2a15710fa35958700000000d74730440220159ac3c574bed4473bd6da6eb4b37a3c073dbe5311a4648795f2b0c02b68ef8d022034bc743cbe656b3d335a138f21093fcc9039f50bff40cf56e2654eb9eb225ca901201e2e0289634d42865e0f82ff0546ce2a384ae3548fb3f927c4aa1faefb0aa5d4004c6b63048cb0d363b17521037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5ac6782012088a9149af6a305578518d693fca3f1e4c529224a81f654882103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ac68ffffffff0118ddf505000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88ac8cb0d363000000000000000000000000000000", + "tx_hash": "02c6bc927712478b866c3303cfdfacb868545a6730513605d4d7b5b2dbe97b09" + } + } + }, + { + "timestamp": 1674802205278, + "event": { + "type": "Finished" + } + } + ], + "maker_amount": "1", + "maker_coin": "DOC", + "maker_coin_usd_price": null, + "taker_amount": "1", + "taker_coin": "MARTY", + "taker_coin_usd_price": null, + "gui": "MM2CLI", + "mm_version": "2.1.9780_dev_89f720751_Linux_CI", + "success_events": [ + "Started", + "Negotiated", + "TakerFeeSent", + "TakerPaymentInstructionsReceived", + "MakerPaymentReceived", + "MakerPaymentWaitConfirmStarted", + "MakerPaymentValidatedAndConfirmed", + "TakerPaymentSent", + "TakerPaymentSpent", + "MakerPaymentSpent", + "Finished" + ], + "error_events": [ + "StartFailed", + "NegotiateFailed", + "TakerFeeSendFailed", + "MakerPaymentValidateFailed", + "MakerPaymentWaitConfirmFailed", + "TakerPaymentTransactionFailed", + "TakerPaymentWaitConfirmFailed", + "TakerPaymentDataSendFailed", + "TakerPaymentWaitForSpendFailed", + "MakerPaymentSpendFailed", + "TakerPaymentWaitRefundStarted", + "TakerPaymentRefundStarted", + "TakerPaymentRefunded", + "TakerPaymentRefundFailed", + "TakerPaymentRefundFinished" + ], + "my_info": { + "my_coin": "MARTY", + "other_coin": "DOC", + "my_amount": "1", + "other_amount": "1", + "started_at": 1674802078 + }, + "recoverable": false + } + } + ``` + + #### Taker Swap Failed with MakerPaymentSpendFailed Event + + ```json + { + "error_events": [ + "StartFailed", + "NegotiateFailed", + "TakerFeeSendFailed", + "MakerPaymentValidateFailed", + "MakerPaymentWaitConfirmFailed", + "TakerPaymentTransactionFailed", + "TakerPaymentWaitConfirmFailed", + "TakerPaymentDataSendFailed", + "TakerPaymentWaitForSpendFailed", + "MakerPaymentSpendFailed", + "TakerPaymentWaitRefundStarted", + "TakerPaymentRefunded", + "TakerPaymentRefundFailed" + ], + "events": [ + { + "event": { + "data": { + "lock_duration": 7800, + "maker": "1bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8", + "maker_amount": "0.12596566232185483", + "maker_coin": "KMD", + "maker_coin_start_block": 1458035, + "maker_payment_confirmations": 1, + "maker_payment_wait": 1564053079, + "my_persistent_pub": "0326846707a52a233cfc49a61ef51b1698bbe6aa78fa8b8d411c02743c09688f0a", + "started_at": 1564050479, + "taker_amount": "50.000000000000001504212457800000", + "taker_coin": "DOGE", + "taker_coin_start_block": 2823448, + "taker_payment_confirmations": 1, + "taker_payment_lock": 1564058279, + "uuid": "41383f43-46a5-478c-9386-3b2cce0aca20" + }, + "type": "Started" + }, + "timestamp": 1564050480269 + }, + { + "event": { + "data": { + "maker_payment_locktime": 1564066080, + "maker_pubkey": "031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8", + "secret_hash": "3669eb83a007a3c507448d79f45a9f06ec2f36a8" + }, + "type": "Negotiated" + }, + "timestamp": 1564050540991 + }, + { + "event": { + "data": { + "tx_hash": "bdde828b492d6d1cc25cd2322fd592dafd722fcc7d8b0fedce4d3bb4a1a8c8ff", + "tx_hex": "0100000002c7efa995c8b7be0a8b6c2d526c6c444c1634d65584e9ee89904e9d8675eac88c010000006a473044022051f34d5e3b7d0b9098d5e35333f3550f9cb9e57df83d5e4635b7a8d2986d6d5602200288c98da05de6950e01229a637110a1800ba643e75cfec59d4eb1021ad9b40801210326846707a52a233cfc49a61ef51b1698bbe6aa78fa8b8d411c02743c09688f0affffffffae6c233989efa7c7d2aa6534adc96078917ff395b7f09f734a147b2f44ade164000000006a4730440220393a784c2da74d0e2a28ec4f7df6c8f9d8b2af6ae6957f1e68346d744223a8fd02201b7a96954ac06815a43a6c7668d829ae9cbb5de76fa77189ddfd9e3038df662c01210326846707a52a233cfc49a61ef51b1698bbe6aa78fa8b8d411c02743c09688f0affffffff02115f5800000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac41a84641020000001976a914444f0e1099709ba4d742454a7d98a5c9c162ceab88ac6d84395d" + }, + "type": "TakerFeeSent" + }, + "timestamp": 1564050545296 + }, + { + "event": { + "data": { + "tx_hash": "0a0f11fa82802c2c30862c50ab2162185dae8de7f7235f32c506f814c142b382", + "tx_hex": "0400008085202f8902ace337db2dd4c56b0697f58fb8cfb6bd1cd6f469d925fc0376d1dcfb7581bf82000000006b483045022100d1f95be235c5c8880f5d703ace287e2768548792c58c5dbd27f5578881b30ea70220030596106e21c7e0057ee0dab283f9a1fe273f15208cba80870c447bd559ef0d0121031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8ffffffff9f339752567c404427fd77f2b35cecdb4c21489edc64e25e729fdb281785e423000000006a47304402203179e95877dbc107123a417f1e648e3ff13d384890f1e4a67b6dd5087235152e0220102a8ab799fadb26b5d89ceb9c7bc721a7e0c2a0d0d7e46bbe0cf3d130010d430121031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8ffffffff025635c0000000000017a91480a95d366d65e34a465ab17b0c9eb1d5a33bae08876cbfce05000000001976a914c3f710deb7320b0efa6edb14e3ebeeb9155fa90d88ac8d7c395d000000000000000000000000000000" + }, + "type": "MakerPaymentReceived" + }, + "timestamp": 1564050588176 + }, + { + "event": { + "type": "MakerPaymentWaitConfirmStarted" + }, + "timestamp": 1564050588178 + }, + { + "event": { + "type": "MakerPaymentValidatedAndConfirmed" + }, + "timestamp": 1564050693585 + }, + { + "event": { + "data": { + "tx_hash": "539cb6dbdc25465bbccc575554f05d1bb04c70efce4316e41194e747375c3659", + "tx_hex": "0100000001ffc8a8a1b43b4dceed0f8b7dcc2f72fdda92d52f32d25cc21c6d2d498b82debd010000006a47304402203967b7f9f5532fa47116585c7d1bcba51861ea2059cca00409f34660db18e33a0220640991911852533a12fdfeb039fb9c8ca2c45482c6993bd84636af3670d49c1501210326846707a52a233cfc49a61ef51b1698bbe6aa78fa8b8d411c02743c09688f0affffffff0200f2052a0100000017a914f2fa08ae416b576779ae5da975e5442663215fce87415173f9000000001976a914444f0e1099709ba4d742454a7d98a5c9c162ceab88ac0585395d" + }, + "type": "TakerPaymentSent" + }, + "timestamp": 1564050695611 + }, + { + "event": { + "data": { + "secret": "1b8886b8a2cdb62505699400b694ac20f04d7bd4abd80e1ab154aa8d861fc093", + "transaction": { + "tx_hash": "cc5af1cf68d246419fee49c3d74c0cd173599d115b86efe274368a614951bc47", + "tx_hex": "010000000159365c3747e79411e41643ceef704cb01b5df0545557ccbc5b4625dcdbb69c5300000000d747304402200e78e27d2f1c18676f98ca3dfa4e4a9eeaa8209b55f57b4dd5d9e1abdf034cfa0220623b5c22b62234cec230342aa306c497e43494b44ec2425b84e236b1bf01257001201b8886b8a2cdb62505699400b694ac20f04d7bd4abd80e1ab154aa8d861fc093004c6b6304a7a2395db175210326846707a52a233cfc49a61ef51b1698bbe6aa78fa8b8d411c02743c09688f0aac6782012088a9143669eb83a007a3c507448d79f45a9f06ec2f36a88821031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8ac68ffffffff01008d380c010000001976a914c3f710deb7320b0efa6edb14e3ebeeb9155fa90d88ac8c77395d" + } + }, + "type": "TakerPaymentSpent" + }, + "timestamp": 1564051092890 + }, + { + "event": { + "data": { + "error": "lp_swap:1981] utxo:891] rpc_clients:738] JsonRpcError { request: JsonRpcRequest { jsonrpc: \"2.0\", id: \"67\", method: \"blockchain.transaction.broadcast\", params: [String(\"0400008085202f890182b342c114f806c5325f23f7e78dae5d186221ab502c86302c2c8082fa110f0a00000000d7473044022035791ea5548f87484065c9e1f0bdca9ebc699f2c7f51182c84f360102e32dc3d02200612ed53bca52d9c2568437f087598531534badf26229fe0f652ea72ddf03ca501201b8886b8a2cdb62505699400b694ac20f04d7bd4abd80e1ab154aa8d861fc093004c6b630420c1395db17521031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8ac6782012088a9143669eb83a007a3c507448d79f45a9f06ec2f36a888210326846707a52a233cfc49a61ef51b1698bbe6aa78fa8b8d411c02743c09688f0aac68ffffffff01460ec000000000001976a914444f0e1099709ba4d742454a7d98a5c9c162ceab88ac967e395d000000000000000000000000000000\")] }, error: Transport(\"rpc_clients:668] All electrums are currently disconnected\") }" + }, + "type": "MakerPaymentSpendFailed" + }, + "timestamp": 1564051092897 + }, + { + "event": { + "type": "Finished" + }, + "timestamp": 1564051092900 + } + ], + "success_events": [ + "Started", + "Negotiated", + "TakerFeeSent", + "MakerPaymentReceived", + "MakerPaymentWaitConfirmStarted", + "MakerPaymentValidatedAndConfirmed", + "TakerPaymentSent", + "TakerPaymentSpent", + "MakerPaymentSpent", + "Finished" + ], + "uuid": "41383f43-46a5-478c-9386-3b2cce0aca20" + } + ``` + + #### Successful Maker Swap + + ```json + { + "result": { + "error_events": [ + "StartFailed", + "NegotiateFailed", + "TakerFeeValidateFailed", + "MakerPaymentTransactionFailed", + "MakerPaymentDataSendFailed", + "MakerPaymentWaitConfirmFailed", + "TakerPaymentValidateFailed", + "TakerPaymentWaitConfirmFailed", + "TakerPaymentSpendFailed", + "TakerPaymentSpendConfirmFailed", + "MakerPaymentWaitRefundStarted", + "MakerPaymentRefunded", + "MakerPaymentRefundFailed" + ], + "events": [ + { + "event": { + "data": { + "lock_duration": 7800, + "maker_amount": "1", + "maker_coin": "BEER", + "maker_coin_start_block": 154221, + "maker_payment_confirmations": 1, + "maker_payment_lock": 1561545442, + "my_persistent_pub": "02031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3", + "secret": "ea774bc94dce44c138920c6e9255e31d5645e60c0b64e9a059ab025f1dd2fdc6", + "started_at": 1561529842, + "taker": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "taker_amount": "1", + "taker_coin": "PIZZA", + "taker_coin_start_block": 141363, + "taker_payment_confirmations": 1, + "uuid": "6bf6e313-e610-4a9a-ba8c-57fc34a124aa" + }, + "type": "Started" + }, + "timestamp": 1561529842866 + }, + { + "event": { + "data": { + "taker_payment_locktime": 1561537641, + "taker_pubkey": "02631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640" + }, + "type": "Negotiated" + }, + "timestamp": 1561529883208 + }, + { + "event": { + "data": { + "tx_hash": "a91469546211cc910fbe4a1f4668ab0353765d3d0cb03f4a67bff9326991f682", + "tx_hex": "0400008085202f89021c7eeec33f8eb5ff2ed6c3d09e40e04b05a9674ea2feefcc12de3f9dcc16aff8000000006b483045022100e18e3d1afa8a24ecec82c92bfc05c119bfacdbb71b5f5663a4b96cc2a41ab269022017a79a1a1f6e0220d8fa1d2cf3b1c9788272f1ad18e4987b8f1cd4418acaa5b0012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff6a0d321eb52c3c7165adf80f83b15b7a5caa3a0dfa87746239021600d47fb43e000000006b483045022100937ed900e084d57d5e3341499fc66c5574884ca71cd4331fa696c8b7a517591b02201f5f851f94c3ca0ffb4789f1af22cb95dc83564e127ed7d23f1129eb2b981a2f012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac9c120100000000001976a91464ae8510aac9546d5e7704e31ce177451386455588ac2f0e135d000000000000000000000000000000" + }, + "type": "TakerFeeValidated" + }, + "timestamp": 1561529927879 + }, + { + "event": { + "data": { + "tx_hash": "efa90a2918e6793c8a2725c06ee34d0fa76c43bc85e680be195414e7aee36154", + "tx_hex": "0400008085202f890cdcd071edda0d5f489b0be9c8b521ad608bb6d7f43f6e7a491843e7a4d0078f85000000006b483045022100fbc3bd09f8e1821ed671d1b1d2ed355833fb42c0bc435fef2da5c5b0a980b9a002204ef92b35576069d640ca0ac08f46645e5ade36afd5f19fb6aad19cfc9fb221fb012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffe6ae2a3ce221a6612d9e640bdbe10a2e477b3bc68a1aeee4a6784cb18648a785010000006a47304402202000a7e60ae2ce1529247875623ef2c5b42448dcaeac8de0f8f0e2f8e5bd8a6b0220426321a004b793172014f522efbca77a3dc92e86ce0a75330d8ceb83072ad4e7012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff9335553edcbac9559cae517a3e25b880a48fabf661c4ac338394972eef4572da000000006b4830450221008ded7230f2fb37a42b94f96174ec192baf4cd9e9e68fb9b6cf0463a36a6093e00220538de51ceda1617f3964a2350802377940fdfa018cc1043d77c66081b1cab0c4012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3fffffffff91b5d3733877f84108de77fec46bee156766e1a6837fa7b580ccbc3905acb14000000006b483045022100d07cf1fd20e07aafdc942ba56f6b45baee61b93145a2bdba391e2cdb8024bf15022056ea8183990703ef05018df2fe8bd5ec678ec0f9207b0283292b2cdafc5e1e0c012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff147870387ca938b2b6e7daa96ba2496014f125c0e4e576273ef36ee8186c415a000000006a47304402204c5b15b641d7e34444456d2ea6663bdc8bd8216e309a7220814474f346b8425e0220634d1dd943b416b7a807704d7f7a3d46a60d88ef4e20734588a0b302c55fa82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffd2b954ae9b4a61fad9f7bc956d24e38d7b6fe313da824bd3bd91287d5a6b49d9000000006b483045022100a7387d9ab7b2c92d3cbce525e96ffac5ae3ef14f848661741ada0db17715c4a002202c1417d5e3e04b1a2d1774a83bb8d5aa1c0536c100138123089fa69921b5d976012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff28792a2e26d9d7be0467fac52b12ece67410b23eea845008257979bd87d083e3000000006a473044022027c40517c33cd3202d4310cfd2c75f38e6d7804b255fc3838a32ea26e5a3cb0002202b4399e1d7e655b64f699318f2bfbdced49f064ee54e9d6a678668fce51caf96012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffa8bf797bacd213b74a9977ae1b956afe3af33a1ee94324e010a16db891a07441000000006a473044022004cbb1d970b9f02c578b5c1d7de33361581eebc19c3cd8d2e50b0211ca4ef13702200c93b9fe5428055b6274dc8e52073c3e87f5b5e4206134d745928ccfc9393919012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff2b6fd82c9a68111b67ad85a614a6ecb50f7b6eac3d21d8ebefd9a6065cdf5729000000006b483045022100fdff16c595c7b4a9b4fc1e445b565f7b29fe5b7a08f79291b0ff585c7b72ac2902200c694aa124013bd419ce2349f15d10435827868d35db939b9d3c344d16e78420012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff6a5468dd8c83553dc51022f2a2fb772cf91c8607dc2ca1b8f203ac534612ab29000000006b483045022100ba7cc79e7ae3720238bfc5caa225dc8017d6a0d1cb1ec66abaf724fd20b3b7ab02206e8c942756604af0f63b74af495a9b3b7f4a44c489267f69a14cf2b1b953f46e012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff5f9f48a91d343fd5aef1d85f00850070931459ab256697afb728d1c81c1fa1d2000000006a47304402200ec85fc66f963e7504eb27361a4b4bb17de60e459da414fdc3962476de636134022056b62c15cf7f9b4e7d4e11c03e4e541dd348919b8c55efa4f1927e2fdd5ae8ea012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffee1f455924d3167e7f7abf452c1856e9abdcfe27dc889942dd249cb376169d38000000006b48304502210089274eed807c5d23d819f6dfa8a358a9748e56f2080be4396ef77bb19d91b17402207fc7b22c879534fffe0eeaaec8fc284e22c2756f380c05ea57b881a96b09f3af012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f5050000000017a9144eb3a361d8a15d7f6a8ef9d1cf44962a90c44d548702912b00000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac490e135d000000000000000000000000000000" + }, + "type": "MakerPaymentSent" + }, + "timestamp": 1561529938879 + }, + { + "event": { + "data": { + "tx_hash": "7e0e38e31dbe80792ef320b8c0a7cb9259127427ef8c2fca1d796f24484046a5", + "tx_hex": "0400008085202f892082f6916932f9bf674a3fb00c3d5d765303ab68461f4abe0f91cc1162546914a9010000006b483045022100999b8bb0224476b5c344a466d0051ec7a8c312574ad8956a4177a42625cb86e302205a6664396bff3f2e6fe57adb7e082a26d1b8da9ee77b3fc24aa4148fdd5c84db012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffcad29a146b81bcaa44744efbec5149b6e3ca32bace140f75ad5794288d5bff6c000000006b483045022100b4dbfe88561c201fb8fbaf5bbf5bc0985893c909429c579425da84b02d23cc12022075f1e1e3eba38d167a6e84aac23faee5a2eb0799511e647213cee168529d4e5d012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffa13eeacd04b3e26ae3f41530b560c615dafa0fd4235cc5b22d48ab97e7c3399c000000006a47304402201158306fe668cbf56ad3f586dc83c1cda9efab44cef46da6bc0fe242292c85ed02201d622fe283410320e760233ae81dc53df65406b09fd07f8649f1775689219c35012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff4352b9f1f01dde4209b9e91076a3cfcabdaa23d9d5a313abfe7edb67ee4273e3000000006b483045022100825242fb3c6d460580016e93718ae1f43917e53abcc1558a64a6ab6f406763dd0220543936ce4c725e5e9f03831274a8475b535171bb29e1919fcf52ba2a9c85a553012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffcc0fa94b5973c893e61d470ae3982b0bedfd29cb0da2c60a362de438598f108c000000006b4830450221008c70a8e10ca37819e5a4d9783366e729e690d78f2fdd8a1f4812ddc14ec7d6ad022035ba8cb4d4e50684107f8af5c184582687b5d7dfda5d9be1bd45e45749c77f08012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffb0bd3bb9fedb7bbf49ca1612c955ba6095202186cef5be6952aed3dd32da4268000000006a4730440220592216d63c199faa587a4a6cbe11ca26027368a116b50818ce30eced59ca887202201bcafcf88f9f2632151596732f839d77cbe2f2243822c8551faffecc90b5dc19012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff65cf2831fc200e55aaacbe0881ad0edfb298ee6d4421b08b048aecc151716bd1000000006a47304402202032eb1ccebc3be4b94bae343d1d168e87040d2d20977c47d073d6bf490ef6c00220067656e00c4b8930167c54078609925cec7b893a52bcb9304e6b2602f564413e012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffeaf67880bee214acecc74b12f648c1014d6394c4abf99832d408981bb460e999000000006b483045022100b9ae1cc824149220ac517298e6f21c26939485b31d0ae19d97d986c5f8f34e4502200a90578cf2c1835dbea00484af1f225711c255f1d0a3208f2e4f1154f0db2c9a012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffad089c3fe7987a44f150f34b7ac66972de76dd84c739bdeddf360ab029dfd4d6000000006a473044022015f0386ed67a61626fbe5ae79e0d39d38e7b4072b648e8a26e23adadc0a8e5bc02202398188fa2feb26994e5c1e7e758788de3d5f0f0096f956a0cd58804710bea6a012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffd6c66730546c62dd003b5af1f1e5ecfd339c62db0169c1d499584e09a8a9b288000000006b4830450221008d4c73f0e3c9d913ba32fd864167649242e3e891412ab80bdd3f7ff43a238ee20220602738e98008b146256b51d0df99e222aa165f2ce351241ebc23d8a098e2b0db012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff12d9eff354f46cbd4446a0bff27a6a635ff5b1dc8a5dd8b0178bb5f89c9ec080000000006b48304502210098d3349ba9b13560748949933d2704663a5ab52cdc804afa1ac4da3e5992e0a002201525d7ad8466ad260219f3873fb7781addbd363f91e8063bfa86c7ed4e385b84012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff69e16767806ea5f069b7d46674f7aa747fcc6e541189ce7fcf92edcfd7642ff4000000006b4830450221008a5ebfe904c87f21947a44d8418190be5893993a683fde0f96df8a9487923da002205be1bbd8b518ba2f303cae23bc20806e84ffbba6a03f032385b15edb8df107f4012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640fffffffff4fbabd508178f553e676d67ce325796b03aa249b41a23c681c1ad9dedb45ae7000000006a47304402207cea6824abe1ce35e18954b858d45243e2cb57d27d782adc5b6b07ebd21a02d7022007ba0469b298c4b1a7c4a148fa16bae93d28593b34e197c10ac0d1faf9cc1bfa012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff14867aa59932d895be607fb7398f5594e39d9fa2e1c7daaed7b1390dbfdddcab000000006b4830450221009fb6e1885a3658c593809f95ecd2049f8ef9e00379686ac236b17312c9613d4c0220709fc50c9a920a19254389944db366c354708c19885d2479d9968fda0848f9f7012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff75777c692daaa21d216a1a2a7059203becfcdcf6793aa1259cdd7aadec957ab6000000006a47304402202945019860abf9b80e71f340320d114846efa4d2780ce12513e3983fb4d3f15b022019be008fb7368e3f1f022924dc7af1138b94041f46084dd27768bc8cacd1529f012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffca037b85742e93df4eef8e8ac3b8531321c8a8e21a4a941360866ea57a973665000000006a4730440220760283a7828edcc53671fc73e29c30cdc64d60d300292761d39730f0d09f94c202201e026293e3891a6fe46e40cd21778a41e21641a261a7fbf3bf75b034d9c788d9012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffa68edd030b4307ad87bfeff96a6db5b3ddd1a0901c488a4fe4d2093531896d75000000006b48304502210091a41e16b2c27d7ef6077e8de9df692b6013e61d72798ff9f7eba7fc983cdb65022034de29a0fb22a339e8044349913915444ab420772ab0ab423e44cfe073cb4e70012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff8c952791181993a7512e48d098a06e6197c993b83241a4bf1330c0e95f2c304d000000006b483045022100fa14b9301feb056f6e6b10446a660525cc1ff3e191b0c45f9e12dcd4f142422c02203f4a94f2a9d3ec0b74fac2156dd9b1addb8fa5b9a1cfc9e34b0802e88b1cbfa3012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff32bc4d014542abf328fecff29b9f4c243c3dd295fe42524b20bf591a3ddc26a1000000006a47304402206f92c4da6651c8959f7aed61608d26b9e46f5c1d69f4fc6e592b1f552b6067f102201c8cc221eac731867d15d483cc83322dba2f14f31d3efb26be937a68ad772394012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffbb3877248c26b23023d7dbb83a5f8293c65c5bff4ac47935a4a31248cefffd91000000006a47304402205bab19ad082a1918e18ccb6462edc263196fb88c8fdfd6bd07a0cf031a4637810220371a621c1bdc6b957db2447a92dcf87b0309653a2db480c9ed623f34a6e6d8a9012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff6415b7356c94609b9a7a7eb06e4c306896767abbc11399779f952fb9ae197059000000006b483045022100e2d038dbb9a873f5a58ec7901d6a7e79f1b404afea3d852056f4d0746cfb821102207fb274947b10d467cd71aa948e9a50f5f4430b661b27afc347efd9d6cc409d9c012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff1aeefdf80ec8a07d657ca64a2c0aa465f58e6284755c9a263c5a807be43b4b81000000006a47304402206e7ff765ba47a8785008f64f49c8e73232d582b2b2d0a49be0880c2557de8f8602206448423a6a37ad9740eb316513b31f73599ae14f65623709fb5443ae609f3e2e012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff3c091681df17b46f280bc9d8011c1bb31397637ce945b393f70380f8cd0a8b0d010000006a47304402206ca8717000f3086d364318f56d52e2369c40b88a1cb86455a8db262b4816698a02206711caf453bfda6b1b3542e27e68c3180f92f0548326d74e30b3ed18cd2c2353012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff91f32d98b581def165495aff6b69530e1f3de7f68fabfeb93730cf9793bbcd2a000000006a47304402200a8cd5e29ee7ff136772ea1789a39a027eaa1cd92f90f9d57fd8cf77202251f402203dd2bc282a838a5730e840a0d22b4f0edbe3cb2da00466c66bc2b5c66fc8b032012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff854d9226c28a1f5fe440e08f41000f3547f304ecf9cc010d0b5bc845ef1f039a000000006b483045022100fe6cce49975cc78af1c394bc02d995710833ba08cf7f8dd5f99add2cc7db26c40220793491309c215d8314a1c142bef7ec6b9a397249bec1c00a0a5ab47dfc1208b6012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff593bc907aa71f3b0f7aa8c48bb5f650595e65a5a733a9601a8374ed978eec9a7000000006a47304402206362ae3c4cf1a19ba0e43424b03af542077b49761172c1ad26d802f54b1b6ca602206bc7edb655bb0024c0e48c1f4c18c8864f8d1ce59ae55cd81dc0bd1234430691012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff3b9da8c5ab0c0cd6b40f602ea6ed8e36a48034b182b9d1a77ffebd15fe203b94000000006b483045022100f8610eae25899663cb5fa9a4575d937da57cdfd41958794bbb4c02f8bed75da40220262d40e019ec3a57b252f4150d509cce6f8a2dbd83184a9fc2ed56aba8018b15012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff0897c8a57e15e7f3893b195d65cf6c6001b29c8c9734213d7a3131f57b9eca2e000000006b483045022100c485cbd6408cf0759bcf23c4154249882934b522a93c6b49e62412305bf7646902201cc4b668af4bb22fe57c32c4d34e822bceb12f6bd6923afdabf4894752a56ec3012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffffffdc7000f7c45b62960623fa3a277e8a55348a4fe4936fef1224b6953434a249000000006b4830450221008a51a9c26f475d5c0838afe9d51524f95adfb21a9b0a02eae31cb01dc0a31fab022071c5492fbc7270731d4a4947a69398bf99dd28c65bb69d19910bf53a515274c8012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff10ec2af7e31ca28e27177215904d9a59abf80f0652b24e3f749f14fb7b2264ec000000006b483045022100fe4269f8f5ca53ebcff6fb782142a6228f0e50498a531b7a9c0d54768af9854102207cc740a9ea359569b49d69a94215ce3e23aeda5779cebc434ad3d608e1752990012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff5e3830c088dd6ea412d778b0a700ef27c183cf03e19f3d6f71bc5eaf53b2c22e000000006b4830450221009788a7e7f2407ba2f7c504091fbdf8f8498367781e8a357616d68e2a6770b4e70220518c92f5fb21e6bfd7d870a783b2a5572ce003f2dbb237ec59df419c9a148966012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff51630ccb0ad32b24cc7ae1b3602950ba518dca6aa65ef560e57f08c23eed8d80000000006a47304402201aa556153ffeb13aa674353bf88c04a7af15c7eb32e1a835464e4b613c31dc2802200395858c29a46e9108de1f90b401ee26c296388b4073143b63f849b2cce461af012102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ffffffff0200e1f5050000000017a914ab802c4d644be63fd1a72834ff63b650d6b5353987bb7e1e00000000001976a91464ae8510aac9546d5e7704e31ce177451386455588ac680e135d000000000000000000000000000000" + }, + "type": "TakerPaymentReceived" + }, + "timestamp": 1561529998938 + }, + { + "event": { + "type": "TakerPaymentWaitConfirmStarted" + }, + "timestamp": 1561529998941 + }, + { + "event": { + "type": "TakerPaymentValidatedAndConfirmed" + }, + "timestamp": 1561530000859 + }, + { + "event": { + "data": { + "tx_hash": "235f8e7ab3c9515a17fe8ee721ef971bbee273eb90baf70788edda7b73138c86", + "tx_hex": "0400008085202f8901a5464048246f791dca2f8cef2774125992cba7c0b820f32e7980be1de3380e7e00000000d8483045022100beca668a946fcad98da64cc56fa04edd58b4c239aa1362b4453857cc2e0042c90220606afb6272ef0773185ade247775103e715e85797816fbc204ec5128ac10a4b90120ea774bc94dce44c138920c6e9255e31d5645e60c0b64e9a059ab025f1dd2fdc6004c6b6304692c135db1752102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ac6782012088a914eb78e2f0cf001ed7dc69276afd37b25c4d6bb491882102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ac68ffffffff0118ddf505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8000135d000000000000000000000000000000" + }, + "type": "TakerPaymentSpent" + }, + "timestamp": 1561530003429 + }, + { + "event": { + "type": "TakerPaymentSpendConfirmStarted" + }, + "timestamp": 1561530003430 + }, + { + "event": { + "type": "TakerPaymentSpendConfirmed" + }, + "timestamp": 1561530003522 + }, + { + "event": { + "type": "Finished" + }, + "timestamp": 1561530003525 + } + ], + "my_info": { + "my_amount": "1", + "my_coin": "BEER", + "other_amount": "1", + "other_coin": "PIZZA", + "started_at": 1561529842 + }, + "maker_coin": "BEER", + "maker_amount": "1", + "taker_coin": "PIZZA", + "taker_amount": "1", + "gui": "AtomicDEX 1.0", + "mm_version": "unknown", + "recoverable": false, + "success_events": [ + "Started", + "Negotiated", + "TakerFeeValidated", + "MakerPaymentSent", + "TakerPaymentReceived", + "TakerPaymentWaitConfirmStarted", + "TakerPaymentValidatedAndConfirmed", + "TakerPaymentSpent", + "TakerPaymentSpendConfirmStarted", + "TakerPaymentSpendConfirmed", + "Finished" + ], + "type": "Maker", + "uuid": "6bf6e313-e610-4a9a-ba8c-57fc34a124aa", + "my_order_uuid": "3447b727-fe93-4357-8e5a-8cf2699b7e86" + } + } + ``` + + #### Maker Swap Failed with MakerPaymentTransactionFailed Event + + ```json + { + "error_events": [ + "StartFailed", + "NegotiateFailed", + "TakerFeeValidateFailed", + "MakerPaymentTransactionFailed", + "MakerPaymentDataSendFailed", + "MakerPaymentWaitConfirmFailed", + "TakerPaymentValidateFailed", + "TakerPaymentWaitConfirmFailed", + "TakerPaymentSpendFailed", + "TakerPaymentSpendConfirmFailed", + "MakerPaymentWaitRefundStarted", + "MakerPaymentRefunded", + "MakerPaymentRefundFailed" + ], + "events": [ + { + "event": { + "data": { + "lock_duration": 7800, + "maker_amount": "3.54932734", + "maker_coin": "KMD", + "maker_coin_start_block": 1452970, + "maker_payment_confirmations": 1, + "maker_payment_lock": 1563759539, + "my_persistent_pub": "031bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8", + "secret": "0000000000000000000000000000000000000000000000000000000000000000", + "started_at": 1563743939, + "taker": "101ace6b08605b9424b0582b5cce044b70a3c8d8d10cb2965e039b0967ae92b9", + "taker_amount": "0.02004833998671660000000000", + "taker_coin": "ETH", + "taker_coin_start_block": 8196380, + "taker_payment_confirmations": 1, + "uuid": "3447b727-fe93-4357-8e5a-8cf2699b7e86" + }, + "type": "Started" + }, + "timestamp": 1563743939211 + }, + { + "event": { + "data": { + "taker_payment_locktime": 1563751737, + "taker_pubkey": "03101ace6b08605b9424b0582b5cce044b70a3c8d8d10cb2965e039b0967ae92b9" + }, + "type": "Negotiated" + }, + "timestamp": 1563743979835 + }, + { + "event": { + "data": { + "tx_hash": "a59203eb2328827de00bed699a29389792906e4f39fdea145eb40dc6b3821bd6", + "tx_hex": "f8690284ee6b280082520894d8997941dd1346e9231118d5685d866294f59e5b865af3107a4000801ca0743d2b7c9fad65805d882179062012261be328d7628ae12ee08eff8d7657d993a07eecbd051f49d35279416778faa4664962726d516ce65e18755c9b9406a9c2fd" + }, + "type": "TakerFeeValidated" + }, + "timestamp": 1563744052878 + }, + { + "event": { + "data": { + "error": "lp_swap:1888] eth:654] RPC error: Error { code: ServerError(-32010), message: \"Transaction with the same hash was already imported.\", data: None }" + }, + "type": "MakerPaymentTransactionFailed" + }, + "timestamp": 1563744118577 + }, + { + "event": { + "type": "Finished" + }, + "timestamp": 1563763243350 + } + ], + "success_events": [ + "Started", + "Negotiated", + "TakerFeeValidated", + "MakerPaymentSent", + "TakerPaymentReceived", + "TakerPaymentWaitConfirmStarted", + "TakerPaymentValidatedAndConfirmed", + "TakerPaymentSpent", + "TakerPaymentSpendConfirmStarted", + "TakerPaymentSpendConfirmed", + "Finished" + ], + "uuid": "3447b727-fe93-4357-8e5a-8cf2699b7e86" + } + ``` + + #### Response (error) + + ```json + { + "error": "swap data is not found" + } + ``` + +export const title = "AtomicDEX Method: My TX History"; +export const description = + "The my_tx_history method returns the blockchain transactions involving the AtomicDEX API node's coin address."; + +# my\_tx\_history + +**my\_tx\_history (from\_id limit=10 max=false page\_number)** + +The `my_tx_history` method returns the blockchain transactions involving the AtomicDEX API node's coin address. + +The coin that is used must have `tx_history` set to true in its [enable](/atomicdex/api/legacy/coin_activation/#enable-method) or [electrum](/atomicdex/api/legacy/coin_activation/#electrum-method) call. + +## Arguments + +| Structure | Type | Description | +| ------------ | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | the name of the coin for the history request | +| limit | number | limits the number of returned transactions; ignored if `max = true` | +| max | bool | whether to return all available records; defaults to `false` | +| from\_id | string | AtomicDEX API will skip records until it reaches this ID, skipping the `from_id` as well; track the `internal_id` of the last displayed transaction to find the value of this field for the next page | +| page\_number | number | AtomicDEX API will return limit swaps from the selected page; This param will be ignored if from\_uuid is set. | + +## Response + +| Structure | Type | Description | +| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| transactions | array of objects | transactions data | +| from\_id | string | the from\_id specified in the request; this value is null if from\_id was not set | +| skipped | number | the number of skipped records (i.e. the position of `from_id` in the list + 1); this value is 0 if `from_id` was not set | +| limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) | +| total | number | the total number of transactions available | +| page\_number | number | the page\_number that was set in the request | +| total\_pages | number | total pages available with the selected limit | +| current\_block | number | the number of the latest block of coin blockchain | +| sync\_status | object | A standard [SyncStatus](/atomicdex/api/common_structures/#sync-status/) object. Provides the information that helps to track the progress of transaction history preloading at background | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "my_tx_history", + "coin": "DOC", + "limit": 1, + "from_id": "1d5c1b67f8ebd3fc480e25a1d60791bece278f5d1245c5f9474c91a142fee8e1" + } + ``` + + +#### Command (max = true) + + + ```json + { + "userpass": "testpsw", + "method": "my_tx_history", + "coin": "DOC", + "max": true, + "from_id": "1d5c1b67f8ebd3fc480e25a1d60791bece278f5d1245c5f9474c91a142fee8e1" + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "current_block": 172418, + "from_id": null, + "limit": 1, + "skipped": 0, + "sync_status": { + "additional_info": { + "transactions_left": 126 + }, + "state": "InProgress" + }, + "total": 5915, + "total_pages": 5915, + "page_number": null, + "transactions": [ + { + "block_height": 172409, + "coin": "ETOMIC", + "confirmations": 10, + "fee_details": { + "type": "Utxo", + "amount": "0.00001" + }, + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "internal_id": "903e5d71b8717205314a71055fe8bbb868e7b76d001fbe813a34bd71ff131e93", + "my_balance_change": "-0.10001", + "received_by_me": "0.8998513", + "spent_by_me": "0.9998613", + "timestamp": 1566539526, + "to": [ + "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "bJrMTiiRiLHJHc6RKQgesKTg1o9VVuKwT5" + ], + "total_amount": "0.9998613", + "tx_hash": "903e5d71b8717205314a71055fe8bbb868e7b76d001fbe813a34bd71ff131e93", + "tx_hex": "0400008085202f8901a242dc691de64c732e823ed0a4d8cfa6a230f8e31bc9bd21499009f1a90b855a010000006b483045022100d83113119004ac0504f812a853a831039dfc4b0bc1cb863d2c7a94c0670f07e902206af87b846b18c0d5e38bd874d43918e0400e4b6b838ab0793f5976843daa20cd012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff02809698000000000017a9144327a5516b28f66249576c18d15debf6dfbd1124876a105d05000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac047f5f5d000000000000000000000000000000" + } + ] + } + } + ``` + + #### Response (error) + + ```json + { + "error": "lp_coins:1011] from_id 1d5c1b67f8ebd3fc480e25a1d60791bece278f5d1245c5f9474c91a142fee8e2 is not found" + } + ``` + + #### Response (History too large in electrum mode) + + ```json + { + "result": { + "current_block": 144753, + "from_id": null, + "limit": 0, + "skipped": 0, + "sync_status": { + "additional_info": { + "code": -1, + "message": "Got `history too large` error from Electrum server. History is not available" + }, + "state": "Error" + }, + "total": 0, + "transactions": [] + } + } + ``` + + #### Response (Sync in progress for UTXO coins) + + ```json + { + "result": { + "current_block": 148300, + "from_id": null, + "limit": 0, + "skipped": 0, + "sync_status": { + "additional_info": { + "transactions_left": 1656 + }, + "state": "InProgress" + }, + "total": 3956, + "transactions": [] + } + } + ``` + + #### Response (Sync in progress for ETH/ERC20 coins) + + ```json + { + "result": { + "current_block": 8039935, + "from_id": null, + "limit": 0, + "skipped": 0, + "sync_status": { + "additional_info": { + "blocks_left": 2158991 + }, + "state": "InProgress" + }, + "total": 0, + "transactions": [] + } + } + ``` + + #### Response (Successful result in case of ETH/ERC20 coins) + + ```json + { + "result": { + "current_block": 9071551, + "from_id": null, + "limit": 3, + "skipped": 0, + "total_pages": 14, + "page_number": 1, + "sync_status": { + "state": "Finished" + }, + "total": 41, + "transactions": [ + { + "block_height": 8980257, + "coin": "ETH", + "confirmations": 91295, + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 57196, + "gas_price": "0.000000027", + "total_fee": "0.001544292" + }, + "from": ["0xE4406Af4CA1dcB05AFE384eBfF3c1F233dCA176A"], + "internal_id": "3978545ce08ca4c7f4b92e10b6c61efc6ce436f35f8a23f4e6a2e74f309cfd0a", + "my_balance_change": "-0.010193732", + "received_by_me": "0", + "spent_by_me": "0.010193732", + "timestamp": 1574423598, + "to": ["0x8500AFc0bc5214728082163326C2FF0C73f4a871"], + "total_amount": "0.00864944", + "tx_hash": "e578a719896ec5f1475c273e02fbdd3cf283d9808c20db336f110e4b4faef10c", + "tx_hex": "f8f11b850649534e00830249f0948500afc0bc5214728082163326c2ff0c73f4a871871eba9eaeb4c000b884152cf3af1b065716fc0c8254828abed3061c181f73a3c698cf1bc0fc8620e158448988050000000000000000000000007296a0cbae6ccfa5cddff9130569731a3b7da419d068b8936743ace66f192407debdcfc38445674e000000000000000000000000000000000000000000000000000000000000000000000000000000005dd808491ba0c78ad466381e0db9fb01f103d9e5c9d9c0c9cb28ee02bf990dc6371313c71bc3a0624e653559cfb19141a67e567e2e1fd4ca1ccd73f40d8b3672d14bd37072dad1" + }, + { + "block_height": 8953592, + "coin": "ETH", + "confirmations": 117960, + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 57196, + "gas_price": "0.00000001", + "total_fee": "0.00057196" + }, + "from": ["0xE4406Af4CA1dcB05AFE384eBfF3c1F233dCA176A"], + "internal_id": "15a3891932876cae74933b66bbfc2bba95b3e09c025152dd8b8d8023ad9a5fbd", + "my_balance_change": "-0.31519846", + "received_by_me": "0", + "spent_by_me": "0.31519846", + "timestamp": 1574038246, + "to": ["0x8500AFc0bc5214728082163326C2FF0C73f4a871"], + "total_amount": "0.3146265", + "tx_hash": "235be0e6ac3860a637ec0c1d0ec2c364e85ab5cd54659c6987c37b2ba3378ffb", + "tx_hex": "f8f21a8502540be400830249f0948500afc0bc5214728082163326c2ff0c73f4a87188045dc722816ca800b884152cf3af84519291dc1e8ea4efe055a1c27e6d33a74137164f5799352c1e10798e7a403c000000000000000000000000ee4398a7ab0a610daab82fef97affae44a5ce1464fd4d66db1e00256442acacc546a8a67433217de000000000000000000000000000000000000000000000000000000000000000000000000000000005dd226fb1ca030a665aeb07080e959e8027663d8f6af4069477c1ec8c712566108a9525b9629a052123cb075c404ff14d5281bd48232185590464de034bc6c86a818e699e4e288" + }, + { + "block_height": 8952273, + "coin": "ETH", + "confirmations": 119279, + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 49472, + "gas_price": "0.00000001", + "total_fee": "0.00049472" + }, + "from": ["0x8500AFc0bc5214728082163326C2FF0C73f4a871"], + "internal_id": "8796cee96c32121cd2ca9fef9d23affb4c173cf719a08e03436cf92e6ae90668", + "my_balance_change": "0.29278494869327806", + "received_by_me": "0.29278494869327806", + "spent_by_me": "0", + "timestamp": 1574019481, + "to": ["0xE4406Af4CA1dcB05AFE384eBfF3c1F233dCA176A"], + "total_amount": "0.29278494869327806", + "tx_hash": "4d02298575e9abf0d18ea2abb4d7f02ddba9266019fe4952eb6fa90f90775850", + "tx_hex": "f9010a198502540be400830249f0948500afc0bc5214728082163326c2ff0c73f4a87180b8a402ed292b0b6ed2b0bbdc333949f4847ffe567064a2a9c2239bcef95abd7f8408321dba3d00000000000000000000000000000000000000000000000004102e5c0e719d6cad1841132d7f23ffedb0e036ae85a80a337dface71b2d494893c16603686073500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f2b27558e45a3f44853e78b3c4bd05217723f841ba007650709e390395e659776b2ec390d951e2ab82ebcd7c540ce73dc6d352bc399a00d727f58ab77970c62bd92a356d057738b88f36fa4948c57b9b50de0815a951f" + } + ] + } + } + ``` + +export const title = "AtomicDEX Method: Order Status"; +export const description = "The order_status method returns the data of the order with the selected uuid created by the AtomicDEX API node."; + +# order\_status + +**order\_status uuid** + +The `order_status` method returns the data of the order with the selected `uuid` created by the AtomicDEX API node. The response is different for `maker` and `taker` orders. + +## Argument + +| Structure | Type | Description | +| --------- | ------ | ------------------------ | +| uuid | string | uuid of order to display | + +## Command + + + ```json + { + "userpass": "testpsw", + "method": "order_status", + "uuid": "c3b3105c-e914-4ed7-9f1c-604783b054a1" + } + ``` + + +#### Response (No order found) + +```json +{ "error": "Order with uuid c3b3105c-e914-4ed7-9f1c-604783b054a1 is not found" } +``` + +#### Maker Order Response + +| Structure | Type | Description | +| ----------------------- | ------ | ------------------------------------------------------------------------------------------------------------- | +| type | string | type of the order ("Maker" or "Taker") | +| order | object | A standard [OrderStatusData](/atomicdex/api/common_structures/orders/#order-status-data) object. | +| base\_orderbook\_ticker | string | The orderbook ticker for base coin. This field is used to group segwit and non-segwit versions of UTXO coins. | +| rel\_orderbook\_ticker | string | The orderbook ticker for rel coin. This field is used to group segwit and non-segwit versions of UTXO coins. | + +#### 📌 Maker Order Examples + + + ```json + { + "order": { + "available_amount": "1", + "base": "BEER", + "cancellable": true, + "created_at": 1568808684710, + "matches": { + "60aaacca-ed31-4633-9326-c9757ea4cf78": { + "connect": { + "dest_pub_key": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "maker_order_uuid": "fedd5261-a57e-4cbf-80ac-b3507045e140", + "method": "connect", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "taker_order_uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + }, + "connected": { + "dest_pub_key": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "maker_order_uuid": "fedd5261-a57e-4cbf-80ac-b3507045e140", + "method": "connected", + "sender_pubkey": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "taker_order_uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + }, + "last_updated": 1560529572571, + "request": { + "action": "Buy", + "base": "BEER", + "base_amount": "1", + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000", + "method": "request", + "rel": "PIZZA", + "rel_amount": "1", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + }, + "reserved": { + "base": "BEER", + "base_amount": "1", + "dest_pub_key": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "maker_order_uuid": "fedd5261-a57e-4cbf-80ac-b3507045e140", + "method": "reserved", + "rel": "PIZZA", + "rel_amount": "1", + "sender_pubkey": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "taker_order_uuid": "60aaacca-ed31-4633-9326-c9757ea4cf78" + } + } + }, + "max_base_vol": "1", + "max_base_vol_rat": [ + [1, [1]], + [1, [1]] + ], + "min_base_vol": "0", + "min_base_vol_rat": [ + [0, []], + [1, [1]] + ], + "price": "1", + "price_rat": [ + [1, [1]], + [1, [1]] + ], + "rel": "ETOMIC", + "started_swaps": ["60aaacca-ed31-4633-9326-c9757ea4cf78"], + "uuid": "ea77dcc3-a711-4c3d-ac36-d45fc5e1ee0c" + }, + "type": "Maker", + "base_orderbook_ticker": null, + "rel_orderbook_ticker": null + } + ``` + + #### Maker Order Response (Cancelled order from history) + + ```json + { + "type": "Maker", + "order": { + "base": "DGB", + "rel": "KMD", + "price": "0.05009337477044780336205678768187597118237039129820596129396807458680604605170221782737674812826670434", + "price_rat": [ + [1, [354611]], + [1, [7079000]] + ], + "max_base_vol": "2509.982886480319452367370222475755847119224187107815173987450085567598402738163148887621220764403879", + "max_base_vol_rat": [ + [1, [4400000]], + [1, [1753]] + ], + "min_base_vol": "227.8553118769581315864426089433209911706066647678724010253489034463115921389917402449444602677299915", + "min_base_vol_rat": [ + [1, [800000]], + [1, [3511]] + ], + "created_at": 1640147130806, + "updated_at": 1640148500481, + "matches": { + "ca791f47-3a84-414b-b7c1-942a0f2fb4ca": { + "request": { + "base": "KMD", + "rel": "DGB", + "base_amount": "12", + "base_amount_rat": [ + [1, [12]], + [1, [1]] + ], + "rel_amount": "241.1820189434802008438151288032397078840799082760529333024574562419162623621175580193501380942429668", + "rel_amount_rat": [ + [1, [42702000]], + [1, [177053]] + ], + "action": "Sell", + "uuid": "ca791f47-3a84-414b-b7c1-942a0f2fb4ca", + "method": "request", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000", + "match_by": { + "type": "Any" + }, + "conf_settings": { + "base_confs": 2, + "base_nota": true, + "rel_confs": 7, + "rel_nota": false + } + }, + "reserved": { + "base": "DGB", + "rel": "KMD", + "base_amount": "241.1820189434802008438151288032397078840799082760529333024574562419162623621175580193501380942429668", + "base_amount_rat": [ + [1, [42702000]], + [1, [177053]] + ], + "rel_amount": "12", + "rel_amount_rat": [ + [1, [12]], + [1, [1]] + ], + "taker_order_uuid": "ca791f47-3a84-414b-b7c1-942a0f2fb4ca", + "maker_order_uuid": "9c034d5f-18d6-494d-8460-7974be2d5beb", + "sender_pubkey": "caecf84197b88739079e55c92f26fe4bc329220a74d7f9d2094dc16e5a0d765e", + "dest_pub_key": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "conf_settings": { + "base_confs": 3, + "base_nota": true, + "rel_confs": 3, + "rel_nota": true + }, + "method": "reserved" + }, + "connect": { + "taker_order_uuid": "ca791f47-3a84-414b-b7c1-942a0f2fb4ca", + "maker_order_uuid": "9c034d5f-18d6-494d-8460-7974be2d5beb", + "method": "connect", + "sender_pubkey": "0000000000000000000000000000000000000000000000000000000000000000", + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000" + }, + "connected": { + "taker_order_uuid": "ca791f47-3a84-414b-b7c1-942a0f2fb4ca", + "maker_order_uuid": "9c034d5f-18d6-494d-8460-7974be2d5beb", + "method": "connected", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000" + }, + "last_updated": 1640147223000 + } + }, + "started_swaps": ["ca791f47-3a84-414b-b7c1-942a0f2fb4ca"], + "uuid": "9c034d5f-18d6-494d-8460-7974be2d5beb", + "conf_settings": { + "base_confs": 3, + "base_nota": true, + "rel_confs": 3, + "rel_nota": true + }, + "base_orderbook_ticker": null, + "rel_orderbook_ticker": null + }, + "cancellation_reason": "Cancelled" + } + ``` + + +#### Response: Taker Orders + +| Structure | Type | Description | +| ----------------------- | ------ | ------------------------------------------------------------------------------------------------------------- | +| type | string | type of the order ("Maker" or "Taker") | +| order | object | A standard [OrderStatusData](/atomicdex/api/common_structures/orders/#order-status-data) object. | +| base\_orderbook\_ticker | string | The orderbook ticker for base coin. This field is used to group segwit and non-segwit versions of UTXO coins. | +| rel\_orderbook\_ticker | string | The orderbook ticker for rel coin. This field is used to group segwit and non-segwit versions of UTXO coins. | + +#### 📌 Taker Order Examples + + + #### Response: Taker Order Fullfilled + + ```json + { + "type": "Taker", + "order": { + "created_at": 1640159838631, + "request": { + "base": "DOC", + "rel": "MARTY", + "base_amount": "1", + "base_amount_rat": [ + [1, [1]], + [1, [1]] + ], + "rel_amount": "33", + "rel_amount_rat": [ + [1, [33]], + [1, [1]] + ], + "action": "Buy", + "uuid": "d1a43d2a-f7c1-4a83-ba32-1ae640cc3b32", + "method": "request", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000", + "match_by": { + "type": "Any" + }, + "conf_settings": { + "base_confs": 1, + "base_nota": false, + "rel_confs": 1, + "rel_nota": false + } + }, + "matches": { + "cc9efdb5-e0f1-4196-b3b2-e4930623c976": { + "reserved": { + "base": "DOC", + "rel": "MARTY", + "base_amount": "1", + "base_amount_rat": [ + [1, [1]], + [1, [1]] + ], + "rel_amount": "1", + "rel_amount_rat": [ + [1, [1]], + [1, [1]] + ], + "taker_order_uuid": "d1a43d2a-f7c1-4a83-ba32-1ae640cc3b32", + "maker_order_uuid": "cc9efdb5-e0f1-4196-b3b2-e4930623c976", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000", + "conf_settings": { + "base_confs": 1, + "base_nota": false, + "rel_confs": 1, + "rel_nota": false + }, + "method": "reserved" + }, + "connect": { + "taker_order_uuid": "d1a43d2a-f7c1-4a83-ba32-1ae640cc3b32", + "maker_order_uuid": "cc9efdb5-e0f1-4196-b3b2-e4930623c976", + "method": "connect", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "dest_pub_key": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920" + }, + "connected": null, + "last_updated": 0 + } + }, + "order_type": { + "type": "FillOrKill" + }, + "cancellable": false, + "base_orderbook_ticker": null, + "rel_orderbook_ticker": null + }, + "cancellation_reason": "Fulfilled" + } + ``` + + #### Response: 'FillOrKill' Taker order after timeout with no match + + ```json + { + "type": "Taker", + "order": { + "created_at": 1640159991278, + "request": { + "base": "DOC", + "rel": "MARTY", + "base_amount": "1", + "base_amount_rat": [ + [1, [1]], + [1, [1]] + ], + "rel_amount": "0.03", + "rel_amount_rat": [ + [1, [3]], + [1, [100]] + ], + "action": "Buy", + "uuid": "6053016b-e1ba-490f-9501-eafb69b4d3a7", + "method": "request", + "sender_pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000", + "match_by": { + "type": "Any" + }, + "conf_settings": { + "base_confs": 1, + "base_nota": false, + "rel_confs": 1, + "rel_nota": false + } + }, + "matches": {}, + "order_type": { + "type": "FillOrKill" + }, + "cancellable": true, + "base_orderbook_ticker": null, + "rel_orderbook_ticker": null + }, + "cancellation_reason": "TimedOut" + } + ``` + +export const title = "AtomicDEX Method: Orderbook"; +export const description = "The orderbook method requests from the network the currently available orders for the specified trading pair."; + +# orderbook + +**orderbook base rel** + +The `orderbook` method requests from the network the currently available orders for the specified trading pair. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------------------------- | +| base | string | Base currency of a pair | +| rel | string | Related currency, also known as the "quote currency" | + +## Response + +| Structure | Type | Description | +| -------------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| asks | array of objects | An array of standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects containing outstanding asks | +| bids | array of objects | An array of standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects containing outstanding bids | +| numasks | number | the number of outstanding asks | +| numbids | number | the number of outstanding bids | +| base | string | the name of the coin the user desires to receive | +| rel | string | the name of the coin the user will trade | +| timestamp | number | the timestamp of the orderbook request | +| netid | number | the id of the network on which the request is made (default is `0`) | +| total\_asks\_base\_vol | string (decimal) | the base volumes sum of all asks | +| total\_asks\_base\_vol\_rat | rational | the `total_asks_base_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| total\_asks\_base\_vol\_fraction | fraction | the `total_asks_base_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| total\_asks\_rel\_vol | string (decimal) | the rel volumes sum of all asks | +| total\_asks\_rel\_vol\_rat | rational | the `total_asks_rel_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| total\_asks\_rel\_vol\_fraction | fraction | the `total_asks_rel_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| total\_bids\_base\_vol | string (decimal) | the base volumes sum of all bids | +| total\_bids\_base\_vol\_rat | rational | the `total_bids_base_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| total\_bids\_base\_vol\_fraction | fraction | the `total_bids_base_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | +| total\_bids\_rel\_vol | string (decimal) | the rel volumes sum of all bids | +| total\_bids\_rel\_vol\_rat | rational | the `total_bids_rel_vol` represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| total\_bids\_rel\_vol\_fraction | fraction | the `total_bids_rel_vol` represented as a standard [FractionalValue](/atomicdex/api/common_structures/#fractional-value) object. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "orderbook", + "base": "HELLO", + "rel": "WORLD" + } + ``` + + + + #### Response + + ```json + { + "askdepth": 0, + "asks": [ + { + "coin": "DOC", + "address": "RB8yufv3YTfdzYnwz5paNnnDynGJG6WsqD", + "price": "1.1", + "price_rat": [ + [1, [11]], + [1, [10]] + ], + "price_fraction": { + "numer": "11", + "denom": "10" + }, + "maxvolume": "69709.32528304", + "max_volume_rat": [ + [1, [1891586123, 101]], + [1, [6250000]] + ], + "max_volume_fraction": { + "numer": "435683283019", + "denom": "6250000" + }, + "min_volume": "0.0001", + "min_volume_rat": [ + [1, [1]], + [1, [10000]] + ], + "min_volume_fraction": { + "numer": "1", + "denom": "10000" + }, + "pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "age": 1618381531, + "zcredits": 0, + "uuid": "bf66f122-aabd-4836-baa9-e08d7b4c3a4d", + "is_mine": false, + "base_max_volume": "69709.32528304", + "base_max_volume_fraction": { + "numer": "435683283019", + "denom": "6250000" + }, + "base_max_volume_rat": [ + [1, [1891586123, 101]], + [1, [6250000]] + ], + "base_min_volume": "0.0001", + "base_min_volume_fraction": { + "numer": "1", + "denom": "10000" + }, + "base_min_volume_rat": [ + [1, [1]], + [1, [10000]] + ], + "rel_max_volume": "76680.257811344", + "rel_max_volume_fraction": { + "numer": "4792516113209", + "denom": "62500000" + }, + "rel_max_volume_rat": [ + [1, [3627578169, 1115]], + [1, [62500000]] + ], + "rel_min_volume": "0.00011", + "rel_min_volume_fraction": { + "numer": "11", + "denom": "100000" + }, + "rel_min_volume_rat": [ + [1, [11]], + [1, [100000]] + ], + "base_confs": 1, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false, + "base_max_volume_aggr": "69711.32528304", + "base_max_volume_aggr_fraction": { + "numer": "435695783019", + "denom": "6250000" + }, + "base_max_volume_aggr_rat": [ + [1, [1904086123, 101]], + [1, [6250000]] + ], + "rel_max_volume_aggr": "76682.257811344", + "rel_max_volume_aggr_fraction": { + "numer": "4792641113209", + "denom": "62500000" + }, + "rel_max_volume_aggr_rat": [ + [1, [3752578169, 1115]], + [1, [62500000]] + ] + }, + { + "coin": "DOC", + "address": "RMaprYNUp8ErJ9ZAKcxMfpC4ioVycYCCCc", + "price": "1", + "price_rat": [ + [1, [1]], + [1, [1]] + ], + "price_fraction": { + "numer": "1", + "denom": "1" + }, + "maxvolume": "2", + "max_volume_rat": [ + [1, [2]], + [1, [1]] + ], + "max_volume_fraction": { + "numer": "2", + "denom": "1" + }, + "min_volume": "0.00777", + "min_volume_rat": [ + [1, [777]], + [1, [100000]] + ], + "min_volume_fraction": { + "numer": "777", + "denom": "100000" + }, + "pubkey": "037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5", + "age": 1618381531, + "zcredits": 0, + "uuid": "f99a1ca7-0202-49b4-80da-23d95361c704", + "is_mine": false, + "base_max_volume": "2", + "base_max_volume_fraction": { + "numer": "2", + "denom": "1" + }, + "base_max_volume_rat": [ + [1, [2]], + [1, [1]] + ], + "base_min_volume": "0.00777", + "base_min_volume_fraction": { + "numer": "777", + "denom": "100000" + }, + "base_min_volume_rat": [ + [1, [777]], + [1, [100000]] + ], + "rel_max_volume": "2", + "rel_max_volume_fraction": { + "numer": "2", + "denom": "1" + }, + "rel_max_volume_rat": [ + [1, [2]], + [1, [1]] + ], + "rel_min_volume": "0.00777", + "rel_min_volume_fraction": { + "numer": "777", + "denom": "100000" + }, + "rel_min_volume_rat": [ + [1, [777]], + [1, [100000]] + ], + "base_confs": 1, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false, + "base_max_volume_aggr": "2", + "base_max_volume_aggr_fraction": { + "numer": "2", + "denom": "1" + }, + "base_max_volume_aggr_rat": [ + [1, [2]], + [1, [1]] + ], + "rel_max_volume_aggr": "2", + "rel_max_volume_aggr_fraction": { + "numer": "2", + "denom": "1" + }, + "rel_max_volume_aggr_rat": [ + [1, [2]], + [1, [1]] + ] + } + ], + "base": "DOC", + "biddepth": 0, + "bids": [ + { + "coin": "MARTY", + "address": "RMaprYNUp8ErJ9ZAKcxMfpC4ioVycYCCCc", + "price": "1", + "price_rat": [ + [1, [1]], + [1, [1]] + ], + "price_fraction": { + "numer": "1", + "denom": "1" + }, + "maxvolume": "2", + "max_volume_rat": [ + [1, [2]], + [1, [1]] + ], + "max_volume_fraction": { + "numer": "2", + "denom": "1" + }, + "min_volume": "0.00777", + "min_volume_rat": [ + [1, [777]], + [1, [100000]] + ], + "min_volume_fraction": { + "numer": "777", + "denom": "100000" + }, + "pubkey": "037310a8fb9fd8f198a1a21db830252ad681fccda580ed4101f3f6bfb98b34fab5", + "age": 1618381531, + "zcredits": 0, + "uuid": "ebc8e982-a1fb-46dd-ac5d-9773e094d699", + "is_mine": false, + "base_max_volume": "2", + "base_max_volume_fraction": { + "numer": "2", + "denom": "1" + }, + "base_max_volume_rat": [ + [1, [2]], + [1, [1]] + ], + "base_min_volume": "0.00777", + "base_min_volume_fraction": { + "numer": "777", + "denom": "100000" + }, + "base_min_volume_rat": [ + [1, [777]], + [1, [100000]] + ], + "rel_max_volume": "2", + "rel_max_volume_fraction": { + "numer": "2", + "denom": "1" + }, + "rel_max_volume_rat": [ + [1, [2]], + [1, [1]] + ], + "rel_min_volume": "0.00777", + "rel_min_volume_fraction": { + "numer": "777", + "denom": "100000" + }, + "rel_min_volume_rat": [ + [1, [777]], + [1, [100000]] + ], + "base_confs": 1, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false, + "base_max_volume_aggr": "2", + "base_max_volume_aggr_fraction": { + "numer": "2", + "denom": "1" + }, + "base_max_volume_aggr_rat": [ + [1, [2]], + [1, [1]] + ], + "rel_max_volume_aggr": "2", + "rel_max_volume_aggr_fraction": { + "numer": "2", + "denom": "1" + }, + "rel_max_volume_aggr_rat": [ + [1, [2]], + [1, [1]] + ] + }, + { + "coin": "MARTY", + "address": "RJ64uWA7fhoaSnoZga9mDhE6FSuNyrts5y", + "price": "0.9847283211370791847221527988755820581396993104499014936871233734208355041669172800243960533191784546", + "price_rat": [ + [1, [25000000]], + [1, [25387713]] + ], + "price_fraction": { + "numer": "25000000", + "denom": "25387713" + }, + "maxvolume": "380.86547541", + "max_volume_rat": [ + [1, [3726809173, 8]], + [1, [100000000]] + ], + "max_volume_fraction": { + "numer": "38086547541", + "denom": "100000000" + }, + "min_volume": "0.00777", + "min_volume_rat": [ + [1, [777]], + [1, [100000]] + ], + "min_volume_fraction": { + "numer": "777", + "denom": "100000" + }, + "pubkey": "0251ecfa90e8b04dfd034b7a3cf36e7b35b7c76c11238f3ae3493b11cd535eca00", + "age": 1618381531, + "zcredits": 0, + "uuid": "5a483a02-ac7a-4c82-aac7-5ec4d94131de", + "is_mine": false, + "base_max_volume": "386.7721352527054932", + "base_max_volume_fraction": { + "numer": "966930338131763733", + "denom": "2500000000000000" + }, + "base_max_volume_rat": [ + [1, [4276380181, 225131012]], + [1, [2616213504, 582076]] + ], + "base_min_volume": "0.0078905012004", + "base_min_volume_fraction": { + "numer": "19726253001", + "denom": "2500000000000" + }, + "base_min_volume_rat": [ + [1, [2546383817, 4]], + [1, [329033728, 582]] + ], + "rel_max_volume": "380.86547541", + "rel_max_volume_fraction": { + "numer": "38086547541", + "denom": "100000000" + }, + "rel_max_volume_rat": [ + [1, [3726809173, 8]], + [1, [100000000]] + ], + "rel_min_volume": "0.00777", + "rel_min_volume_fraction": { + "numer": "777", + "denom": "100000" + }, + "rel_min_volume_rat": [ + [1, [777]], + [1, [100000]] + ], + "base_confs": 1, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false, + "base_max_volume_aggr": "388.7721352527054932", + "base_max_volume_aggr_fraction": { + "numer": "971930338131763733", + "denom": "2500000000000000" + }, + "base_max_volume_aggr_rat": [ + [1, [918872597, 226295166]], + [1, [2616213504, 582076]] + ], + "rel_max_volume_aggr": "382.86547541", + "rel_max_volume_aggr_fraction": { + "numer": "38286547541", + "denom": "100000000" + }, + "rel_max_volume_aggr_rat": [ + [1, [3926809173, 8]], + [1, [100000000]] + ] + }, + { + "coin": "MARTY", + "address": "RB8yufv3YTfdzYnwz5paNnnDynGJG6WsqD", + "price": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "price_rat": [ + [1, [10]], + [1, [11]] + ], + "price_fraction": { + "numer": "10", + "denom": "11" + }, + "maxvolume": "56120.59538087909090909090909090909090909090909090909090909090909090909090909090909090909090909090909", + "max_volume_rat": [ + [1, [1089973559, 14373]], + [1, [1100000000]] + ], + "max_volume_fraction": { + "numer": "61732654918967", + "denom": "1100000000" + }, + "min_volume": "0.0001", + "min_volume_rat": [ + [1, [1]], + [1, [10000]] + ], + "min_volume_fraction": { + "numer": "1", + "denom": "10000" + }, + "pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "age": 1618381531, + "zcredits": 0, + "uuid": "7b5fc790-cbe1-4714-812c-2e307818f258", + "is_mine": false, + "base_max_volume": "61732.654918967", + "base_max_volume_fraction": { + "numer": "61732654918967", + "denom": "1000000000" + }, + "base_max_volume_rat": [ + [1, [1089973559, 14373]], + [1, [1000000000]] + ], + "base_min_volume": "0.00011", + "base_min_volume_fraction": { + "numer": "11", + "denom": "100000" + }, + "base_min_volume_rat": [ + [1, [11]], + [1, [100000]] + ], + "rel_max_volume": "56120.59538087909090909090909090909090909090909090909090909090909090909090909090909090909090909090909", + "rel_max_volume_fraction": { + "numer": "61732654918967", + "denom": "1100000000" + }, + "rel_max_volume_rat": [ + [1, [1089973559, 14373]], + [1, [1100000000]] + ], + "rel_min_volume": "0.0001", + "rel_min_volume_fraction": { + "numer": "1", + "denom": "10000" + }, + "rel_min_volume_rat": [ + [1, [1]], + [1, [10000]] + ], + "base_confs": 1, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false, + "base_max_volume_aggr": "62121.4270542197054932", + "base_max_volume_aggr_fraction": { + "numer": "155303567635549263733", + "denom": "2500000000000000" + }, + "base_max_volume_aggr_rat": [ + [1, [1405359989, 1799691246, 8]], + [1, [2616213504, 582076]] + ], + "rel_max_volume_aggr": "56503.46085628909090909090909090909090909090909090909090909090909090909090909090909090909090909090909", + "rel_max_volume_aggr_fraction": { + "numer": "31076903470959", + "denom": "550000000" + }, + "rel_max_volume_aggr_rat": [ + [1, [2815084399, 7235]], + [1, [550000000]] + ] + }, + { + "coin": "MARTY", + "address": "RD9Jv1onKkFSey1km2AdcvhsRPvRxv8saX", + "price": "0.17", + "price_rat": [ + [1, [17]], + [1, [100]] + ], + "price_fraction": { + "numer": "17", + "denom": "100" + }, + "maxvolume": "0.01921", + "max_volume_rat": [ + [1, [1921]], + [1, [100000]] + ], + "max_volume_fraction": { + "numer": "1921", + "denom": "100000" + }, + "min_volume": "0.0001000008", + "min_volume_rat": [ + [1, [125001]], + [1, [1250000000]] + ], + "min_volume_fraction": { + "numer": "125001", + "denom": "1250000000" + }, + "pubkey": "039ef1b42c635c32440099910bbe1c5e8b0c9373274c3f21cf1003750fc88d3499", + "age": 1618381531, + "zcredits": 0, + "uuid": "41559ddd-8cba-4322-a74b-69ea1027a7c4", + "is_mine": false, + "base_max_volume": "0.113", + "base_max_volume_fraction": { + "numer": "113", + "denom": "1000" + }, + "base_max_volume_rat": [ + [1, [113]], + [1, [1000]] + ], + "base_min_volume": "0.00058824", + "base_min_volume_fraction": { + "numer": "7353", + "denom": "12500000" + }, + "base_min_volume_rat": [ + [1, [7353]], + [1, [12500000]] + ], + "rel_max_volume": "0.01921", + "rel_max_volume_fraction": { + "numer": "1921", + "denom": "100000" + }, + "rel_max_volume_rat": [ + [1, [1921]], + [1, [100000]] + ], + "rel_min_volume": "0.0001000008", + "rel_min_volume_fraction": { + "numer": "125001", + "denom": "1250000000" + }, + "rel_min_volume_rat": [ + [1, [125001]], + [1, [1250000000]] + ], + "base_confs": 1, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false, + "base_max_volume_aggr": "62121.5400542197054932", + "base_max_volume_aggr_fraction": { + "numer": "155303850135549263733", + "denom": "2500000000000000" + }, + "base_max_volume_aggr_rat": [ + [1, [4226432885, 1799757020, 8]], + [1, [2616213504, 582076]] + ], + "rel_max_volume_aggr": "56503.48006628909090909090909090909090909090909090909090909090909090909090909090909090909090909090909", + "rel_max_volume_aggr_fraction": { + "numer": "31076914036459", + "denom": "550000000" + }, + "rel_max_volume_aggr_rat": [ + [1, [2825649899, 7235]], + [1, [550000000]] + ] + }, + { + "coin": "MARTY", + "address": "RD9Jv1onKkFSey1km2AdcvhsRPvRxv8saX", + "price": "0.113", + "price_rat": [ + [1, [113]], + [1, [1000]] + ], + "price_fraction": { + "numer": "113", + "denom": "1000" + }, + "maxvolume": "0.014351", + "max_volume_rat": [ + [1, [14351]], + [1, [1000000]] + ], + "max_volume_fraction": { + "numer": "14351", + "denom": "1000000" + }, + "min_volume": "0.00010000048", + "min_volume_rat": [ + [1, [625003]], + [1, [1955032704, 1]] + ], + "min_volume_fraction": { + "numer": "625003", + "denom": "6250000000" + }, + "pubkey": "039ef1b42c635c32440099910bbe1c5e8b0c9373274c3f21cf1003750fc88d3499", + "age": 1618381531, + "zcredits": 0, + "uuid": "6949a7c0-0c8b-4a01-bf6a-ee80e7c05a09", + "is_mine": false, + "base_max_volume": "0.127", + "base_max_volume_fraction": { + "numer": "127", + "denom": "1000" + }, + "base_max_volume_rat": [ + [1, [127]], + [1, [1000]] + ], + "base_min_volume": "0.00088496", + "base_min_volume_fraction": { + "numer": "5531", + "denom": "6250000" + }, + "base_min_volume_rat": [ + [1, [5531]], + [1, [6250000]] + ], + "rel_max_volume": "0.014351", + "rel_max_volume_fraction": { + "numer": "14351", + "denom": "1000000" + }, + "rel_max_volume_rat": [ + [1, [14351]], + [1, [1000000]] + ], + "rel_min_volume": "0.00010000048", + "rel_min_volume_fraction": { + "numer": "625003", + "denom": "6250000000" + }, + "rel_min_volume_rat": [ + [1, [625003]], + [1, [1955032704, 1]] + ], + "base_confs": 1, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false, + "base_max_volume_aggr": "62121.6670542197054932", + "base_max_volume_aggr_fraction": { + "numer": "155304167635549263733", + "denom": "2500000000000000" + }, + "base_max_volume_aggr_rat": [ + [1, [3064043381, 1799830944, 8]], + [1, [2616213504, 582076]] + ], + "rel_max_volume_aggr": "56503.49441728909090909090909090909090909090909090909090909090909090909090909090909090909090909090909", + "rel_max_volume_aggr_fraction": { + "numer": "31076921929509", + "denom": "550000000" + }, + "rel_max_volume_aggr_rat": [ + [1, [2833542949, 7235]], + [1, [550000000]] + ] + }, + { + "coin": "MARTY", + "address": "RD9Jv1onKkFSey1km2AdcvhsRPvRxv8saX", + "price": "0.111", + "price_rat": [ + [1, [111]], + [1, [1000]] + ], + "price_fraction": { + "numer": "111", + "denom": "1000" + }, + "maxvolume": "0.012321", + "max_volume_rat": [ + [1, [12321]], + [1, [1000000]] + ], + "max_volume_fraction": { + "numer": "12321", + "denom": "1000000" + }, + "min_volume": "0.00010000101", + "min_volume_rat": [ + [1, [10000101]], + [1, [1215752192, 23]] + ], + "min_volume_fraction": { + "numer": "10000101", + "denom": "100000000000" + }, + "pubkey": "039ef1b42c635c32440099910bbe1c5e8b0c9373274c3f21cf1003750fc88d3499", + "age": 1618381531, + "zcredits": 0, + "uuid": "8cc74b4d-3b16-4f2b-8658-66b1195934f0", + "is_mine": false, + "base_max_volume": "0.111", + "base_max_volume_fraction": { + "numer": "111", + "denom": "1000" + }, + "base_max_volume_rat": [ + [1, [111]], + [1, [1000]] + ], + "base_min_volume": "0.00090091", + "base_min_volume_fraction": { + "numer": "90091", + "denom": "100000000" + }, + "base_min_volume_rat": [ + [1, [90091]], + [1, [100000000]] + ], + "rel_max_volume": "0.012321", + "rel_max_volume_fraction": { + "numer": "12321", + "denom": "1000000" + }, + "rel_max_volume_rat": [ + [1, [12321]], + [1, [1000000]] + ], + "rel_min_volume": "0.00010000101", + "rel_min_volume_fraction": { + "numer": "10000101", + "denom": "100000000000" + }, + "rel_min_volume_rat": [ + [1, [10000101]], + [1, [1215752192, 23]] + ], + "base_confs": 1, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false, + "base_max_volume_aggr": "62121.7780542197054932", + "base_max_volume_aggr_fraction": { + "numer": "155304445135549263733", + "denom": "2500000000000000" + }, + "base_max_volume_aggr_rat": [ + [1, [932081525, 1799895555, 8]], + [1, [2616213504, 582076]] + ], + "rel_max_volume_aggr": "56503.50673828909090909090909090909090909090909090909090909090909090909090909090909090909090909090909", + "rel_max_volume_aggr_fraction": { + "numer": "31076928706059", + "denom": "550000000" + }, + "rel_max_volume_aggr_rat": [ + [1, [2840319499, 7235]], + [1, [550000000]] + ] + } + ], + "netid": 7777, + "numasks": 2, + "numbids": 6, + "rel": "MARTY", + "timestamp": 1618381531, + "total_asks_base_vol": "69711.32528304", + "total_asks_base_vol_fraction": { + "numer": "435695783019", + "denom": "6250000" + }, + "total_asks_base_vol_rat": [ + [1, [1904086123, 101]], + [1, [6250000]] + ], + "total_asks_rel_vol": "76682.257811344", + "total_asks_rel_vol_fraction": { + "numer": "4792641113209", + "denom": "62500000" + }, + "total_asks_rel_vol_rat": [ + [1, [3752578169, 1115]], + [1, [62500000]] + ], + "total_bids_base_vol": "62121.7780542197054932", + "total_bids_base_vol_fraction": { + "numer": "155304445135549263733", + "denom": "2500000000000000" + }, + "total_bids_base_vol_rat": [ + [1, [932081525, 1799895555, 8]], + [1, [2616213504, 582076]] + ], + "total_bids_rel_vol": "56503.50673828909090909090909090909090909090909090909090909090909090909090909090909090909090909090909", + "total_bids_rel_vol_fraction": { + "numer": "31076928706059", + "denom": "550000000" + }, + "total_bids_rel_vol_rat": [ + [1, [2840319499, 7235]], + [1, [550000000]] + ] + } + ``` + +export const title = "AtomicDEX Method: Orderbook Depth"; +export const description = "The orderbook_depth method returns the number of asks and bids for the specified trading pairs."; + +# orderbook\_depth + +**orderbook\_depth pairs** + +The `orderbook_depth` method returns the number of asks and bids for the specified trading pairs. + +## Arguments + +| Structure | Type | Description | +| --------- | ----- | ------------------------- | +| pairs | array | an array of trading pairs | + +## Response + + + The pairs in the response are not guaranteed to be in the order of pairs in the request. + + +| Structure | Type | Description | +| --------- | -------------------- | ------------------------------ | +| result | array of `PairDepth` | an array of pair depth objects | + +Where `PairDepth` object structure is as follows + +| Structure | Type | Description | +| ---------- | ------------------ | ------------------ | +| pair | array of 2 strings | the orderbook pair | +| depth.asks | number | the number of asks | +| depth.bids | number | the number of bids | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "orderbook_depth", + "pairs": [ + [ + "DOC", + "MARTY" + ], + [ + "BTC", + "KMD" + ], + [ + "DOGE", + "KMD" + ] + ] + } + ``` + + + + #### Response + + ```json + { + "result": [ + { + "pair": ["DOC", "MARTY"], + "depth": { + "asks": 2, + "bids": 6 + } + }, + { + "pair": ["DOGE", "KMD"], + "depth": { + "asks": 3, + "bids": 3 + } + }, + { + "pair": ["BTC", "KMD"], + "depth": { + "asks": 5, + "bids": 9 + } + } + ] + } + ``` + +export const title = "AtomicDEX Method: Orders History by Filter"; +export const description = "The orders_history_by_filter method returns all orders whether active or inactive that match the selected filters."; + +# orders\_history\_by\_filter + +**orders\_history\_by\_filter (order\_type initial\_action base rel from\_price to\_price from\_volume to\_volume from\_timestamp to\_timestamp was\_taker status include\_details)** + +The `orders_history_by_filter` method returns all orders whether active or inactive that match the selected filters. Please note that all filters (order\_type initial\_action, etc.) are combined using logical AND. + +## Arguments + +| Structure | Type | Description | +| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| order\_type | string | return only orders that match the `order_type`; `order_type` can be "Maker" or "Taker" | +| initial\_action | string | return only orders that match the `initial_action`; `initial_action` can be "Sell" or "Buy". Note that maker order `initial_action` is considered "Sell" | +| base | string | return only orders that match the `order.base = base` condition | +| rel | string | return only orders that match the `order.rel = rel` condition | +| from\_price | varies | return only orders that match the `order.price >= from_price` condition | +| to\_price | varies | return only orders that match the `order.price <= to_price` condition | +| from\_volume | varies | return only orders that match the `order.volume >= from_volume` condition | +| to\_volume | varies | return only orders that match the `order.volume <= to_volume` condition | +| from\_timestamp | integer | Timestamp in UNIX format. Return only orders that match the `order.created_at >= from_timestamp` condition | +| to\_timestamp | number | Timestamp in UNIX format. return only orders that match the `order.created_at <= to_timestamp` condition | +| was\_taker | bool | return only `GoodTillCancelled` orders that got converted from `taker` to `maker` | +| status | string | return only orders that match the `status`; `status` can be:
  • For active maker order `Created`, `Updated`
  • For active taker order `Created`
  • For inactive maker order `Fulfilled`, `Insufficient Balance`, `Cancelled`
  • For inactive taker order `Fulfilled`, `Timed Out`, `Cancelled`
| +| include\_details | bool | whether to include complete order details in response; defaults to false | + +## Response + +| Structure | Type | Description | +| ---------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| orders | array of order objects | Array of [OrderSummaryData](/atomicdex/api/common_structures/orders/#order-summary-data) that match the selected filters. | +| details | array | array of complete order details for every order that matches the selected filters; returns `[]` if `include_details` is false or not included in the | +| details.type | string | type of the order; "Maker" or "Taker" | +| details.order | object | A standard [OrderDataV1](/atomicdex/api/common_structures/orders/#order-data-v1) objects containing outstanding asks | +| found\_records | number | the number of returned orders | +| warnings | array | array containing warnings objects | +| warnings.uuid | string | uuid of the order that produced this warning | +| warnings.warning | string | warning message | + +#### 📌 Examples + +#### Command (select orders from history that have order\_type = Taker and initial\_action = Buy) + + + ```json + { + "userpass": "testpsw", + "method": "orders_history_by_filter", + "order_type": "Taker", + "initial_action": "Buy" + } + ``` + + +#### Command (select orders from history that have base = DOC and rel = MARTY) + + + ```json + { + "userpass": "testpsw", + "method": "orders_history_by_filter", + "base": "DOC", + "rel": "MARTY" + } + ``` + + +#### Command (select orders from history that have base = DOC and price >= 1 and volume {"<="} 1) + + + ```json + { + "userpass": "testpsw", + "method": "orders_history_by_filter", + "base": "DOC", + "from_price": 1, + "to_volume": 1 + } + ``` + + +#### Command (select orders from history that was\_taker and created\_at >= 1611705600 (January 27, 2021 0:00:00 GMT)) + + + ```json + { + "userpass": "testpsw", + "method": "orders_history_by_filter", + "was_taker": true, + "from_timestamp": 1611705600 + } + ``` + + +#### Command (select orders with details from history that was cancelled because it timed-out) + + + ```json + { + "userpass": "testpsw", + "method": "orders_history_by_filter", + "status": "Timed Out", + "include_details": true + } + ``` + + + + #### Response (orders only) + + ```json + { + "result": { + "orders": [ + { + "uuid": "e5f453e2-b414-4df2-9fc3-eeedb5cc1f1e", + "order_type": "Maker", + "initial_action": "Sell", + "base": "DOC", + "rel": "MARTY", + "price": 2, + "volume": 3, + "created_at": 1620727954406, + "last_updated": 1620727954406, + "was_taker": 0, + "status": "Created" + } + ], + "details": [], + "found_records": 1, + "warnings": [] + } + } + ``` + + #### Response (details included) + + ```json + { + "result": { + "orders": [ + { + "uuid": "e5f453e2-b414-4df2-9fc3-eeedb5cc1f1e", + "order_type": "Maker", + "initial_action": "Sell", + "base": "DOC", + "rel": "MARTY", + "price": 2, + "volume": 3, + "created_at": 1620727954406, + "last_updated": 1620727954406, + "was_taker": 0, + "status": "Created" + } + ], + "details": [ + { + "type": "Maker", + "order": { + "base": "DOC", + "rel": "MARTY", + "price": "2", + "price_rat": [ + [1, [2]], + [1, [1]] + ], + "max_base_vol": "3", + "max_base_vol_rat": [ + [1, [3]], + [1, [1]] + ], + "min_base_vol": "0.0001", + "min_base_vol_rat": [ + [1, [1]], + [1, [10000]] + ], + "created_at": 1620727954406, + "updated_at": 1620727954406, + "matches": {}, + "started_swaps": [], + "uuid": "e5f453e2-b414-4df2-9fc3-eeedb5cc1f1e", + "conf_settings": { + "base_confs": 1, + "base_nota": false, + "rel_confs": 1, + "rel_nota": false + } + } + } + ], + "found_records": 1, + "warnings": [] + } + } + ``` + + #### Response (warning - uuid could not be parsed) + + ```json + { + "result": { + "orders": [ + { + "uuid": "e5f453e2-b414-4df2-9fc3-eeedb5cc1f1e", + "order_type": "Maker", + "initial_action": "Sell", + "base": "DOC", + "rel": "MARTY", + "price": 2, + "volume": 3, + "created_at": 1620727954406, + "last_updated": 1620727954406, + "was_taker": 0, + "status": "Created" + } + ], + "details": [], + "found_records": 1, + "warnings": [ + { + "uuid": "e5f453e2-b414-4df2-9fc3-eeedb5cc1f1e", + "warning": "Order details for Uuid e5f453e2-b414-4df2-9fc3-eeedb5cc1f1e were skipped because uuid could not be parsed" + } + ] + } + } + ``` + +export const title = "AtomicDEX Method: Rational Number Type"; +export const description = "The AtomicDEX API now offers the num-rational crate feature. This is used to represent order volumes and prices."; + +# Note About Rational Number Type + +The AtomicDEX API now offers the [num-rational crate](https://crates.io/crates/num-rational) feature. This is used to represent order volumes and prices. + +Komodo highly recommends that the developer use the rational number type when calculating an order's price and volume. This avoids rounding and precision errors when calculating numbers, such as `1/3`, as these cannot be represented as a finite decimal. + +The AtomicDEX API typically will return both the rational number type as well as the decimal representation, but the decimal representation should be considered only a convenience feature for readability. + +The number can be represented in the following two JSON formats: + +1. As a fraction object that contains a numerator and a denominator as numeric strings, as follows: + +```json +{ + "numer": "10000", + "denom": "3000" +} +``` + +2. As a unique format supplied by the `num-rational` crate: + +```json +[ + [1, [0, 1]], + [1, [1]] +] +``` + +In the above unique format, the first item `[1,[0,1]]` is the `numerator` and the second item `[1,[1]]` is the `denominator`. + +The `numerator` and `denominator` are BigInteger numbers represented as a sign and a uint32 array (where numbers are 32-bit parts of big integer in little-endian order). + +`[1,[0,1]]` represents `+0000000000000000000000000000000010000000000000000000000000000000` = `4294967296` + +`[-1,[1,1]]` represents `-1000000000000000000000000000000010000000000000000000000000000000` = `-4294967297` +export const title = "AtomicDEX Method: Recover Funds of Swap UUID"; +export const description = "Learn how to recover funds from a swap-payment address in case of an error using the recover_funds_of_swap method in the AtomicDEX API."; + +# recover\_funds\_of\_swap + +**recover\_funds\_of\_swap uuid** + +In certain cases, a swap can finish with an error wherein the user's funds are stuck on the swap-payment address. (This address is the P2SH address when executing on a utxo-based blockchain, or an etomic-swap smart contract when executing on an ETH/ERC20 blockchain.) + +This error can occur when one side of the trade does not follow the protocol (for any reason). The error persists as attempts to refund the payment fail due to network connection issues between the AtomicDEX API node and the coin's RPC server. + +In this scenario, the `recover_funds_of_swap` method instructs the AtomicDEX API software to attempt to reclaim the user funds from the swap-payment address, if possible. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ------------------------------------- | +| uuid | string | uuid of the swap to recover the funds | + +## Response + +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------------------------------------------------------- | +| action | string | the action executed to unlock the funds. Can be either `SpentOtherPayment` or `RefundedMyPayment` | +| coin | string | the balance of this coin will be unstuck by the recovering transaction | +| tx\_hash | string | the hash of the recovering transaction | +| tx\_hex | string | raw bytes of the recovering transaction in hexadecimal representation | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "recover_funds_of_swap", + "params": { + "uuid": "6343b2b1-c896-47d4-b0f2-a11798f654ed" + } + } + ``` + + + + #### Response (success - SpentOtherPayment) + + ```json + { + "result": { + "action": "SpentOtherPayment", + "coin": "HELLO", + "tx_hash": "696571d032976876df94d4b9994ee98faa870b44fbbb4941847e25fb7c49b85d", + "tx_hex": "0400008085202f890113591b1feb52878f8aea53b658cf9948ba89b0cb27ad0cf30b59b5d3ef6d8ef700000000d8483045022100eda93472c1f6aa18aacb085e456bc47b75ce88527ed01c279ee1a955e85691b702201adf552cfc85cecf588536d5b8257d4969044dde86897f2780e8c122e3a705e40120576fa34d308f39b7a704616656cc124232143565ca7cf1c8c60d95859af8f22d004c6b63042555555db1752102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ac6782012088a9146e602d4affeb86e4ee208802901b8fd43be2e2a4882102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ac68ffffffff0198929800000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac0238555d000000000000000000000000000000" + } + } + ``` + + #### Response (success - RefundedMyPayment) + + ```json + { + "result": { + "action": "RefundedMyPayment", + "coin": "HELLO", + "tx_hash": "696571d032976876df94d4b9994ee98faa870b44fbbb4941847e25fb7c49b85d", + "tx_hex": "0400008085202f890113591b1feb52878f8aea53b658cf9948ba89b0cb27ad0cf30b59b5d3ef6d8ef700000000d8483045022100eda93472c1f6aa18aacb085e456bc47b75ce88527ed01c279ee1a955e85691b702201adf552cfc85cecf588536d5b8257d4969044dde86897f2780e8c122e3a705e40120576fa34d308f39b7a704616656cc124232143565ca7cf1c8c60d95859af8f22d004c6b63042555555db1752102631dcf1d4b1b693aa8c2751afc68e4794b1e5996566cfc701a663f8b7bbbe640ac6782012088a9146e602d4affeb86e4ee208802901b8fd43be2e2a4882102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ac68ffffffff0198929800000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac0238555d000000000000000000000000000000" + } + } + ``` + + #### Response (error - maker payment was already spent) + + ```json + { + "error": "lp_swap:702] lp_swap:412] taker_swap:890] Maker payment is spent, swap is not recoverable" + } + ``` + + #### Response (error - swap is not finished yet) + + ```json + { + "error": "lp_swap:702] lp_swap:412] taker_swap:886] Swap must be finished before recover funds attempt" + } + ``` + +export const title = "AtomicDEX Method: Sell"; +export const description = "The sell method issues a sell request and attempts to match an order from the orderbook based on the provided arguments."; + +# sell + +**sell base rel price volume (match\_by order\_type base\_confs base\_nota rel\_confs rel\_nota)** + +The `sell` method issues a sell request and attempts to match an order from the orderbook based on the provided arguments. + + + * Buy and sell methods always create the `taker` order first. A `taker` order must pay a `dexfee` during the swap as it is taking liquidity from the market. The `dexfee` is calculated as "the greater of either `Minimum transaction amount (dust) TAKER COIN` or `0.0001 TAKER COIN` or `1/777th` the size of the desired order". If your `GoodTillCancelled` order is not matched in 30 seconds, the order is automatically converted to a `maker` request and stays on the orderbook until the request is matched or cancelled. To always act as a maker, please use the [setprice](/atomicdex/api/legacy/setprice/) method. + * To prevent a user from making trades in which the transaction fees may end up costing a significant portion of the value of the trade, we have set a lower limit to the value of a trade. See the description of the `volume` argument for more info. + + +## Arguments + +| Structure | Type | Description | +| ----------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| base | string | the name of the coin the user desires to sell | +| rel | string | the name of the coin the user desires to receive | +| price | varies | The price in `rel` the user is willing to pay per one unit of the `base` coin. Can be a numeric string, expressed using standard [RationalValue](/atomicdex/api/common_structures/#rational-value) or [FractionalValue](/atomicdex/api/common_structures/#fractional-value) objects. | +| volume | varies | The amount of coins the user is willing to receive of the `base` coin; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin:
  • the argument `volume`
  • the product of the arguments `volume` and `price`
. . Can be a numeric string, expressed using standard [RationalValue](/atomicdex/api/common_structures/#rational-value) or [FractionalValue](/atomicdex/api/common_structures/#fractional-value) objects. | +| min\_volume | varies (optional) | The amount of `base` coin that will be used as `min_volume` of `GoodTillCancelled` order after conversion to maker; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin:
  • the argument `min_volume`
  • the product of the arguments `min_volume` and `price`
. . Can be a numeric string, expressed using standard [RationalValue](/atomicdex/api/common_structures/#rational-value) or [FractionalValue](/atomicdex/api/common_structures/#fractional-value) objects. | +| match\_by | object | Optional. A standard [MatchBy](/atomicdex/api/common_structures/orders/#match-by) object, to filter to include only matches by pubkey or uuid. *Important:* This condition is not applied after a `GoodTillCancelled` order is converted to a `maker` request. | +| order\_type | object | Optional. A standard [OrderType](/atomicdex/api/common_structures/orders/#order-type) object. | +| base\_confs | number | number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set | +| base\_nota | bool | whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set | +| rel\_confs | number | number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set | +| rel\_nota | bool | whether dPoW notarization is required for rel coin atomic swap transaction; default to rel coin configuration if not set | +| save\_in\_history | boolean | Defaults to `true`. If set to `false` no order history will be saved (though order status will be temporarily stored while in progress). If `true`, each order's short record history is stored in a local SQLite database table, and when the order is cancelled or fully matched, it's history will be saved as a json file | + +## Response + +| Structure | Type | Description | +| ----------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| action | string | the action of the request (`Sell`) | +| base | string | the base currency of the request | +| base\_amount | numeric string | the resulting amount of base currency that is sold if the order matches, represented as a decimal value. | +| base\_amount\_rat | rational | the resulting amount of base currency that is sold if the order matches, represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object. | +| rel | string | the rel currency of the request | +| rel\_amount | string | the minimum amount of `rel` coin that must be received in order to sell the `base_amount` of `base` (according to `price`, in decimal representation) | +| rel\_amount\_rat | rational | the minimum amount of `rel` coin that must be received in order to sell the `base_amount` of `base` (according to `price`, represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object). | +| method | string | this field is used for internal P2P interactions; the value is always equal to "request | +| dest\_pub\_key | string | reserved for future use. The `dest_pub_key` allows the user to choose the P2P node that is eligible to match with the request. This value defaults to "zero pubkey", meaning that `anyone` can match | +| sender\_pubkey | string | the public key of our node | +| uuid | string | the request uuid | +| match\_by | object | A standard [MatchBy](/atomicdex/api/common_structures/orders/#match-by) object, to filter to include only matches by pubkey or uuid. *Important:* This condition is not applied after a `GoodTillCancelled` order is converted to a `maker` request. | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | +| base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | +| rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | + +#### 📌 Examples + +#### Command (decimal representation) + + + ```json + { + "userpass": "testpsw", + "method": "sell", + "base": "BASE", + "rel": "REL", + "volume": "1", + "price": "1" + } + ``` + + +#### Command (rational representation in num-rational crate format) + + + ```json + { + "userpass": "testpsw", + "method": "sell", + "base": "BASE", + "rel": "REL", + "volume": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ] + } + ``` + + +#### Command (rational representation as a fraction object) + + + ```json + { + "userpass": "testpsw", + "method": "sell", + "base": "HELLO", + "rel": "WORLD", + "volume": { + "numer": "3", + "denom": "2" + }, + "price": { + "numer": "2", + "denom": "1" + } + } + ``` + + +#### Command (with confirmations and notarization settings) + + + ```json + { + "userpass": "testpsw", + "method": "sell", + "base": "HELLO", + "rel": "WORLD", + "volume": { + "numer": "3", + "denom": "2" + }, + "price": { + "numer": "2", + "denom": "1" + }, + "base_confs": 2, + "base_nota": true, + "rel_confs": 5, + "rel_nota": false + } + ``` + + +#### Command (set to not save order history) + + + ```json + { + "userpass": "testpsw", + "method": "sell", + "base": "TKL", + "rel": "DUST", + "volume": { + "numer": "5", + "denom": "2" + }, + "price": { + "numer": "9", + "denom": "4" + }, + "save_in_history": false + } + ``` + + +#### Command (GoodTillCancelled type) + + + ```json + { + "userpass": "testpsw", + "method": "sell", + "base": "BASE", + "rel": "REL", + "volume": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "order_type": { + "type": "GoodTillCancelled" + } + } + ``` + + +#### Command (FillOrKill type) + + + ```json + { + "userpass": "testpsw", + "method": "sell", + "base": "BASE", + "rel": "REL", + "volume": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "order_type": { + "type": "FillOrKill" + } + } + ``` + + +#### Command (match by Any) + + + ```json + { + "userpass": "testpsw", + "method": "sell", + "base": "BASE", + "rel": "REL", + "volume": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "match_by": { + "type": "Any" + } + } + ``` + + +#### Command (match by Pubkeys) + + + ```json + { + "userpass": "testpsw", + "method": "sell", + "base": "BASE", + "rel": "REL", + "volume": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "match_by": { + "type": "Pubkeys", + "data": [ + "1ab7edc96abaefb358b52c583048eaaeb8ea42609d096d6cddfafa02fa510c6a" + ] + } + } + ``` + + +#### Command (match by Orders) + + + ```json + { + "userpass": "testpsw", + "method": "sell", + "base": "BASE", + "rel": "REL", + "volume": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "match_by": { + "type": "Orders", + "data": [ + "d14452bb-e82d-44a0-86b0-10d4cdcb8b24" + ] + } + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "action": "Sell", + "base": "BASE", + "base_amount": "1", + "base_amount_rat": [ + [1, [1]], + [1, [1]] + ], + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000", + "method": "request", + "rel": "REL", + "rel_amount": "1", + "rel_amount_rat": [ + [1, [1]], + [1, [1]] + ], + "sender_pubkey": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "uuid": "d14452bb-e82d-44a0-86b0-10d4cdcb8b24", + "match_by": { + "data": [ + "1ab7edc96abaefb358b52c583048eaaeb8ea42609d096d6cddfafa02fa510c6a" + ], + "type": "Pubkeys" + }, + "conf_settings": { + "base_confs": 2, + "base_nota": true, + "rel_confs": 5, + "rel_nota": false + }, + "base_orderbook_ticker": null, + "rel_orderbook_ticker": null + } + } + ``` + + #### Response (error) + + ```json + { + "error": "rpc:278] utxo:884] BASE balance 12.88892991 is too low, required 21.15" + } + ``` + +export const title = "AtomicDEX Method: Send Raw Transaction"; +export const description = "The send_raw_transaction method broadcasts the transaction to the network of selected coin."; + +# send\_raw\_transaction + +**send\_raw\_transaction coin tx\_hex** + +The `send_raw_transaction` method broadcasts the transaction to the network of selected coin. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------------------------------------------------------- | +| coin | string | the name of the coin network on which to broadcast the transaction | +| tx\_hex | string | the transaction bytes in hexadecimal format; this is typically generated by the `withdraw` method | + +## Response + +| Structure | Type | Description | +| --------- | ------ | ------------------------------------- | +| tx\_hash | string | the hash of the broadcast transaction | + +#### 📌 Examples + +#### Command + + + ```json + { + "method": "send_raw_transaction", + "coin": "KMD", + "tx_hex": "0400008085202f8902d6a5b976db5e5c9e8f9ead50713b25f22cd061edc8ff0ff1049fd2cd775ba087000000006b483045022100bf2073c1ecfef3fc78f272045f46a722591401f61c2d2fac87fc474a17df7c3102200ca1bd0664ba75f3383e5cbbe96127ad534a86238dbea256e000b0fe2067ab8c012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffffd04d4e07ac5dacd08fb76e08d2a435fc4fe2b16eb0158695c820b44f42f044cb010000006a47304402200a0c21e8c0ae4a740f3663fe08aeff02cea6495157d531045b58d2dd79fb802702202f80dddd264db33f55e49799363997a175d39a91242a95f268c40f7ced97030b012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788acc3b3ca27000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac00000000000000000000000000000000000000", + "userpass": "testpsw" + } + ``` + + + + #### Response (success) + + ```json + { + "tx_hash": "0b024ea6997e16387c0931de9f203d534c6b2b8500e4bda2df51a36b52a3ef33" + } + ``` + +export const title = "AtomicDEX Method: Set Required Confirmations"; +export const description = "The set_required_confirmations method sets the number of confirmations for which AtomicDEX API must wait for the selected coin."; + +# set\_required\_confirmations + +**set\_required\_confirmations coin confirmations** + +The `set_required_confirmations` method sets the number of confirmations for which AtomicDEX API must wait for the selected coin. + + + This setting is ***not*** persistent. The value must be reset in the coins file on restart. + + +## Arguments + +| Structure | Type | Description | +| ------------- | ------ | -------------------------------------- | +| coin | string | the ticker of the selected coin | +| confirmations | number | the number of confirmations to require | + +#### Response + +| Structure | Type | Description | +| ------------- | ------ | ------------------------------------------ | +| coin | string | the coin selected in the request | +| confirmations | number | the number of confirmations in the request | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "set_required_confirmations", + "coin": "DOC", + "confirmations": 3 + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "coin": "ETOMIC", + "confirmations": 3 + } + } + ``` + +export const title = "AtomicDEX Method: Set Requires Notarization"; +export const description = "The set_requires_notarization method indicates whether AtomicDEX API must wait for a dPoW notarization of the given atomic swap transactions."; + +# set\_requires\_notarization + +**set\_requires\_notarization coin requires\_notarization** + +The `set_requires_notarization` method indicates whether AtomicDEX API must wait for a dPoW notarization of the given atomic swap transactions. + + + This setting is ***not*** persistent. The value must be reset in the coins file on restart. + + +## Arguments + +| Structure | Type | Description | +| ---------------------- | ------ | ------------------------------------------------------------------------------ | +| coin | string | the ticker of the selected coin | +| requires\_notarization | bool | whether the node should wait for dPoW notarization of atomic swap transactions | + +#### Response + +| Structure | Type | Description | +| ---------------------- | ------ | ---------------------------------------------------------------------------------- | +| coin | string | the coin selected in the request | +| requires\_notarization | bool | whether the node must wait for a dPoW notarization of the atomic swap transactions | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "set_requires_notarization", + "coin": "DOC", + "requires_notarization": true + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "coin": "ETOMIC", + "requires_notarization": true + } + } + ``` + +export const title = "AtomicDEX Method: Setprice"; +export const description = "The setprice method places an order on the orderbook, and it relies on this node acting as a maker, also called a Bob node."; + +# setprice + +**setprice base rel price (volume max cancel\_previous=true base\_confs base\_nota rel\_confs rel\_nota min\_volume)** + +The `setprice` method places an order on the orderbook, and it relies on this node acting as a `maker`, also called a `Bob` node. + +The `setprice` order is always considered a `sell`, for internal implementation convenience. + + + To prevent a user from making trades in which the transaction fees may end up costing a significant portion of the value of the trade, we have set a lower limit to the value of a trade. See the description of the `volume` and `min_volume` arguments for more info. + + +## Arguments + +| Structure | Type | Description | +| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| base | string | the name of the coin the user desires to sell | +| rel | string | the name of the coin the user desires to receive | +| price | numeric string or rational | the price in `rel` the user is willing to receive per one unit of the `base` coin | +| volume | numeric string or rational | the maximum amount of `base` coin available for the order, ignored if max is `true`; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin:
  • the argument `volume`
  • the product of the arguments `volume` and `price`
| +| min\_volume | numeric string or rational | the minimum amount of `base` coin available for the order; it must be less or equal than `volume` param; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin:
  • the argument `min_volume`
  • the product of the arguments `min_volume` and `price`
| +| max | bool | AtomicDEX API will use the entire coin balance for the order, taking `0.001` coins into reserve to account for fees | +| cancel\_previous | bool | AtomicDEX API will cancel all existing orders for the selected pair by default; set this value to `false` to prevent this behavior | +| base\_confs | number | number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set | +| base\_nota | bool | whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set | +| rel\_confs | number | number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set | +| rel\_nota | bool | whether dPoW notarization is required for rel coin atomic swap transaction; default to rel coin configuration if not set | +| save\_in\_history | boolean | Defaults to `true`. If set to `false` no order history will be saved (though order status will be temporarily stored while in progress). If `true`, each order's short record history is stored in a local SQLite database table, and when the order is cancelled or fully matched, it's history will be saved as a json file | + +#### Response + +| Structure | Type | Description | +| ----------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | object | the resulting order object | +| base | string | the base coin of the order | +| rel | string | the rel coin of the order | +| price | string (numeric) | the expected amount of `rel` coin to be received per 1 unit of `base` coin; decimal representation | +| price\_rat | rational | the expected amount of `rel` coin to be received per 1 unit of `base` coin; rational representation | +| max\_base\_vol | string (numeric) | the maximum volume of base coin available to trade; decimal representation | +| max\_base\_vol\_rat | rational | the maximum volume of base coin available to trade; rational representation | +| min\_base\_vol | string (numeric) | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; decimal representation | +| min\_base\_vol\_rat | rational | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; rational representation | +| created\_at | number | unix timestamp in milliseconds, indicating the order creation time | +| updated\_at | number | unix timestamp in milliseconds, indicating the order update time | +| matches | object | contains the map of ongoing matches with other orders, empty as the order was recently created | +| started\_swaps | array of strings | uuids of swaps that were initiated by the order | +| uuid | string | uuid of the created order | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | +| base\_orderbook\_ticker | string | the ticker of the base currency if `orderbook_ticker` is configured for the base currency in `coins` file. If not defined, will return a null value. | +| rel\_orderbook\_ticker | string | the ticker of the rel currency if `orderbook_ticker` is configured for the rel currency in `coins` file. If not defined, will return a null value. | + +#### 📌 Examples + +#### Command (with volume) + + + ```json + { + "userpass": "testpsw", + "method": "setprice", + "base": "BASE", + "rel": "REL", + "price": "0.9", + "volume": "1" + } + ``` + + +#### Command (max = true) + + + ```json + { + "userpass": "testpsw", + "method": "setprice", + "base": "BASE", + "rel": "REL", + "price": "0.9", + "max": true + } + ``` + + +#### Command (rational representation in num-rational crate format) + + + ```json + { + "userpass": "testpsw", + "method": "setprice", + "base": "HELLO", + "rel": "WORLD", + "volume": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ] + } + ``` + + +#### Command (rational representation as fraction object) + + + ```json + { + "userpass": "testpsw", + "method": "setprice", + "base": "HELLO", + "rel": "WORLD", + "volume": { + "numer": "3", + "denom": "2" + }, + "price": { + "numer": "2", + "denom": "1" + } + } + ``` + + +#### Command (with min\_volume) + + + ```json + { + "userpass": "testpsw", + "method": "setprice", + "base": "HELLO", + "rel": "WORLD", + "volume": { + "numer": "3", + "denom": "2" + }, + "price": { + "numer": "2", + "denom": "1" + }, + "min_volume": "1" + } + ``` + + +#### Command (with confirmations and notarization settings) + + + ```json + { + "userpass": "testpsw", + "method": "setprice", + "base": "HELLO", + "rel": "WORLD", + "volume": { + "numer": "3", + "denom": "2" + }, + "price": { + "numer": "2", + "denom": "1" + }, + "base_confs": 2, + "base_nota": true, + "rel_confs": 5, + "rel_nota": false + } + ``` + + +#### Command (set to not save order history) + + + ```json + { + "userpass": "testpsw", + "method": "setprice", + "base": "KMD", + "rel": "TKL", + "volume": { + "numer": "4", + "denom": "3" + }, + "price": { + "numer": "7", + "denom": "12" + }, + "save_in_history": false + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "base": "BASE", + "rel": "REL", + "max_base_vol": "1", + "max_base_vol_rat": [ + [1, [1]], + [1, [1]] + ], + "min_base_vol": "0", + "min_base_vol": [ + [0, []], + [1, [1]] + ], + "created_at": 1559052299258, + "matches": {}, + "price": "1", + "price_rat": [ + [1, [1]], + [1, [1]] + ], + "started_swaps": [], + "uuid": "6a242691-6c05-474a-85c1-5b3f42278f41", + "conf_settings": { + "base_confs": 2, + "base_nota": true, + "rel_confs": 5, + "rel_nota": false + } + }, + "base_orderbook_ticker": null, + "rel_orderbook_ticker": null + } + ``` + + #### Response (error) + + ```json + { "error": "Rel coin REL is not found" } + ``` + +export const title = "AtomicDEX Method: Setprice"; +export const description = "The show_priv_key method returns the private key of the specified coin in a format compatible with coin wallets."; + +# show\_priv\_key + +**show\_priv\_key coin** + +The `show_priv_key` method returns the private key of the specified `coin` in a format compatible with `coin` wallets. +The output can be used for the `importprivkey` method (UTXO coins) or as a private key for MyEtherWallet (ETH/ERC20). + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ----------------------------------------------- | +| coin | string | the name of the coin of the private key to show | + +## Response + +| Structure | Type | Description | +| --------- | ------ | --------------------------- | +| coin | string | the name of the coin | +| priv\_key | string | the private key of the coin | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "show_priv_key", + "coin": "HELLOWORLD" + } + ``` + + + + #### Response (UTXO WIF) + + ```json + { + "coin": "HELLOWORLD", + "priv_key": "UvCjJf4dKSs2vFGVtCnUTAhR5FTZGdg43DDRa9s7s5DV1sSDX14g" + } + ``` + + #### Response (0x-prefixed ETH private key) + + ```json + { + "coin": "ETH", + "priv_key": "0xb8c774f071de08c7fd8f62b97f1a5726f6ce9f1bcf141b70b86689254ed6714e" + } + ``` + +export const title = "AtomicDEX Method: Stop"; +export const description = "The stop method stops the AtomicDEX API software."; + +# stop + +**stop()** + +The `stop` method stops the AtomicDEX API software. + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +## Response + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | +export const title = "AtomicDEX Method: Trade Preimage"; +export const description = "The trade_preimage method returns the approximate fee amounts that are paid per the whole swap."; + +# trade\_preimage {{label : 'trade_preimage', tag : 'deprecated'}} + +\*\*trade\_preimage (deprecated) \*\* + +The `trade_preimage` method returns the approximate fee amounts that are paid per the whole swap. +Depending on the parameters, the function returns different results: + +* If the `swap_method` is `buy` or `sell`, then the result will include the `taker_fee` and the `fee_to_send_taker_fee`. + The `taker_fee` amount is paid from the `base` coin balance if the `swap_method` is `sell`, else it is paid from the `rel` coin balance; +* If the `max` field is true, then the result will include the `volume`. + + + This method can be used instead of **max\_taker\_vol**, if the `max` field is true and the `swap_method` is `buy` or `sell`. + Use the resulting `volume` as an argument of the `buy` or `sell` requests. + + + + Use the `trade_preimage` request with `max = true` and `swap_method = "setprice"` arguments to approximate the fee amounts **only**. Do not use the resulting `volume` as an argument of the `setprice`. + + + + This function is deprecated. Please consider using [trade\_preimage v2.0](/atomicdex/api/v20/trade_preimage/) instead. + + +#### Arguments + +| Structure | Type | Description | +| ------------ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | +| base | string | the base currency of the request | +| rel | string | the rel currency of the request | +| swap\_method | string | the name of the method whose preimage is requested. Possible values: `buy`, `sell`, `setprice` | +| price | numeric string or rational | the price in `rel` the user is willing to pay per one unit of the `base` coin | +| volume | numeric string or rational (optional) | the amount the user is willing to trade; ignored if `max = true` **and** `swap_method = setprice`, otherwise, it must be set | +| max | bool (optional) | whether to return the maximum available volume for `setprice` method; must not be set or `false` if `swap_method` is `buy` or `sell` | + +#### Response + +| Structure | Type | Description | +| ------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | object | an object containing the relevant information | +| base\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `base` coin | +| rel\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `rel` coin | +| volume | string (numeric) | Optional. The max available volume that can be traded (in decimal representation); empty if the `max` argument is missing or false | +| volume\_rat | rational | Optional. The max available volume that can be traded represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object.; empty if the `max` argument is missing or false | +| volume\_fraction | fraction | Optional. The max available volume that can be traded represented as a standard [fractionalValue](/atomicdex/api/common_structures/#fractional-value) object.; empty if the `max` argument is missing or false | +| taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The dex fee to be paid by Taker; empty if `swap_method` is `setprice` | +| fee\_to\_send\_taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid to send the dex fee; empty if `swap_method` is `setprice` | +| total\_fees | array of objects | A standard [TotalFeeInfo](/atomicdex/api/common_structures/#total-fee-info) object. Each element is a sum of fees required to be paid from user's balance of corresponding `ExtendedFeeInfo.coin`; the elements are unique by coin | + +#### 📌 Examples + +#### Command (setprice) + + + ```json + { + "userpass": "testpsw", + "method": "trade_preimage", + "base": "DOC", + "rel": "BTC", + "price": "1", + "volume": "0.1", + "swap_method": "setprice" + } + ``` + + + + #### Response + + ```json + { + "result": { + "base_coin_fee": { + "coin": "DOC", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "paid_from_trading_vol": false + }, + "rel_coin_fee": { + "coin": "BTC", + "amount": "0.00029211", + "amount_fraction": { + "numer": "29211", + "denom": "100000000" + }, + "amount_rat": [ + [1, [29211]], + [1, [100000000]] + ], + "paid_from_trading_vol": true + }, + "total_fees": [ + { + "coin": "DOC", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "required_balance": "0.00001", + "required_balance_fraction": { + "numer": "1", + "denom": "100000" + }, + "required_balance_rat": [ + [1, [1]], + [1, [100000]] + ] + }, + { + "coin": "BTC", + "amount": "0.00029211", + "amount_fraction": { + "numer": "29211", + "denom": "100000000" + }, + "amount_rat": [ + [1, [29211]], + [1, [100000000]] + ], + "required_balance": "0", + "required_balance_fraction": { + "numer": "0", + "denom": "1" + }, + "required_balance_rat": [ + [0, []], + [1, [1]] + ] + } + ] + } + } + ``` + + +#### Command (buy) + + + ```json + { + "userpass": "testpsw", + "method": "trade_preimage", + "base": "BTC", + "rel": "DOC", + "price": "1", + "volume": "0.1", + "swap_method": "buy" + } + ``` + + + + #### Response + + ```json + { + "result": { + "base_coin_fee": { + "coin": "BTC", + "amount": "0.00029211", + "amount_fraction": { + "numer": "29211", + "denom": "100000000" + }, + "amount_rat": [ + [1, [29211]], + [1, [100000000]] + ], + "paid_from_trading_vol": true + }, + "rel_coin_fee": { + "coin": "DOC", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "paid_from_trading_vol": false + }, + "taker_fee": { + "coin": "DOC", + "amount": "0.0001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287", + "amount_fraction": { + "numer": "1", + "denom": "7770" + }, + "amount_rat": [ + [1, [1]], + [1, [7770]] + ], + "paid_from_trading_vol": false + }, + "fee_to_send_taker_fee": { + "coin": "DOC", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "paid_from_trading_vol": false + }, + "total_fees": [ + { + "coin": "BTC", + "amount": "0.00029211", + "amount_fraction": { + "numer": "29211", + "denom": "100000000" + }, + "amount_rat": [ + [1, [29211]], + [1, [100000000]] + ], + "required_balance": "0", + "required_balance_fraction": { + "numer": "0", + "denom": "1" + }, + "required_balance_rat": [ + [0, []], + [1, [1]] + ] + }, + { + "coin": "DOC", + "amount": "0.0001487001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287", + "amount_fraction": { + "numer": "5777", + "denom": "38850000" + }, + "amount_rat": [ + [1, [5777]], + [1, [38850000]] + ], + "required_balance": "0.0001487001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287", + "required_balance_fraction": { + "numer": "5777", + "denom": "38850000" + }, + "required_balance_rat": [ + [1, [5777]], + [1, [38850000]] + ] + } + ] + } + } + ``` + + +#### Command (ERC20 and QRC20) + + + ```json + { + "userpass": "testpsw", + "method": "trade_preimage", + "base": "BAT", + "rel": "QC", + "price": "1", + "volume": "2.21363478", + "swap_method": "setprice" + } + ``` + + + + #### Response + + ```json + { + "result": { + "base_coin_fee": { + "amount": "0.0045", + "amount_fraction": { + "denom": "2000", + "numer": "9" + }, + "amount_rat": [ + [1, [9]], + [1, [2000]] + ], + "coin": "ETH", + "paid_from_trading_vol": false + }, + "rel_coin_fee": { + "amount": "0.00325", + "amount_fraction": { + "denom": "4000", + "numer": "13" + }, + "amount_rat": [ + [0, [13]], + [1, [4000]] + ], + "coin": "QTUM", + "paid_from_trading_vol": false + }, + "total_fees": [ + { + "amount": "0.003", + "amount_fraction": { + "denom": "1000", + "numer": "3" + }, + "amount_rat": [ + [1, [3]], + [1, [1000]] + ], + "required_balance": "0.003", + "required_balance_fraction": { + "denom": "1000", + "numer": "3" + }, + "required_balance_rat": [ + [1, [3]], + [1, [1000]] + ], + "coin": "ETH" + }, + { + "amount": "0.00325", + "amount_fraction": { + "denom": "4000", + "numer": "13" + }, + "amount_rat": [ + [0, [13]], + [1, [4000]] + ], + "required_balance": "0.00325", + "required_balance_fraction": { + "denom": "4000", + "numer": "13" + }, + "required_balance_rat": [ + [0, [13]], + [1, [4000]] + ], + "coin": "QTUM" + } + ] + } + } + ``` + +export const title = "AtomicDEX Method: Unban Pubkeys"; +export const description = "The unban_pubkeys method will remove all currently banned pubkeys from your ban list, or specific pubkeys from a user defined list."; + +# unban\_pubkeys + +**unban\_pubkeys type data** + +The `unban_pubkeys` method will remove all currently banned pubkeys from your ban list, or specific pubkeys from a user defined list. + + + Use the secp256k1 pubkey without prefix for this method input. E.g. if pubkey is `022cd3021a2197361fb70b862c412bc8e44cff6951fa1de45ceabfdd9b4c520420` you should submit `2cd3021a2197361fb70b862c412bc8e44cff6951fa1de45ceabfdd9b4c520420`. + + +## Arguments + +| Structure | Type | Description | +| -------------- | ------ | -------------------------------------------------------------------------- | +| pubkey | string | the pubkey to ban | +| unban\_by.type | string | `All` to unban all pubkeys, or `Few` to provide a list of pubkeys to unban | +| unban\_by.data | list | A list of pubkeys to unbanned. Only required when `type` is `Few`. | + +## Response + +| Structure | Type | Description | +| ----------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| still\_banned | list | List of pubkeys which remain banned. For each `pubkey`, the reason it was banned `pubkey.reason` and the type of of ban `pubkey.type` is also returned. | +| unbanned | list | List of pubkeys which were unbanned. For each `pubkey`, the reason it was banned `pubkey.reason` and the type of of ban `pubkey.type` is also returned. | +| were\_not\_banned | list | If using `unban_by.type: Few` this will return a list of pubkeys which were not banned, but had been requested to be unbanned. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "unban_pubkeys", + "unban_by": { + "type": "All" + } + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "still_banned": {}, + "unbanned": { + "2cd3021a2197361fb70b862c412bc8e44cff6951fa1de45ceabfdd9b4c520420": { + "type": "Manual", + "reason": "testing" + } + }, + "were_not_banned": [] + } + } + ``` + + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "unban_pubkeys", + "unban_by": { + "type": "Few" + }, + "data": [ + "2cd3021a2197361fb70b862c412bc8e44cff6951fa1de45ceabfdd9b4c520420", + "2cd3021a2197361fb70b862c412bc8e44cff6951fa1de45ceabfdd9b4c520422" + ] + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "still_banned": { + "2cd3021a2197361fb70b862c412bc8e44cff6951fa1de45ceabfdd9b4c520421": { + "type": "Manual", + "reason": "testing" + } + }, + "unbanned": { + "2cd3021a2197361fb70b862c412bc8e44cff6951fa1de45ceabfdd9b4c520420": { + "type": "Manual", + "reason": "testing" + } + }, + "were_not_banned": [ + "2cd3021a2197361fb70b862c412bc8e44cff6951fa1de45ceabfdd9b4c520422" + ] + } + } + ``` + +export const title = "AtomicDEX Method: Update Maker Order"; +export const description = + "The update_maker_order method modifies an active order on the orderbook created by the current node as a maker (or Bob)."; + +# update\_maker\_order + +**update\_maker\_order uuid (new\_price volume\_delta max base\_confs base\_nota rel\_confs rel\_nota min\_volume)** + +The `update_maker_order` method updates an active order on the orderbook created before by `setprice`, and it relies on this node acting as a `maker`, also called a `Bob` node. + + + To prevent a user from making trades in which the transaction fees may end up costing a significant portion of the value of the trade, we have set a lower limit to the value of a trade. See the description of the `volume_delta` and `min_volume` arguments for more info. + + +## Arguments + +| Structure | Type | Description | +| ------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| uuid | string | the uuid of the order the user desires to update | +| new\_price | numeric string or rational (optional) | the price in `rel` the user is willing to receive per one unit of the `base` coin | +| volume\_delta | numeric string or rational (optional) | volume added to or subtracted from the `max_base_vol` of the order to be updated, resulting in the new volume which is the maximum amount of `base` coin available for the order, ignored if max is `true`; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin:
  • the new volume which is the `max_base_vol` of the order to be updated plus `volume_delta`
  • the product of the new volume and the argument `new_price`
| +| min\_volume | numeric string or rational (optional) | the minimum amount of `base` coin available for the order; it must be less or equal than the new volume; the following values must be greater than or equal to the `min_trading_vol` of the corresponding coin:
  • the argument `min_volume`
  • the product of the arguments `min_volume` and `new_price`
| +| max | bool (optional) | AtomicDEX API will use the entire coin balance for the order, taking `0.001` coins into reserve to account for fees | +| base\_confs | number (optional) | number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set | +| base\_nota | bool (optional) | whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set | +| rel\_confs | number (optional) | number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set | +| rel\_nota | bool (optional) | whether dPoW notarization is required for rel coin atomic swap transaction; default to rel coin configuration if not set | + +## Response + +| Structure | Type | Description | +| ------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------- | +| base | string | the base coin of the order | +| rel | string | the rel coin of the order | +| price | string (numeric) | the expected amount of `rel` coin to be received per 1 unit of `base` coin; decimal representation | +| price\_rat | rational | the expected amount of `rel` coin to be received per 1 unit of `base` coin; rational representation | +| max\_base\_vol | string (numeric) | the maximum volume of base coin available to trade; decimal representation | +| max\_base\_vol\_rat | rational | the maximum volume of base coin available to trade; rational representation | +| min\_base\_vol | string (numeric) | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; decimal representation | +| min\_base\_vol\_rat | rational | AtomicDEX API won't match with other orders that attempt to trade less than `min_base_vol`; rational representation | +| created\_at | number | unix timestamp in milliseconds, indicating the order creation time | +| updated\_at | number | unix timestamp in milliseconds, indicating the order update time | +| matches | object | contains the map of ongoing matches with other orders, empty as the order was recently created | +| started\_swaps | array of strings | uuids of swaps that were initiated by the order | +| uuid | string | uuid of the updated order | +| conf\_settings | object | A standard [ConfSettings](/atomicdex/api/common_structures/orders/#conf-settings) object. | + +#### 📌 Examples + +#### Command (with volume) + + + ```json + { + "userpass": "testpsw", + "method": "update_maker_order", + "uuid": "6a242691-6c05-474a-85c1-5b3f42278f41", + "new_price": "0.9", + "volume_delta": "1" + } + ``` + + +#### Command (max = true) + + + ```json + { + "userpass": "testpsw", + "method": "update_maker_order", + "uuid": "6a242691-6c05-474a-85c1-5b3f42278f41", + "new_price": "0.9", + "max": true + } + ``` + + +#### Command (rational representation in num-rational crate format) + + + ```json + { + "userpass": "testpsw", + "method": "update_maker_order", + "uuid": "6a242691-6c05-474a-85c1-5b3f42278f41", + "volume_delta": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ], + "new_price": [ + [ + 1, + [ + 1 + ] + ], + [ + 1, + [ + 1 + ] + ] + ] + } + ``` + + +#### Command (rational representation as fraction object) + + + ```json + { + "userpass": "testpsw", + "method": "update_maker_order", + "uuid": "6a242691-6c05-474a-85c1-5b3f42278f41", + "volume_delta": { + "numer": "3", + "denom": "2" + }, + "new_price": { + "numer": "2", + "denom": "1" + } + } + ``` + + +#### Command (with min\_volume) + + + ```json + { + "userpass": "testpsw", + "method": "update_maker_order", + "uuid": "6a242691-6c05-474a-85c1-5b3f42278f41", + "volume_delta": { + "numer": "3", + "denom": "2" + }, + "new_price": { + "numer": "2", + "denom": "1" + }, + "min_volume": "1" + } + ``` + + +#### Command (with confirmations and notarization settings) + + + ```json + { + "userpass": "testpsw", + "method": "update_maker_order", + "uuid": "6a242691-6c05-474a-85c1-5b3f42278f41", + "volume_delta": { + "numer": "3", + "denom": "2" + }, + "new_price": { + "numer": "2", + "denom": "1" + }, + "base_confs": 2, + "base_nota": true, + "rel_confs": 5, + "rel_nota": false + } + ``` + + + + #### Response (success) + + ```json + { + "result": { + "base": "BASE", + "rel": "REL", + "max_base_vol": "1", + "max_base_vol_rat": [ + [1, [1]], + [1, [1]] + ], + "min_base_vol": "0", + "min_base_vol": [ + [0, []], + [1, [1]] + ], + "created_at": 1559052299258, + "updated_at": 1619736650000, + "matches": {}, + "price": "1", + "price_rat": [ + [1, [1]], + [1, [1]] + ], + "started_swaps": [], + "uuid": "6a242691-6c05-474a-85c1-5b3f42278f41", + "conf_settings": { + "base_confs": 2, + "base_nota": true, + "rel_confs": 5, + "rel_nota": false + } + } + } + ``` + + #### Response (error) + + ```json + { "error": "There is no order with UUID 6a242691-6c05-474a-85c1-5b3f42278f41" } + ``` + +export const title = "AtomicDEX Method: Validate Address"; +export const description = "The validateaddress method checks if an input string is a valid address of the specified coin."; + +# validateaddress + +**validateaddress coin address** + +The `validateaddress` method checks if an input string is a valid address of the specified coin. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | -------------------------------- | +| coin | string | the coin to validate address for | +| address | string | the input string to validate | + +## Response + +| Structure | Type | Description | +| --------- | ----------------- | ------------------------------------------------------------------------------ | +| is\_valid | bool | Whether input string is a valid coin address. | +| reason | string (optional) | Only present if not valid. The reason why input string is not a valid address. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "validateaddress", + "coin": "DOC", + "address": "RRnMcSeKiLrNdbp91qNVQwwXx5azD4S4CD" + } + ``` + + + + #### Response (valid address) + + ```json + { + "result": { + "is_valid": true + } + } + ``` + + #### Response (invalid cash address) + + ```json + { + "result": { + "is_valid": false, + "reason": "utxo:415] Checksum verification failed" + } + } + ``` + + #### Response (invalid ETH address) + + ```json + { + "result": { + "is_valid": false, + "reason": "eth:360] eth:2522] Invalid address checksum" + } + } + ``` + +export const title = "AtomicDEX Method: Version"; +export const description = "The version method returns the AtomicDEX API version."; + +# version + +**version()** + +The `version` method returns the AtomicDEX API version. + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +## Response + +| Structure | Type | Description | +| --------- | ------ | ------------------------- | +| result | string | the AtomicDEX API version | + +#### 📌 Examples + +#### Command + + + ```json + { + "method": "version", + "userpass": "testpsw" + } + ``` + + + + #### Response + + ```json + { + "result": "2.0.996_mm2_3bb412578_Linux" + } + ``` + +export const title = "AtomicDEX Method: Withdraw"; +export const description = "The withdraw method generates, signs, and returns a transaction that transfers the amount of coin to the address indicated in the to argument."; + +# withdraw + +**withdraw coin to (amount max)** + +The `withdraw` method generates, signs, and returns a transaction that transfers the `amount` of `coin` to the address indicated in the `to` argument. + +This method generates a raw transaction which should then be broadcast using [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/). + +## Arguments + +| Structure | Type | Description | +| --------- | ---------------- | ---------------------------------------------------------------------------------- | +| coin | string | the name of the coin the user desires to withdraw | +| to | string | coins are withdrawn to this address | +| amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` | +| max | bool | withdraw the maximum available amount | +| fee | object | Optional. A standard [FeeInfo](/atomicdex/api/common_structures/#fee-info) object. | + +## Response + +| Structure | Type | Description | +| ---------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| from | array of strings | coins are withdrawn from this address; the array contains a single element, but transactions may be sent from several addresses (UTXO coins) | +| to | array of strings | coins are withdrawn to this address; this may contain the `my_address` address, where change from UTXO coins is sent | +| my\_balance\_change | string (numeric) | the expected balance of change in `my_address` after the transaction broadcasts | +| received\_by\_me | string (numeric) | the amount of coins received by `my_address` after the transaction broadcasts; the value may be above zero when the transaction requires that the AtomicDEX API send change to `my_address` | +| spent\_by\_me | string (numeric) | the amount of coins spent by `my_address`; this value differ from the request amount, as the transaction fee is added here | +| total\_amount | string (numeric) | the total amount of coins transferred | +| fee\_details | object | the fee dsetails of the generated transaction; this value differs for utxo and ETH/ERC20 coins, check the examples for more details | +| tx\_hash | string | the hash of the generated transaction | +| tx\_hex | string | transaction bytes in hexadecimal format; use this value as input for the `send_raw_transaction` method | +| coin | string | the name of the coin the user wants to withdraw | +| kmd\_rewards | object (optional) | an object containing information about accrued rewards; always exists if the coin is `KMD` | +| kmd\_rewards.amount | string (numeric, optional) | the amount of accrued rewards | +| kmd\_rewards.claimed\_by\_me | bool (optional) | whether the rewards been claimed by me | + +#### 📌 Examples + +#### Withdraw UTXO based coins + + + ```json + { + "method": "withdraw", + "coin": "KMD", + "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", + "amount": "10", + "userpass": "testpsw" + } + ``` + + + + #### Response (KMD success) + + ```json + { + "block_height": 0, + "coin": "KMD", + "fee_details": { + "type": "Utxo", + "amount": "0.00001" + }, + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "my_balance_change": "-10.00001", + "received_by_me": "0.34417325", + "spent_by_me": "10.34418325", + "to": ["RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh"], + "total_amount": "10.34418325", + "tx_hash": "3a1c382c50a7d12e4675d12ed7e723ce9f0167693dd75fd772bae8524810e605", + "tx_hex": "0400008085202f890207a8e96978acfb8f0d002c3e4390142810dc6568b48f8cd6d8c71866ad8743c5010000006a47304402201960a7089f2d93480fff68ce0b7ca7bb7a32a52915753ac7ae780abd6162cb1d02202c9b11d442e5f72a532f44ceb10122898d486b1474a10eb981c60c5538b9c82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff97f56bf3b0f815bb737b7867e71ddb8198bba3574bb75737ba9c389a4d08edc6000000006a473044022055199d80bd7e2d1b932e54f097c6a15fc4b148d21299dc50067c1da18045f0ed02201d26d85333df65e6daab40a07a0e8a671af9d9b9d92fdf7d7ef97bd868ca545a012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200ca9a3b000000001976a91464ae8510aac9546d5e7704e31ce177451386455588acad2a0d02000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac00000000000000000000000000000000000000", + "kmd_rewards": { + "amount": "0.0791809", + "claimed_by_my": true + } + } + ``` + + +#### Withdraw UTXO based-coins with fixed fee + + + ```json + { + "method": "withdraw", + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", + "fee": { + "type": "UtxoFixed", + "amount": "0.1" + }, + "userpass": "testpsw" + } + ``` + + + + #### Response (success) + + ```json + { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", + "block_height": 0, + "timestamp": 1566472936, + "fee_details": { + "type": "Utxo", + "amount": "0.1" + }, + "coin": "DOC", + "internal_id": "" + } + ``` + + #### Response (error - attempt to use EthGas for UTXO coin) + + ```json + { "error": "utxo:1295] Unsupported input fee type" } + ``` + + +#### Withdraw UTXO based coins with custom fee per kbyte + + + ```json + { + "method": "withdraw", + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", + "fee": { + "type": "UtxoPerKbyte", + "amount": "1" + }, + "userpass": "testpsw" + } + ``` + + + + #### Response (success) + + ```json + { + "tx_hex": "0400008085202f890258be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a000000006b483045022100ef11280e981be280ca5d24c947842ca6a8689d992b73e3a7eb9ff21070b0442b02203e458a2bbb1f2bf8448fc47c51485015904a5271bb17e14be5afa6625d67b1e8012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff58be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a010000006b483045022100daaa10b09e7abf9d4f596fc5ac1f2542b8ecfab9bb9f2b02201644944ddc0280022067aa1b91ec821aa48f1d06d34cd26fb69a9f27d59d5eecdd451006940d9e83db012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788acf31c655d010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788accd7c5e5d000000000000000000000000000000", + "tx_hash": "fd115190feec8c0c14df2696969295c59c674886344e5072d64000379101b78c", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.00253836", + "spent_by_me": "60.00253836", + "received_by_me": "59.61874931", + "my_balance_change": "-0.38378905", + "block_height": 0, + "timestamp": 1566473421, + "fee_details": { + "type": "Utxo", + "amount": "0.38378905" + }, + "coin": "DOC", + "internal_id": "" + } + ``` + + #### Response (error - attempt to use EthGas for UTXO coin) + + ```json + { "error": "utxo:1295] Unsupported input fee type" } + ``` + + +#### Withdraw ETH/ERC20 and other ETH-based forks + + + ```json + { + "method": "withdraw", + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "amount": 10, + "userpass": "testpsw" + } + ``` + + + + #### Response (success) + + ```json + { + "block_height": 0, + "coin": "ETH", + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" + }, + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + } + ``` + + +#### Withdraw ETH/ERC20, and other ETH-based forks with gas limit + + + ```json + { + "userpass": "testpsw", + "method": "withdraw", + "coin": "COIN_NAME", + "to": "RECIPIENT_ADDRESS", + "amount": "AMOUNT", + "fee": { + "type": "EthGas", + "gas_price": "3.5", + "gas": 55000 + } + } + ``` + + + + #### Response (success) + + ```json + { + "tx_hex": "f86d820b2884d09dc30082d6d894bab36286672fbdc7b250804bf6d14be0df69fa29888ac7230489e80000801ca0ef0167b0e53ed50d87b6fd630925f2bce6ee72e9b5fdb51c6499a7caaecaed96a062e5cb954e503ff83f2d6ce082649fdcdf8a77c8d37c7d26d46d3f736b228d10", + "tx_hash": "a26c4dcacf63c04e385dd973ca7e7ca1465a3b904a0893bcadb7e37681d38c95", + "from": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "to": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "total_amount": "10", + "spent_by_me": "10.0001925", + "received_by_me": "10", + "my_balance_change": "-0.0001925", + "block_height": 0, + "timestamp": 1566474670, + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 55000, + "gas_price": "0.0000000035", + "total_fee": "0.0001925" + }, + "coin": "ETH", + "internal_id": "" + } + ``` + + #### Response (error - attempt to use UtxoFixed or UtxoPerKbyte for ETH coin) + + ```json + { "error": "eth:369] Unsupported input fee type" } + ``` + + +#### Withdraw Max + + + ```json + { + "method": "withdraw", + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "max": true, + "userpass": "testpsw" + } + ``` + + + + #### Response (success) + + ```json + { + "block_height": 0, + "coin": "ETH", + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" + }, + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + } + ``` + + +#### Withdraw QRC20 + + + ```json + { + "method": "withdraw", + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10, + "userpass": "testpsw" + } + ``` + + + + #### Response (success) + + ```json + { + "block_height": 0, + "coin": "QRC20", + "timestamp": 1608725061, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" + }, + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + } + ``` + + +#### Withdraw QRC20 with gas limit + + + ```json + { + "userpass": "testpsw", + "method": "withdraw", + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10, + "fee": { + "type": "Qrc20Gas", + "gas_limit": 250000, + "gas_price": 40 + } + } + ``` + + + + ```json + { + "block_height": 0, + "coin": "QRC20", + "timestamp": 1608725061, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 250000, + "gas_price": 40, + "total_gas_fee": "0.1" + }, + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + } + ``` + +export const title = "AtomicDEX Method: Add Delegation"; +export const description = + "The add_delegation method initiates your node's staking of a compatible coin."; + +# add\_delegation + +The `add_delegation` method initiates your node's staking of a compatible coin. Currently QTUM and tQTUM (test tokens avalable at `https://testnet-faucet.qtum.info/`) have been integrated, but this functionality will be expanded to more coins in future. + +Note: Only UTXOs of 100 QTUM / tQTUM will be actively staked. It is recomended to consolidate your balance into a single UTXO before initiating delegated staking. After running `add_delegation`, you will need to broadcast the returned hex via [`send_raw_transaction`](/atomicdex/api/legacy/send_raw_transaction/) to complete the process. Staking will only work with legacy QTUM addresses (segwit addresses are not supported). + +## Arguments + +| Structure | Type | Description | +| ------------------------ | ------ | ---------------------------- | +| coin | string | the coin being staked | +| staking\_details.type | string | the protocol being staked | +| staking\_details.address | string | the delegated staker address | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "add_delegation", + "params": { + "coin": "tQTUM", + "staking_details": { + "type": "Qtum", + "address": "qcyBHeSct7Wr4mAw18iuQ1zW5mMFYmtmBE" + } + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "01000000017fdeb56c5b601454731451aa4daa004a7e1993e196462159c5e5360545fb9965000000006b483045022100c4101e0a70560dd8480404a620ac48a36a509c779cd3eb294d5b07f0447109ea0220145096570e6661fa52bf5df4b23329108959cb58cb02f1629e01cefb2d55fca6012102641b541e35bc915e375c8038f1099a977bc6736aa7265e9f65b7270b70d34366ffffffff020000000000000000fd0301540310552201284ce44c0e968c000000000000000000000000d4ea77298fdac12c657a18b222adc8b307e18127000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004120bf35729611a42875b49e890b7330c94a5227259b2cd987f885aaea3a08bad3897266a39db2d34f8009efa95eb877083b1eefccf2257f02cc0aa2e8db9a7f3eea00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000086c200c4a0ba030000001976a914c36ac1020b1eae632079692e7bef350d279489c988acb4db8061", + "tx_hash": "308c91fd50ec0f724d8c9f5601676b93889ae072b369b7a3d62684d6c3c60e7b", + "from": ["qbNeoqCbBu4hySDUzgmo666faYH3qgaeKz"], + "to": ["qbNeoqCbBu4hySDUzgmo666faYH3qgaeKz"], + "total_amount": "161.064", + "spent_by_me": "161.064", + "received_by_me": "160.16", + "my_balance_change": "-0.904", + "block_height": 0, + "timestamp": 1635834804, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.004", + "gas_limit": 2250000, + "gas_price": 40, + "total_gas_fee": "0.9" + }, + "coin": "tQTUM", + "internal_id": "", + "transaction_type": "StakingDelegation" + }, + "id": 0 + } + ``` + + #### Response (error - already delegating) + + ```json + { + "mmrpc": "2.0", + "error": "Already delegating to: qcyBHeSct7Wr4mAw18iuQ1zW5mMFYmtmBE", + "error_path": "qtum_delegation", + "error_trace": "qtum_delegation:222]", + "error_type": "AlreadyDelegating", + "error_data": "qcyBHeSct7Wr4mAw18iuQ1zW5mMFYmtmBE", + "id": 0 + } + ``` + +export const title = "AtomicDEX Method: Add Node to Version Stat"; +export const description = "The add_node_to_version_stat method adds a Node's name, IP address and PeerID to a local database to track which version of MM2 it is running."; + +# add\_node\_to\_version\_stat + +The `add_node_to_version_stat` method adds a Node's name, IP address and PeerID to a local database to track which version of MM2 it is running. The name parameter is an arbitrary identifying string, such as "seed\_alpha" or "dragonhound\_DEV". The address parameter is the node's IP address or domain names. The Peer ID can be found in the MM2 log file after a connection has been initiated, and looks like the below: + +`07 09:33:58, atomicdex_behaviour:610] INFO Local peer id: PeerId("12D3KooWReXsTVCKGAna1tzrD1jaUttTSs17ULFuvvzoGD9bqmmA") +` + +Note: To allow collection of version stats, added nodes must open port 38890. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ----------------------------- | +| name | string | the name assigned to the node | +| address | string | the IP address of the node | +| peer\_id | string | the node's unique Peer ID | + +#### 📌 Examples + +#### Command + + + ```json + { + "mmrpc": "2.0", + "method": "add_node_to_version_stat", + "userpass": "testpsw", + "params": { + "name": "seed1", + "address": "168.119.236.241", + "peer_id": "12D3KooWEsuiKcQaBaKEzuMtT6uFjs89P1E8MK3wGRZbeuCbCw6P" + } + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + + #### Response (error - peer id already in database) + + ```json + { + "mmrpc": "2.0", + "error": "Database error: UNIQUE constraint failed: nodes.peer_id", + "error_path": "lp_stats", + "error_trace": "lp_stats:124]", + "error_type": "DatabaseError", + "error_data": "UNIQUE constraint failed: nodes.peer_id", + "id": null + } + ``` + + #### Response (error - name already in database) + + ```json + { + "mmrpc": "2.0", + "error": "Database error: UNIQUE constraint failed: nodes.name", + "error_path": "lp_stats", + "error_trace": "lp_stats:124]", + "error_type": "DatabaseError", + "error_data": "UNIQUE constraint failed: nodes.name", + "id": null + } + ``` + + #### Response (error - invalid Peer ID) + + ```json + { + "mmrpc": "2.0", + "error": "Error on parse peer id 12D3RsaaWRmXsJsCKGAD5FJSsd7CSbbdrsd: decoding multihash failed", + "error_path": "lp_stats", + "error_trace": "lp_stats:121]", + "error_type": "PeerIdParseError", + "error_data": [ + "12D3RsaaWRmXsJsCKGAD5FJSsd7CSbbdrsd", + "decoding multihash failed" + ], + "id": null + } + ``` + +export const title = "AtomicDEX Method: Best Orders"; +export const description = "The best_orders method returns the best priced trades available on the orderbook."; + +# best\_orders + +The `best_orders` method returns the best priced trades available on the orderbook. There are two options for the request, either `volume` or `number`. +If request is made by `volume`, the returned results will show the best prices for trades that can fill the requested volume. +If request is made by `number`, the returned results will show a list of the best prices, `number` pairs long (e.g. top 5 best priced orders). +For coins with segwit, they may appear twice in the output (once for each address). E.g. `LTC` and `LTC-segwit` + + + The response of this method can contain coins that are not activated on the AtomicDEX API instance. + Activation will be required to proceed with the trade. + + +#### Arguments + +| Structure | Type | Description | +| ----------- | ------ | ----------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin to get best orders | +| action | string | Whether to `buy` or `sell` the selected coin | +| request\_by | object | A standard [RequestBy](/atomicdex/api/common_structures/orders/#request-by) object. | + +#### Response + +| Structure | Type | Description | +| ----------------- | ------------- | -------------------------------------------------------------------------------------------------------------- | +| orders | object (map) | the `ticker -> array of standard [OrderData](/atomicdex/api/common_structures/orders/#order-data) objects` map | +| original\_tickers | list (string) | Tickers included in response when `orderbook_ticker` is configured for the queried coin in `coins` file | + +#### 📌 Examples + +#### Command (by number) + + + ```json + { + "userpass": "testpsw", + "method": "best_orders", + "mmrpc": "2.0", + "params": { + "coin": "DGB", + "action": "buy", + "request_by": { + "type": "number", + "value": 100 + } + } + } + ``` + + + + #### Response (by number - success) + + ```json + { + "mmrpc": "2.0", + "result": { + "orders": { + "TKL": [ + { + "coin": "TKL", + "address": { + "address_type": "Transparent", + "address_data": "RAwv8JhfvmFx2V3QpY7ehiYpBJ1eqxxdxR" + }, + "price": { + "decimal": "8.7753611926", + "rational": [ + [1, [927133003, 10]], + [1, [705032704, 1]] + ], + "fraction": { + "numer": "43876805963", + "denom": "5000000000" + } + }, + "pubkey": "02dbd8c73e2e80e4f3cf88d2f04a9d2d0df4269496608b14a3e17556fdcb01e0c1", + "uuid": "416bb993-acac-42cf-ae54-bf57a21f7a3d", + "is_mine": false, + "base_max_volume": { + "decimal": "2478.31474597274", + "rational": [ + [1, [1635841741, 28851]], + [1, [2755359744, 11]] + ], + "fraction": { + "numer": "123915737298637", + "denom": "50000000000" + } + }, + "base_min_volume": { + "decimal": "0.0001", + "rational": [ + [1, [1]], + [1, [10000]] + ], + "fraction": { + "numer": "1", + "denom": "10000" + } + }, + "rel_max_volume": { + "decimal": "21748.107044857509733489724", + "rational": [ + [1, [2703103759, 3484586521, 294741]], + [1, [2007498752, 2373086065, 13]] + ], + "fraction": { + "numer": "5437026761214377433372431", + "denom": "250000000000000000000" + } + }, + "rel_min_volume": { + "decimal": "0.00087753611926", + "rational": [ + [1, [927133003, 10]], + [1, [2285707264, 11641]] + ], + "fraction": { + "numer": "43876805963", + "denom": "50000000000000" + } + }, + "conf_settings": { + "base_confs": 7, + "base_nota": false, + "rel_confs": 2, + "rel_nota": true + } + } + ], + "XMY-segwit": [ + { + "coin": "XMY-segwit", + "address": { + "address_type": "Transparent", + "address_data": "MJx4vyc657NwQUMjzRgDcypvRw5NduzSz4" + }, + "price": { + "decimal": "88.3356107012", + "rational": [ + [1, [1795694657, 51]], + [1, [2500000000]] + ], + "fraction": { + "numer": "220839026753", + "denom": "2500000000" + } + }, + "pubkey": "025d81c96aa4269c5946c0bd8dad7785ae0f4f595e7aea2ec4f8fe71f77ebf74a9", + "uuid": "999b34ca-c7b2-4caa-92e2-76349ed2d4b5", + "is_mine": false, + "base_max_volume": { + "decimal": "2478.31474597274", + "rational": [ + [1, [1635841741, 28851]], + [1, [2755359744, 11]] + ], + "fraction": { + "numer": "123915737298637", + "denom": "50000000000" + } + }, + "base_min_volume": { + "decimal": "0.0001", + "rational": [ + [1, [1]], + [1, [10000]] + ], + "fraction": { + "numer": "1", + "denom": "10000" + } + }, + "rel_max_volume": { + "decimal": "218923.446595291331147485288", + "rational": [ + [1, [1174424077, 4198508482, 1483482]], + [1, [3151233024, 3334026680, 6]] + ], + "fraction": { + "numer": "27365430824411416393435661", + "denom": "125000000000000000000" + } + }, + "rel_min_volume": { + "decimal": "0.00883356107012", + "rational": [ + [1, [1795694657, 51]], + [1, [3290337280, 5820]] + ], + "fraction": { + "numer": "220839026753", + "denom": "25000000000000" + } + }, + "conf_settings": { + "base_confs": 7, + "base_nota": false, + "rel_confs": 3, + "rel_nota": false + } + } + ], + "LTC": [ + { + "coin": "LTC", + "address": { + "address_type": "Transparent", + "address_data": "Lgrta1iKRcy8zzygVkZeEXuxBqzssPWtae" + }, + "price": { + "decimal": "0.0001087673", + "rational": [ + [1, [1087673]], + [1, [1410065408, 2]] + ], + "fraction": { + "numer": "1087673", + "denom": "10000000000" + } + }, + "pubkey": "026da2fc632afabbb1b86d04a9a012db25eca74db38ba2eccd88552f27f4c0b245", + "uuid": "8530300a-b11c-4eca-80ab-c4124aaf3b64", + "is_mine": false, + "base_max_volume": { + "decimal": "24706.624279842", + "rational": [ + [1, [986196625, 2876]], + [1, [500000000]] + ], + "fraction": { + "numer": "12353312139921", + "denom": "500000000" + } + }, + "base_min_volume": { + "decimal": "5.019891088590044985947063133864681756373468864263432116086360514603194158538457790163036133102504153", + "rational": [ + [1, [5460000]], + [1, [1087673]] + ], + "fraction": { + "numer": "5460000", + "denom": "1087673" + } + }, + "rel_max_volume": { + "decimal": "2.6872728150328587666", + "rational": [ + [1, [4244429513, 3128397295]], + [1, [1156841472, 1164153218]] + ], + "fraction": { + "numer": "13436364075164293833", + "denom": "5000000000000000000" + } + }, + "rel_min_volume": { + "decimal": "0.000546", + "rational": [ + [1, [273]], + [1, [500000]] + ], + "fraction": { + "numer": "273", + "denom": "500000" + } + }, + "conf_settings": { + "base_confs": 7, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false + } + } + ], + "LTC-segwit": [ + { + "coin": "LTC-segwit", + "address": { + "address_type": "Transparent", + "address_data": "Lgrta1iKRcy8zzygVkZeEXuxBqzssPWtae" + }, + "price": { + "decimal": "0.0001087673", + "rational": [ + [1, [1087673]], + [1, [1410065408, 2]] + ], + "fraction": { + "numer": "1087673", + "denom": "10000000000" + } + }, + "pubkey": "026da2fc632afabbb1b86d04a9a012db25eca74db38ba2eccd88552f27f4c0b245", + "uuid": "8530300a-b11c-4eca-80ab-c4124aaf3b64", + "is_mine": false, + "base_max_volume": { + "decimal": "24706.624279842", + "rational": [ + [1, [986196625, 2876]], + [1, [500000000]] + ], + "fraction": { + "numer": "12353312139921", + "denom": "500000000" + } + }, + "base_min_volume": { + "decimal": "5.019891088590044985947063133864681756373468864263432116086360514603194158538457790163036133102504153", + "rational": [ + [1, [5460000]], + [1, [1087673]] + ], + "fraction": { + "numer": "5460000", + "denom": "1087673" + } + }, + "rel_max_volume": { + "decimal": "2.6872728150328587666", + "rational": [ + [1, [4244429513, 3128397295]], + [1, [1156841472, 1164153218]] + ], + "fraction": { + "numer": "13436364075164293833", + "denom": "5000000000000000000" + } + }, + "rel_min_volume": { + "decimal": "0.000546", + "rational": [ + [1, [273]], + [1, [500000]] + ], + "fraction": { + "numer": "273", + "denom": "500000" + } + }, + "conf_settings": { + "base_confs": 7, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false + } + } + ], + "MATIC": [ + { + "coin": "MATIC", + "address": { + "address_type": "Transparent", + "address_data": "0xf2ed2ac92489106c942c9e32c6a912ba61af93e3" + }, + "price": { + "decimal": "0.0104639634", + "rational": [ + [1, [52319817]], + [1, [705032704, 1]] + ], + "fraction": { + "numer": "52319817", + "denom": "5000000000" + } + }, + "pubkey": "02dbd8c73e2e80e4f3cf88d2f04a9d2d0df4269496608b14a3e17556fdcb01e0c1", + "uuid": "95bb48ce-7411-4be7-a1b9-70e8f8d7887f", + "is_mine": false, + "base_max_volume": { + "decimal": "8964.021726027", + "rational": [ + [1, [424979275, 2087]], + [1, [1000000000]] + ], + "fraction": { + "numer": "8964021726027", + "denom": "1000000000" + } + }, + "base_min_volume": { + "decimal": "20.0825412816031", + "rational": [ + [1, [1331989663, 46758]], + [1, [1316134912, 2328]] + ], + "fraction": { + "numer": "200825412816031", + "denom": "10000000000000" + } + }, + "rel_max_volume": { + "decimal": "93.7991952579513554118", + "rational": [ + [1, [2658798179, 1822452630, 25]], + [1, [1156841472, 1164153218]] + ], + "fraction": { + "numer": "468995976289756777059", + "denom": "5000000000000000000" + } + }, + "rel_min_volume": { + "decimal": "0.21014297694968393172654", + "rational": [ + [1, [3263923031, 2549837702, 569]], + [1, [2067791872, 2170810533, 2710]] + ], + "fraction": { + "numer": "10507148847484196586327", + "denom": "50000000000000000000000" + } + }, + "conf_settings": { + "base_confs": 7, + "base_nota": false, + "rel_confs": 3, + "rel_nota": false + } + } + ] + }, + "original_tickers": { + "LTC": ["LTC-segwit"], + "BTC": ["BTC-segwit"], + "XMY": ["XMY-segwit"] + } + }, + "id": 0 + } + ``` + + +#### Command (by volume) + + + ```json + { + "userpass": "testpsw", + "method": "best_orders", + "mmrpc": "2.0", + "params": { + "coin": "BTC", + "action": "buy", + "request_by": { + "type": "volume", + "value": 0.01 + } + } + } + ``` + + + + #### Response (by volume - success) + + ```json + { + "mmrpc": "2.0", + "result": { + "orders": { + "DASH": [ + { + "coin": "DASH", + "address": { + "address_type": "Transparent", + "address_data": "XefPeyw3KQYa5PUJeTMQRhMHQZGVy4YMWa" + }, + "price": { + "decimal": "3333.333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333", + "rational": [ + [1, [10000]], + [1, [3]] + ], + "fraction": { + "numer": "10000", + "denom": "3" + } + }, + "pubkey": "0261eef15cbc141f555aff1aa40fb21de17a0a9e6897eee18c14c6032586b456b3", + "uuid": "b17d7aee-2c0b-4311-935c-8c05e81f3813", + "is_mine": false, + "base_max_volume": { + "decimal": "0.097714296984", + "rational": [ + [1, [3624352531, 2]], + [1, [445948416, 29]] + ], + "fraction": { + "numer": "12214287123", + "denom": "125000000000" + } + }, + "base_min_volume": { + "decimal": "0.000002331", + "rational": [ + [1, [2331]], + [1, [1000000000]] + ], + "fraction": { + "numer": "2331", + "denom": "1000000000" + } + }, + "rel_max_volume": { + "decimal": "325.71432328", + "rational": [ + [1, [4071429041]], + [1, [12500000]] + ], + "fraction": { + "numer": "4071429041", + "denom": "12500000" + } + }, + "rel_min_volume": { + "decimal": "0.00777", + "rational": [ + [1, [777]], + [1, [100000]] + ], + "fraction": { + "numer": "777", + "denom": "100000" + } + }, + "conf_settings": null + } + ], + "LTC": [ + { + "coin": "LTC", + "address": { + "address_type": "Transparent", + "address_data": "LPCW5waySMa3BFZsxi2UrBjFnS464b97WU" + }, + "price": { + "decimal": "10000", + "rational": [ + [1, [10000]], + [1, [1]] + ], + "fraction": { + "numer": "10000", + "denom": "1" + } + }, + "pubkey": "0261eef15cbc141f555aff1aa40fb21de17a0a9e6897eee18c14c6032586b456b3", + "uuid": "07764da3-bbec-4e50-9711-2baf0f8bf30b", + "is_mine": false, + "base_max_volume": { + "decimal": "0.11423436", + "rational": [ + [1, [2855859]], + [1, [25000000]] + ], + "fraction": { + "numer": "2855859", + "denom": "25000000" + } + }, + "base_min_volume": { + "decimal": "0.000000777", + "rational": [ + [1, [777]], + [1, [1000000000]] + ], + "fraction": { + "numer": "777", + "denom": "1000000000" + } + }, + "rel_max_volume": { + "decimal": "1142.3436", + "rational": [ + [1, [2855859]], + [1, [2500]] + ], + "fraction": { + "numer": "2855859", + "denom": "2500" + } + }, + "rel_min_volume": { + "decimal": "0.00777", + "rational": [ + [1, [777]], + [1, [100000]] + ], + "fraction": { + "numer": "777", + "denom": "100000" + } + }, + "conf_settings": { + "base_confs": 1, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false + } + } + ], + "KMD": [ + { + "coin": "KMD", + "address": { + "address_type": "Transparent", + "address_data": "RDFjuFARxX8YzTEvFk2JfgzhLV9QcPWy5f" + }, + "price": { + "decimal": "322580.6451612903225806451612903225806451612903225806451612903225806451612903225806451612903225806452", + "rational": [ + [1, [10000000]], + [1, [31]] + ], + "fraction": { + "numer": "10000000", + "denom": "31" + } + }, + "pubkey": "0261eef15cbc141f555aff1aa40fb21de17a0a9e6897eee18c14c6032586b456b3", + "uuid": "adff2e1d-4514-49ea-a30b-9575711767cd", + "is_mine": false, + "base_max_volume": { + "decimal": "0.031", + "rational": [ + [1, [31]], + [1, [1000]] + ], + "fraction": { + "numer": "31", + "denom": "1000" + } + }, + "base_min_volume": { + "decimal": "0.000000024087", + "rational": [ + [1, [24087]], + [1, [3567587328, 232]] + ], + "fraction": { + "numer": "24087", + "denom": "1000000000000" + } + }, + "rel_max_volume": { + "decimal": "10000", + "rational": [ + [1, [10000]], + [1, [1]] + ], + "fraction": { + "numer": "10000", + "denom": "1" + } + }, + "rel_min_volume": { + "decimal": "0.00777", + "rational": [ + [1, [777]], + [1, [100000]] + ], + "fraction": { + "numer": "777", + "denom": "100000" + } + }, + "conf_settings": null + } + ], + "DAI-ERC20": [ + { + "coin": "DAI-ERC20", + "address": { + "address_type": "Transparent", + "address_data": "0xe5e6d27100474d34cc0f87ee387756395019019c" + }, + "price": { + "decimal": "33333333.33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333", + "rational": [ + [1, [100000000]], + [1, [3]] + ], + "fraction": { + "numer": "100000000", + "denom": "3" + } + }, + "pubkey": "0261eef15cbc141f555aff1aa40fb21de17a0a9e6897eee18c14c6032586b456b3", + "uuid": "15a47eff-607e-4729-896b-6acb309d5022", + "is_mine": false, + "base_max_volume": { + "decimal": "0.1075026242236026", + "rational": [ + [1, [2258990909, 125149]], + [1, [937459712, 1164153]] + ], + "fraction": { + "numer": "537513121118013", + "denom": "5000000000000000" + } + }, + "base_min_volume": { + "decimal": "0.0081585", + "rational": [ + [1, [16317]], + [1, [2000000]] + ], + "fraction": { + "numer": "16317", + "denom": "2000000" + } + }, + "rel_max_volume": { + "decimal": "3583420.80745342", + "rational": [ + [1, [2184652735, 41716]], + [1, [50000000]] + ], + "fraction": { + "numer": "179171040372671", + "denom": "50000000" + } + }, + "rel_min_volume": { + "decimal": "271950", + "rational": [ + [1, [271950]], + [1, [1]] + ], + "fraction": { + "numer": "271950", + "denom": "1" + } + }, + "conf_settings": null + } + ], + "NMC": [ + { + "coin": "NMC", + "address": { + "address_type": "Transparent", + "address_data": "MzYv2Nn8H5RYSz8E4PMkngpQJT5ruqWV4N" + }, + "price": { + "decimal": "80000", + "rational": [ + [1, [80000]], + [1, [1]] + ], + "fraction": { + "numer": "80000", + "denom": "1" + } + }, + "pubkey": "0261eef15cbc141f555aff1aa40fb21de17a0a9e6897eee18c14c6032586b456b3", + "uuid": "87e3e99c-481f-46cc-9a64-ccc89ba5e434", + "is_mine": false, + "base_max_volume": { + "decimal": "0.025", + "rational": [ + [1, [1]], + [1, [40]] + ], + "fraction": { + "numer": "1", + "denom": "40" + } + }, + "base_min_volume": { + "decimal": "0.000000097125", + "rational": [ + [1, [777]], + [1, [3705032704, 1]] + ], + "fraction": { + "numer": "777", + "denom": "8000000000" + } + }, + "rel_max_volume": { + "decimal": "2000", + "rational": [ + [1, [2000]], + [1, [1]] + ], + "fraction": { + "numer": "2000", + "denom": "1" + } + }, + "rel_min_volume": { + "decimal": "0.00777", + "rational": [ + [1, [777]], + [1, [100000]] + ], + "fraction": { + "numer": "777", + "denom": "100000" + } + }, + "conf_settings": null + } + ], + "DOGE": [ + { + "coin": "DOGE", + "address": { + "address_type": "Transparent", + "address_data": "D97eMzDnf7EGTT4KXA2k7vq6TMR7JDpe1D" + }, + "price": { + "decimal": "20000000", + "rational": [ + [1, [20000000]], + [1, [1]] + ], + "fraction": { + "numer": "20000000", + "denom": "1" + } + }, + "pubkey": "0261eef15cbc141f555aff1aa40fb21de17a0a9e6897eee18c14c6032586b456b3", + "uuid": "14de5083-daee-4d82-bc41-ac809076bf5f", + "is_mine": false, + "base_max_volume": { + "decimal": "0.02074779", + "rational": [ + [1, [2074779]], + [1, [100000000]] + ], + "fraction": { + "numer": "2074779", + "denom": "100000000" + } + }, + "base_min_volume": { + "decimal": "0.00777", + "rational": [ + [1, [777]], + [1, [100000]] + ], + "fraction": { + "numer": "777", + "denom": "100000" + } + }, + "rel_max_volume": { + "decimal": "414955.8", + "rational": [ + [1, [2074779]], + [1, [5]] + ], + "fraction": { + "numer": "2074779", + "denom": "5" + } + }, + "rel_min_volume": { + "decimal": "155400", + "rational": [ + [1, [155400]], + [1, [1]] + ], + "fraction": { + "numer": "155400", + "denom": "1" + } + }, + "conf_settings": null + } + ], + "ETH": [ + { + "coin": "ETH", + "address": { + "address_type": "Transparent", + "address_data": "0xe5e6d27100474d34cc0f87ee387756395019019c" + }, + "price": { + "decimal": "400000", + "rational": [ + [1, [400000]], + [1, [1]] + ], + "fraction": { + "numer": "400000", + "denom": "1" + } + }, + "pubkey": "0261eef15cbc141f555aff1aa40fb21de17a0a9e6897eee18c14c6032586b456b3", + "uuid": "19220788-3643-4fb2-9445-e13515ef811e", + "is_mine": false, + "base_max_volume": { + "decimal": "0.11209544", + "rational": [ + [1, [1401193]], + [1, [12500000]] + ], + "fraction": { + "numer": "1401193", + "denom": "12500000" + } + }, + "base_min_volume": { + "decimal": "0.0081585", + "rational": [ + [1, [16317]], + [1, [2000000]] + ], + "fraction": { + "numer": "16317", + "denom": "2000000" + } + }, + "rel_max_volume": { + "decimal": "44838.176", + "rational": [ + [1, [5604772]], + [1, [125]] + ], + "fraction": { + "numer": "5604772", + "denom": "125" + } + }, + "rel_min_volume": { + "decimal": "3263.4", + "rational": [ + [1, [16317]], + [1, [5]] + ], + "fraction": { + "numer": "16317", + "denom": "5" + } + }, + "conf_settings": null + } + ] + }, + "original_tickers": { + "MONA": ["MONA-segwit"], + "NMC": ["NMC-segwit"], + "LTC": ["LTC-segwit"], + "PIC": ["PIC-segwit"], + "LCC": ["LCC-segwit"], + "BSTY": ["BSTY-segwit"], + "BTC": ["BTC-segwit"], + "PPC": ["PPC-segwit"], + "GLEEC-OLD": ["GLEEC-OLD-segwit"], + "LBC": ["LBC-segwit"], + "BTE": ["BTE-segwit"], + "VTC": ["VTC-segwit"], + "LTFN": ["LTFN-segwit"], + "SYS": ["SYS-segwit"], + "BTX": ["BTX-segwit"], + "tBTC-TEST": ["tBTC-TEST-segwit"], + "CDN": ["CDN-segwit"], + "FTC": ["FTC-segwit"], + "GRS": ["GRS-segwit"], + "RIC": ["RIC-segwit"], + "XMY": ["XMY-segwit"], + "VIA": ["VIA-segwit"], + "WHIVE": ["WHIVE-segwit"], + "XEP": ["XEP-segwit"], + "FJC": ["FJC-segwit"], + "WCN": ["WCN-segwit"], + "QTUM": ["QTUM-segwit"], + "tQTUM": ["tQTUM-segwit"], + "DGB": ["DGB-segwit"] + } + }, + "id": null + } + ``` + + + + #### Error Responses + + `InvalidRequest` - Invalid type (`number` value must be integer) + `InvalidRequest` - Invalid type (type must be either `volume` or `number`, action mut be either `buy` or `sell`) + `CoinIsWalletOnly` - Wallet only coins can not be traded. + `P2PError` - There is a connection problem. + +export const title = "AtomicDEX Method: Enable BCH with Tokens"; +export const description = "Using this method, you can enable BCH/tBCH along with multiple SLP tokens in a single command."; + +# enable\_bch\_with\_tokens + +The AtomicDEX-API supports Bitcoin Cash SLP tokens. Using this method, you can enable BCH/tBCH along with multiple SLP tokens in a single command. + +### Request Parameters + +| Parameter | Type | Description | +| ------------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of the platform protocol coin. Options: `BCH` or `tBCH` | +| bchd\_urls | array of strings | A list of BCHD gRPC API server URLs, used for validation of SLP token transactions. It's recommended to add as many servers as possible. The URLs list can be found at [https://bchd.fountainhead.cash/](https://bchd.fountainhead.cash/). | +| mode | object | A standard [ActivationMode](/atomicdex/api/common_structures/activation/#activation-mode) object. | +| tx\_history | boolean | If `true`, spawns a background loop to store the local cache of address(es) transactions. Defaults to `false`. | +| slp\_tokens\_requests | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/nfts/#tokens-request) objects. | +| address\_format | object | Optional. Overwrites the address format from coins file, if set. A standard [AddressFormat](/atomicdex/api/common_structures/#address-format) object. | +| allow\_slp\_unsafe\_conf | boolean | Optional, defaults to `false`. If `true`, allows bchd\_urls to be empty. **Warning:** it is highly unsafe to do so as it may lead to invalid SLP transactions generation and tokens burning. | +| get\_balances | boolean | Optional, defaults to `true`. If `false`, coin and token balances will not be returned in the response, and the response will be returned more quickly. | +| required\_confirmations | integer | Optional, defaults to value in the coins file, or `3` if not set. Confirmations to wait for steps in swap. | +| requires\_notarization | boolean | Optional, defaults to `true`. Has no effect on BCH. | +| tx\_history | boolean | Optional, defaults to `true`. If `true` the AtomicDEX API will preload transaction history as a background process. Must be set to `true` to use the [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method | +| utxo\_merge\_params | object | A standard [UtxoMergeParams](/atomicdex/api/common_structures/activation/#utxo-merge-params) object. Used to reduce a wallet's UTXO count in cases where it is causing significantly slower RPC responses. | + +### Response Parameters + +| Parameter | Type | Description | +| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| current\_block | integer | Block height of the coin being activated | +| bch\_addresses\_infos | object | A standard [AddressInfo](/atomicdex/api/common_structures/#address-info) object. Note: the structure may vary based on the value of the `get_balances` parameter. | +| slp\_addresses\_infos | object | A standard [AddressInfo](/atomicdex/api/common_structures/#address-info) object. Note: the structure may vary based on the value of the `get_balances` parameter. | + + + bch\_addresses\_infos and slp\_addresses\_infos are the same. This should be consolidated in the api. + + +### 📌 Examples + +#### Request with tx\_history, cashaddress format, and automated utxo merging. + + + ```json + { + "userpass": "testpsw", + "method": "enable_bch_with_tokens", + "mmrpc": "2.0", + "params": { + "ticker": "BCH", + "allow_slp_unsafe_conf": false, + "bchd_urls": [ + "https://bchd.imaginary.cash:8335/" + ], + "mode": { + "rpc": "Electrum", + "rpc_data": { + "servers": [ + { + "url": "electrum1.cipig.net:10055" + }, + { + "url": "electrum3.cipig.net:20055", + "protocol": "SSL" + } + ] + } + }, + "tx_history": true, + "slp_tokens_requests": [ + { + "ticker": "ASLP-SLP", + "required_confirmations": 4 + } + ], + "required_confirmations": 5, + "requires_notarization": false, + "address_format": { + "format": "cashaddress", + "network": "bitcoincash" + }, + "utxo_merge_params": { + "merge_at": 50, + "check_every": 10, + "max_merge_at_once": 25 + } + } + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "current_block": 1480481, + "bch_addresses_infos": { + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "balances": { + "spendable": "0.11398301", + "unspendable": "0.00001" + } + } + }, + "slp_addresses_infos": { + "simpleledger:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5va3wuz4v": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "036879df230663db4cd083c8eeb0f293f46abc460ad3c299b0089b72e6d472202c", + "balances": { + "ASLP": { + "spendable": "5.2974", + "unspendable": "0" + } + } + } + } + }, + "id": null + } + ``` + + +#### Request with `get_balances` set to false + + + ```json + { + "userpass": "testpsw", + "method": "enable_bch_with_tokens", + "mmrpc": "2.0", + "params": { + "ticker": "BCH", + "allow_slp_unsafe_conf": false, + "bchd_urls": [ + "https://bchd.imaginary.cash:8335/" + ], + "mode": { + "rpc": "Electrum", + "rpc_data": { + "servers": [ + { + "url": "electrum1.cipig.net:10055" + }, + { + "url": "electrum3.cipig.net:20055", + "protocol": "SSL" + } + ] + } + }, + "tx_history": true, + "get_balances": false, + "slp_tokens_requests": [ + { + "ticker": "ASLP-SLP", + "required_confirmations": 4 + } + ] + } + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "current_block": 791267, + "bch_addresses_infos": { + "bitcoincash:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5qx64fztj": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2" + } + }, + "slp_addresses_infos": { + "simpleledger:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5va3wuz4v": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "03d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2", + "tickers": ["ASLP-SLP"] + } + } + }, + "id": null + } + ``` + + + + ### Error Types + + | Structure | Type | Description | + | -------------------------- | ------ | ----------------------------------------------------------------------------------- | + | CoinProtocolParseError | string | Parsing the protocol of the platform coin you are trying to activate failed | + | InternalError | string | The request was failed due to an AtomicDEX API internal error | + | PlatformCoinCreationError | string | There was an error when trying to activate the platform coin | + | PlatformConfigIsNotFound | string | Config of the platform coin you are trying to activate is not found | + | PlatformIsAlreadyActivated | string | The platform coin you are trying to activate is already activated | + | PrivKeyNotAllowed | string | The privkey is not allowed | + | TokenConfigIsNotFound | string | Config of the token you are trying to activate is not found | + | TokenProtocolParseError | string | Parsing the protocol of the token you are trying to activate failed | + | Transport | string | The request was failed due to a network error | + | UnexpectedDerivationMethod | string | The derivation method used is unexpected | + | UnexpectedPlatformProtocol | string | Unexpected platform protocol found for the platform coin you are trying to activate | + | UnexpectedTokenProtocol | string | Unexpected protocol is found in the config of the token you are trying to activate | + + #### PlatformIsAlreadyActivated Error + + In this case, you need to [disable](/atomicdex/api/legacy/disable_coin/) BCH and try again. + + ```json + { + "mmrpc": "2.0", + "error": "BCH", + "error_path": "platform_coin_with_tokens", + "error_trace": "platform_coin_with_tokens:281]", + "error_type": "PlatformIsAlreadyActivated", + "error_data": "BCH", + "id": null + } + ``` + + #### PlatformConfigIsNotFound Error + + ```json + { + "mmrpc": "2.0", + "error": "Platform BCH-wrong config is not found", + "error_path": "platform_coin_with_tokens.prelude", + "error_trace": "platform_coin_with_tokens:286] prelude:56]", + "error_type": "PlatformConfigIsNotFound", + "error_data": "BCH-wrong", + "id": null + } + ``` + + #### UnexpectedPlatformProtocol Error + + ```json + { + "mmrpc": "2.0", + "error": "Unexpected platform protocol UTXO for BTC", + "error_path": "platform_coin_with_tokens.prelude.bch_with_tokens_activation", + "error_trace": "platform_coin_with_tokens:286] prelude:67] bch_with_tokens_activation:127]", + "error_type": "UnexpectedPlatformProtocol", + "error_data": { + "ticker": "BTC", + "protocol": { + "type": "UTXO" + } + }, + "id": null + } + ``` + + #### UnexpectedTokenProtocol Error + + ```json + { + "mmrpc": "2.0", + "error": "Unexpected token protocol ERC20 { platform: \"ETH\", contract_address: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\" } for USDT-ERC20", + "error_path": "platform_coin_with_tokens.prelude.slp_token_activation", + "error_trace": "platform_coin_with_tokens:301] platform_coin_with_tokens:114] prelude:67] slp_token_activation:47]", + "error_type": "UnexpectedTokenProtocol", + "error_data": { + "ticker": "USDT-ERC20", + "protocol": { + "type": "ERC20", + "protocol_data": { + "platform": "ETH", + "contract_address": "0xdAC17F958D2ee523a2206206994597C13D831ec7" + } + } + }, + "id": null + } + ``` + + #### PlatformCoinCreationError Error + + ```json + { + "mmrpc": "2.0", + "error": "Error Using empty bchd_urls is unsafe for SLP users! on platform coin BCH creation", + "error_path": "platform_coin_with_tokens.bch_with_tokens_activation", + "error_trace": "platform_coin_with_tokens:290] bch_with_tokens_activation:212]", + "error_type": "PlatformCoinCreationError", + "error_data": { + "ticker": "BCH", + "error": "Using empty bchd_urls is unsafe for SLP users!" + }, + "id": null + } + ``` + + #### PlatformCoinCreationError Error (native) + + ```json + { + "mmrpc": "2.0", + "error": "Error bch:633] utxo:1704] utxo:995] Error parsing the native wallet configuration '/home/user/.Bitcoin Cash Testnet/Bitcoin Cash Testnet.conf': No such file or directory (os error 2) on platform coin tBCH creation", + "error_path": "platform_coin_with_tokens.bch_with_tokens_activation", + "error_trace": "platform_coin_with_tokens:290] bch_with_tokens_activation:212]", + "error_type": "PlatformCoinCreationError", + "error_data": { + "ticker": "tBCH", + "error": "bch:633] utxo:1704] utxo:995] Error parsing the native wallet configuration '/home/user/.Bitcoin Cash Testnet/Bitcoin Cash Testnet.conf': No such file or directory (os error 2)" + }, + "id": null + } + ``` + + #### PlatformCoinCreationError Error (Electrum server not responding) + + ```json + { + "mmrpc": "2.0", + "error": "Error bch:633] utxo:1667] Failed to connect to at least 1 of [ElectrumRpcRequest { url: \"bch0.kister.net:5100\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"testnet.imaginary.cash:5000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"blackie.c3-soft.com:6000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"tbch.loping.net:6000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"electroncash.de:5000\", protocol: TCP, disable_cert_verification: false }] in 5 seconds. on platform coin tBCH creation", + "error_path": "platform_coin_with_tokens.bch_with_tokens_activation", + "error_trace": "platform_coin_with_tokens:290] bch_with_tokens_activation:212]", + "error_type": "PlatformCoinCreationError", + "error_data": { + "ticker": "tBCH", + "error": "bch:633] utxo:1667] Failed to connect to at least 1 of [ElectrumRpcRequest { url: \"bch0.kister.net:5100\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"testnet.imaginary.cash:5000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"blackie.c3-soft.com:6000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"tbch.loping.net:6000\", protocol: TCP, disable_cert_verification: false }, ElectrumRpcRequest { url: \"electroncash.de:5000\", protocol: TCP, disable_cert_verification: false }] in 5 seconds." + }, + "id": null + } + ``` + +export const title = "AtomicDEX Method: Enable ERC20"; +export const description = + "The enable_erc20 method allows you to activate additional ERC20 like tokens of a EVM type platform coin."; + +# enable\_erc20 + +The `enable_erc20` method allows you to activate additional ERC20 like tokens of a EVM type platform coin. Before using this method, you first need to use the [enable\_eth\_with\_tokens](/atomicdex/api/v20/enable_eth_with_tokens/) method. + +| parameter | Type | Description | +| ------------------------------------------ | ------- | -------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of the ERC20 like token coin. | +| activation\_params.required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | + + + ```json + { + "userpass": "testpsw", + "method": "enable_erc20", + "mmrpc": "2.0", + "params": { + "ticker": "BAT-ERC20", + "activation_params": { + "required_confirmations": 3 + } + } + } + ``` + + +## Response + +```json +{ + "mmrpc": "2.0", + "result": { + "balances": { + "0x0d317904AF3BA3A993d557b6cba147FEA4DeB57E": { + "spendable": "0", + "unspendable": "0" + } + }, + "platform_coin": "ETH", + "token_contract_address": "0x0d8775f648430679a709e98d2b0cb6250d2887ef", + "required_confirmations": 3 + }, + "id": null +} +``` + +## Error - Platform coin is not yet activated + +```json +{ + "mmrpc": "2.0", + "error": "Platform coin ETH is not activated", + "error_path": "token.lp_coins", + "error_trace": "token:126] lp_coins:2797]", + "error_type": "PlatformCoinIsNotActivated", + "error_data": "ETH", + "id": null +} +``` + +## Error - Token already activated + +```json +{ + "mmrpc": "2.0", + "error": "Token BAT-ERC20 is already activated", + "error_path": "token", + "error_trace": "token:119]", + "error_type": "TokenIsAlreadyActivated", + "error_data": "BAT-ERC20", + "id": null +} +``` + +## Error - Token config not found in coins file + +```json +{ + "mmrpc": "2.0", + "error": "Token BATT-ERC20 config is not found", + "error_path": "token.prelude", + "error_trace": "token:122] prelude:79]", + "error_type": "TokenConfigIsNotFound", + "error_data": "BATT-ERC20", + "id": null +} +``` +export const title = "AtomicDEX Method: Enable ETH with Tokens"; +export const description = "The enable_eth_with_tokens method allows you to enable a platform coin like ETH along with multiple ERC20 like tokens of the platform coin chain in a single command."; + +# enable\_eth\_with\_tokens + +The AtomicDEX-API supports ETH(Ethereum) and many other EVM type platform coins like AVAX(Avalanche), BNB(Binance), FTM(Fantom), MATIC(Polygon), ONE(Harmony), ETH-ARB20(Arbitrum). +Additionally, it supports ERC20 tokens on the ETH chain and associated ERC20 like tokens on the rest of the platform coin chains.Using this method, you can enable a platform coin along with multiple ERC20 like tokens of the platform coin chain in a single command. + +### Request Parameters + +| Parameter | Type | Description | +| --------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of the platform protocol coin. Options: `ETH`, `AVAX`, `BNB`, `FTM`, `MATIC`, `ONE`, `ETH-ARB20` | +| mm2 | integer | Required if not set in `coins` file. Informs the AtomicDEX API whether or not the coin is expected to function. Accepted values are `0` or `1` | +| swap\_contract\_address | string | Address of etomic swap smart contract | +| fallback\_swap\_contract | string | Address of backup etomic swap smart contract | +| nodes | array of objects | A list of standard [EvmNode](/atomicdex/api/common_structures/activation/#evm-node) objects. | +| erc20\_tokens\_requests | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/nfts/#tokens-request) objects. | +| gas\_station\_decimals | integer | Optional, for ETH/ERC20 and other gas model chains. Defaults to `8`. Defines the decimals used to denominate the gas station response to gwei units. For example, the ETH gas station uses 8 decimals, which means that "average": 860 is equal to 86 gwei. While the Matic gas station uses 9 decimals, so 860 would mean 860 gwei exactly. | +| gas\_station\_policy.policy | string | Optional, for ETH/ERC20 and other gas model chains. Defaults to `"MeanAverageFast"`. Defines the method of gas price calculation from the station response. `"MeanAverageFast"` will use the mean between average and fast fields. `"Average"` will return a simple average value. | +| get\_balances | boolean | Optional, defaults to `true`. If `false`, coin and token balances will not be returned in the response, and the response will be returned more quickly. | +| priv\_key\_policy | string | Optional, defaults to `ContextPrivKey`. value can be `ContextPrivKey`,`Trezor` when AtomicDEX-API is built for native platforms. value can be `ContextPrivKey`, `Trezor`, `Metamask` when the AtomicDEX-API is built targeting `wasm` | +| required\_confirmations | integer | Optional, defaults to `3`. When the platform coin is involved, the number of confirmations for the AtomicDEX API to wait during the transaction steps of an atomic swap | +| requires\_notarization | boolean | Optional, defaults to `false`. If `true`, coins protected by [Komodo Platform's dPoW security](https://satindergrewal.medium.com/delayed-proof-of-work-explained-9a74250dbb86) will wait for a notarization before progressing to the next atomic swap transactions step. | +| rpc\_mode | string | Optional, defaults to `Http`, value can be `Metamask` when the AtomicDEX-API is built targeting `wasm` | +| tx\_history | boolean | Optional, defaults to `false`. If `true` the AtomicDEX API will preload transaction history as a background process. Must be set to `true` to use the [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method | + +### Response Parameters + +| Parameter | Type | Description | +| ----------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| current\_block | integer | Block height of the coin being activated | +| eth\_addresses\_infos | object | A standard [AddressInfo](/atomicdex/api/common_structures/#address-info) object. Note: the structure may vary based on the value of the `get_balances` parameter. | +| erc20\_addresses\_infos | object | A standard [AddressInfo](/atomicdex/api/common_structures/#address-info) object. Note: the structure may vary based on the value of the `get_balances` parameter. | + +### 📌 Examples + +#### Request including optional gas station parameters + + + ```json + { + "userpass": "testpsw", + "method": "enable_eth_with_tokens", + "mmrpc": "2.0", + "params": { + "ticker": "ETH", + "gas_station_url": "https://ethgasstation.info/json/ethgasAPI.json", + "gas_station_decimals": 8, + "gas_station_policy": { + "policy": "MeanAverageFast" + }, + "mm2": 1, + "priv_key_policy": "ContextPrivKey", + "swap_contract_address": "0x24ABE4c71FC658C91313b6552cd40cD808b3Ea80", + "fallback_swap_contract": "0x8500AFc0bc5214728082163326C2FF0C73f4a871", + "nodes": [ + { + "url": "http://eth1.cipig.net:8555", + "gui_auth": false + }, + { + "url": "https://node.komodo.earth:8080/ethereum", + "gui_auth": true + } + ], + "rpc_mode": "Http", + "tx_history": true, + "erc20_tokens_requests": [ + { + "ticker": "APE-ERC20", + "required_confirmations": 4 + }, + { + "ticker": "BCH-ERC20", + "required_confirmations": 4 + }, + { + "ticker": "MINDS-ERC20", + "required_confirmations": 4 + }, + { + "ticker": "BUSD-ERC20", + "required_confirmations": 4 + } + ], + "required_confirmations": 5, + "requires_notarization": false + } + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "current_block": 16145371, + "eth_addresses_infos": { + "0x0d317904AF3BA3A993d557b6cba147FEA4DeB57E": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "042e6e6b1ca76a7cd1fd2e1ed13bdc83909ad17b17748781308abe55caf863bec6dac19a0ead812d54c8c07508e2f30a258628832c1337f4fdd423a879f67bc823", + "balances": { + "spendable": "0", + "unspendable": "0" + } + } + }, + "erc20_addresses_infos": { + "0x0d317904AF3BA3A993d557b6cba147FEA4DeB57E": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "042e6e6b1ca76a7cd1fd2e1ed13bdc83909ad17b17748781308abe55caf863bec6dac19a0ead812d54c8c07508e2f30a258628832c1337f4fdd423a879f67bc823", + "balances": { + "MINDS-ERC20": { + "spendable": "0", + "unspendable": "0" + }, + "APE-ERC20": { + "spendable": "0", + "unspendable": "0" + }, + "BUSD-ERC20": { + "spendable": "0", + "unspendable": "0" + }, + "BCH-ERC20": { + "spendable": "0", + "unspendable": "0" + } + } + } + } + }, + "id": null + } + ``` + + +#### Request with `get_balances` set to false + + + ```json + { + "userpass": "testpsw", + "method": "enable_eth_with_tokens", + "mmrpc": "2.0", + "params": { + "ticker": "MATIC", + "get_balances": false, + "tx_history": false, + "gas_station_url": "https://gasstation-mainnet.matic.network/", + "swap_contract_address": "0x9130b257D37A52E52F21054c4DA3450c72f595CE", + "fallback_swap_contract": "0x9130b257D37A52E52F21054c4DA3450c72f595CE", + "nodes": [ + { + "url": "https://polygon-rpc.com" + }, + { + "url": "https://poly-rpc.gateway.pokt.network" + } + ], + "erc20_tokens_requests": [ + { + "ticker": "PGX-PLG20", + "required_confirmations": 4 + }, + { + "ticker": "AAVE-PLG20", + "required_confirmations": 4 + } + ], + "required_confirmations": 5, + "requires_notarization": false + } + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "current_block": 42328813, + "eth_addresses_infos": { + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "04d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2a91c9ce32b6fc5489c49e33b688423b655177168afee1b128be9b2fee67e3f3b" + } + }, + "erc20_addresses_infos": { + "0xaB95D01Bc8214E4D993043E8Ca1B68dB2c946498": { + "derivation_method": { + "type": "Iguana" + }, + "pubkey": "04d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2a91c9ce32b6fc5489c49e33b688423b655177168afee1b128be9b2fee67e3f3b", + "tickers": ["AAVE-PLG20", "PGX-PLG20"] + } + } + }, + "id": null + } + ``` + + + + ### Error Types + + | Structure | Type | Description | + | -------------------------- | ------ | ----------------------------------------------------------------------------------- | + | CoinProtocolParseError | string | Parsing the protocol of the platform coin you are trying to activate failed | + | InternalError | string | The request was failed due to an AtomicDEX API internal error | + | PlatformCoinCreationError | string | There was an error when trying to activate the platform coin | + | PlatformConfigIsNotFound | string | Config of the platform coin you are trying to activate is not found | + | PlatformIsAlreadyActivated | string | The platform coin you are trying to activate is already activated | + | PrivKeyNotAllowed | string | The privkey is not allowed | + | TokenConfigIsNotFound | string | Config of the token you are trying to activate is not found | + | TokenProtocolParseError | string | Parsing the protocol of the token you are trying to activate failed | + | Transport | string | The request was failed due to a network error | + | UnexpectedDerivationMethod | string | The derivation method used is unexpected | + | UnexpectedPlatformProtocol | string | Unexpected platform protocol found for the platform coin you are trying to activate | + | UnexpectedTokenProtocol | string | Unexpected protocol is found in the config of the token you are trying to activate | + + #### PlatformIsAlreadyActivated Error + + In this case, you need to [disable](/atomicdex/api/legacy/disable_coin/) the platform coin and try again. + + ```json + { + "mmrpc": "2.0", + "error": "ETH", + "error_path": "platform_coin_with_tokens", + "error_trace": "platform_coin_with_tokens:297]", + "error_type": "PlatformIsAlreadyActivated", + "error_data": "ETH", + "id": null + } + ``` + + #### PlatformConfigIsNotFound Error + + ```json + { + "mmrpc": "2.0", + "error": "Platform ETH config is not found", + "error_path": "platform_coin_with_tokens.prelude", + "error_trace": "platform_coin_with_tokens:302] prelude:79]", + "error_type": "PlatformConfigIsNotFound", + "error_data": "ETH", + "id": null + } + ``` + + #### CoinProtocolParseError Error + + ```json + { + "mmrpc": "2.0", + "error": "Platform coin ETH protocol parsing failed: invalid type: null, expected adjacently tagged enum CoinProtocol", + "error_path": "platform_coin_with_tokens.prelude", + "error_trace": "platform_coin_with_tokens:302] prelude:82]", + "error_type": "CoinProtocolParseError", + "error_data": { + "ticker": "ETH", + "error": "invalid type: null, expected adjacently tagged enum CoinProtocol" + }, + "id": null + } + ``` + + #### UnexpectedPlatformProtocol Error + + ```json + { + "mmrpc": "2.0", + "error": "Unexpected platform protocol QTUM for ETH", + "error_path": "platform_coin_with_tokens.prelude.eth_with_token_activation", + "error_trace": "platform_coin_with_tokens:302] prelude:90] eth_with_token_activation:64]", + "error_type": "UnexpectedPlatformProtocol", + "error_data": { "ticker": "ETH", "protocol": { "type": "QTUM" } }, + "id": null + } + ``` + + #### TokenConfigIsNotFound Error + + ```json + { + "mmrpc": "2.0", + "error": "Token BTUSD-ERC20 config is not found", + "error_path": "platform_coin_with_tokens.prelude", + "error_trace": "platform_coin_with_tokens:314] platform_coin_with_tokens:109] prelude:79]", + "error_type": "TokenConfigIsNotFound", + "error_data": "BTUSD-ERC20", + "id": null + } + ``` + + #### TokenProtocolParseError Error + + ```json + { + "mmrpc": "2.0", + "error": "Token BUSD-ERC20 protocol parsing failed: unknown variant `TERC20`, expected one of `UTXO`, `QTUM`, `QRC20`, `ETH`, `ERC20`, `SLPTOKEN`, `BCH`, `TENDERMINT`, `TENDERMINTTOKEN`, `LIGHTNING`, `SOLANA`, `SPLTOKEN`, `ZHTLC`", + "error_path": "platform_coin_with_tokens.prelude", + "error_trace": "platform_coin_with_tokens:314] platform_coin_with_tokens:109] prelude:82]", + "error_type": "TokenProtocolParseError", + "error_data": { + "ticker": "BUSD-ERC20", + "error": "unknown variant `TERC20`, expected one of `UTXO`, `QTUM`, `QRC20`, `ETH`, `ERC20`, `SLPTOKEN`, `BCH`, `TENDERMINT`, `TENDERMINTTOKEN`, `LIGHTNING`, `SOLANA`, `SPLTOKEN`, `ZHTLC`" + }, + "id": null + } + ``` + + #### UnexpectedTokenProtocol Error + + ```json + { + "mmrpc": "2.0", + "error": "Unexpected token protocol QRC20 { platform: \"ETH\", contract_address: \"0x4Fabb145d64652a948d72533023f6E7A623C7C53\" } for BUSD-ERC20", + "error_path": "platform_coin_with_tokens.prelude.erc20_token_activation", + "error_trace": "platform_coin_with_tokens:314] platform_coin_with_tokens:109] prelude:90] erc20_token_activation:58]", + "error_type": "UnexpectedTokenProtocol", + "error_data": { + "ticker": "BUSD-ERC20", + "protocol": { + "type": "QRC20", + "protocol_data": { + "platform": "ETH", + "contract_address": "0x4Fabb145d64652a948d72533023f6E7A623C7C53" + } + } + }, + "id": null + } + ``` + +export const title = "AtomicDEX Method: Enable SLP"; +export const description = + "The enable_slp method allows you to activate additional SLP tokens."; + +# enable\_slp + +The `enable_slp` method allows you to activate additional SLP tokens. Before using this method, you first need to use the [enable\_bch\_with\_tokens](/atomicdex/api/v20/enable_bch_with_tokens/) method. + +| parameter | Type | Description | +| ------------------------------------------ | ------- | -------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of the SLP token. | +| activation\_params.required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | + + + ```json + { + "userpass": "testpsw", + "method": "enable_slp", + "mmrpc": "2.0", + "params": { + "ticker": "SPICE-SLP", + "activation_params": { + "required_confirmations": 3 + } + } + } + ``` + + +## Response + +```json +{ + "mmrpc": "2.0", + "result": { + "balances": { + "simpleledger:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5va3wuz4v": { + "spendable": "0", + "unspendable": "0" + } + }, + "token_id": "7f8889682d57369ed0e32336f8b7e0ffec625a35cca183f4e81fde4e71a538a1", + "platform_coin": "BCH", + "required_confirmations": 3 + }, + "id": null +} +``` + +## Error - BCH not yet activated + +```json +{ + "mmrpc": "2.0", + "error": "Platform coin BCH is not activated", + "error_path": "token.lp_coins", + "error_trace": "token:102] lp_coins:1924]", + "error_type": "PlatformCoinIsNotActivated", + "error_data": "BCH", + "id": null +} +``` + +## Error - Token already activated + +```json +{ + "mmrpc": "2.0", + "error": "Token SPICE-SLP is already activated", + "error_path": "token", + "error_trace": "token:95]", + "error_type": "TokenIsAlreadyActivated", + "error_data": "SPICE-SLP", + "id": null +} +``` + +## Error - Token config not found in coins file + +```json +{ + "mmrpc": "2.0", + "error": "Token SPICE-SLP-WRONG config is not found", + "error_path": "token.prelude", + "error_trace": "token:98] prelude:56]", + "error_type": "TokenConfigIsNotFound", + "error_data": "SPICE-SLP-WRONG", + "id": null +} +``` +export const title = "AtomicDEX Method: Enable Tendermint Token"; +export const description = + "The enable_tendermint_token method allows you to activate additional Tendermint assets."; + +# enable\_tendermint\_token + +The `enable_tendermint_token` method allows you to activate additional Tendermint assets. Before using this method, you first need to use the [enable\_tendermint\_with\_assets](/atomicdex/api/v20/enable_tendermint_with_assets/) method. + +| parameter | Type | Description | +| ------------------------------------------ | ------- | -------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of the Tendermint asset. | +| activation\_params.required\_confirmations | integer | Optional. Confirmations to wait for steps in swap. Defaults to value in the coins file if not set. | + + + ```json + { + "userpass": "testpsw", + "method": "enable_tendermint_token", + "mmrpc": "2.0", + "params": { + "ticker": "ATOM-IBC_IRIS", + "activation_params": { + "required_confirmations": 3 + } + } + } + ``` + + +## Response + +```json +{ + "mmrpc": "2.0", + "result": { + "balances": { + "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k": { + "spendable": "0.028306", + "unspendable": "0" + } + }, + "platform_coin": "IRIS" + }, + "id": null +} +``` + +## Error - Platform coin is not yet activated + +```json +{ + "mmrpc": "2.0", + "error": "Platform coin IRIS is not activated", + "error_path": "token.lp_coins", + "error_trace": "token:126] lp_coins:2847]", + "error_type": "PlatformCoinIsNotActivated", + "error_data": "IRIS", + "id": null +} +``` + +## Error - Token already activated + +```json +{ + "mmrpc": "2.0", + "error": "Token ATOM-IBC_IRIS is already activated", + "error_path": "token", + "error_trace": "token:119]", + "error_type": "TokenIsAlreadyActivated", + "error_data": "ATOM-IBC_IRIS", + "id": null +} +``` + +## Error - Token config not found in coins file + +```json +{ + "mmrpc": "2.0", + "error": "Token UP-AND-ATOM config is not found", + "error_path": "token.prelude", + "error_trace": "token:122] prelude:79]", + "error_type": "TokenConfigIsNotFound", + "error_data": "UP-AND-ATOM", + "id": null +} +``` +export const title = "AtomicDEX Method: Enable Tendermint Token with Assets"; +export const description = "Use this method to activate Tendermint coins (COSMOS/IRIS/OSMOSIS) and IBC assets in a single command."; + +# enable\_tendermint\_with\_assets + +Use this method to activate Tendermint coins (COSMOS/IRIS/OSMOSIS) and IBC assets in a single command. + +### Request Parameters + +| Parameter | Type | Description | +| ----------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of the platform protocol coin. Options: `ATOM`, `IRIS`, `OSMOSIS` | +| mm2 | integer | Required if not set in `coins` file. Informs the AtomicDEX API whether or not the coin is expected to function. Accepted values are `0` or `1` | +| tokens\_params | array of objects | A list of standard [TokensRequest](/atomicdex/api/common_structures/nfts/#tokens-request) objects. | +| priv\_key\_policy | string | Optional, defaults to `ContextPrivKey`. value can be `ContextPrivKey`,`Trezor` when AtomicDEX-API is built for native platforms. value can be `ContextPrivKey`, `Trezor`, `Metamask` when the AtomicDEX-API is built targeting `wasm` | +| tx\_history | boolean | Optional, defaults to `false`. If `true` the AtomicDEX API will preload transaction history as a background process. Must be set to `true` to use the [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method | +| required\_confirmations | integer | Optional, defaults to `3`. When the platform coin is involved, the number of confirmations for the AtomicDEX API to wait during the transaction steps of an atomic swap | +| requires\_notarization | boolean | Optional, defaults to `false`. If `true`, coins protected by [Komodo Platform's dPoW security](https://satindergrewal.medium.com/delayed-proof-of-work-explained-9a74250dbb86) will wait for a notarization before progressing to the next atomic swap transactions step. | +| get\_balances | boolean | Optional, defaults to `true`. If `false`, coin and token balances will not be returned in the response, and the response will be returned more quickly. | + +### Response Parameters + +| Parameter | Type | Description | +| ---------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| current\_block | integer | Block height of the coin being activated | +| ticker | string | Ticker of the platform protocol coin, as input in the request. | +| address | string | An address for the activated coin | +| balance | object | Only returned when `get_balances` is `true`. A standard [BalanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | +| tokens\_balances | array of objects | Only returned when `get_balances` is `true`. A list of standard [AddressInfo](/atomicdex/api/common_structures/#address-info) objects, one for each token. | +| tokens\_tickers | array | Only returned when `get_balances` is `false`. A list of each token which was activated. | + +### 📌 Examples + +#### Request default optional values + + + ```json + { + "method": "enable_tendermint_with_assets", + "mmrpc": "2.0", + "params": { + "ticker": "IRIS", + "tokens_params": [ + { + "ticker": "ATOM-IBC_IRIS" + } + ], + "rpc_urls": [ + "https://iris.komodo.earth/", + "https://rpc.irishub-1.irisnet.org" + ] + }, + "userpass": "testpsw" + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "ticker": "IRIS", + "address": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k", + "current_block": 19769638, + "balance": { + "spendable": "44.147264", + "unspendable": "0" + }, + "tokens_balances": { + "ATOM-IBC_IRIS": { + "spendable": "0.028306", + "unspendable": "0" + } + } + }, + "id": null + } + ``` + + +#### Request with `get_balances` set to `false` + + + ```json + { + "method": "enable_tendermint_with_assets", + "mmrpc": "2.0", + "params": { + "ticker": "IRIS", + "tokens_params": [ + { + "ticker": "ATOM-IBC_IRIS" + } + ], + "rpc_urls": [ + "https://iris.komodo.earth/", + "https://rpc.irishub-1.irisnet.org" + ], + "tx_history": true, + "get_balances": false + }, + "userpass": "testpsw" + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "ticker": "IRIS", + "address": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k", + "current_block": 19769628, + "tokens_tickers": ["ATOM-IBC_IRIS"] + }, + "id": null + } + ``` + + + + ### Error Types + + | Structure | Type | Description | + | -------------------------- | ------ | ----------------------------------------------------------------------------------- | + | CoinProtocolParseError | string | Parsing the protocol of the platform coin you are trying to activate failed | + | InternalError | string | The request was failed due to an AtomicDEX API internal error | + | PlatformCoinCreationError | string | There was an error when trying to activate the platform coin | + | PlatformConfigIsNotFound | string | Config of the platform coin you are trying to activate is not found | + | PlatformIsAlreadyActivated | string | The platform coin you are trying to activate is already activated | + | PrivKeyNotAllowed | string | The privkey is not allowed | + | TokenConfigIsNotFound | string | Config of the token you are trying to activate is not found | + | TokenProtocolParseError | string | Parsing the protocol of the token you are trying to activate failed | + | Transport | string | The request was failed due to a network error | + | UnexpectedDerivationMethod | string | The derivation method used is unexpected | + | UnexpectedPlatformProtocol | string | Unexpected platform protocol found for the platform coin you are trying to activate | + | UnexpectedTokenProtocol | string | Unexpected protocol is found in the config of the token you are trying to activate | + + #### PlatformConfigIsNotFound Error + + ```json + { + "mmrpc": "2.0", + "error": "Platform WALDO config is not found", + "error_path": "platform_coin_with_tokens.prelude", + "error_trace": "platform_coin_with_tokens:302] prelude:79]", + "error_type": "PlatformConfigIsNotFound", + "error_data": "WALDO", + "id": null + } + ``` + + #### PlatformIsAlreadyActivated Error + + ```json + { + "mmrpc": "2.0", + "error": "IRIS", + "error_path": "platform_coin_with_tokens", + "error_trace": "platform_coin_with_tokens:297]", + "error_type": "PlatformIsAlreadyActivated", + "error_data": "IRIS", + "id": null + } + ``` + + #### CoinProtocolParseError + + ```json + { + "mmrpc": "2.0", + "error": "Platform coin IRIS protocol parsing failed: invalid type: null, expected adjacently tagged enum CoinProtocol", + "error_path": "platform_coin_with_tokens.prelude", + "error_trace": "platform_coin_with_tokens:302] prelude:82]", + "error_type": "CoinProtocolParseError", + "error_data": { + "ticker": "IRIS", + "error": "invalid type: null, expected adjacently tagged enum CoinProtocol" + }, + "id": null + } + ``` + + ### UnexpectedPlatformProtocol Error + + ```json + { + "mmrpc": "2.0", + "error": "Unexpected platform protocol BCH { slp_prefix: \"simpleledger\" } for BCH", + "error_path": "platform_coin_with_tokens.prelude.tendermint_with_assets_activation", + "error_trace": "platform_coin_with_tokens:302] prelude:90] tendermint_with_assets_activation:92]", + "error_type": "UnexpectedPlatformProtocol", + "error_data": { + "ticker": "BCH", + "protocol": { + "type": "BCH", + "protocol_data": { + "slp_prefix": "simpleledger" + } + } + }, + "id": null + } + ``` + + ### TokenConfigIsNotFound Error + + ```json + { + "mmrpc": "2.0", + "error": "Token GALT config is not found", + "error_path": "platform_coin_with_tokens.prelude", + "error_trace": "platform_coin_with_tokens:314] platform_coin_with_tokens:109] prelude:79]", + "error_type": "TokenConfigIsNotFound", + "error_data": "GALT", + "id": null + } + ``` + + ### TokenProtocolParseError Error + + ```json + { + "mmrpc": "2.0", + "error": "Token BABYDOGE-BEP20 protocol parsing failed: unknown variant `WOOF`, expected one of `UTXO`, `QTUM`, `QRC20`, `ETH`, `ERC20`, `SLPTOKEN`, `BCH`, `TENDERMINT`, `TENDERMINTTOKEN`, `LIGHTNING`, `SOLANA`, `SPLTOKEN`, `ZHTLC`", + "error_path": "platform_coin_with_tokens.prelude", + "error_trace": "platform_coin_with_tokens:314] platform_coin_with_tokens:109] prelude:82]", + "error_type": "TokenProtocolParseError", + "error_data": { + "ticker": "BABYDOGE-BEP20", + "error": "unknown variant `WOOF`, expected one of `UTXO`, `QTUM`, `QRC20`, `ETH`, `ERC20`, `SLPTOKEN`, `BCH`, `TENDERMINT`, `TENDERMINTTOKEN`, `LIGHTNING`, `SOLANA`, `SPLTOKEN`, `ZHTLC`" + }, + "id": null + } + ``` + + ### UnexpectedTokenProtocol Error + + ```json + { + "mmrpc": "2.0", + "error": "Unexpected token protocol UTXO for KMD", + "error_path": "platform_coin_with_tokens.prelude.tendermint_with_assets_activation", + "error_trace": "platform_coin_with_tokens:314] platform_coin_with_tokens:109] prelude:90] tendermint_with_assets_activation:101]", + "error_type": "UnexpectedTokenProtocol", + "error_data": { + "ticker": "KMD", + "protocol": { + "type": "UTXO" + } + }, + "id": null + } + ``` + +export const title = "AtomicDEX Method: Get Public Key"; +export const description = "The get_public_key method returns the compressed secp256k1 pubkey corresponding to the user's seed phrase."; + +# get\_public\_key + +The `get_public_key` method returns the compressed secp256k1 pubkey corresponding to the user's seed phrase. + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| ----------- | ------ | ------------- | +| public\_key | string | User's pubkey | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "get_public_key", + "params": {}, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "public_key": "0366d28a7926fb20287132692c4cef7bc7e00e76da064948676f8549c0ed7114d3" + }, + "id": 0 + } + ``` + +export const title = "AtomicDEX Method: Get Public Key Hash"; +export const description = "The get_public_key_hash method returns the RIPEMD-160 hash version of your public key."; + +# get\_public\_key\_hash + +The `get_public_key_hash` method returns the [RIPEMD-160](https://en.bitcoin.it/wiki/RIPEMD-160) hash version of your public key + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| ----------------- | ------ | --------------------------------- | +| public\_key\_hash | string | User's RIPEMD-160 public key hash | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "get_public_key_hash", + "params": {}, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "public_key_hash": "05aab5342166f8594baf17a7d9bef5d567443327" + }, + "id": 0 + } + ``` + +export const title = "AtomicDEX Method: Get Raw Transaction"; +export const description = "The get_raw_transaction method retrieves the signed raw transaction hex for a confirmed or mempool transaction by providing the coin and tx_hash as input."; + +# get\_raw\_transaction + +The `get_raw_transaction` method takes `coin` and `tx_hash` as input, and returns the full signed raw transaction hex for any transaction that is confirmed or within the mempool. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | -------------------------------------------------------------------- | +| coin | string | the name of the coin the user desires to request for the transaction | +| tx\_hash | string | hash of the transaction | + +## Response + +| Structure | Type | Description | +| --------- | ------ | -------------------------------------------- | +| tx\_hex | string | bytes of signed transaction in string format | + +#### Examples: + +##### Request (DOC) + + + ```json + { + "mmrpc": "2.0", + "method": "get_raw_transaction", + "userpass": "testpsw", + "params": { + "coin": "DOC", + "tx_hash": "989360b0225b4e05fa13643e2e306c8eb5c52fa611615dfd30195089010b1c7b" + }, + "id": 1 + } + ``` + + + + ##### Response (success) + + ```json + { + "mmrpc":"2.0", + "result":{ + "tx_hex":"0400008085202f89025655b6fec358091a4a6b34107e69b10bd7660056d8f2a1e5f8eef0db6aec960100000000494830450221008c89db5e2d93d7674fe152e37344dfd24a0b1d4d382a7e0bcfc5d8190a141d72022050ce4ef929429e7e1a6c4ebd3f72a1a2aa25da1e0df65553a2c657658077ed1d01feffffff79cc137b70c39c9c7c2b9230c818ec684ffe731bf1ae821f91ba9d3e526f55f00000000049483045022100868c71f4a8e1452a3bc8b1d053a846959ab7df63fb0d147e9173f69818bbb1f3022060c7e045a34cf6af61bc3a74dc2db7b8bfa4949bc5919acceed40fc07d8706d201feffffff0240043a0000000000232102afdbba3e3c90db5f0f4064118f79cf308f926c68afd64ea7afc930975663e4c4ac201efc01000000001976a914347f2aedf63bac168c2cc4f075a2850435e20ac188ac96d3c96036dd0e000000000000000000000000" + }, + "id":0 + } + ``` + + +##### Request (ETH) + + + ```json + { + "mmrpc": "2.0", + "method": "get_raw_transaction", + "userpass": "testpsw", + "params": { + "coin": "ETH", + "tx_hash": "0x529aca42b6b592cca5d400832c83854135b924cada6e1c41b85f27fa0a0984b9" + }, + "id": 1 + } + ``` + + + + ##### Response (success) + + ```json + { + "mmrpc":"2.0", + "result":{ + "tx_hex":"f86e8227578503b6ed90e6825208943faaa59e42f616f859d5771cbc07a99412ae44b288026fe9cb1ec6e9a08026a08e04accc3733376cf7b8f8d51c8398fd244fca736277053a7e87093f6db67708a069cc7dbc57094c4cca7828e6f8d92a8221c457ac7b5d0b0562e9d8896f75d1a5" + }, + "id":0 + } + ``` + + + + ##### Error response (no such coin) + + ```json + { + "mmrpc": "2.0", + "error": "No such coin KMD", + "error_path": "lp_coins", + "error_trace": "lp_coins:2234] lp_coins:2156]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "KMD" + }, + "id": 0 + } + ``` + + ##### Error (invalid hash) + + ```json + { + "mmrpc": "2.0", + "error": "Invalid hash: Invalid input length", + "error_path": "utxo_common", + "error_trace": "utxo_common:1809]", + "error_type": "InvalidHashError", + "error_data": "Invalid input length", + "id": 1 + } + ``` + + ##### Error (invalid EC Signature) + + ```json + { + "mmrpc": "2.0", + "error": "Internal error: eth:3221] Crypto error (Invalid EC signature)", + "error_path": "eth", + "error_trace": "eth:543]", + "error_type": "InternalError", + "error_data": "eth:3221] Crypto error (Invalid EC signature)", + "id": 1 + } + ``` + + +## Error Types + +| Structure | Type | Description | +| ---------------- | ------ | ------------------------------------------------------------- | +| NoSuchCoin | string | The specified coin was not found or is not activated yet | +| InvalidHashError | string | The specified `hash` is not valid | +| Transport | string | The request was failed due to a network error | +| HashNotExist | string | The specified `hash` is not exist | +| InternalError | string | The request was failed due to an AtomicDEX API internal error | +export const title = "AtomicDEX Method: Get Staking Info"; +export const description = + "The get_staking_infos method returns information about your node's staking."; + +# get\_staking\_infos + +The `get_staking_infos` method returns information about your node's staking. Currently QTUM and tQTUM (test tokens avalable at `https://testnet-faucet.qtum.info/`) have been integrated, but this functionality will be expanded to more coins in future. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | --------------------- | +| coin | string | the coin being staked | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "get_staking_infos", + "params": { + "coin": "tQTUM" + }, + "id": 0 + } + ``` + + + + #### Response (not currently staking) + + ```json + { + "mmrpc": "2.0", + "result": { + "staking_infos_details": { + "type": "Qtum", + "amount": "0", + "staker": null, + "am_i_staking": false, + "is_staking_supported": true + } + }, + "id": 0 + } + ``` + + #### Response (staking active) + + ```json + { + "mmrpc": "2.0", + "result": { + "staking_infos_details": { + "type": "Qtum", + "amount": "160.16", + "staker": "qcyBHeSct7Wr4mAw18iuQ1zW5mMFYmtmBE", + "am_i_staking": true, + "is_staking_supported": true + } + }, + "id": 0 + } + ``` + +export const title = "Komodo DeFi SDK RPC Protocol v2.0"; +export const description = "Starting with version beta-2.1.3434, the Komodo DeFi SDK supports the standardized protocol format called mmrpc 2.0."; + +# Komodo DeFi SDK RPC Protocol v2.0 + +Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the Komodo DeFi SDK supports the standardized protocol format called `mmrpc 2.0`. + +It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. + +## Request + +| Structure | Type | Description | +| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the Komodo DeFi SDK RPC protocol. Must be exactly "2.0" | +| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | +| method | string | the name of the method to be invoked | +| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | +| id | number (optional) | the identifier is established by the client. Komodo DeFi SDK will reply with the same value in the Response object if the `id` field is included and not `NULL` | + +### Response (Success) + +| Structure | Type | Description | +| --------- | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the Komodo DeFi SDK RPC protocol | +| result | object | the value of this field is determined by the method invoked on Komodo DeFi SDK | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | + +### Response (Error) + +| Structure | Type | Description | +| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| error | string | the common error description | +| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | +| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | +| error\_type | string | the string error identifier used to determine the cause of the error | +| error\_data | object | an object containing the error data of the corresponding `error_type` | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | + +### 📌 Examples + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "KMD", + "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", + "amount": "10" + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", + "block_height": 0, + "timestamp": 1566472936, + "fee_details": { + "type": "Utxo", + "amount": "0.1" + }, + "coin": "DOC", + "internal_id": "" + }, + "id": 0 + } + ``` + + + + #### Response (error) + + ```json + { + "mmrpc": "2.0", + "error": "The amount 0.000005 is too small", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:301]", + "error_type": "AmountIsTooSmall", + "error_data": { + "amount": "0.000005" + }, + "id": 0 + } + ``` + +export const title = "AtomicDEX: Signing and Verifying Messages"; +export const description = "The methods in this document allow you to sign and verify messages for all coins supported by AtomicDEX."; + +# Signing\_and\_Verifying\_Messages + +Cryptographically signed messages are a useful feature which can be used to [prove ownership of an address](https://www.coindesk.com/policy/2020/05/25/craig-wright-called-fraud-in-message-signed-with-bitcoin-addresses-he-claims-to-own/). + +If your [`coins`](https://github.com/KomodoPlatform/coins) file contains the correct [`sign_message_prefix`](https://bitcoin.stackexchange.com/questions/77324/how-are-bitcoin-signed-messages-generated/77325#77325) parameter value for a coin, you can sign messages with the [AtomicDEX API](https://github.com/KomodoPlatform/komodo-defi-framework). + +```json +{ + "coin": "DOC", + "asset": "DOC", + "fname": "DOC (TESTCOIN)", + "sign_message_prefix": "Komodo Signed Message:\n", + "rpcport": 25435, + "txversion": 4, + "overwintered": 1, + "mm2": 1, + "protocol": { + "type": "UTXO" + } +} +``` + +## Sign Message + +### Arguments + +| Structure | Type | Description | +| --------- | ------ | ------------------------------- | +| coin | string | The coin to sign a message with | +| message | string | The message you want to sign | + +### Response + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------- | +| signature | string | The signature generated for the message | + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "sign_message", + "mmrpc": "2.0", + "id": 0, + "params": { + "coin": "DOC", + "message": "Between subtle shading and the absence of light lies the nuance illusion" + } + } + ``` + + +#### Response (success) + +```json +{ + "mmrpc": "2.0", + "result": { + "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=" + }, + "id": 0 +} +``` + +### ⚠ Error types + +**PrefixNotFound:** sign\_message\_prefix is not set in coin config file +**CoinIsNotFound:** Specified coin is not found +**InvalidRequest:** Message signing is not supported by the given coin type +**InternalError:** An internal error occured during the signing process + +## Verify Message + +### Arguments + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------------------------- | +| coin | string | The coin to sign a message with | +| message | string | The message input via the `sign_message` method sign | +| signature | string | The signature generated for the message | +| address | string | The address used to sign the message | + +### Response + +| Structure | Type | Description | +| --------- | ------- | ----------------------------------------------------------- | +| is\_valid | boolean | `true` is message signature is valid; `false` if it is not. | + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "verify_message", + "mmrpc": "2.0", + "id": 0, + "params": { + "coin": "DOC", + "message": "Between subtle shading and the absence of light lies the nuance illusion", + "signature": "H43eTmJxBKEPiHkrCe/8NsRidkKCIkXDxLyp30Ez/RwoApGdg89Hlvj9mTMSPGp8om5297zvdL8EVx3IdIe2swY=", + "address": "RUYJYSTuCKm9gouWzQN1LirHFEYThwzA2d" + } + } + ``` + + +#### Response (valid) + +```json +{ + "mmrpc": "2.0", + "result": { + "is_valid": true + }, + "id": 0 +} +``` + +#### Response (not valid) + +```json +{ + "mmrpc": "2.0", + "result": { + "is_valid": false + }, + "id": 0 +} +``` + +### ⚠ Error types + +**PrefixNotFound:** sign\_message\_prefix is not set in coin config +**CoinIsNotFound:** Specified coin is not found +**InvalidRequest:** Message verification is not supported by the given coin type +**InternalError:** An internal error occured during the verification process +**SignatureDecodingError:** Given signature could not be decoded +**AddressDecodingError:** Given address could not be decoded +export const title = "AtomicDEX Method: My TX History"; +export const description = "The my_tx_history method allows you to view the transaction history of coins."; + +# my\_tx\_history + +To use this method, you must activate your coin with `"tx_history": true`. The response will vary depending on the coin. +Currently only BCH & SLP tokens are supported in the master/release API. In the latest dev API, UTXO coins, QTUM, and Tendermint/Tendermint tokens are also supported. +For ZHTLC coins, you must use the [z\_coin\_tx\_history](/atomicdex/api/v20-dev/task_enable_z_coin/#z-coin-transaction-history) method. +For all other coins, use the legacy [my\_tx\_history](/atomicdex/api/legacy/my_tx_history/#my-tx-history) method. + +## Arguments + +| parameter | Type | Description | +| --------------- | ------- | ------------------------------------------------------------------------------------------------ | +| coin | string | Ticker of the coin to get history for. | +| limit | integer | Optional. Limits the number of returned transactions. Defaults to `10`. Ignored if `max = true`. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | + +#### Response + +| Structure | Type | Description | +| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| transactions | array of objects | transactions data | +| from\_id | string | the from\_id specified in the request; this value is null if from\_id was not set | +| skipped | number | the number of skipped records (i.e. the position of `from_id` in the list + 1); this value is 0 if `from_id` was not set | +| limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) | +| total | number | the total number of transactions available | +| page\_number | number | the page\_number that was set in the request | +| total\_pages | number | total pages available with the selected limit | +| current\_block | number | the number of the latest block of coin blockchain | +| sync\_status | object | A standard [SyncStatus](/atomicdex/api/common_structures/#sync-status/) object. Provides the information that helps to track the progress of transaction history preloading at background | + +## Request (BCH from page 2) + + + ```json + { + "userpass": "testpsw", + "method": "my_tx_history", + "mmrpc": "2.0", + "params": { + "coin": "BCH", + "limit": 2, + "paging_options": { + "PageNumber": 2 + } + } + } + ``` + + + + ### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "coin": "BCH", + "target": { + "type": "iguana" + }, + "current_block": 772607, + "transactions": [ + { + "tx_hex": "0100000001b7b45d92f8f3413a0e5656258e0a51f5c7e8230c0a08cef2ebec1ddbb8f7c28200000000d747304402203ca957fdfcfbba6123d78afe28b17fd4103cc04f6ada4110eb61c2a0350c29b802204215f203d583e8bcc79bd70f33af4f4e27500b5a5375efe75a1c31ec112f3c344120b3f71dbea00eeace7f09b0911de31e46f76a48036b86ccc207dac55540912e01004c6b6304dbf67563b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a914dde61fe24ea3cfa39379c475702692fa2f080900882103ed00156316c46094c0cbcf21a5ee549a1b3a50938c43096ef499ca28059edca6ac68ffffffff0133980200000000001976a91411a1563bfa55ae05fa621b2e245abe5a358c852e88acdbf67563", + "tx_hash": "e2167df56142bccdb8c620297f1b6ca3f7c8a955332838430d4d0f62530870f9", + "from": [ + "bitcoincash:ppaa62685yaucdf2a54g3rgtyc9g7yawrvvmqsfumc" + ], + "to": [ + "bitcoincash:qqg6z43mlf26up06vgdjufz6hedrtry99cvk5dgcnt" + ], + "total_amount": "0.00171035", + "spent_by_me": "0", + "received_by_me": "0.00170035", + "my_balance_change": "0.00170035", + "block_height": 766923, + "timestamp": 1668615553, + "fee_details": { + "type": "Utxo", + "coin": "BCH", + "amount": "0.00001" + }, + "coin": "BCH", + "internal_id": "e2167df56142bccdb8c620297f1b6ca3f7c8a955332838430d4d0f62530870f9", + "transaction_type": "StandardTransfer", + "confirmations": 5685 + }, + { + "tx_hex": "0100000001eccfa8c296e7b3e229be28a8ca6a5e5a7e89ee07a2d9441faaf5905679286a3c00000000d7473044022077d38ae45bb7257b152d4cb803aab62ca879cab60e9b3a7ca05ef099078e000402203106be31513c6526c14bdf40b28b4d38f78bb1958fc995e040ac4b2165d9d79141203bffadbc5bf035674f0d0f6e1d1a121fc6d404720679ff9b6610b298b41375a3004c6b6304bc847463b175210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ac6782012088a91457c7ce14c0444edc37ee52ed32b68890b0647cd3882103ed00156316c46094c0cbcf21a5ee549a1b3a50938c43096ef499ca28059edca6ac68ffffffff0163b10200000000001976a91411a1563bfa55ae05fa621b2e245abe5a358c852e88acbc847463", + "tx_hash": "98ddc27aa161967519f53cb3e91146a23b76ac4e33605f8e827c69f4d9b6de37", + "from": [ + "bitcoincash:ppnzkha52y53d7r7qn6mq4mcmaadmxzj4clfgneaxv" + ], + "to": [ + "bitcoincash:qqg6z43mlf26up06vgdjufz6hedrtry99cvk5dgcnt" + ], + "total_amount": "0.00177483", + "spent_by_me": "0", + "received_by_me": "0.00176483", + "my_balance_change": "0.00176483", + "block_height": 766752, + "timestamp": 1668519015, + "fee_details": { + "type": "Utxo", + "coin": "BCH", + "amount": "0.00001" + }, + "coin": "BCH", + "internal_id": "98ddc27aa161967519f53cb3e91146a23b76ac4e33605f8e827c69f4d9b6de37", + "transaction_type": "StandardTransfer", + "confirmations": 5856 + } + ], + "sync_status": { + "state": "Finished" + }, + "limit": 2, + "skipped": 2, + "total": 16, + "total_pages": 8, + "paging_options": { + "PageNumber": 2 + } + }, + "id": null + } + ``` + + +## Request (TTT-SLP with FromId) + + + ```json + { + "userpass": "testpsw", + "method": "my_tx_history", + "mmrpc": "2.0", + "params": { + "coin": "TTT-SLP", + "limit": 2, + "paging_options": { + "FromId": "433b641bc89e1b59c22717918583c60ec98421805c8e85b064691705d9aeb970" + } + } + } + ``` + + + + ### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "coin": "TTT-SLP", + "target": { + "type": "iguana" + }, + "current_block": 772612, + "transactions": [ + { + "tx_hex": "0200000002365a29eb638da7fc57720ad6c99fdbc6cfb9c957920cfb62fd69e494b412c1c1020000006b483045022100de81bca8cfef2f95b3da8aa89edf4f5cc6cf489c565d0965b8142380ef3986f1022062d6ed47f2cd281f4860a27e835949aafbab89eeb0865fbf2280a283dfb7c417412102b9fdfedefde71b21523974b9f24a4b6a1b83c5640b839baa6eb14418cae08191ffffffffc1f73b403f893f93d95b8c7dfa1b59bb5445109d4c51107da1e08fb770e54136010000006a47304402203658375dac3b84ae17e72cf3f5157b8ad25e7caee0629fa8708868974f8d58b402206f38d016ed4e390d783627441685692d21b889d83919abd39368cba28f43f544412102b9fdfedefde71b21523974b9f24a4b6a1b83c5640b839baa6eb14418cae08191ffffffff040000000000000000406a04534c500001010453454e44205321508197ffed321c5fc9a1427e5c68b31d2c1ec92ae1c495f8acb08d8d66cd080000000000002710080000002278c569d322020000000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88ac22020000000000001976a914580af35e3553d57b4b3a2036f4959f10246e98c788ac68955e03000000001976a914580af35e3553d57b4b3a2036f4959f10246e98c788ac00000000", + "tx_hash": "7b58248f3486079951a57d6dbd41c019a83f2b876c9fa3afa6fcc5a7c595b837", + "from": ["simpleledger:qpvq4u67x4fa276t8gsrday4nugzgm5ccu4usawss8"], + "to": [ + "simpleledger:qpvq4u67x4fa276t8gsrday4nugzgm5ccu4usawss8", + "simpleledger:qrf5vpn78s7rjexrjhlwyzzeg7gw98k7t5va3wuz4v" + ], + "total_amount": "1480551016.67", + "spent_by_me": "0", + "received_by_me": "100", + "my_balance_change": "100", + "block_height": 772211, + "timestamp": 1671817336, + "fee_details": { + "type": "Utxo", + "coin": "BCH", + "amount": "0.00000482" + }, + "coin": "TTT-SLP", + "internal_id": "57b78eb912a704921640a589d8bb42bb147dfb88c3d1b4b2e3df910be6b9ab31", + "transaction_type": { + "TokenTransfer": "5321508197ffed321c5fc9a1427e5c68b31d2c1ec92ae1c495f8acb08d8d66cd" + }, + "confirmations": 402 + } + ], + "sync_status": { + "state": "Finished" + }, + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "FromId": "433b641bc89e1b59c22717918583c60ec98421805c8e85b064691705d9aeb970" + } + }, + "id": null + } + ``` + + +## Request (IRIS with limit = 50) + + + ```json + { + "userpass": "testpsw", + "method": "my_tx_history", + "mmrpc": "2.0", + "params": { + "coin": "IRIS", + "limit": 50 + } + } + ``` + + + + ### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "coin": "IRIS", + "target": { + "type": "iguana" + }, + "current_block": 18120346, + "transactions": [ + { + "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083130303030303030", + "tx_hash": "B34A8D5AD74067F01A0207DF1851A14673C859D8A6F4FB0CBE292D2104C143CA", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "total_amount": "10.044559", + "spent_by_me": "10.044559", + "received_by_me": "10", + "my_balance_change": "-0.044559", + "block_height": 18120218, + "timestamp": 1673016440, + "fee_details": { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.044559", + "gas_limit": 100000 + }, + "coin": "IRIS", + "internal_id": "4644373032304131304637363034374441354438413433420000000000000000", + "transaction_type": "StandardTransfer", + "memo": "while you are out, buy milk", + "confirmations": 129 + }, + { + "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a696161317a78733476776c36326b687174376e7a7276687a676b34377467366365706677707a673537711a4d0a446962632f3237333934464230393244324543434435363132334337344633364534433146393236303031434541444139434139374541363232423235463431453545423212053130303030", + "tx_hash": "09ADDD3427A3BA4B0A94023456DF534DB5B9B6821EC17C7C1B2C168EFCF49F26", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": [], + "total_amount": "0.051788", + "spent_by_me": "0.051788", + "received_by_me": "0", + "my_balance_change": "-0.051788", + "block_height": 17996530, + "timestamp": 1672232661, + "fee_details": { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.051788", + "gas_limit": 100000 + }, + "coin": "IRIS", + "internal_id": "0000000000000000303941444444333432374133424134423041393430323334", + "transaction_type": "FeeForTokenTx", + "memo": null, + "confirmations": 123817 + }, + { + "tx_hex": "0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1240343133433843414333434142363945454632344432423643414238314146454344383044413745323731433237343637453142324635463337314446353241441a4061353539343834666536316665383630326465383632353964643263663031613865393437306437666635346262323536336233393035646462366238366535", + "tx_hash": "4E30C074CED6825F3E1B6584C376A426C20FDEFC9A22EB17D8E7DA4139FA0AEB", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": [], + "total_amount": "182.742425", + "spent_by_me": "0.053103", + "received_by_me": "182.689322", + "my_balance_change": "182.636219", + "block_height": 17981793, + "timestamp": 1672138900, + "fee_details": { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.053103", + "gas_limit": 100000 + }, + "coin": "IRIS", + "internal_id": "3438353642314533463532383644454334373043303345340000000000000000", + "transaction_type": { + "CustomTendermintMsg": { + "msg_type": "SignClaimHtlc", + "token_id": null + } + }, + "memo": null, + "confirmations": 138554 + } + ], + "sync_status": { + "state": "NotStarted" + }, + "limit": 50, + "skipped": 0, + "total": 3, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": null + } + ``` + + +## Error cases + +### Error - Coin not active + +```json +{ + "mmrpc": "2.0", + "error": "TTT-SLP", + "error_path": "my_tx_history_v2.lp_coins", + "error_trace": "my_tx_history_v2:389] lp_coins:2847]", + "error_type": "CoinIsNotActive", + "error_data": "TTT-SLP", + "id": null +} +``` + +### Error - Coin not compatible + +```json +{ + "mmrpc": "2.0", + "error": "TTT-SLP", + "error_path": "my_tx_history_v2", + "error_trace": "my_tx_history_v2:336]", + "error_type": "NotSupportedFor", + "error_data": "TTT-SLP", + "id": null +} +``` + +### Error - Coin enabled without tx\_history = true + +```json +{ + "mmrpc": "2.0", + "error": "Storage is not initialized for TTT-SLP", + "error_path": "my_tx_history_v2", + "error_trace": "my_tx_history_v2:343]", + "error_type": "StorageIsNotInitialized", + "error_data": "Storage is not initialized for TTT-SLP", + "id": null +} +``` + +### Error - Local database failed + +```json +{ + "mmrpc": "2.0", + "error": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))", + "error_path": "my_tx_history_v2.sql_tx_history_storage", + "error_trace": "my_tx_history_v2:351] sql_tx_history_storage:472]", + "error_type": "StorageError", + "error_data": "SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some(\"no such column: block_height\"))", + "id": null +} +``` +export const title = "AtomicDEX Method: Orderbook v2"; +export const description = "The orderbook method requests from the network the currently available orders for the specified trading pair."; + +# orderbook + +**orderbook base rel** + +The v2 `orderbook` method requests from the network the currently available orders for the specified trading pair. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ---------------------------------------------------- | +| base | string | Base currency of a pair | +| rel | string | Related currency, also known as the "quote currency" | + +## Response + +| Structure | Type | Description | +| ---------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| base | string | The name of the coin the user desires to receive | +| rel | string | The name of the coin the user will trade | +| numasks | integer | The number of outstanding asks | +| numbids | integer | The number of outstanding bids | +| netid | integer | The id of the network on which the request is made (default is `8762`) | +| asks | array of objects | An array of standard [OrderDataV2](/atomicdex/api/common_structures/orders/#order-data-v2) objects containing outstanding asks | +| bids | array of objects | An array of standard [OrderDataV2](/atomicdex/api/common_structures/orders/#order-data-v2) objects containing outstanding bids | +| timestamp | integer | A UNIX timestamp representing when the orderbook was requested | +| total\_asks\_base\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | +| total\_asks\_rel\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | +| total\_bids\_base\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | +| total\_bids\_rel\_vol | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object. | + +#### 📌 Examples + +#### Command + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "orderbook", + "params": { + "base": "DGB", + "rel": "DASH" + }, + "id": 42 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "asks": [ + { + "coin": "DGB", + "address": { + "address_type": "Transparent", + "address_data": "DEsCggcN3WNmaTkF2WpqoMQqx4JGQrLbPS" + }, + "price": { + "decimal": "0.0002658065", + "rational": [ + [1, [531613]], + [1, [2000000000]] + ], + "fraction": { + "numer": "531613", + "denom": "2000000000" + } + }, + "pubkey": "03de96cb66dcfaceaa8b3d4993ce8914cd5fe84e3fd53cefdae45add8032792a12", + "uuid": "1115d7f2-a7b9-4ab1-913f-497db2549a2b", + "is_mine": false, + "base_max_volume": { + "decimal": "90524.256020352", + "rational": [ + [1, [2846113615, 164]], + [1, [7812500]] + ], + "fraction": { + "numer": "707220750159", + "denom": "7812500" + } + }, + "base_min_volume": { + "decimal": "0.3762135237475381527539770472129161626973004798603495399849138376977237200745655204067620618758382508", + "rational": [ + [1, [200000]], + [1, [531613]] + ], + "fraction": { + "numer": "200000", + "denom": "531613" + } + }, + "rel_max_volume": { + "decimal": "24.061935657873693888", + "rational": [ + [1, [4213143411, 87536811]], + [1, [3466432512, 3637978]] + ], + "fraction": { + "numer": "375967744654276467", + "denom": "15625000000000000" + } + }, + "rel_min_volume": { + "decimal": "0.0001", + "rational": [ + [1, [1]], + [1, [10000]] + ], + "fraction": { + "numer": "1", + "denom": "10000" + } + }, + "conf_settings": { + "base_confs": 7, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false + }, + "base_max_volume_aggr": { + "decimal": "133319.023345413", + "rational": [ + [1, [3238477573, 31040]], + [1, [1000000000]] + ], + "fraction": { + "numer": "133319023345413", + "denom": "1000000000" + } + }, + "rel_max_volume_aggr": { + "decimal": "35.2500366381728643576", + "rational": [ + [1, [473921343, 1669176307, 2]], + [1, [2436694016, 291038304]] + ], + "fraction": { + "numer": "44062545797716080447", + "denom": "1250000000000000000" + } + } + } + ], + "base": "DGB", + "bids": [ + { + "coin": "DASH", + "address": { + "address_type": "Transparent", + "address_data": "XcYdfQgeuM5f5V2LNo9g8o8p3rPPbKwwCg" + }, + "price": { + "decimal": "0.0002544075418788651605521516540338523799763700988224165198319218986992534200426899830070024093907274001", + "rational": [ + [1, [1410065408, 2]], + [1, [3765089107, 9151]] + ], + "fraction": { + "numer": "10000000000", + "denom": "39307010814803" + } + }, + "pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "uuid": "e9e4feb2-60b4-4184-8294-591687171e6b", + "is_mine": false, + "base_max_volume": { + "decimal": "15449.5309493280527473176", + "rational": [ + [1, [161102659, 3869502237, 1046]], + [1, [2436694016, 291038304]] + ], + "fraction": { + "numer": "19311913686660065934147", + "denom": "1250000000000000000" + } + }, + "base_min_volume": { + "decimal": "0.39307010814803", + "rational": [ + [1, [3765089107, 9151]], + [1, [276447232, 23283]] + ], + "fraction": { + "numer": "39307010814803", + "denom": "100000000000000" + } + }, + "rel_max_volume": { + "decimal": "3.930477192", + "rational": [ + [1, [491309649]], + [1, [125000000]] + ], + "fraction": { + "numer": "491309649", + "denom": "125000000" + } + }, + "rel_min_volume": { + "decimal": "0.0001", + "rational": [ + [1, [1]], + [1, [10000]] + ], + "fraction": { + "numer": "1", + "denom": "10000" + } + }, + "conf_settings": { + "base_confs": 7, + "base_nota": false, + "rel_confs": 2, + "rel_nota": false + }, + "base_max_volume_aggr": { + "decimal": "15449.5309493280527473176", + "rational": [ + [1, [161102659, 3869502237, 1046]], + [1, [2436694016, 291038304]] + ], + "fraction": { + "numer": "19311913686660065934147", + "denom": "1250000000000000000" + } + }, + "rel_max_volume_aggr": { + "decimal": "3.930477192", + "rational": [ + [1, [491309649]], + [1, [125000000]] + ], + "fraction": { + "numer": "491309649", + "denom": "125000000" + } + } + } + ], + "net_id": 7777, + "num_asks": 3, + "num_bids": 3, + "rel": "DASH", + "timestamp": 1694183345, + "total_asks_base_vol": { + "decimal": "133319.023345413", + "rational": [ + [1, [3238477573, 31040]], + [1, [1000000000]] + ], + "fraction": { + "numer": "133319023345413", + "denom": "1000000000" + } + }, + "total_asks_rel_vol": { + "decimal": "35.2500366381728643576", + "rational": [ + [1, [473921343, 1669176307, 2]], + [1, [2436694016, 291038304]] + ], + "fraction": { + "numer": "44062545797716080447", + "denom": "1250000000000000000" + } + }, + "total_bids_base_vol": { + "decimal": "59100.6554157135128550633", + "rational": [ + [1, [1422777577, 2274178813, 32038]], + [1, [2313682944, 2328306436]] + ], + "fraction": { + "numer": "591006554157135128550633", + "denom": "10000000000000000000" + } + }, + "total_bids_rel_vol": { + "decimal": "14.814675225", + "rational": [ + [1, [592587009]], + [1, [40000000]] + ], + "fraction": { + "numer": "592587009", + "denom": "40000000" + } + } + }, + "id": 42 + } + ``` + +export const title = "AtomicDEX Method: Recreate Swap Data"; +export const description = "The recreate_swap_data method helps recover lost swap data due to storage errors or hardware failure."; + +# recreate\_swap\_data + +The `recreate_swap_data` can assist in the event of local stored swap data being lost due to storage errors related to low disk space or hardware failure, and if required, aid with the refunding of failed swaps. + +To source the opposite side of the trade, please [contact the Komodo Support team on Discord](https://discord.com/invite/RRZ8hzc). You will need to provide details about the trade you are trying to recover, such as the coins and amounts being traded, the approximate time of the trade, any known transaction IDs involved in the trade, and if available the UUID of the trade. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------- | +| swap | object | Swap data from other side of trade. For example to recreate a Maker's swap data, the input would be the corresponding Taker's swap data | + +#### Response + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------- | +| result | object | Opposite side's swap data. For example if a Taker's swap data is input, the reponse would be the corresponding Maker's swap data. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "recreate_swap_data", + "params": { + "swap": { + "type": "Taker", + "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "my_order_uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "events": [ + { + "timestamp": 1638984440546, + "event": { + "type": "Started", + "data": { + "taker_coin": "MARTY", + "maker_coin": "DOC", + "maker": "15d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "my_persistent_pub": "03b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", + "lock_duration": 7800, + "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "taker_amount": "1", + "maker_payment_confirmations": 1, + "maker_payment_requires_nota": false, + "taker_payment_confirmations": 1, + "taker_payment_requires_nota": false, + "taker_payment_lock": 1638992240, + "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "started_at": 1638984440, + "maker_payment_wait": 1638987560, + "maker_coin_start_block": 1207822, + "taker_coin_start_block": 1222573, + "fee_to_send_taker_fee": { + "coin": "MARTY", + "amount": "0.00001", + "paid_from_trading_vol": false + }, + "taker_payment_trade_fee": { + "coin": "MARTY", + "amount": "0.00001", + "paid_from_trading_vol": false + }, + "maker_payment_spend_trade_fee": { + "coin": "DOC", + "amount": "0.00001", + "paid_from_trading_vol": true + } + } + } + }, + { + "timestamp": 1638984456603, + "event": { + "type": "Negotiated", + "data": { + "maker_payment_locktime": 1639000040, + "maker_pubkey": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "secret_hash": "4da9e7080175e8e10842e0e161b33cd298cab30b", + "maker_coin_swap_contract_addr": null, + "taker_coin_swap_contract_addr": null + } + } + }, + { + "timestamp": 1638984456814, + "event": { + "type": "TakerFeeSent", + "data": { + "tx_hex": "0400008085202f89016383e8aced2256378bb126a1ca1a41e2f344d9295f65b3ea4b99055c5eb4a6cb000000006a47304402201c7e661e0dbeb9b3eb6e4e9e3194010e5772227017772b2e48c1b8d48ed3b21f02201c2eda64e74455fa1878a5c221f25d22fe626abd0078a26a9fc0f829e0921639012103b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58adddffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac74c3e90b000000001976a91483762a373935ca241d557dfce89171d582b486de88ac08ebb061000000000000000000000000000000", + "tx_hash": "fcb49167c79e8e014143643b94878866f7e80b26c5a5dcf693010543da70b5bc" + } + } + }, + { + "timestamp": 1638984457822, + "event": { + "type": "MakerPaymentReceived", + "data": { + "tx_hex": "0400008085202f8901c41fdf6b9d8aea4b472f83e4fa0d99dfafc245e897d681fd2ca7df30707fbf48020000006b483045022100c7b294bd46cbf3b13530879a43c5cf67414047266d8b64c3c7263b5e75b989ba02201974f38d688b184bc44e628806c6ab2ac9092f394729d0ce838f14e1e76117c001210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff03a2296b050000000017a91491c45f69e1760c12a1f90fb2a811f6dfde35cc35870000000000000000166a144da9e7080175e8e10842e0e161b33cd298cab30bac503d64000000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac09ebb061000000000000000000000000000000", + "tx_hash": "6287e0d30951cd859bfb837eb1e5409f7596e75ffeb2e61fd6df1843bfd0203d" + } + } + }, + { + "timestamp": 1638984457826, + "event": { + "type": "MakerPaymentWaitConfirmStarted" + } + }, + { + "timestamp": 1638984503611, + "event": { + "type": "MakerPaymentWaitConfirmFailed", + "data": { + "error": "An error" + } + } + }, + { + "timestamp": 1638984503615, + "event": { + "type": "Finished" + } + } + ], + "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "maker_coin": "DOC", + "taker_amount": "1", + "taker_coin": "MARTY", + "gui": "atomicDEX 0.5.1 iOS", + "mm_version": "1b065636a", + "success_events": [ + "Started", + "Negotiated", + "TakerFeeSent", + "MakerPaymentReceived", + "MakerPaymentWaitConfirmStarted", + "MakerPaymentValidatedAndConfirmed", + "TakerPaymentSent", + "TakerPaymentSpent", + "MakerPaymentSpent", + "Finished" + ], + "error_events": [ + "StartFailed", + "NegotiateFailed", + "TakerFeeSendFailed", + "MakerPaymentValidateFailed", + "MakerPaymentWaitConfirmFailed", + "TakerPaymentTransactionFailed", + "TakerPaymentWaitConfirmFailed", + "TakerPaymentDataSendFailed", + "TakerPaymentWaitForSpendFailed", + "MakerPaymentSpendFailed", + "TakerPaymentWaitRefundStarted", + "TakerPaymentRefunded", + "TakerPaymentRefundFailed" + ] + } + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "swap": { + "type": "Maker", + "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "my_order_uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "events": [ + { + "timestamp": 1638984440546, + "event": { + "type": "Started", + "data": { + "taker_coin": "MARTY", + "maker_coin": "DOC", + "taker": "b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", + "secret": "0000000000000000000000000000000000000000000000000000000000000000", + "secret_hash": "4da9e7080175e8e10842e0e161b33cd298cab30b", + "my_persistent_pub": "0315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732", + "lock_duration": 7800, + "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "taker_amount": "1", + "maker_payment_confirmations": 1, + "maker_payment_requires_nota": false, + "taker_payment_confirmations": 1, + "taker_payment_requires_nota": false, + "maker_payment_lock": 1639000040, + "uuid": "f87fa9ce-0820-4675-b85d-db18c7bc9fb4", + "started_at": 1638984440, + "maker_coin_start_block": 1207822, + "taker_coin_start_block": 1222573, + "maker_payment_trade_fee": null, + "taker_payment_spend_trade_fee": null + } + } + }, + { + "timestamp": 1638984456603, + "event": { + "type": "Negotiated", + "data": { + "taker_payment_locktime": 1638992240, + "taker_pubkey": "03b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58addd", + "maker_coin_swap_contract_addr": null, + "taker_coin_swap_contract_addr": null + } + } + }, + { + "timestamp": 1638984457822, + "event": { + "type": "TakerFeeValidated", + "data": { + "tx_hex": "0400008085202f89016383e8aced2256378bb126a1ca1a41e2f344d9295f65b3ea4b99055c5eb4a6cb000000006a47304402201c7e661e0dbeb9b3eb6e4e9e3194010e5772227017772b2e48c1b8d48ed3b21f02201c2eda64e74455fa1878a5c221f25d22fe626abd0078a26a9fc0f829e0921639012103b1e544ce2d860219bc91314b5483421a553a7b33044659eff0be9214ed58adddffffffff02bcf60100000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac74c3e90b000000001976a91483762a373935ca241d557dfce89171d582b486de88ac08ebb061000000000000000000000000000000", + "tx_hash": "fcb49167c79e8e014143643b94878866f7e80b26c5a5dcf693010543da70b5bc" + } + } + }, + { + "timestamp": 1638984457822, + "event": { + "type": "MakerPaymentSent", + "data": { + "tx_hex": "0400008085202f8901c41fdf6b9d8aea4b472f83e4fa0d99dfafc245e897d681fd2ca7df30707fbf48020000006b483045022100c7b294bd46cbf3b13530879a43c5cf67414047266d8b64c3c7263b5e75b989ba02201974f38d688b184bc44e628806c6ab2ac9092f394729d0ce838f14e1e76117c001210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff03a2296b050000000017a91491c45f69e1760c12a1f90fb2a811f6dfde35cc35870000000000000000166a144da9e7080175e8e10842e0e161b33cd298cab30bac503d64000000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac09ebb061000000000000000000000000000000", + "tx_hash": "6287e0d30951cd859bfb837eb1e5409f7596e75ffeb2e61fd6df1843bfd0203d" + } + } + }, + { + "timestamp": 1638984503611, + "event": { + "type": "TakerPaymentValidateFailed", + "data": { + "error": "Origin Taker error event: MakerPaymentWaitConfirmFailed(SwapError { error: \"An error\" })" + } + } + }, + { + "timestamp": 1638984503611, + "event": { + "type": "MakerPaymentWaitRefundStarted", + "data": { + "wait_until": 1639003740 + } + } + } + ], + "maker_amount": "0.9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909091", + "maker_coin": "DOC", + "taker_amount": "1", + "taker_coin": "MARTY", + "gui": "nogui", + "mm_version": "", + "success_events": [ + "Started", + "Negotiated", + "TakerFeeValidated", + "MakerPaymentSent", + "TakerPaymentReceived", + "TakerPaymentWaitConfirmStarted", + "TakerPaymentValidatedAndConfirmed", + "TakerPaymentSpent", + "TakerPaymentSpendConfirmStarted", + "TakerPaymentSpendConfirmed", + "Finished" + ], + "error_events": [ + "StartFailed", + "NegotiateFailed", + "TakerFeeValidateFailed", + "MakerPaymentTransactionFailed", + "MakerPaymentDataSendFailed", + "MakerPaymentWaitConfirmFailed", + "TakerPaymentValidateFailed", + "TakerPaymentWaitConfirmFailed", + "TakerPaymentSpendFailed", + "TakerPaymentSpendConfirmFailed", + "MakerPaymentWaitRefundStarted", + "MakerPaymentRefunded", + "MakerPaymentRefundFailed" + ] + } + }, + "id": null + } + ``` + +export const title = "AtomicDEX Method: Remove Delegation"; +export const description = + "The remove_delegation method stops your node's staking of a compatible coin."; + +# remove\_delegation + +The `remove_delegation` method stops your node's staking of a compatible coin. Currently QTUM and tQTUM (test tokens avalable at `https://testnet-faucet.qtum.info/`) have been integrated, but this functionality will be expanded to more coins in future. + +Note: After running `remove_delegation`, you will need to broadcast the returned hex via [`send_raw_transaction`](/atomicdex/api/legacy/send_raw_transaction/) to complete the process. + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | --------------------- | +| coin | string | the coin being staked | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "remove_delegation", + "params": { + "coin": "tQTUM" + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "01000000015c7f32b1b3396ce1bed4f6c161bcc3a5bf5c58e4338c66a24c9de1deffc5b94e000000006a47304402203fcdf1e48f6e43fd718b4aab79c56a7ff81b12304339ddf6d871a3f26f217a7502200c22fa8e2bcc33d16f4bf62feb71f637acbefdd34135314e6aa526e6655cba73012102641b541e35bc915e375c8038f1099a977bc6736aa7265e9f65b7270b70d34366ffffffff020000000000000000225403a086010128043d666e8b140000000000000000000000000000000000000086c280584f00000000001976a914c36ac1020b1eae632079692e7bef350d279489c988acb8d98061", + "tx_hash": "3564859a7ff902e8d65387c44f6049943582e0b9e29161bf1075a00097e535ae", + "from": ["qbNeoqCbBu4hySDUzgmo666faYH3qgaeKz"], + "to": ["qbNeoqCbBu4hySDUzgmo666faYH3qgaeKz"], + "total_amount": "0.096", + "spent_by_me": "0.096", + "received_by_me": "0.052", + "my_balance_change": "-0.044", + "block_height": 0, + "timestamp": 1635834296, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.004", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" + }, + "coin": "tQTUM", + "internal_id": "", + "transaction_type": "RemoveDelegation" + }, + "id": 0 + } + ``` + +export const title = "AtomicDEX Method: Remove Node from Version Stat"; +export const description = "The remove_node_from_version_stat method removes a Node from the local database that tracks which version of MM2 it is running."; + +# remove\_node\_from\_version\_stat + +The `remove_node_from_version_stat` method removes a Node (by name) from the local database which tracks which version of MM2 it is running. The name parameter is an arbitrary identifying string, such as "seed\_alpha" or "dragonhound\_DEV". + +## Arguments + +| Structure | Type | Description | +| --------- | ------ | ----------------------------- | +| name | string | the name assigned to the node | + +#### 📌 Examples + +#### Command + + + ```json + { + "mmrpc": "2.0", + "method": "remove_node_from_version_stat", + "userpass": "testpsw", + "params": { + "name": "dragonhound_DEV" + } + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + +export const title = "AtomicDEX Method: Start Simple Market Maker Bot"; +export const description = "The AtomicDEX API allows for simple bot trading via the start_simple_market_maker_bot method."; + +# start\_simple\_market\_maker\_bot + +The AtomicDEX API allows for simple bot trading via the `start_simple_market_maker_bot` method. This method takes as input a url to a price service, and configuration parameters of the pair to trade at a defined spread percentage value. It will update orders every 30 seconds (or higher values if defined with the `bot_refresh_rate` parameter). + +Note: If using a custom prices API endpoint, please ensure it conforms to the same schema as the url in the example. + +For convenience, an online [tool for generating configs](https://stats.kmd.io/atomicdex/makerbot_config_form/) is available. + +## Arguments + +| Structure | Type | Description | +| -------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| price\_url | string | Link to a price service API | +| bot\_refresh\_rate | float | Bot loop interval in seconds (optional, 30 sec default) | +| cfg.name | string | The name assigned to this configuration (e.g. the pair being configured) | +| cfg.name.base | string | Ticker of the coin you wish to sell | +| cfg.name.rel | string | Ticker of the coin you wish to buy | +| cfg.name.max | boolean | Set to `true` if you would like to trade your whole balance (optional) | +| cfg.name.max\_volume.percentage | string | Percentage of balance to trade (optional; can not use at same time as `max_volume.usd`; if greater than 1.0 `max=true` is implied) | +| cfg.name.max\_volume.usd | string | Maximum USD trade volume value to trade (optional; can not use at same time as `max_volume.percentage`; if greater than full balance `max=true` is implied) | +| cfg.name.min\_volume.percentage | string | Minimum percentage of balance to accept in trade (optional, can not use at same time as `min_volume.usd`) | +| cfg.name.min\_volume.usd | float | Minimum USD trade volume of trades accepted for order (optional, can not use at same time as `min_volume.percentage`) | +| cfg.name.min\_base\_price | float | Minimum USD price of base coin to accept in trade (optional) | +| cfg.name.min\_rel\_price | float | Minimum USD price of rel coin to accept in trade (optional) | +| cfg.name.min\_pair\_price | float | Minimum USD price of pair (base/rel) to accept in trade (optional) | +| cfg.name.spread\*\* | string | Target price in relation to prices API value | +| cfg.name.base\_confs | integer | number of required blockchain confirmations for base coin atomic swap transaction; default to base coin configuration if not set | +| cfg.name.base\_nota | boolean | whether dPoW notarization is required for base coin atomic swap transaction; default to base coin configuration if not set | +| cfg.name.rel\_confs | integer | number of required blockchain confirmations for rel coin atomic swap transaction; default to rel coin configuration if not set | +| cfg.name.rel\_nota | boolean | whether dPoW notarization is required for rel coin atomic swap transaction; default to base coin configuration if not set | +| cfg.name.enable | boolean | Bot will ignore this config entry if set to false | +| cfg.name.price\_elapsed\_validity | float | Will cancel current orders for this pair and not submit a new order if last price update time has been longer than this value in seconds (optional; defaults to 5 minutes) | +| cfg.name.check\_last\_bidirectional\_trade\_thresh\_hold | boolean | Will readjust the calculated cex price if a precedent trade exists for the pair (or reversed pair), applied via a [VWAP logic](https://www.investopedia.com/terms/v/vwap.asp) (optional; defaults to false) | + +* Percentage values are within the range of 0-1, such that 0.25 = 25% +* For spread, a value of 1.05 equates to 5% over the value returned from the prices API url. +* At least one of the optional fields `max`, `max_volume.usd` or `max_volume.percentage` must be present, or orders will not be placed. + +#### 📌 Examples + +As demonstrated below, multiple configs can be included within the same command. It is recommended to not exceed 500-1000 simultaneous orders placed to avoid decreased performance. + +In the example below, the first config lets the bot know we want to: + +* Sell DASH in exchange for KMD +* Use whole of available DASH balance, with minimum trade volume accepted as 25% of your balance +* Sets the sell price at 2.5% over the value returned from the prices API (spread). +* Only accepts values from the prices API that have been updated within the last 30 seconds +* Waits for 3 confirmations and does not wait for a notarisation to progress to the next steps in the atomic swap process +* Checks trade history within the local AtomicDEX API database to never create trades with a sell price that is less than the average trading price. + +The second config tells the bot to: + +* Sell DASH in exchange for DGB +* Trade at most 50% of your DASH balance, with minimum trade volume accepted at least $20 USD. +* Only place an order when the DASH price is $250 USD or more. +* Sets the sell price at 4% over the value returned from the prices API (spread). +* Only accepts values from the prices API that have been updated within the last 60 seconds +* Waits for 1 confirmation and does not wait for a notarisation to progress to the next steps in the atomic swap process +* Ignores your trade history and average trading price, creating/updating orders regardless. + +The third config tells the bot to: + +* Sell DASH in exchange for LTC +* Trade at most $500 USD worth of DASH, with minimum trade volume accepted at least $50 USD. +* Only place an order when the DASH price is $250 USD or more. +* Sets the sell price at 5% over the value returned from the prices API (spread). +* Only accepts values from the prices API that have been updated within the last 60 seconds +* Waits for 1 confirmation and does not wait for a notarisation to progress to the next steps in the atomic swap process +* Ignores your trade history and average trading price, creating/updating orders regardless. + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "start_simple_market_maker_bot", + "params": { + "price_url": "https://prices.komodo.earth/api/v2/tickers?expire_at=600", + "bot_refresh_rate": 60, + "cfg": { + "DASH/KMD": { + "base": "DASH", + "rel": "KMD", + "max": true, + "min_volume": { + "percentage": "0.25" + }, + "spread": "1.025", + "base_confs": 3, + "base_nota": false, + "rel_confs": 3, + "rel_nota": false, + "enable": true, + "price_elapsed_validity": 30, + "check_last_bidirectional_trade_thresh_hold": true + }, + "DASH/DGB": { + "base": "DASH", + "rel": "DGB", + "min_volume": { + "usd": "20" + }, + "min_base_price": "250", + "spread": "1.04", + "base_confs": 1, + "base_nota": false, + "rel_confs": 1, + "rel_nota": false, + "enable": true, + "price_elapsed_validity": 60, + "check_last_bidirectional_trade_thresh_hold": false + }, + "DASH/LTC": { + "base": "DASH", + "rel": "LTC", + "max_volume": { + "usd": "500" + }, + "min_volume": { + "usd": "50" + }, + "min_base_price": "250", + "spread": "1.04", + "base_confs": 1, + "base_nota": false, + "rel_confs": 1, + "rel_nota": false, + "enable": true, + "price_elapsed_validity": 60, + "check_last_bidirectional_trade_thresh_hold": false + } + } + }, + "id": 0 + } + ``` + + +As we have `\"bot_refresh_rate\": 60,` in the above command, our bot loop will update order prices every 60 seconds, as long as the price service returns data that is no more than 30 seconds old (for DASH/KMD) or no more than 60 seconds old (for DASH/DGB). + + + #### Response (success) {{class : 'text-green-500'}} + + ```json + { + "mmrpc": "2.0", + "result": { + "result": "Success" + }, + "id": 0 + } + ``` + + #### Response (error - bot already started) {{class : 'text-red-500'}} + + ```json + { + "mmrpc": "2.0", + "error": "The bot is already started", + "error_path": "simple_market_maker", + "error_trace": "simple_market_maker:770]", + "error_type": "AlreadyStarted", + "id": 0 + } + ``` + +export const title = "AtomicDEX Method: Start Version Stat Collection"; +export const description = "The start_version_stat_collection method initiates storing version statistics for nodes previously registered via the add_node_to_version_stat method."; + +# start\_version\_stat\_collection + +The `start_version_stat_collection` method initiates storing version statistics for nodes previously registered via the `add_node_to_version_stat` method. + +## Arguments + +| Structure | Type | Description | +| --------- | ------- | ------------------------------------------------ | +| interval | integer | polling rate (in seconds) to check node versions | + +#### 📌 Examples + +#### Command + + + ```json + { + "mmrpc": "2.0", + "method": "start_version_stat_collection", + "userpass": "testpsw", + "params": { + "interval": 600 + } + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + + #### Response (error - invalid peer id unable to parse) + + ```json + { + "mmrpc": "2.0", + "error": "Database error: UNIQUE constraint failed: nodes.peer_id", + "error_path": "lp_stats", + "error_trace": "lp_stats:124]", + "error_type": "DatabaseError", + "error_data": "UNIQUE constraint failed: nodes.peer_id", + "id": null + } + ``` + +export const title = "AtomicDEX Method: Stop Simple Market Maker Bot"; +export const description = "The stop_simple_market_maker_bot method tells the bot to finish placing orders at the end of the current loop 30 seconds minimum and 30 seconds by default."; + +# stop\_simple\_market\_maker\_bot + +The `stop_simple_market_maker_bot` method tells the bot to finish placing orders at the end of the current loop (30 seconds minimum & 30 seconds by default). This method takes as input a url to a price service, and configuration parameters of the pairs to trade at a defined spread percentage value. + +At the end of the final loop, orders placed by the bot will be cancelled. Users should wait until the loop ends before exiting the AtomicDEX API, otherwise orders will not cancel, and will reappear on the orderbook next time AtomicDEX API starts. + +## Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none ) | | | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "stop_simple_market_maker_bot", + "params": {}, + "id": 0 + } + ``` + + + + #### Response (success) {{class : 'text-green-500'}} + + ```json + { + "mmrpc": "2.0", + "result": { + "result": "Success" + }, + "id": 0 + } + ``` + + #### Response (error - bot already stopped) {{class : 'text-red-500'}} + + ```json + { + "mmrpc": "2.0", + "error": "The bot is already stopped", + "error_path": "simple_market_maker", + "error_trace": "simple_market_maker:813]", + "error_type": "AlreadyStopped", + "id": 0 + } + ``` + +export const title = "AtomicDEX Method: Stop Version Stat Collection"; +export const description = "The stop_version_stat_collection method stops the collection of version stats at the end of the current loop interval."; + +# stop\_version\_stat\_collection + +The `stop_version_stat_collection` method stops the collection of version stats at the end of the current loop interval. + +#### Arguments + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### Response + +| Structure | Type | Description | +| --------- | ------ | ---------------- | +| result | string | success or error | + +#### 📌 Examples + +#### Command + + + ```json + { + "mmrpc": "2.0", + "method": "stop_version_stat_collection", + "userpass": "testpsw", + "params": {} + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + + + + #### Response (error - stats collection not running) + + ```json + { + "mmrpc": "2.0", + "error": "start_version_stat_collection is not running", + "error_path": "lp_stats", + "error_trace": "lp_stats:395]", + "error_type": "NotRunning", + "id": null + } + ``` + +export const title = "AtomicDEX Method: Telegram Alerts for MM Bot"; +export const description = "The AtomicDEX API Market Maker bot can be configured to send status update alerts via Telegram."; + +# Telegram Alerts for Market Maker Bot + +The AtomicDEX API Market Maker bot can be configured to send status update alerts via [Telegram!](https://telegram.org/) + +To set this up, you can add some additional parameters to your MM2.json as shown in the example below + +```json +{ + "gui": "MarketMakerBot", + "netid": 7777, + "rpc_password": "YOUR_PASSWORD", + "passphrase": "YOUR SEED PHRASE", + "dbdir": "/path/to/your/atomicdex/DB", + "message_service_cfg": { + "telegram": { + "api_key": "YOUR:TELEGRAM_API_TOKEN", + "chat_registry": { + "default": "YOUR_TELEGRAM_CHAT_ID", + "maker_bot": "YOUR_TELEGRAM_CHAT_ID", + "swap_events": "YOUR_TELEGRAM_CHAT_ID" + } + } + } +} +``` + +The extra fields required are: + +| Parameter | Type | Description | +| --------------------------- | ------ | ------------------------ | +| api\_key | string | A Telegram bot API token | +| chat\_registry.default | string | A Telegram Chat ID | +| chat\_registry.maker\_bot | string | A Telegram Chat ID | +| chat\_registry.swap\_events | string | A Telegram Chat ID | + +You can use the same Telegram chat ID for all three `chat_registry` subfields, or sent your alerts to a different chat ID if you want to separate the alerts by type. + +To get a Telegram bot API token, you need to [have chat with the BotFather](https://sean-bradley.medium.com/get-telegram-chat-id-80b575520659) + +To get a Telegram chat ID, check out [this guide](https://sean-bradley.medium.com/get-telegram-chat-id-80b575520659) +export const title = "AtomicDEX Method: Trade Preimage"; +export const description = "The trade_preimage method returns the approximate fee amounts that are paid per the whole swap."; + +# trade\_preimage + +The `trade_preimage` method returns the approximate fee amounts that are paid per the whole swap. +Depending on the parameters, the function returns different results: + +* If the `swap_method` is `buy` or `sell`, then the result will include the `taker_fee` and the `fee_to_send_taker_fee`. + The `taker_fee` amount is paid from the `base` coin balance if the `swap_method` is `sell`, else it is paid from the `rel` coin balance; +* If the `max` field is true, then the result will include the `volume`. + + + This method can be used instead of **max\_taker\_vol**, if the `max` field is true and the `swap_method` is `buy` or `sell`. + Use the resulting `volume` as an argument of the `buy` or `sell` requests. + + + + Use the `trade_preimage` request with `max = true` and `swap_method = "setprice"` arguments to approximate the fee amounts **only**. Do not use the resulting `volume` as an argument of the `setprice`. + + +## Arguments + +| Structure | Type | Description | +| ------------ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | +| base | string | the base currency of the request | +| rel | string | the rel currency of the request | +| swap\_method | string | the name of the method whose preimage is requested. Possible values: `buy`, `sell`, `setprice` | +| price | numeric string or rational | the price in `rel` the user is willing to pay per one unit of the `base` coin | +| volume | numeric string or rational (optional) | the amount the user is willing to trade; ignored if `max = true` **and** `swap_method = setprice`, otherwise, it must be set | +| max | bool (optional) | whether to return the maximum available volume for `setprice` method; must not be set or `false` if `swap_method` is `buy` or `sell` | + +### Result + +| Structure | Type | Description | +| ------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| base\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `base` coin | +| rel\_coin\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid per the whole swap concerning the `rel` coin | +| volume | string (numeric) | Optional. The max available volume that can be traded (in decimal representation); empty if the `max` argument is missing or false | +| volume\_rat | rational | Optional. The max available volume that can be traded represented as a standard [RationalValue](/atomicdex/api/common_structures/#rational-value) object.; empty if the `max` argument is missing or false | +| volume\_fraction | fraction | Optional. The max available volume that can be traded represented as a standard [fractionalValue](/atomicdex/api/common_structures/#fractional-value) object.; empty if the `max` argument is missing or false | +| taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The dex fee to be paid by Taker; empty if `swap_method` is `setprice` | +| fee\_to\_send\_taker\_fee | object | A standard [ExtendedFeeInfo](/atomicdex/api/common_structures/#extended-fee-info) object. The approximate miner fee is paid to send the dex fee; empty if `swap_method` is `setprice` | +| total\_fees | array of objects | A standard [TotalFeeInfo](/atomicdex/api/common_structures/#total-fee-info) object. Each element is a sum of fees required to be paid from user's balance of corresponding `ExtendedFeeInfo.coin`; the elements are unique by coin | + +### ⚠ Error types + +#### NotSufficientBalance + +The `available` balance of the `coin` is not sufficient to start the swap. + +| Structure | Type | Description | +| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------- | +| coin | string | the name of the coin which balance is not sufficient | +| available | string (numeric) | the balance available for swap, including the amount locked by other swaps | +| required | string (numeric) | the amount required to start the swap. This amount is necessary but may not be sufficient | +| locked\_by\_swaps | string (numeric, optional) | the amount locked by other swaps | + +#### NotSufficientBaseCoinBalance + +The available balance of the base `coin` is not sufficient to pay transaction fees. + +For example, ERC20 fees are paid by ETH (gas), and this error type is returned if the ETH coin balance is not sufficient to start the swap. + +| Structure | Type | Description | +| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------- | +| coin | string | the name of the base coin which balance is not sufficient | +| available | string (numeric) | the balance available for swap, including the amount locked by other swaps | +| required | string (numeric) | the amount required to start the swap. This amount is necessary but may not be sufficient | +| locked\_by\_swaps | string (numeric, optional) | the amount is locked by other swaps | + +#### VolumeTooLow + +The specified `volume` is too low. Required at least `threshold`. + + + If the `coin` field returned in Response is the same as the `rel` argument in Request, then the base volume threshold can be calculated as follows: + `base_coin_threshold = rel_vol_threshold / price` + + +| Structure | Type | Description | +| --------- | ---------------- | -------------------------------------------------- | +| coin | string | either `base` or `rel` coin specified in Request | +| volume | string (numeric) | the amount the user was willing to trade in `coin` | +| threshold | string (numeric) | the `volume` has not to be less than this amount | + +#### NoSuchCoin + +The specified coin was not found or is not activated yet. + +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------ | +| coin | string | either `base` or `rel` coin specified in Request | + +#### CoinIsWalletOnly + +The specified coin is wallet only and cannot be participated in the swap. + +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------ | +| coin | string | either `base` or `rel` coin specified in Request | + +#### BaseEqualRel + +The coin is wallet only and cannot be participated in the swap. + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### InvalidParam + +Incorrect use of the `param` parameter in Request. + +| Structure | Type | Description | +| --------- | ------ | ------------------------------------------------ | +| param | string | the name of the parameter in Request | +| reason | string | the reason why the parameter is used incorrectly | + +#### PriceTooLow + +The specified `price` is too low. + +| Structure | Type | Description | +| --------- | ---------------- | ---------------------------------------------------------------------------------- | +| price | string (numeric) | the price in `rel` the user was willing to receive per one unit of the `base` coin | +| threshold | string (numeric) | the `price` has not to be less than this amount | + +#### Transport + +The request was failed due to a network error. + +| Structure | Type | Description | +| --------- | ------ | ------------------------------- | +| (none) | string | the transport error description | + +#### InternalError + +The request was failed due to a AtomicDEX API internal error. + +| Structure | Type | Description | +| --------- | ------ | ------------------------------ | +| (none) | string | the internal error description | + +### 📌 Examples + +#### Command (setprice) + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "trade_preimage", + "params": { + "base": "BTC", + "rel": "DOC", + "price": "1", + "volume": "0.1", + "swap_method": "setprice" + }, + "id": 0 + } + ``` + + +#### Response + +```json +{ + "mmrpc": "2.0", + "result": { + "base_coin_fee": { + "coin": "KMD", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "paid_from_trading_vol": false + }, + "rel_coin_fee": { + "coin": "DGB", + "amount": "0.00030782", + "amount_fraction": { + "numer": "15391", + "denom": "50000000" + }, + "amount_rat": [ + [1, [15391]], + [1, [50000000]] + ], + "paid_from_trading_vol": true + }, + "volume": "1138.46868712", + "volume_fraction": { + "numer": "14230858589", + "denom": "12500000" + }, + "volume_rat": [ + [1, [1345956701, 3]], + [1, [12500000]] + ], + "total_fees": [ + { + "coin": "KMD", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "required_balance": "0.00001", + "required_balance_fraction": { + "numer": "1", + "denom": "100000" + }, + "required_balance_rat": [ + [1, [1]], + [1, [100000]] + ] + }, + { + "coin": "DGB", + "amount": "0.00030782", + "amount_fraction": { + "numer": "15391", + "denom": "50000000" + }, + "amount_rat": [ + [1, [15391]], + [1, [50000000]] + ], + "required_balance": "0", + "required_balance_fraction": { + "numer": "0", + "denom": "1" + }, + "required_balance_rat": [ + [0, []], + [1, [1]] + ] + } + ] + }, + "id": 0 +} +``` + +#### Command (buy) + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "trade_preimage", + "params": { + "base": "BTC", + "rel": "DOC", + "price": "1", + "volume": "0.1", + "swap_method": "buy" + }, + "id": 0 + } + ``` + + +#### Response + +```json +{ + "mmrpc": "2.0", + "result": { + "base_coin_fee": { + "amount": "0.00042049", + "amount_fraction": { + "denom": "100000000", + "numer": "42049" + }, + "amount_rat": [ + [1, [42049]], + [1, [100000000]] + ], + "coin": "BTC", + "paid_from_trading_vol": true + }, + "rel_coin_fee": { + "amount": "0.0001", + "amount_fraction": { + "denom": "10000", + "numer": "1" + }, + "amount_rat": [ + [1, [1]], + [1, [10000]] + ], + "coin": "DOC", + "paid_from_trading_vol": false + }, + "taker_fee": { + "amount": "0.00012870012870012872", + "amount_fraction": { + "denom": "7770", + "numer": "1" + }, + "amount_rat": [ + [1, [1]], + [1, [7770]] + ], + "coin": "DOC", + "paid_from_trading_vol": false + }, + "fee_to_send_taker_fee": { + "amount": "0.0001", + "amount_fraction": { + "denom": "10000", + "numer": "1" + }, + "amount_rat": [ + [1, [1]], + [1, [10000]] + ], + "coin": "DOC", + "paid_from_trading_vol": false + }, + "total_fees": [ + { + "coin": "DOC", + "amount": "0.001307001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287", + "amount_fraction": { + "numer": "50777", + "denom": "38850000" + }, + "amount_rat": [ + [1, [50777]], + [1, [38850000]] + ], + "required_balance": "0.001307001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287", + "required_balance_fraction": { + "numer": "50777", + "denom": "38850000" + }, + "required_balance_rat": [ + [1, [50777]], + [1, [38850000]] + ] + }, + { + "coin": "tBTC", + "amount": "0.00042049", + "amount_fraction": { + "denom": "100000000", + "numer": "42049" + }, + "amount_rat": [ + [1, [42049]], + [1, [100000000]] + ], + "required_balance": "0", + "required_balance_fraction": { + "numer": "0", + "denom": "1" + }, + "required_balance_rat": [ + [0, []], + [1, [1]] + ] + } + ] + }, + "id": 0 +} +``` + +#### Command (sell, max) + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "trade_preimage", + "params": { + "base": "BTC", + "rel": "DOC", + "price": "1", + "volume": "2.21363478", + "swap_method": "sell" + }, + "id": 0 + } + ``` + + +#### Response + +```json +{ + "mmrpc": "2.0", + "result": { + "base_coin_fee": { + "amount": "0.00042049", + "amount_fraction": { + "denom": "100000000", + "numer": "42049" + }, + "amount_rat": [ + [1, [42049]], + [1, [100000000]] + ], + "coin": "BTC", + "paid_from_trading_vol": false + }, + "rel_coin_fee": { + "coin": "DOC", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "paid_from_trading_vol": true + }, + "taker_fee": { + "amount": "0.0028489508108108107", + "amount_fraction": { + "denom": "1850000000", + "numer": "5270559" + }, + "amount_rat": [ + [1, [5270559]], + [1, [1850000000]] + ], + "coin": "BTC", + "paid_from_trading_vol": false + }, + "fee_to_send_taker_fee": { + "amount": "0.00033219", + "amount_fraction": { + "denom": "100000000", + "numer": "33219" + }, + "amount_rat": [ + [1, [33219]], + [1, [100000000]] + ], + "coin": "BTC", + "paid_from_trading_vol": false + }, + "total_fees": [ + { + "coin": "DOC", + "amount": "0.00001", + "amount_fraction": { + "numer": "1", + "denom": "100000" + }, + "amount_rat": [ + [1, [1]], + [1, [100000]] + ], + "required_balance": "0", + "required_balance_fraction": { + "numer": "0", + "denom": "1" + }, + "required_balance_rat": [ + [0, []], + [1, [1]] + ] + }, + { + "coin": "BTC", + "amount": "0.0036016308108108106", + "amount_fraction": { + "denom": "1850000000", + "numer": "6663017" + }, + "amount_rat": [ + [1, [6663017]], + [1, [1850000000]] + ], + "required_balance": "0.0036016308108108106", + "required_balance_fraction": { + "denom": "1850000000", + "numer": "6663017" + }, + "required_balance_rat": [ + [1, [6663017]], + [1, [1850000000]] + ] + } + ] + }, + "id": 0 +} +``` + +#### Command (ERC20 and QRC20) + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "trade_preimage", + "params": { + "base": "BAT", + "rel": "QC", + "price": "1", + "volume": "2.21363478", + "swap_method": "setprice" + }, + "id": 0 + } + ``` + + +#### Response + +```json +{ + "mmrpc": "2.0", + "result": { + "base_coin_fee": { + "amount": "0.0045", + "amount_fraction": { + "denom": "2000", + "numer": "9" + }, + "amount_rat": [ + [1, [9]], + [1, [2000]] + ], + "coin": "ETH", + "paid_from_trading_vol": false + }, + "rel_coin_fee": { + "amount": "0.00325", + "amount_fraction": { + "denom": "4000", + "numer": "13" + }, + "amount_rat": [ + [0, [13]], + [1, [4000]] + ], + "coin": "QTUM", + "paid_from_trading_vol": false + }, + "total_fees": [ + { + "amount": "0.003", + "amount_fraction": { + "denom": "1000", + "numer": "3" + }, + "amount_rat": [ + [1, [3]], + [1, [1000]] + ], + "required_balance": "0.003", + "required_balance_fraction": { + "denom": "1000", + "numer": "3" + }, + "required_balance_rat": [ + [1, [3]], + [1, [1000]] + ], + "coin": "ETH" + }, + { + "amount": "0.00325", + "amount_fraction": { + "denom": "4000", + "numer": "13" + }, + "amount_rat": [ + [0, [13]], + [1, [4000]] + ], + "required_balance": "0.00325", + "required_balance_fraction": { + "denom": "4000", + "numer": "13" + }, + "required_balance_rat": [ + [0, [13]], + [1, [4000]] + ], + "coin": "QTUM" + } + ] + }, + "id": 0 +} +``` + +#### Response (NotSufficientBalance error) + +```json +{ + "mmrpc": "2.0", + "error": "Not enough BTC for swap: available 0.000015, required at least 0.10012, locked by swaps None", + "error_path": "maker_swap", + "error_trace": "maker_swap:1540] maker_swap:1641]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "BTC", + "available": "0.000015", + "required": "0.10012", + "locked_by_swaps": "0" + }, + "id": 0 +} +``` + +#### Response (VolumeTooLow error) + +```json +{ + "mmrpc": "2.0", + "error": "The volume 0.00001 of the DOC coin less than minimum transaction amount 0.0001", + "error_path": "maker_swap", + "error_trace": "maker_swap:1599]", + "error_type": "VolumeTooLow", + "error_data": { + "coin": "DOC", + "volume": "0.00001", + "threshold": "0.0001" + }, + "id": 0 +} +``` + +#### Response (Transport error) + +```json +{ + "mmrpc": "2.0", + "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "error_path": "taker_swap.utxo_common", + "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", + "error_type": "Transport", + "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "id": 0 +} +``` + +#### Response (incorrect use of "max" error) + +```json +{ + "mmrpc": "2.0", + "error": "Incorrect use of the 'max' parameter: 'max' cannot be used with 'sell' or 'buy' method", + "error_path": "taker_swap", + "error_trace": "taker_swap:1602]", + "error_type": "InvalidParam", + "error_data": { + "param": "max", + "reason": "'max' cannot be used with 'sell' or 'buy' method" + }, + "id": 0 +} +``` +export const title = "AtomicDEX Method: Update Version Stat Collection"; +export const description = "The update_version_stat_collection method updates the polling interval for version stats collection."; + +# update\_version\_stat\_collection + +The `update_version_stat_collection` method updates the polling interval for version stats collection. Note: the new interval will take effect after the current interval loop has completed. + +## Arguments + +| Structure | Type | Description | +| --------- | ------- | ------------------------------------------------ | +| interval | integer | polling rate (in seconds) to query node versions | + +#### 📌 Examples + +#### Command + + + ```json + { + "mmrpc": "2.0", + "method": "update_version_stat_collection", + "userpass": "testpsw", + "params": { + "interval": 900 + } + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + + + + #### Response (error - stats collection not running) + + ```json + { + "mmrpc": "2.0", + "error": "start_version_stat_collection is not running", + "error_path": "lp_stats", + "error_trace": "lp_stats:374]", + "error_type": "NotRunning", + "id": null + } + ``` + +export const title = "AtomicDEX Method: Withdraw"; +export const description = "The withdraw method generates, signs, and returns a transaction that transfers the amount of coin to the address indicated in the to argument."; + +# withdraw + +The `withdraw` method generates, signs, and returns a transaction that transfers the `amount` of `coin` to the address indicated in the `to` argument. + +This method generates a raw transaction which should then be broadcast using [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/). + +## Arguments + +| Structure | Type | Description | +| --------- | ---------------- | ----------------------------------------------------------------------------------- | +| coin | string | the name of the coin the user desires to withdraw | +| to | string | coins are withdrawn to this address | +| amount | string (numeric) | the amount the user desires to withdraw, ignored when `max=true` | +| memo | string | Optional. Adds a transaction memo for compatible coins (e.g. Tendermint ecosystem). | +| max | bool | withdraw the maximum available amount | +| fee | object | Optional. A standard [FeeInfo](/atomicdex/api/common_structures/#fee-info) object. | + +### Response + +| Structure | Type | Description | +| ---------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| from | array of strings | coins are withdrawn from this address; the array contains a single element, but transactions may be sent from several addresses (UTXO coins) | +| to | array of strings | coins are withdrawn to this address; this may contain the `my_address` address, where change from UTXO coins is sent | +| my\_balance\_change | string (numeric) | the expected balance of change in `my_address` after the transaction broadcasts | +| received\_by\_me | string (numeric) | the amount of coins received by `my_address` after the transaction broadcasts; the value may be above zero when the transaction requires that the AtomicDEX API send change to `my_address` | +| spent\_by\_me | string (numeric) | the amount of coins spent by `my_address`; this value differ from the request amount, as the transaction fee is added here | +| total\_amount | string (numeric) | the total amount of coins transferred | +| fee\_details | object | the fee details of the generated transaction; this value differs for utxo and ETH/ERC20 coins, check the examples for more details | +| tx\_hash | string | the hash of the generated transaction | +| tx\_hex | string | transaction bytes in hexadecimal format; use this value as input for the `send_raw_transaction` method | +| coin | string | the name of the coin the user wants to withdraw | +| kmd\_rewards | object (optional) | an object containing information about accrued rewards; always exists if the coin is `KMD` | +| kmd\_rewards.amount | string (numeric, optional) | the amount of accrued rewards | +| kmd\_rewards.claimed\_by\_me | bool (optional) | whether the rewards been claimed by me | + +### ⚠ Error types + +#### NotSufficientBalance + +The `available` balance is not sufficient to transfer the specified amount. + +| Structure | Type | Description | +| --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| coin | string | the name of the coin which balance is not sufficient. This coin name may differ from the requested coin. For example, ERC20 fees are paid by ETH (gas) | +| available | string (numeric) | the balance available for transfer | +| required | string (numeric) | the amount required to transfer the specified amount. This amount is necessary but may not be sufficient | + +#### ZeroBalanceToWithdrawMax + +The available balance is zero. + +| Structure | Type | Description | +| --------- | ---- | ----------- | +| (none) | | | + +#### AmountTooLow + +The specified amount is too low. Required at least `threshold`. + +| Structure | Type | Description | +| --------- | ---------------- | ---------------------------------------------------- | +| amount | string (numeric) | the amount the user was willing to transfer | +| threshold | string (numeric) | the `amount` has not to be less than the `threshold` | + +#### InvalidAddress + +The specified `to` address is not valid. + +| Structure | Type | Description | +| --------- | ------ | --------------------- | +| (none) | string | the error description | + +#### InvalidFeePolicy + +The specified `fee` is not valid. + +| Structure | Type | Description | +| --------- | ------ | --------------------- | +| (none) | string | the error description | + +#### NoSuchCoin + +The specified coin was not found or is not activated yet. + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------- | +| coin | string | the not found `coin` specified in the Request | + +#### Transport + +The request was failed due to a network error. + +| Structure | Type | Description | +| --------- | ------ | ------------------------------- | +| (none) | string | the transport error description | + +#### InternalError + +The request was failed due to an AtomicDEX API internal error. + +| Structure | Type | Description | +| --------- | ------ | ------------------------------ | +| (none) | string | the internal error description | + +### 📌 Examples + +#### Withdraw BTC, KMD, and other BTC-based forks + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "withdraw", + "params": { + "coin": "KMD", + "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", + "amount": "10" + }, + "id": 0 + } + ``` + + + + #### Response (KMD success) + + ```json + { + "mmrpc": "2.0", + "result": { + "block_height": 0, + "coin": "KMD", + "fee_details": { + "type": "Utxo", + "amount": "0.00001" + }, + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "my_balance_change": "-10.00001", + "received_by_me": "0.34417325", + "spent_by_me": "10.34418325", + "to": ["RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh"], + "total_amount": "10.34418325", + "tx_hash": "3a1c382c50a7d12e4675d12ed7e723ce9f0167693dd75fd772bae8524810e605", + "tx_hex": "0400008085202f890207a8e96978acfb8f0d002c3e4390142810dc6568b48f8cd6d8c71866ad8743c5010000006a47304402201960a7089f2d93480fff68ce0b7ca7bb7a32a52915753ac7ae780abd6162cb1d02202c9b11d442e5f72a532f44ceb10122898d486b1474a10eb981c60c5538b9c82d012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff97f56bf3b0f815bb737b7867e71ddb8198bba3574bb75737ba9c389a4d08edc6000000006a473044022055199d80bd7e2d1b932e54f097c6a15fc4b148d21299dc50067c1da18045f0ed02201d26d85333df65e6daab40a07a0e8a671af9d9b9d92fdf7d7ef97bd868ca545a012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200ca9a3b000000001976a91464ae8510aac9546d5e7704e31ce177451386455588acad2a0d02000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac00000000000000000000000000000000000000", + "kmd_rewards": { + "amount": "0.0791809", + "claimed_by_my": true + } + }, + "id": 0 + } + ``` + + #### Response (NotSufficientBalance error) + + ```json + { + "mmrpc": "2.0", + "error": "Not enough DOC to withdraw: available 69.75066225, required at least 1000.00001", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:449]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "DOC", + "available": "69.75066225", + "required": "1000.00001" + }, + "id": 0 + } + ``` + + +#### Withdraw BTC, KMD, and other BTC-based forks, fixed fee + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", + "fee": { + "type": "UtxoFixed", + "amount": "0.1" + } + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", + "block_height": 0, + "timestamp": 1566472936, + "fee_details": { + "type": "Utxo", + "amount": "0.1" + }, + "coin": "DOC", + "internal_id": "" + }, + "id": 0 + } + ``` + + #### Response (InvalidFeePolicy error - attempt to use EthGas for UTXO coin) + + ```json + { + "mmrpc": "2.0", + "error": "Invalid fee policy: Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", + "error_path": "utxo_common", + "error_trace": "utxo_common:1371]", + "error_type": "InvalidFeePolicy", + "error_data": "Expected 'UtxoFixed' or 'UtxoPerKbyte' fee types, found EthGas", + "id": 0 + } + ``` + + +#### Withdraw BTC, KMD, and other BTC-based forks, 1 coin per Kbyte fee + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "DOC", + "to": "R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW", + "amount": "1.0", + "fee": { + "type": "UtxoPerKbyte", + "amount": "1" + } + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f890258be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a000000006b483045022100ef11280e981be280ca5d24c947842ca6a8689d992b73e3a7eb9ff21070b0442b02203e458a2bbb1f2bf8448fc47c51485015904a5271bb17e14be5afa6625d67b1e8012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff58be11d196cb18764c71aa9ae84a2c81d100ac27a48f72bc6059690893bcb31a010000006b483045022100daaa10b09e7abf9d4f596fc5ac1f2542b8ecfab9bb9f2b02201644944ddc0280022067aa1b91ec821aa48f1d06d34cd26fb69a9f27d59d5eecdd451006940d9e83db012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788acf31c655d010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788accd7c5e5d000000000000000000000000000000", + "tx_hash": "fd115190feec8c0c14df2696969295c59c674886344e5072d64000379101b78c", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.00253836", + "spent_by_me": "60.00253836", + "received_by_me": "59.61874931", + "my_balance_change": "-0.38378905", + "block_height": 0, + "timestamp": 1566473421, + "fee_details": { + "type": "Utxo", + "amount": "0.38378905" + }, + "coin": "DOC", + "internal_id": "" + }, + "id": 0 + } + ``` + + +#### Withdraw ETH, ERC20, and other ETH-based forks + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "amount": 10 + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "block_height": 0, + "coin": "ETH", + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" + }, + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + + +#### ETH/ERC20 and other ETH-based forks, with gas fee + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "COIN_NAME", + "to": "RECIPIENT_ADDRESS", + "amount": "AMOUNT", + "fee": { + "type": "EthGas", + "gas_price": "3.5", + "gas": 55000 + } + }, + "id": 0 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "f86d820b2884d09dc30082d6d894bab36286672fbdc7b250804bf6d14be0df69fa29888ac7230489e80000801ca0ef0167b0e53ed50d87b6fd630925f2bce6ee72e9b5fdb51c6499a7caaecaed96a062e5cb954e503ff83f2d6ce082649fdcdf8a77c8d37c7d26d46d3f736b228d10", + "tx_hash": "a26c4dcacf63c04e385dd973ca7e7ca1465a3b904a0893bcadb7e37681d38c95", + "from": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "to": ["0xbAB36286672fbdc7B250804bf6D14Be0dF69fa29"], + "total_amount": "10", + "spent_by_me": "10.0001925", + "received_by_me": "10", + "my_balance_change": "-0.0001925", + "block_height": 0, + "timestamp": 1566474670, + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 55000, + "gas_price": "0.0000000035", + "total_fee": "0.0001925" + }, + "coin": "ETH", + "internal_id": "" + }, + "id": 0 + } + ``` + + #### Response (InvalidFeePolicy error - attempt to use UtxoFixed or UtxoPerKbyte for ETH coin) + + ```json + { + "mmrpc": "2.0", + "error": "Invalid fee policy: Expected 'EthGas' fee type, found UtxoFixed", + "error_path": "eth", + "error_trace": "eth:535]", + "error_type": "InvalidFeePolicy", + "error_data": "Expected 'EthGas' fee type, found UtxoFixed", + "id": 0 + } + ``` + + +#### Withdraw maximum + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "ETH", + "to": "0xbab36286672fbdc7b250804bf6d14be0df69fa28", + "max": true + }, + "id": 0 + } + ``` + + + + ##### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "block_height": 0, + "coin": "ETH", + "fee_details": { + "type": "Eth", + "coin": "ETH", + "gas": 21000, + "gas_price": "0.000000001", + "total_fee": "0.000021" + }, + "from": ["0xbab36286672fbdc7b250804bf6d14be0df69fa29"], + "my_balance_change": "-10.000021", + "received_by_me": "0", + "spent_by_me": "10.000021", + "to": ["0xbab36286672fbdc7b250804bf6d14be0df69fa28"], + "total_amount": "10.000021", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + + +##### Withdraw QRC20 coins + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10 + }, + "id": 0 + } + ``` + + + + ##### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "block_height": 0, + "coin": "QRC20", + "timestamp": 1608725061, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 100000, + "gas_price": 40, + "total_gas_fee": "0.04" + }, + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + + +##### Withdraw QRC20 coins with gas limit + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "QRC20", + "to": "qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs", + "amount": 10, + "fee": { + "type": "Qrc20Gas", + "gas_limit": 250000, + "gas_price": 40 + } + }, + "id": 0 + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "block_height": 0, + "coin": "QRC20", + "timestamp": 1608725061, + "fee_details": { + "type": "Qrc20", + "coin": "tQTUM", + "miner_fee": "0.00000447", + "gas_limit": 250000, + "gas_price": 40, + "total_gas_fee": "0.1" + }, + "from": ["qXxsj5RtciAby9T7m98AgAATL4zTi4UwDG"], + "my_balance_change": "-10", + "received_by_me": "0", + "spent_by_me": "10", + "to": ["qHmJ3KA6ZAjR9wGjpFASn4gtUSeFAqdZgs"], + "total_amount": "10", + "tx_hash": "8fbc5538679e4c4b78f8b9db0faf9bf78d02410006e8823faadba8e8ae721d60", + "tx_hex": "f86d820a59843b9aca0082520894bab36286672fbdc7b250804bf6d14be0df69fa28888ac7230489e80000801ba0fee87414a3b40d58043a1ae143f7a75d7f47a24e872b638281c448891fd69452a05b0efcaed9dee1b6d182e3215d91af317d53a627404b0efc5102cfe714c93a28" + }, + "id": 0 + } + ``` + + +##### Withdraw Tendermint coins with a memo + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "IRIS", + "to": "iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k", + "amount": 13, + "memo": "It was a bright cold day in April, and the clocks were striking thirteen." + }, + "id": 0 + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "tx_hex": "0ade010a8b010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126b0a2a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b122a6961613136647271766c33753873756b667375346c6d3371736b32386a72336661686a6139767376366b1a110a05756972697312083133303030303030124949742077617320612062726967687420636f6c642064617920696e20417072696c2c20616e642074686520636c6f636b73207765726520737472696b696e6720746869727465656e2e188f85b50812680a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc212040a020801181d12140a0e0a0575697269731205333835353310a08d061a40a9ac8c4112d7d7252062e289d222a438258a7c49c6657fdcbf831d62fc5eb2d05af46d6b86881335b3bc7ca98b2bfc3ef02ec5adf6768de9a778b282f9cc868e", + "tx_hash": "E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6", + "from": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "to": ["iaa16drqvl3u8sukfsu4lm3qsk28jr3fahja9vsv6k"], + "total_amount": "13.038553", + "spent_by_me": "13.038553", + "received_by_me": "13", + "my_balance_change": "-0.038553", + "block_height": 0, + "timestamp": 0, + "fee_details": { + "type": "Tendermint", + "coin": "IRIS", + "amount": "0.038553", + "gas_limit": 100000 + }, + "coin": "IRIS", + "internal_id": "e00982a2a8442d7140916a34e29e287a0b1cbb4b38940372d1966ba7acde5bd6", + "transaction_type": "StandardTransfer", + "memo": "It was a bright cold day in April, and the clocks were striking thirteen." + }, + "id": 0 + } + ``` + + You can see the memo is included on the [block explorer](https://irishub.iobscan.io/#/txs/E00982A2A8442D7140916A34E29E287A0B1CBB4B38940372D1966BA7ACDE5BD6) + +export const title = "AtomicDEX Method: Get Current MTP"; +export const description = "The get_current_mtp method returns the Median Time Past (MTP) from electrum servers for UTXO coins."; + +# get\_current\_mtp + +The `get_current_mtp` method returns the Median Time Past (MTP) from electrum servers for UTXO coins. This information is useful for debugging, specifically in cases where an electrum server has been misconfigured. + +## Arguments + +| Parameter | Type | Description | +| --------- | ------- | --------------------------------------------------------------------------------------- | +| coin | string | A compatible (UTXO) coin's ticker | +| id | integer | Optional. Identifies a request to allow matching it with a response. Defaults to `null` | + +#### Response + +| Parameter | Type | Description | +| --------- | ------- | ------------------------------------------------------------------------------------------------------------- | +| mtp | integer | Unix timestamp | +| id | integer | Identifies a response to allow matching it with a request. Defaults to `null` if `id` not provided in request | + +#### 📌 Examples + +#### Command + + + ```json + { + "method": "get_current_mtp", + "userpass": "testpsw", + "mmrpc": "2.0", + "id": 42, + "params": { + "coin": "DOC" + } + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "mtp": 1658746383 + }, + "id": 42 + } + ``` + +export const title = "AtomicDEX Method: Get Locked Amount"; +export const description = "The get_locked_amount method returns the amount of a coin which is currently locked by a swap which is in progress."; + +# get\_locked\_amount + +The `get_locked_amount` method returns the amount of a coin which is currently locked by a swap which is in progress. If the coin is not activated, a `NoSuchCoin` error will be returned. + +## Arguments + +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------- | +| coin | string | The ticker of the coin you want to query. | + +#### Response + +| Parameter | Type | Description | +| ----------------------- | --------------- | --------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you queried. | +| locked\_amount | object | An object cointaining the locked amount in decimal, fraction and rational formats. | +| locked\_amount.decimal | numeric string | The locked amount in [decimal format](https://www.mathsisfun.com/definitions/decimal.html). | +| locked\_amount.rational | rational object | The locked amount in [rational format](/atomicdex/api/legacy/rational_number_note/). | +| locked\_amount.fraction | fraction object | The locked amount in [fraction format](https://www.mathsisfun.com/definitions/fraction.html). | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "get_locked_amount", + "params": { + "coin": "DOC" + }, + "id": 42 + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "coin": "DOC", + "locked_amount": { + "decimal": "0.77803", + "rational": [ + [1, [77803]], + [1, [100000]] + ], + "fraction": { + "numer": "77803", + "denom": "100000" + } + } + }, + "id": 42 + } + ``` + + #### Response (error) + + ```json + { + "mmrpc": "2.0", + "error": "No such coin: TIME", + "error_path": "lp_swap.lp_coins", + "error_trace": "lp_swap:486] lp_coins:2894]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "TIME" + }, + "id": 42 + } + ``` + +export const title = "AtomicDEX: HD Address Management"; +export const description = "The methods in this document allow generation of HD addresses on AtomicDEX."; + +# Heirarchical Deterministic Address Management + +A hierarchical-deterministic (HD) wallet generates a new key pair from a master key pair, allowing for multiple addresses to be generated from the same seed so that change from transactions go to a previously unused address, enhancing privacy and security. The hierarchical structure resembles that of a tree, with the master key “determining” the key pairs that follow it in the hierarchy. If you have activated a coin with the [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) or [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) and used the `"priv_key_policy": "Trezor"` parameter, you can use the methods below to generate new addresses. + +## can\_get\_new\_address + +To avoid generating too many addresses at once, we can use a `gap_limit` constraint so that no more than a specific amount of unused addresses can be generated before more addresses can be generated. + +#### Arguments + +| Parameter | Type | Description | +| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you want to get a new address for | +| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | +| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| gap\_limit | integer | The maximum number of empty addresses in a row. | + +#### Response + +| Parameter | Type | Description | +| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------ | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| result.allowed | boolean | Whether or not you can get a new address. | +| result.reason | string | The reason you cant get a new address (if allowed is `false`). | +| result.details | object | Contains extra contextual information about the reason why allowed is `false` | +| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | + +Other reasons you might not be able to get a new address are: + +* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. +* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "can_get_new_address", + "params": { + "coin": "DOC", + "account_id": 0, + "chain": "External", + "gap_limit": 20 + } + } + ``` + + + + #### Response (success, allowed) + + ```json + { + "mmrpc": "2.0", + "result": { + "allowed": true + }, + "id": null + } + ``` + + #### Response (success, not allowed) + + ```json + { + "mmrpc": "2.0", + "result": { + "allowed": false, + "reason": "LastAddressNotUsed", + "details": { + "address": "RMHFCEWacWP7dYw1DWxH3TF5YW8q8hM5z7" + } + }, + "id": null + } + ``` + + +## get\_new\_address + +If we don't already have too many unused addresses, we can use the `get_new_address` method to generate a new address. The generated address will be shown in account\_balance and init\_account\_balance RPCs and on the next coin activation. + +#### Arguments + +| Parameter | Type | Description | +| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you want to get a new address for | +| account\_id | integer | Generally this will be `0` unless you have multiple accounts registered on your Trezor | +| chain | string | `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| gap\_limit | integer | The maximum number of empty addresses in a row. | + +#### Response + +| Parameter | Type | Description | +| ---------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| result.new\_address | object | Contains details about your new address. | +| result.address | string | The new address that was generated. | +| result.details | object | Contains extra contextual information about the reason why allowed is `false` | +| result.details.address | boolean | If reason is `LastAddressNotUsed`, this is the address that should be used before you can get a new address. | +| result.details.derivation\_path | string | The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of the address. | +| result.details.chain | string | `External` or `Internal` External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| result.details.balance | object | Contains the spendable and unspendable balance for this address | +| result.details.balance.spendable | string(numeric) | Spendable balance for this address | +| result.details.balance.unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | + +Other reasons you might not be able to get a new address are: + +* `EmptyAddressesLimitReached` - Last gap\_limit addresses are still unused. +* `AddressLimitReached` - Addresses limit reached. Currently, the limit is [2^31](https://www.wolframalpha.com/input?i=2%5E%2832%29) + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "get_new_address", + "params": { + "coin": "DOC", + "account_id": 0, + "chain": "External", + "gap_limit": 20 + } + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "allowed": true + }, + "id": null + } + ``` + + #### Response (success, not allowed) + + ```json + { + "mmrpc": "2.0", + "result": { + "new_address": { + "address": "RRqF4cYniMwYs66S4QDUUZ4GJQFQF69rBE", + "derivation_path": "m/44'/141'/0'/0/3", + "chain": "External", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } + }, + "id": null + } + ``` + +export const title = "AtomicDEX: HD Wallets Overview"; +export const description = + "This document describes all the methods available to activate coins, generate addresses etc., in Hardware Wallet mode."; + +# HD Wallets Overview + +The AtomicDEX API now is able to activate coins in Iguana and HW modes simultaneously! + +For example, you can activate DOC with seed phrase or private key in Iguana mode and also activate MARTY with a Hardware wallet or using a HD account at the same time. + +To get started, [configure and launch the AtomicDEX API](/atomicdex/setup/), then plug in your Trezor hardware wallet device. + +## Initialisation and authentication: + +* Initialise connection with your Trezor with [task::init\_trezor::init](/atomicdex/api/v20-dev/task_init_trezor/#init) +* Check the status of the connecton with [task::init\_trezor::status](/atomicdex/api/v20-dev/task_init_trezor/#status) +* Cancel authentication process with [task::init\_trezor::cancel](/atomicdex/api/v20-dev/task_init_trezor/#cancel) +* Authenticate using PIN or phrase with [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action) + +## UTXO Coin Activation in Hardware Mode: + +* Use [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) for UTXO coins like KMD, BTC and DOGE. +* Check the activation status with [task::enable\_utxo::status](/atomicdex/api/v20-dev/task_enable_utxo/#status) +* Authenticate the activation with [task::enable\_utxo::user\_action](/atomicdex/api/v20-dev/task_enable_utxo/#user-action) + +## QTUM Coin Activation in Hardware Mode: + +* Use [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) for QTUM Ecosystem coins. +* Check the activation status with [task::enable\_qtum::status](/atomicdex/api/v20-dev/task_enable_qtum/#status) +* Authenticate the activation with [task::enable\_qtum::user\_action](/atomicdex/api/v20-dev/task_enable_qtum/#user-action) + +## Withdrawing your Funds: + +* Prepare a transaction with [task::withdraw::init](/atomicdex/api/v20-dev/task_withdraw/#init) +* Check the status of the transaction preparation with [task::withdraw::status](/atomicdex/api/v20-dev/task_withdraw/#status) +* Cancel the transaction preparation with [task::withdraw::cancel](/atomicdex/api/v20-dev/task_withdraw/#cancel) + +## Viewing Hardware Wallet Coin Balances: + +* Initialise the balance request with [task::account\_balance::init](/atomicdex/api/v20-dev/task_account_balance/#init) +* Check the status of the balance request with [task::account\_balance::status](/atomicdex/api/v20-dev/task_account_balance/#status) + +## Creating New Addresses: + +* Use [can\_get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#can-get-new-address) to determine if your current address has been used, or should be updated. +* Use [get\_new\_address](/atomicdex/api/v20-dev/hd_address_management/#get-new-address) to generate a new address + + + These methods (and others with a `task::` prefix) will be linked to a numeric + `task_id` value which is used to query the status or outcome of the task. + + +## Details for HwError error type + +When requesting the status of a task, if an `error_type` of `HwError` is returned, the GUI / User should check the details in `error_data` field to know which action is required (as detailed below). + +### FoundUnexpectedDevice + +The connected Trezor device has a different pubkey value than what was specified in the `device_pubkey` parameter + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Found unexpected device. Please re-initialize Hardware wallet", + "error_path": "lib.common_impl.coin_balance.utxo_common.hd_pubkey.hw_ctx", + "error_trace": "lib:93] common_impl:46] coin_balance:304] utxo_common:163] hd_pubkey:176] hw_ctx:149]", + "error_type": "HwError", + "error_data": "FoundUnexpectedDevice" + } + }, + "id": null +} +``` + +### FoundMultipleDevices + +Multiple Trezor devices are plugged in. Remove the additional devices, and keep the one you want to use plugged in. + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Found multiple devices. Please unplug unused devices", + "error_path": "init_hw.crypto_ctx.hw_client", + "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:152] hw_client:126]", + "error_type": "HwError", + "error_data": "FoundMultipleDevices" + } + }, + "id": null +} +``` + +### NoTrezorDeviceAvailable + +No Trezor device detected by the AtomicDEX API. Make sure it is plugged in, or try a different USB cable / port. + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "No Trezor device available", + "error_path": "init_hw.crypto_ctx.hw_ctx.response.usb.libusb", + "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_ctx:120] response:136] usb:46] libusb:195]", + "error_type": "HwError", + "error_data": "NoTrezorDeviceAvailable" + } + }, + "id": null +} +``` +export const title = "AtomicDEX API RPC Protocol v2.0 (Dev)"; +export const description = "AtomicDEX API now supports mmrpc 2.0 protocol format, providing a standardized format for requests, successful responses, and error responses."; + +# AtomicDEX API RPC Protocol v2.0 (Dev) + +Starting with version [beta-2.1.3434](https://github.com/KomodoPlatform/komodo-defi-framework/releases/tag/beta-2.1.3434), the AtomicDEX API supports the standardized protocol format called `mmrpc 2.0`. + +It includes a uniform request, successful and error response formats. At the moment, only a few RPC methods support the `mmrpc 2.0` protocol. + +## Request + +| Structure | Type | Description | +| --------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol. Must be exactly "2.0" | +| userpass | string (optional) | your password for protected RPC methods. Skip this field if the specified `method` is public | +| method | string | the name of the method to be invoked | +| params | object (optional) | a structured value that holds the parameter values to be used during the invocation of the method. This field may be omitted if the method doesn't take arguments | +| id | number (optional) | the identifier is established by the client. AtomicDEX API will reply with the same value in the Response object if the `id` field is included and not `NULL` | + +### Response (Success) + +| Structure | Type | Description | +| --------- | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| result | object | the value of this field is determined by the method invoked on AtomicDEX API | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | + +### Response (Error) + +| Structure | Type | Description | +| ------------ | ----------------- | ------------------------------------------------------------------------------------------- | +| mmrpc | string | the string specifying the version of the AtomicDEX API RPC protocol | +| error | string | the common error description | +| error\_path | string | the error path consisting of file names separated by a dot similar to JSON path notation | +| error\_trace | string | the error path consisting of file and line number pairs separated by ']' | +| error\_type | string | the string error identifier used to determine the cause of the error | +| error\_data | object | an object containing the error data of the corresponding `error_type` | +| id | number (optional) | the identifier established by the client. The same value as in the Request if it was passed | + +### 📌 Examples + +#### Command + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "withdraw", + "params": { + "coin": "KMD", + "to": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", + "amount": "10" + }, + "id": 0 + } + ``` + + +#### Response (success) + +```json +{ + "mmrpc": "2.0", + "result": { + "tx_hex": "0400008085202f8901ef25b1b7417fe7693097918ff90e90bba1351fff1f3a24cb51a9b45c5636e57e010000006b483045022100b05c870fcd149513d07b156e150a22e3e47fab4bb4776b5c2c1b9fc034a80b8f022038b1bf5b6dad923e4fb1c96e2c7345765ff09984de12bbb40b999b88b628c0f9012102031d4256c4bc9f99ac88bf3dba21773132281f65f9bf23a59928bce08961e2f3ffffffff0200e1f505000000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ac8cbaae5f010000001976a91405aab5342166f8594baf17a7d9bef5d56744332788ace87a5e5d000000000000000000000000000000", + "tx_hash": "1ab3bc9308695960bc728fa427ac00d1812c4ae89aaa714c7618cb96d111be58", + "from": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "to": ["R9o9xTocqr6CeEDGDH6mEYpwLoMz6jNjMW"], + "total_amount": "60.10253836", + "spent_by_me": "60.10253836", + "received_by_me": "60.00253836", + "my_balance_change": "-0.1", + "block_height": 0, + "timestamp": 1566472936, + "fee_details": { + "type": "Utxo", + "amount": "0.1" + }, + "coin": "DOC", + "internal_id": "" + }, + "id": 0 +} +``` + +#### Response (error) + +```json +{ + "mmrpc": "2.0", + "error": "The amount 0.000005 is too small", + "error_path": "utxo_common", + "error_trace": "utxo_common:1379] utxo_common:301]", + "error_type": "AmountIsTooSmall", + "error_data": { + "amount": "0.000005" + }, + "id": 0 +} +``` +export const title = "AtomicDEX: Lightning Network Initialization Tasks"; +export const description = "The methods in this document allow initialization of Lightning Network on AtomicDEX-API."; + +# Lightning Network Initialization Tasks + + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + + +## Initialize Lightning {{label : 'task::enable_lightning::init', tag : 'API-v2'}} + +The `task::enable_lightning::init` request a task to run a lightning node. Use the returned `task_id` as an input to check the status of the lightning node (i.e, running or still initiating). An error will be returned if a lightning node was already running for the requested ticker. + + + Any methods with a `task::` prefix will be linked to a numeric `task_id` value which is used to query the status or outcome of the task. + + +### Request Parameters + +| Parameter | Type | Description | +| ------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of coin to activate | +| activation\_params | object | A standard [LightningActivationParams](/atomicdex/api/common_structures/lightning/#lightning-activation-params) object. | + +#### 📌 Example + + + ```json + { + "method": "task::enable_lightning::init", + "userpass": "testpsw", + "mmrpc": "2.0", + "params": { + "ticker": "tBTC-lightning", + "activation_params": { + "name": "AtomicDEX-Docs-Node-1", + "listening_port": 9735, + "color": "000000", + "payment_retries": 5 + } + }, + "id": 2 + } + ``` + + + + ### Response Parameters + + | Parameter | Type | Description | + | --------- | ------- | --------------------------------------------------------- | + | task\_id | integer | An identifying number which is used to query task status. | + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "task_id": 1 + }, + "id": null + } + ``` + + + + #### L2ConfigIsNotFound Error + + Coin is not in `coins` file. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-coin-config-parameters) for more information. + + ```json + { + "mmrpc": "2.0", + "error": "Layer 2 tBTC-lightning config is not found", + "error_path": "init_l2.prelude", + "error_trace": "init_l2:82] prelude:82]", + "error_type": "L2ConfigIsNotFound", + "error_data": "tBTC-lightning", + "id": 2 + } + ``` + + #### InvalidRequest Error + + A parameter is incorrect. + + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string "9735", expected u16", + "error_path": "dispatcher", + "error_trace": "dispatcher:110]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string "9735", expected u16", + "id": 762 + } + ``` + + #### UnexpectedL2Protocol Error + + Coin is wrong protocol type. + + ```json + { + "mmrpc": "2.0", + "error": "Unexpected layer 2 protocol UTXO for tBTC-segwit", + "error_path": "init_l2.prelude.lightning_activation", + "error_trace": "init_l2:82] prelude:93] lightning_activation:92]", + "error_type": "UnexpectedL2Protocol", + "error_data": { + "ticker": "tBTC-segwit", + "protocol": { + "type": "UTXO" + } + }, + "id": 2 + } + ``` + + #### Internal Error + + Address already in use. + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "I/O error Address already in use (os error 48)", + "error_path": "lib.lightning_activation.ln_p2p", + "error_trace": "lib:103] lightning_activation:280] ln_p2p:196]", + "error_type": "Internal", + "error_data": "I/O error Address already in use (os error 48)" + } + }, + "id": null + } + ``` + + #### PlatformCoinIsNotActivated Error + + The selected coin is not activated. It needs to be activated before the lightning node can be initialized. + + ```json + { + "mmrpc": "2.0", + "error": "Platform coin tBTC-lightning is not activated", + "error_path": "init_l2.lp_coins", + "error_trace": "init_l2:87] lp_coins:3087]", + "error_type": "PlatformCoinIsNotActivated", + "error_data": "tBTC-lightning", + "id": 2 + } + ``` + + + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1197550229](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1197550229) + Another bug found, will fix it in an upcoming PR. Platform coin should be tBTC-segwit. You can leave as it is in docs until I fix it. + + + #### InvalidPlatformConfiguration Error + + Coin's configuration is missing a required parameter. Refer to the [coins file configuration for lightning](/atomicdex/api/v20-dev/lightning/#lightning-network-coins-file-configuration) for more information. + + ```json + { + "mmrpc": "2.0", + "error": "Invalid config for platform coin: tBTC-segwit, error: 'avg_blocktime' field is not found in platform coin config", + "error_path": "init_l2.lightning_activation", + "error_trace": "init_l2:95] lightning_activation:254]", + "error_type": "InvalidPlatformConfiguration", + "error_data": { + "platform_coin_ticker": "tBTC-segwit", + "err": "'avg_blocktime' field is not found in platform coin config" + }, + "id": 2 + } + ``` + + +## Initialization Status {{label : 'task::enable_lightning::status', tag : 'API-v2'}} + +The `task::enable_lightning::status` request checks the status of lightning node initialization. + +### Request Parameters + +| Parameter | Type | Description | +| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| task\_id | integer | The task id returned from `task::enable_lightning::init` | +| forget\_if\_finished | boolean | Optional, defaults to `true`. If `false`, the status of the `task_id` will still be available after the task has completed. | + +#### 📌 Example + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::enable_lightning::status", + "params": { + "task_id": 1, + "forget_if_finished": false + }, + "id": 2 + } + ``` + + + + ### Response Parameters + + | Parameter | Type | Description | + | -------------- | ------ | ---------------------------------------------------------------------------------- | + | platform\_coin | string | The coin ticker for which the lightning node is being intitialized. | + | address | string | This node's address for the activated coin. | + | balance | object | A standard [balanceInfos](/atomicdex/api/common_structures/#balance-infos) object. | + + + The unspendable balance for lightning is different to a layer-1 unspendable balance. The channel reserve is part of the unspendable balance in lightning - the user will get this part of the balance on chain when closing the channel, but it can't be spent on layer 2 (lightning) because it's part of the security mechanism to prevent channel breaches and ensure that both parties fulfill their obligations within the channel. + + + #### Response (ready, success) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Ok", + "details": { + "platform_coin": "BTC-segwit", + "address": "0321937a095229510bd2b02a930d7b7eb273147e348ef1086b22e8790e3c609804", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } + }, + "id": null + } + ``` + + + In the above response spendable will always be 0 since the balance is unspendable until connections with lightning channels counterparties are established. + Using the [my\_balance](/atomicdex/api/legacy/my_balance/) method after the coin is activated will get the spendable balance depending on how many channel counterparties are online. + For exact channels balances and which channels are usable, use [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter). + + + #### Response (in progress state) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": "ReadingNetworkGraphFromFile" + }, + "id": null + } + ``` + + Possible in progress statuses: + + * ActivatingCoin + * GettingFeesFromRPC + * ReadingNetworkGraphFromFile + * InitializingChannelManager + * InitializingPeerManager + * ReadingScorerFromFile + * InitializingBackgroundProcessor + * ReadingChannelsAddressesFromFile + + +## Cancel Initialization {{label : 'task::enable_lightning::cancel', tag : 'API-v2'}} + +The `task::enable_lightning::cancel` request cancels lightning node initialization. + +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------- | -------------------------------------------------------- | +| task\_id | integer | The task id returned from `task::enable_lightning::init` | + +#### 📌 Example + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::enable_lightning::cancel", + "params": { + "task_id": 1 + }, + "id": 1 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + + + + #### TaskFinished Error + + Task has already been completed. + + ```json + { + "mmrpc": "2.0", + "error": "Task is finished already", + "error_path": "init_l2.manager", + "error_trace": "init_l2:157] manager:104]", + "error_type": "TaskFinished", + "error_data": 3, + "id": null + } + ``` + +export const title = "AtomicDEX: Lightning Network Channels"; +export const description = "The methods in this document allow management of Lightning Network Channels on AtomicDEX-API."; + +# Lightning Network Channels + + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + + +## Open Channel {{label : 'lightning::channels::open_channel', tag : 'API-v2'}} + +The `lightning::channels::open_channel` method opens a new channel with a remote node. + +### Request Parameters + +| Parameter | Type | Description | +| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to open a channel for. | +| node\_address | string | Lightning node addresses always have a format of `node_pubkey`@`ip_address`:`port`. | +| amount | object | A standard [LightningChannelAmount](/atomicdex/api/common_structures/lightning/#lightning-channel-amount) object. | +| push\_msat | integer | Optional. The amount in millisatoshi to push to the counterparty while openning, to create inbound liquidity for the channel. Using the `push_msat` parameter avoids having to send funds in a separate request later. Please note that the funds given using push\_msat is given unconditionally, meaning that there is no proof of payment in a preimage as with paying an invoice. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| channel\_configs | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | + +#### 📌 Example using an exact amount + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::open_channel", + "params": { + "coin": "tBTC-lightning", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", + "amount": { + "type": "Exact", + "value": 0.004 + } + }, + "id": 22 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@233.112.95.142:9735" + }, + "id": 22 + } + ``` + + +#### 📌 Example using max available with channel options and configs + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::open_channel", + "params": { + "coin": "tBTC-lightning", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735", + "amount": { + "type": "Max" + }, + "push_msat": 0, + "channel_options": { + "proportional_fee_in_millionths_sats": 0, + "base_fee_msat": 1000, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_satoshis": 1000 + }, + "channel_configs": { + "counterparty_locktime": 144, + "our_htlc_minimum_msat": 1, + "negotiate_scid_privacy": false, + "max_inbound_in_flight_htlc_percent": 10, + "commit_upfront_shutdown_pubkey": true, + "inbound_channels_confirmations": 3, + "their_channel_reserve_sats": 10000 + } + }, + "id": null + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" + }, + "id": null + } + ``` + + +## Close Channel {{label : 'lightning::channels::close_channel', tag : 'API-v2'}} + +The `lightning::channels::close_channel` method closes a channel with a remote node. + +### Request Parameters + +| Parameter | Type | Description | +| ------------ | ------- | ---------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to close a channel for. | +| uuid | string | Unique channel identifier. | +| force\_close | boolean | Optional, defaults to `false`. If `true`, will force closure of the channel. | + + + It is not recommended to force close a channel unless the counterparty is offline or unreachable for a long time. + Force closure of a channel will makeresult in the party who initiates the force closure to wait for a number of blocks (equal to the `force_close_spend_delay` value returned by [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details)) before they can get their funds on chain. + + +#### 📌 Example to force closing a channel + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::close_channel", + "params": { + "coin": "tBTC-lightning", + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "force_close": true + }, + "id": 8 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": "Initiated closing of channel with uuid: 2b50e274-c173-4fa1-95f3-97f9f82ace92", + "id": 8 + } + ``` + + + To see if the channel is closed or not, use the [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) method. + + + + Already added this message to the response in this upcoming PR KomodoPlatform/atomicDEX-API#1814, also added force\_close\_spend\_delay to the close channel response. No need to change the docs now until this PR is merged KomodoPlatform/atomicDEX-API#1814, I will write a comment about all the changes when opening the PR for review. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1202462310](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1202462310) + + + + + #### InvalidRequest Error + + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `uuid`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `uuid`", + "id": 8 + } + ``` + + #### NoSuchChannel Error + + ```json + { + "mmrpc": "2.0", + "error": "No such channel with uuid 2b50e274-c173-4fa1-95f3-97f9f82ace92", + "error_path": "close_channel", + "error_trace": "close_channel:55]", + "error_type": "NoSuchChannel", + "error_data": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "id": 8 + } + ``` + + +## Update Channel {{label : 'lightning::channels::update_channel', tag : 'API-v2'}} + +The `lightning::channels::update_channel` method updates channel options. + +### Request Parameters + +| Parameter | Type | Description | +| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to update channel configuration options for. | +| uuid | string | Unique channel identifier. | +| channel\_options | object | A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | + +#### 📌 Example to update all available channel options + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::update_channel", + "params": { + "coin": "tBTC-lightning", + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_options": { + "proportional_fee_in_millionths_sats": 1, + "base_fee_msat": 1100, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_satoshis": 1000 + } + }, + "id": 2 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "channel_options": { + "proportional_fee_in_millionths_sats": 1, + "base_fee_msat": 1100, + "cltv_expiry_delta": 72, + "max_dust_htlc_exposure_msat": 5000000, + "force_close_avoidance_max_fee_sats": null + } + }, + "id": 2 + } + ``` + + + + #### NoSuchChannel Error + + Channel with the given uuid is not foun on the lightning network. + + ```json + { + "mmrpc": "2.0", + "error": "No such channel with uuid dc33b998-8589-44fd-a246-256a582e8942", + "error_path": "update_channel", + "error_trace": "update_channel:61]", + "error_type": "NoSuchChannel", + "error_data": "dc33b998-8589-44fd-a246-256a582e8942", + "id": 2 + } + ``` + + +## Get Channel Details {{label : 'lightning::channels::get_channel_details', tag : 'API-v2'}} + +The `lightning::channels::get_channel_details` method returns details about a channel. + +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------ | +| coin | string | The ticker of the coin you would like to view channel details for. | +| uuid | string | Unique channel identifier. | + +#### 📌 Example to update all available channel options + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::get_channel_details", + "params": { + "coin": "tBTC-lightning", + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92" + }, + "id": 54 + } + ``` + + + + + The response will vary depending on whether the channel status is `open` or `closed`. + + + #### Response (opened channel) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Open", + "details": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 959722, + "is_outbound": true, + "balance_msat": 959722000, + "outbound_capacity_msat": 950125000, + "inbound_capacity_msat": 0, + "current_confirmations": 0, + "required_confirmations": 3, + "is_ready": false, + "is_usable": false, + "is_public": false + } + }, + "id": 54 + } + ``` + + + `force_close_spend_delay` is not currently available in get\_channel\_details response, but should be added soon. + It's configured by the other side using counterparty\_locktime where we are the counterparty to the other side, the other side gets to set it since it's part of their security considerations since they have to be online at least once during this period if we tried to steal funds by broadcasting an old commitment transaction. We set our own too in our configs where it shows in the channel details of the other side as force\_close\_spend\_delay. The other side can't set counterparty\_locktime to any value when opening the channel though, since they can set it to a very long time and our funds will be locked for a very long time if we force closed the channel, this is where counterparty\_channel\_config\_limits::our\_locktime\_limit comes in as the other side can't make counterparty\_locktime larger than this limit otherwise the channel gets rejected and is never opened in the first place. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206109172](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206109172) + + + #### Response (closed channel) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Open", + "details": { + "uuid": "2b50e274-c173-4fa1-95f3-97f9f82ace92", + "channel_id": "4a869115dfd260d0925a1266f544a6ab36666448d4bbc0e2a028d8426b2b6d4e", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": "4e6d2b6b42d828a0e2c0bbd448646636aba644f566125a92d060d2df1591864a", + "funding_value": "98982", + "closing_tx": "f1591864ad0e2c0bad060425a94b8288646e6d24f56b6d2db42d4636aba64612", + "closure_reason": "null", + "claiming_tx": "null", + "claimed_balance": "null", + "funding_generated_in_block": "null", + "is_outbound": false, + "is_public": true, + "is_closed": true, + "created_at": 167273496966, + "closed_at": 171069595935 + } + }, + "id": 54 + } + ``` + + + The closed response above was spoofed, so the values are not accurate. Once code is finalised we should generate a real one. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206150595](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206150595) + + + + + #### InvalidRequest Error + + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `coin`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `coin`", + "id": 54 + } + ``` + + +## Get Claimable Balances {{label : 'lightning::channels::get_claimable_balances', tag : 'API-v2'}} + +The `lightning::channels::get_claimable_balances` method returns a list of claimable balances for a coin. + +### Request Parameters + +| Parameter | Type | Description | +| --------------------------------- | ------- | ------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view claimable balances for. | +| include\_open\_channels\_balances | integer | Optional, defaults to `false`. If `true`, includes balances from open channels. | + +#### 📌 Example to update all available channel options + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::get_claimable_balances", + "params": { + "coin": "tBTC-lightning", + "include_open_channels_balances": true + }, + "id": 762 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": [{ + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 0 + } + }, { + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 38815 + } + }, { + "ClaimableOnChannelClose": { + "claimable_amount_satoshis": 959539 + } + }], + "id": 762 + } + ``` + + + This response may include additional information in future. + [https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\\_r1206152132](https://github.com/KomodoPlatform/komodo-docs-mdx/pull/31#discussion\\_r1206152132) + + + +## List Open Channels by Filter {{label : 'lightning::channels::list_open_channels_by_filter', tag : 'API-v2'}} + +The `lightning::channels::list_open_channels_by_filter` method returns a list of open channels filtered by the provided filter object. + +### Request Parameters + +| Parameter | Type | Description | +| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view open channels for. | +| filter | object | A standard [LightningOpenChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-open-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | + +#### 📌 Example without using `filter` parameter + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_open_channels_by_filter", + "params": { + "coin": "tBTC-lightning" + }, + "id": 55 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "funding_tx": null, + "funding_tx_output_index": null, + "funding_tx_value_sats": 4000, + "is_outbound": true, + "balance_msat": 4000000, + "outbound_capacity_msat": 4000000, + "inbound_capacity_msat": 0, + "current_confirmations": 0, + "required_confirmations": null, + "is_ready": false, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 + } + ``` + + +#### 📌 Example with `filter` for inbound channels only + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_open_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "is_outbound": false + } + }, + "id": 55 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", + "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", + "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", + "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": false, + "balance_msat": 5211, + "outbound_capacity_msat": 0, + "inbound_capacity_msat": 38994789, + "current_confirmations": 215, + "required_confirmations": 3, + "is_ready": true, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 + } + ``` + + +#### 📌 Example with `filter` for a specific `node_id` + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_open_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "counterparty_node_id": "02eb0b178576857b6990ba57d56aa08f651a05a8098496004f42df5e7440b0a9c1" + } + }, + "id": 55 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", + "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": true, + "balance_msat": 38998197, + "outbound_capacity_msat": 38598197, + "inbound_capacity_msat": 1803, + "current_confirmations": 215, + "required_confirmations": 3, + "is_ready": true, + "is_usable": true, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 + } + ``` + + +#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_open_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "from_funding_value_sats": 1000, + "to_funding_value_sats": 500000 + } + }, + "id": 55 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "open_channels": [{ + "uuid": "adde8899-ba11-435a-9433-d180e2f5af6b", + "channel_id": "4cde288dd1ec1691b51cac8890a867a58fcfc98670e32ed7a112402b819a01f1", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "f1019a812b4012a1d72ee37086c9cf8fa567a89088ac1cb59116ecd18d28de4c", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": true, + "balance_msat": 38998197, + "outbound_capacity_msat": 38598197, + "inbound_capacity_msat": 1803, + "current_confirmations": 218, + "required_confirmations": 3, + "is_ready": true, + "is_usable": true, + "is_public": false + }, { + "uuid": "f86dbfae-898a-4f49-8149-58d9dfa095a5", + "channel_id": "143cd1fa265c4bed860ce81f369d5c4ee8ef80c5c91872176f524348c2c1fff4", + "counterparty_node_id": "03cf982b1c16f7d3561d8bb17f7cf30057389d228756bce517c0f3cc111b38ecd0", + "funding_tx": "f4ffc1c24843526f177218c9c580efe84e5c9d361fe80c86ed4b5c26fad13c14", + "funding_tx_output_index": 0, + "funding_tx_value_sats": 40000, + "is_outbound": false, + "balance_msat": 5211, + "outbound_capacity_msat": 0, + "inbound_capacity_msat": 38994789, + "current_confirmations": 218, + "required_confirmations": 3, + "is_ready": true, + "is_usable": false, + "is_public": false + }], + "limit": 10, + "skipped": 0, + "total": 2, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 55 + } + ``` + + +## List Closed Channels by Filter {{label : 'lightning::channels::list_closed_channels_by_filter', tag : 'API-v2'}} + +The `lightning::channels::list_closed_channels_by_filter` method returns a list of closed channels filtered by the provided filter object. + +### Request Parameters + +| Parameter | Type | Description | +| --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you would like to view closed channels for. | +| filter | object | A standard [LightningClosedChannelsFilter](/atomicdex/api/common_structures/lightning/#lightning-closed-channels-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | + +#### 📌 Example without using `filter` parameter + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_closed_channels_by_filter", + "params": { + "coin": "tBTC-lightning" + }, + "id": 55 + } + ``` + + + + #### Response + + ```json + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683864431, + "closed_at": 1683864432 + }, + { + "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", + "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683866505, + "closed_at": 1683866505 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 + } + ``` + + +#### 📌 Example with `filter` for inbound channels only + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_closed_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "channel_type": "Inbound" + } + }, + "id": 55 + } + ``` + + + + #### Response + + ```json + + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "de006b65-bd30-41e1-9b44-5e04518a3d98", + "channel_id": "928a041767f23c461fe3b41a387bd3f91a10b284cd7f90fb04544eda4f38f967", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because of an exception: We consider the minimum depth to be unreasonably large. Expected minimum: (1). Actual: (3)", + "is_outbound": false, + "is_public": false, + "is_closed": true, + "created_at": 1683866505, + "closed_at": 1683866505 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 + } + ``` + + +#### 📌 Example with `filter` for a specific `node_id` + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_closed_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + } + }, + "id": 55 + } + ``` + + + + #### Response + + ```json + + {"mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "434681f8-95e5-484f-af49-fa80d8ae857b", + "channel_id": "ebfbf19193ee26f25c6e236e863786e59818c11e136ce9c50dba63ec44b0c89a", + "counterparty_node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "closure_reason": "Channel closed because counterparty force-closed with message chan size of 0.00004 BTC is below min chan size of 0.0002 BTC", + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1683864431, + "closed_at": 1683864432 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, "id": 55 + } + ``` + + +#### 📌 Example with `filter` for a node with between 100000 and 500000 satoshi funding value + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::channels::list_closed_channels_by_filter", + "params": { + "coin": "tBTC-lightning", + "filter": { + "from_funding_value_sats": 100000, + "to_funding_value_sats": 500000 + } + }, + "id": 55 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "closed_channels": [{ + "uuid": "f901b604-54f7-4094-80f7-86aa9e362343", + "channel_id": "20aae008973fad5a59559ac0650143ec5b53aba1c6584d3d92177491a8284d00", + "counterparty_node_id": "02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248", + "funding_tx": "3807d9353557d15ad46e90a68dab8e4cd3a68a4af6b61bc7414bf81e29bc0517", + "funding_value": 40000, + "closing_tx": "61575237132b78aa5d1b4d62137da316bc67d09804b0bee53ab50f5d7cd0337c", + "closure_reason": "Channel closed because the channel was cooperatively closed", + "funding_generated_in_block": 2433122, + "is_outbound": true, + "is_public": false, + "is_closed": true, + "created_at": 1684083341, + "closed_at": 1684146940 + }], + "limit": 10, + "skipped": 0, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 762 + } + ``` + +export const title = "AtomicDEX: Lightning Network Methods"; +export const description = + "This document describes all the available methods for the Lightning Network on AtomicDEX-API."; + +import lightningflowchart from "@/public/images/api-images/lightning-methods.png"; + +# Lightning Network Methods + + + Lightning methods are currently only available using the native AtomicDEX-API. + WASM support should be available in late 2023. + + +## Lightning Network Initialization Tasks + +* Initialise your lightning node with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) +* Check the initialization status of the lightning node with [task::enable\_lightning::status](/atomicdex/api/v20-dev/lightning/activation/#initialization-status) +* Cancel initialization process of the lightning node with [task::enable\_lightning::cancel](/atomicdex/api/v20-dev/lightning/activation/#cancel-initialization) + + + Any methods with a `task::` prefix will be linked to a numeric `task_id` value + which is used to query the status or outcome of the task. + + +## Lightning Network Nodes Methods + +* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) +* Add a trusted node with [lightning::nodes::add\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#add-trusted-node) +* Remove a trusted node with [lightning::nodes::remove\_trusted\_node](/atomicdex/api/v20-dev/lightning/nodes/#remove-trusted-node) +* List your trusted lightning nodes with [lightning::nodes::list\_trusted\_nodes](/atomicdex/api/v20-dev/lightning/nodes/#list-trusted-nodes) + +## Lightning Network Channels Methods + +* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) +* Close a lightning channel [lightning::channels::close\_channel](/atomicdex/api/v20-dev/lightning/channels/#close-channel) +* Update a lightning channel [lightning::channels::update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) +* Get details about a lightning channel [lightning::channels::get\_channel\_details](/atomicdex/api/v20-dev/lightning/channels/#get-channel-details) +* Get claimable balances from lightning channels [lightning::channels::get\_claimable\_balances](/atomicdex/api/v20-dev/lightning/channels/#get-claimable-balances) +* List open lightning channels matching a filter [lightning::channels::list\_open\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-open-channels-by-filter) +* List closed lightning channels matching a filter [lightning::channels::list\_closed\_channels\_by\_filter](/atomicdex/api/v20-dev/lightning/channels/#list-closed-channels-by-filter) + +## Lightning Network Payments Methods + +* Generate lightning invoices with [lightning::payments::generate\_invoice](/atomicdex/api/v20-dev/lightning/payments/#generate-invoice) +* Send lightning payments with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) +* Get details about a lightning payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) +* Get a filtered list of lightning payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) + +## Lightning Network Flowchart + +Once you: + +* Enable lightning with [task::enable\_lightning::init](/atomicdex/api/v20-dev/lightning/activation/#initialize-lightning) +* Connect to a lightning node with [lightning::nodes::connect\_to\_node](/atomicdex/api/v20-dev/lightning/nodes/#connect-to-node) +* Open a lightning channel [lightning::channels::open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) + +You can get an invoice for a coffee from [https://starblocks.acinq.co](https://starblocks.acinq.co)! + +Then you can: + +* Pay the invoice with [lightning::payments::send\_payment](/atomicdex/api/v20-dev/lightning/payments/#send-payment) +* View details about the payment with [lightning::payments::get\_payment\_details](/atomicdex/api/v20-dev/lightning/payments/#get-payment-details) +* List your payments with [lightning::payments::list\_payments\_by\_filter](/atomicdex/api/v20-dev/lightning/payments/#list-payments-by-filter) + +Follow the flowchart below to visualize the process: + + + +## Lightning Network Coins File Configuration + + + Some configurations are set per coin, and some are set per channel. The + [counterparty\_channel\_config\_limits](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) + param must be set in the `coins` configuration file, and aplies to all + channels opened by counterparty nodes. The + [our\_channels\_config](/atomicdex/api/common_structures/lightning/#lightning-channel-config) and + [channel\_options](/atomicdex/api/common_structures/lightning/#lightning-channel-options) parameters + are set per channel. These can be defined in the `coins` configuration file to + act as the default for all opened channels, and optionally overwritten or + updated using the + [open\_channel](/atomicdex/api/v20-dev/lightning/channels/#open-channel) or + [update\_channel](/atomicdex/api/v20-dev/lightning/channels/#update-channel) + methods. + + +### Lightning Coin Config Parameters + +| Parameter | Type | Description | +| ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | object | The ticker of the coin you will use lightning network with, suffixed with `-lightning` | +| mm2 | integer | Defaults to `0`. A value of `1`, indicates the coin is atomic swap compatible. | +| decimals | integer | The decimal precision of the coin you will use the lightning network with. | +| protocol | object | A standard [CoinProtocol](/atomicdex/api/common_structures/activation/#coin-protocol) object. | +| accept\_inbound\_channels | boolean | Optional, defaults to `true`. If this is set to false, we do not accept inbound requests to open a new channel. | +| accept\_forwards\_to\_priv\_channels | boolean | Optional, defaults to `false`. When set to `false`, any HTLCs which were to be forwarded over private channels will be rejected. This prevents us from taking on HTLC-forwarding risk when we intend to run as a node which is not online reliably (e.g. GUI wallet apps). Generally, private channels are used for non-routing purposes only. | +| counterparty\_channel\_config\_limits | object | Optional. A standard [CounterpartyChannelConfig](/atomicdex/api/common_structures/lightning/#counterparty-channel-config) object. | +| channel\_options | object | Optional. A standard [LightningChannelOptions](/atomicdex/api/common_structures/lightning/#lightning-channel-options) object. | +| our\_channels\_config | object | Optional. A standard [LightningChannelConfig](/atomicdex/api/common_structures/lightning/#lightning-channel-config) object. | + + + For GUIs and wallet apps, it is recommended to set + `accept_forwards_to_priv_channels` to `false`. This prevents users from taking + on HTLC-forwarding risk when a node is expected to not be reliably online. + [our\_channels\_config::announced\_channel](/atomicdex/api/common_structures/lightning/#lightning-channel-options) + should also be set to `false` for GUIs and wallet apps. + + + + ```json + { + "coin": "BTC-lightning", + "mm2": 1, + "decimals": 11, + "our_channels_config": { + "inbound_channels_confirmations": 3, + "max_inbound_in_flight_htlc_percent": 90 + }, + "counterparty_channel_config_limits": { + "outbound_channels_confirmations": 3, + "force_announced_channel_preference": false + }, + "protocol": { + "type": "LIGHTNING", + "protocol_data":{ + "platform": "BTC-segwit", + "network": "mainnet", + "confirmation_targets": { + "background": 12, + "normal": 6, + "high_priority": 1 + } + } + } + }, + { + "coin": "tBTC-lightning", + "mm2": 1, + "decimals": 11, + "our_channels_configs": { + "inbound_channels_confirmations": 3, + "max_inbound_in_flight_htlc_percent": 90, + "their_channel_reserve_sats": 10000 + }, + "counterparty_channel_config_limits": { + "outbound_channels_confirmations": 3 + }, + "protocol": { + "type": "LIGHTNING", + "protocol_data":{ + "platform": "tBTC-segwit", + "network": "testnet", + "confirmation_targets": { + "background": 12, + "normal": 6, + "high_priority": 1 + } + } + } + }, + ``` + +export const title = "AtomicDEX: Lightning Network Nodes"; +export const description = "The methods in this document allow management of connections to Lightning Network Nodes on AtomicDEX-API."; + +# Lightning Network Nodes + + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + + +## Connect to Node {{label : 'lightning::nodes::connect_to_node', tag : 'API-v2'}} + +The `lightning::nodes::connect_to_node` method allows you to connect to a lightning node. + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ------ | ----------------------------------------------------------------------------------- | +| coin | string | The coin ticker you would like to connect to a node on. | +| node\_address | string | Lightning nodes addresses always have a format of `node_pubkey`@`ip_address`:`port` | + +#### 📌 Example + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::nodes::connect_to_node", + "params": { + "coin": "tBTC-lightning", + "node_address": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9@203.132.94.196:9735" + }, + "id": 1 + } + ``` + + + + The node address in the above request is for the WalletOfSatoshi lightning node, which is one of the most connected lightning nodes. + Other node addresses can be retrieved from any lightning explorer, such as: + + * [https://1ml.com/](https://1ml.com/) + * [https://mempool.space/lightning/](https://mempool.space/lightning/) + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": "Connected successfully to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", + "id": null + } + ``` + + #### Response (already connected) + + ```json + { + "mmrpc": "2.0", + "result": "Already connected to node : 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735", + "id": null + } + ``` + + + + #### InvalidRequest Error (Invalid node\_address) + + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: Could not parse node address from str rgjhk3", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "Could not parse node address from str rgjhk3", + "id": 762 + } + ``` + + #### ConnectionError Error (Timed out waiting to connect to node\_address) + + ```json + { + "mmrpc": "2.0", + "error": "Error connecting to node: Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", + "error_path": "connect_to_node", + "error_trace": "connect_to_node:78]", + "error_type": "ConnectionError", + "error_data": "Timeout error: Failed to connect to node: 035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226", + "id": null + } + ``` + + +## List Trusted Nodes {{label : 'lightning::nodes::list_trusted_nodes', tag : 'API-v2'}} + +The `lightning::nodes::list_trusted_nodes` method allows you to list all nodes in your trusted list. + +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------- | +| coin | string | The coin ticker you would like to view your trusted nodes to. | + +#### 📌 Example + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::nodes::list_trusted_nodes", + "params": { + "coin": "tBTC-lightning" + }, + "id": 1 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "trusted_nodes": ["038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9"] + }, + "id": 1 + } + ``` + + +## Add Trusted Node {{label : 'lightning::nodes::add_trusted_node', tag : 'API-v2'}} + +The `lightning::nodes::add_trusted_node` method allows you to add a node to your trusted list. + +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | --------------------------------------------------------- | +| coin | string | The coin ticker you would like to add a trusted node for. | +| node\_id | string | ID of node you would like to add to your trusted list. | + +#### 📌 Example + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::nodes::add_trusted_node", + "params": { + "coin": "tBTC-lightning", + "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + }, + "id": 1 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "added_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + }, + "id": 1 + } + ``` + + +## Remove Trusted Node {{label : 'lightning::nodes::remove_trusted_node', tag : 'API-v2'}} + +The `lightning::nodes::remove_trusted_node` method allows you to remove a node from your trusted list. + +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------- | +| coin | string | The coin ticker you would like to remove a trusted node from. | +| node\_id | string | ID of node you would like to remove from your trusted list. | + +#### 📌 Example + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::nodes::remove_trusted_node", + "params": { + "coin": "tBTC-lightning", + "node_id": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + }, + "id": 1 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "removed_node": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9" + }, + "id": 1 + } + ``` + +export const title = "AtomicDEX: Lightning Network Payments"; +export const description = "The methods in this document allow management of Lightning Network Payments on AtomicDEX-API."; + +# Lightning Network Payments + + + Lightning methods are currently only available using the native AtomicDEX-API. WASM support should be available in late 2023. + + +## Generate invoice {{label : 'lightning::payments::generate_invoice', tag : 'API-v2'}} + +The `lightning::payments::generate_invoice` method generates an invoice to be paid by another node. + +### Request Parameters + +| Parameter | Type | Description | +| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of coin to generate invoice for. | +| description | string | A note to indicate the purpose of the invoice. | +| amount\_in\_msat | integer | Amount to be paid, in [millisatoshis](https://bitcoindata.science/bitcoin-units-converter.html) (A thousandth of a satoshi; the same as 0.00000000001 bitcoin.) | +| expiry | integer | Optional, defaults to `3600`. Seconds until the invoice expires. | + +#### 📌 Example + + + ```json + { + "method": "lightning::payments::generate_invoice", + "userpass": "testpsw", + "mmrpc": "2.0", + "params": { + "coin": "tBTC-lightning", + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "expiry": 600 + }, + "id": 1 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", + "invoice": "lntb100n1pj9aq73dpggehhygr5dpjjqcn4wfnk2u3qdahzq4r4v4ekgctenp4qf3dqylh55jd8m5x5hh0g5q82h9p86yghwhl2s0t826nlyp8zdgjzpp58leevp0jzjjtg9vln385fj2duw388ucqqsk2rzmuk0tz7fc2n67qsp5k33rvvq46xtuppl22ggcq5q7qqywyekcemhzazt4m6vulwsarcrq9qyysgqcqpcxqzjcrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjfgaasqqqvqqqqqqqqlgqqqqqqgq9qpwesnhre7xmdg6tajvp939vl72vxm8csecy6hfcah9fzgazd5eyzjskgtt7u9xshj7gq2vkejjcquem08tqfrc2pj78xa95teazzf0qq7pnyqj" + }, + "id": 1 + } + ``` + + + + ### InvalidRequest (invalid paramater value) + + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: invalid type: string '56', expected u64", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid type: string '56', expected u64", + "id": 762 + } + ``` + + +## Send Payment {{label : 'lightning::payments::send_payment', tag : 'API-v2'}} + +The `lightning::payments::send_payment` method sends a payment to another node. + +Used to pay an invoice or send a payment via pubkey/address. + +### Request Parameters + +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------------------------------------------------------------------- | +| type | string | Ticker of the coin to query. | +| payment | object | A standard [LightningPayment](/atomicdex/api/common_structures/lightning/#lightning-payment) object. | + +#### 📌 Example using `invoice` + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::payments::send_payment", + "params": { + "coin": "tBTC-lightning", + "payment": { + "type": "invoice", + "invoice": "lntb20u1p32wwxapp5p8gjy2e79jku5tshhq2nkdauv0malqqhzefnqmx9pjwa8h83cmwqdp8xys9xcmpd3sjqsmgd9czq3njv9c8qatrvd5kumcxqrrsscqp79qy9qsqsp5m473qknpecv6ajmwwtjw7keggrwxerymehx6723avhdrlnxmuvhs54zmyrumkasvjp0fvvk2np30cx5xpjs329alvm60rwy3payrnkmsd3n8ahnky3kuxaraa3u4k453yf3age7cszdxhjxjkennpt75erqpsfmy4y" + } + }, + "id": 6 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb" + }, + "id": 762 + } + ``` + + +#### 📌 Example using `keysend` + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "lightning::payments::send_payment", + "params": { + "coin": "tBTC-lightning", + "payment": { + "type": "keysend", + "destination": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9", + "amount_in_msat": 1000, + "expiry": 24 + } + }, + "id": 6 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "payment_hash": "2620d47033fd366bff40cfe0879c47f683ef66c3882d0fab88a9bc72b5499655" + }, + "id": 762 + } + ``` + + + + ### PaymentError (attempt to pay self) + + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:231]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: "Cannot generate a route to ourselves", action: IgnoreError })", + "id": 6 + } + ``` + + ### PaymentError (no outbound routes) + + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:232]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: 'Cannot route when there are no outbound routes away from us ', action: IgnoreError })", + "id": 762 + } + ``` + + ### PaymentError (keysend - no path to destination) + + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:107] lightning:256]", + "error_type": "PaymentError", + "error_data": "Keysend error: Routing(LightningError { err: "Failed to find a path to the given destination", action: IgnoreError })", + "id": 762 + } + ``` + + ### PaymentError (invoice - no path to destination) + + ```json + { + "mmrpc": "2.0", + "error": "Payment error: Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", + "error_path": "send_payment.lightning", + "error_trace": "send_payment:102] lightning:232]", + "error_type": "PaymentError", + "error_data": "Error paying invoice: Routing(LightningError { err: 'Failed to find a path to the given destination', action: IgnoreError })", + "id": 762 + } + ``` + + ### InvalidRequest (request is missing a required field) + + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: missing field `payment`", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "missing field `payment`", + "id": 762 + } + ``` + + ### InvalidRequest (A required field is invalid) + + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: ParseError(Bech32Error(MissingSeparator))", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "ParseError(Bech32Error(MissingSeparator))", + "id": 762 + } + ``` + + +## Get Payment Details {{label : 'lightning::payments::get_payment_details', tag : 'API-v2'}} + +The `lightning::payments::get_payment_details` method returns details about a lightning payment from a given `payment_hash`. + +### Request Parameters + +| Parameter | Type | Description | +| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| coin | string | Ticker of the coin to query. | +| payment\_hash | string | The hexidecimal string which identifies a invoice. The payment\_hash is returned from a `lightning::payments::send_payment` request if the payment was sent by us, or from a `lightning::payments::generate_invoice` request if the payment is received (or will be received) by us. | + +#### 📌 Example + + + ```json + { + "method": "lightning::payments::get_payment_details", + "userpass": "testpsw", + "mmrpc": "2.0", + "params": { + "coin": "tBTC-lightning", + "payment_hash": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e" + }, + "id": 1 + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "payment_details": { + "payment_hash": "c4e25cc10d77e3cd5f3d2af7b14ad72f123b2a5021bd6705c0b8ee8386bdeceb", + "payment_type": { + "type": "Outbound Payment", + "destination": "0348cc1a9479697cd52db445ea74149ad40bb01bb2045a3e8acba21b70f94ab7cf" + }, + "description": "1 Blokaccino", + "amount_in_msat": 1000000, + "fee_paid_msat": 1803, + "status": "succeeded", + "created_at": 1684081413, + "last_updated": 1684081419 + } + }, + "id": 762 + } + ``` + + + + ### NoSuchPayment (payment hash not found) + + ```json + { + "mmrpc": "2.0", + "error": "Payment with hash: 414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e is not found", + "error_path": "get_payment_details", + "error_trace": "get_payment_details:75]", + "error_type": "NoSuchPayment", + "error_data": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e", + "id": 762 + } + ``` + + ### InvalidRequest (payment\_hash not a hash string) + + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: invalid value: string '', expected a hash string", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid value: string '', expected a hash string", + "id": 762 + } + ``` + + +## List Payments by Filter {{label : 'lightning::payments::list_payments_by_filter', tag : 'API-v2'}} + +The `lightning::payments::list_payments_by_filter` method returns a list of payments (sent and/or received) for a coin which match the given filter. + +### Request Parameters + +| Parameter | Type | Description | +| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of the coin to query. | +| filter | object | Optional. A standard [LightningPaymentFilter](/atomicdex/api/common_structures/lightning/#lightning-payment-filter) object. | +| paging\_options | object | Optional. A standard [Pagination](/atomicdex/api/common_structures/#pagination) object. | +| limit | integer | Optional, defaults to `10`. Maximum number of results to return. | + +#### 📌 Example without filter + + + ```json + { + "method": "lightning::payments::list_payments_by_filter", + "userpass": "testpsw", + "mmrpc": "2.0", + "params": { + "coin": "tBTC-lightning" + }, + "id": 1 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "59175643db24fc79c77da073994d596444b6909fb2d452bde662ae386115c758", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683917593, + "last_updated": 1683917593 + }, { + "payment_hash": "3ff39605f214a4b4159f9c4f44c94de3a273f300042ca18b7cb3d62f270a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "A 1:24 scale model of a 1981 DeLorean DMC-12", + "amount_in_msat": 88000, + "status": "succeeded", + "created_at": 1683815625, + "last_updated": 1683815721 + }, { + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "Grays Sports Almanac, 1950-2000", + "amount_in_msat": 1000000000, + "status": "succeeded", + "created_at": 1683714225, + "last_updated": 1683805721 + }, { + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "ACME shrink ray", + "amount_in_msat": 4000012, + "status": "succeeded", + "created_at": 1683814625, + "last_updated": 1683815321 + }], + "limit": 10, + "skipped": 0, + "total": 6, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 1 + } + ``` + + +#### 📌 Example for Inbound Payment `payment_type`, `limit` and `pagination` + + + ```json + { + "method": "lightning::payments::list_payments_by_filter", + "userpass": "testpsw", + "mmrpc": "2.0", + "params": { + "coin": "tBTC-lightning", + "filter": { + "payment_type": { + "type": "Inbound Payment" + } + }, + "limit": 2, + "paging_options": { + "PageNumber": 2 + } + }, + "id": 1 + } + ``` + + + + ```json + { + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683916900, + "last_updated": 1683916900 + }, { + "payment_hash": "605f214a4b4b159f9c4f44c94de3a273f3ff39300042ca18b7cbb4159f3d62f2", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "14 pallets of frozen spinach", + "amount_in_msat": 56005000, + "status": "succeeded", + "created_at": 1683815625, + "last_updated": 1683815721 + }], + "limit": 2, + "skipped": 2, + "total": 7, + "total_pages": 4, + "paging_options": { + "PageNumber": 2 + } + }, + "id": 1 + } + ``` + + +#### 📌 Example for `pending` payments between 10000 and 40000 millisatoshis + + + ```json + { + "method": "lightning::payments::list_payments_by_filter", + "userpass": "testpsw", + "mmrpc": "2.0", + "params": { + "coin": "tBTC-lightning", + "filter": { + "status": "pending", + "from_amount_msat": 10000, + "to_amount_msat": 40000 + } + }, + "id": 1 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "e51f1526d3322ddc0aaa0e893e5875418ddd12f206b7e1545c8e4375c97d0e31", + "payment_type": { + "type": "Inbound Payment" + }, + "description": "For the burger on Tuesday", + "amount_in_msat": 10000, + "status": "pending", + "created_at": 1683916900, + "last_updated": 1683916900 + }], + "limit": 10, + "skipped": 6, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 1 + } + ``` + + +#### 📌 Example for successful payments on the 20th of April 2023 + + + ```json + { + "method": "lightning::payments::list_payments_by_filter", + "userpass": "testpsw", + "mmrpc": "2.0", + "params": { + "coin": "tBTC-lightning", + "filter": { + "status": "succeeded", + "from_timestamp": 1681948800, + "to_timestamp": 1682035199 + } + }, + "id": 1 + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "payments": [{ + "payment_hash": "c4f44c94214a4b4159f9273f30de3a3ff39605f18b7c27b3d62f0a9ebc", + "payment_type": { + "type": "Outbound Payment" + }, + "description": "Grays Sports Almanac, 1950-2000", + "amount_in_msat": 1000000000, + "status": "succeeded", + "created_at": 1681998480, + "last_updated": 1682008491 + }], + "limit": 10, + "skipped": 6, + "total": 1, + "total_pages": 1, + "paging_options": { + "PageNumber": 1 + } + }, + "id": 1 + } + ``` + +export const title = "AtomicDEX Method: Max Maker Vol"; +export const description = + "The max_maker_vol method returns the maximum volume of a coin which can be used to create a maker order."; + +# max\_maker\_vol + +The `max_maker_vol` method returns the maximum volume of a coin which can be used to create a maker order (taking into account estimated fees). If the coin is not activated, a `NoSuchCoin` error will be returned. + +#### Arguments + +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------- | +| coin | string | The ticker of the coin you want to query. | + +#### Response + +| Parameter | Type | Description | +| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The ticker of the coin you queried. | +| volume | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable maker volume. | +| balance | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the tradable taker balance. | +| locked\_by\_swaps | object | A standard [NumericFormatsValue](/atomicdex/api/common_structures/#numeric-formats-value) object representing the volume of a coin's balance which is locked by swaps in progress. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "max_maker_vol", + "params": { + "coin": "DOC" + } + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "coin": "MARTY", + "volume": { + "decimal": "4.489763268712998712998712998712998712998712998712998712998712998712998712998712998712998712998712999", + "rational": [ + [1, [962255003, 81]], + [1, [390588672, 18]] + ], + "fraction": { + "numer": "348854605979", + "denom": "77700000000" + } + }, + "balance": { + "decimal": "5.49110027", + "rational": [ + [1, [549110027]], + [1, [100000000]] + ], + "fraction": { + "numer": "549110027", + "denom": "100000000" + } + }, + "locked_by_swaps": { + "decimal": "1.001317001287001287001287001287001287001287001287001287001287001287001287001287001287001287001287001", + "rational": [ + [1, [77802331]], + [1, [77700000]] + ], + "fraction": { + "numer": "77802331", + "denom": "77700000" + } + } + }, + "id": null + } + ``` + + #### Response (error) + + ```json + { + "mmrpc": "2.0", + "error": "No such coin TIME", + "error_path": "max_maker_vol_rpc.lp_coins", + "error_trace": "max_maker_vol_rpc:140] lp_coins:2894]", + "error_type": "NoSuchCoin", + "error_data": { + "coin": "TIME" + }, + "id": null + } + ``` + + #### Response (balance too low) + + ```json + { + "mmrpc": "2.0", + "error": "Not enough QTUM for swap: available 0, required at least 0.000728, locked by swaps None", + "error_path": "max_maker_vol_rpc.maker_swap.utxo_common", + "error_trace": "max_maker_vol_rpc:148] maker_swap:2203] utxo_common:3327] utxo_common:892]", + "error_type": "NotSufficientBalance", + "error_data": { + "coin": "QTUM", + "available": "0", + "required": "0.000728" + }, + "id": null + } + ``` + + #### Response (Transport error) + + ```json + { + "mmrpc": "2.0", + "error": "Transport error: JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "error_path": "taker_swap.utxo_common", + "error_trace": "taker_swap:1599] utxo_common:1990] utxo_common:166]", + "error_type": "Transport", + "error_data": "JsonRpcError { client_info: 'coin: tBTC', request: JsonRpcRequest { jsonrpc: '2.0', id: '31', method: 'blockchain.estimatefee', params: [Number(1), String('ECONOMICAL')] }, error: Transport('rpc_clients:1237] rpc_clients:1239] ['rpc_clients:2047] common:1385] future timed out']') }", + "id": 0 + } + ``` + +export const title = "AtomicDEX: Account Balance Tasks"; +export const description = "The methods in this document allow tracking of balances across multiple addresses under a specified account index."; + +# Account Balance Tasks + +If you have activated a coin with the [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) or [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) and used the `"priv_key_policy": "Trezor"` parameter, your funds may be spread across a range of addresses under a specified account index. The methods below will return the combined balance of your account, detailing the balance for each active account address. + +## init {{label : 'task::account_balance::init', tag : 'API-v2'}} + +Use the `task::account_balance::init` method to initialise an account balance request. + +#### Arguments + +| Parameter | Type | Description | +| -------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of activated coin you want to see addresses and balance for | +| account\_index | string | For GUIs, this will be zero. In CLI you can use other values if you [know what you are doing](https://learnmeabitcoin.com/technical/hd-wallets) | + +#### Response + +| Parameter | Type | Description | +| --------- | ------- | --------------------------------------------------------- | +| task\_id | integer | An identifying number which is used to query task status. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::account_balance::init", + "params": { + "coin": "COIN_NAME", + "account_index": 0 + } + } + ``` + + + + #### Response (ready, successful) + + ```json + { + "mmrpc": "2.0", + "result": { + "task_id": 6 + }, + "id": null + } + ``` + + +## status {{label : 'task::account_balance::status', tag : 'API-v2'}} + +Use the `task::account_balance::status` method to view the status / response of an account balance request. + +#### Arguments + +| Parameter | Type | Description | +| -------------------- | ------- | ----------------------------------------------------------------------------------------- | +| task\_id | integer | The identifying number returned when initiating the withdrawal process. | +| forget\_if\_finished | boolean | If `false`, will return final response for completed tasks. Optional, defaults to `true`. | + +#### Response + +| Parameter | Type | Description | +| ------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| result | object | Object containing status and details of the task | +| .status | string | Status of the task (`Ok` or `Error`) | +| ..account\_index | integer | For GUIs, this will return `0`. In CLI it will return the same as the user request input | +| ..derivation\_path | string | The The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of the wallet. | +| ..total\_balance | object | Contains the spendable and unspendable balance for the wallet | +| ...spendable | string(numeric) | Spendable balance for this wallet | +| ...unspendable | string(numeric) | Unspendable balance for this wallet (e.g. from unconfirmed incoming transactions) | +| ..addresses | list | Contains information about current active addresses in the wallet | +| ...address | string | Spendable balance for this address | +| ...derivation\_path | string | The The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of an address. | +| ...chain | string(numeric) | `Internal` or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| ...balance | object | Contains the spendable and unspendable balance for this address | +| ....spendable | string(numeric) | Spendable balance for this address | +| ....unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::account_balance::status", + "params": { + "task_id": "", + "forget_if_finished": false + } + } + ``` + + + + #### Response (ready, successful) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Ok", + "details": { + "account_index": 0, + "derivation_path": "m/44'/20'/0'", + "total_balance": { + "spendable": "99.999", + "unspendable": "0" + }, + "addresses": [ + { + "address": "DJdsr4Mhqm1afkbxwBJfwH6236xNh5kJZU", + "derivation_path": "m/44'/20'/0'/0/0", + "chain": "External", + "balance": { + "spendable": "49.999", + "unspendable": "0" + } + }, + { + "address": "DJdsr4Mhqm1afkbxwBJfwH6236xNh5kJZU", + "derivation_path": "m/44'/20'/0'/0/1", + "chain": "External", + "balance": { + "spendable": "50", + "unspendable": "0" + } + }, + { + "address": "DJdsr4Mhqm1afkbxwBJfwH6236xNh5kJZU", + "derivation_path": "m/44'/20'/0'/0/2", + "chain": "External", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } + ] + } + }, + "id": null + } + ``` + + +## cancel {{label : 'task::account_balance::cancel', tag : 'API-v2'}} + +Use the `task::account_balance::cancel` method to cancel an account balance request. + +#### Arguments + +| Parameter | Type | Description | +| --------- | ------- | ----------------------------------------------------------------------- | +| task\_id | integer | The identifying number returned when initiating the withdrawal process. | + +#### Response + +| Parameter | Type | Description | +| ------------ | ------ | -------------------------------------------------------------------------------------- | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| error | string | Description of the error | +| error\_path | string | Used for debugging. A reference to the function in code base which returned the error | +| error\_trace | string | Used for debugging. A trace of lines of code which led to the returned error | +| error\_type | string | An enumerated error identifier to indicate the category of error | +| error\_data | string | Additonal context for the error type | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::account_balance::cancel", + "params": { + "task_id": "", + "forget_if_finished": false + } + } + ``` + + + + #### Response (ready, successful) + + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + + #### Response (error, task already finished) + + ```json + { + "mmrpc": "2.0", + "error": "Task is finished already", + "error_path": "init_account_balance.manager", + "error_trace": "init_account_balance:113] manager:104]", + "error_type": "TaskFinished", + "error_data": 2, + "id": null + } + ``` + +export const title = "KomoDeFi: QTUM Activation Tasks"; +export const description = + "The methods in this document allow activation of QTUM."; + +import trezorpin from "@/public/images/api-images/trezor_pin.png"; + +# task::enable\_qtum + +## init {{label : 'task::enable_qtum::init', tag : 'API-v2'}} + +QTUM coins are activated using this method. For UTXO coins, refer to [task::enable\_utxo::init](/atomicdex/api/v20-dev/task_enable_utxo/#init) + +#### Arguments + +| Parameter | Type | Description | +| ------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ticker | string | The ticker of the coin you want to enable. | +| activation\_params | object | An object containing the actvation parameters below. | +| .priv\_key\_policy | string | Defaults to `ContextPrivkey`. Set as `Trezor` to activate in Trezor mode. | +| .min\_addresses\_number | integer | How many additional addreesses to generate at a minimum. | +| .scan\_policy | string | Whether or not to scan for new addresses. Select from `do_not_scan`, `scan_if_new_wallet` or `scan`. Note that `scan` will result in multple requests to the AtomicDEX-API. | +| .gap\_limit | integer | The max number of empty addresses in a row. If transactions were sent to an address outside the `gap_limit`, they will not be identified when scanning. | +| .mode | object | An object containing RPC type and data parameters as below. | +| ..rpc | string | UTXO RPC mode. Options: `{ "rpc":"Native" }` if running a native blockchain node, or `"rpc":"Electrum"` to use electrum RPCs. If using electrum, a list of electrum servers is required under `rpc_data.servers` | +| ..rpc\_data | object | An object containing electrum server information. | +| ...servers | list | A list of electrum server URLs | +| ....url | object | The url and port of a coins electrum server | +| ....ws\_url | object | Optional. Used to define electrum server url/port for websocket connections. | +| ....protocol | object | Defines electrum server protocol as `TCP` or `SSL`. Defaults to `TCP` | +| ....disable\_cert\_verification | boolean | Optional. For `SSL` electrum connections, this will allow expired certificates. | + +#### Response + +| Parameter | Type | Description | +| --------- | ------- | --------------------------------------------------------- | +| task\_id | integer | An identifying number which is used to query task status. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::enable_qtum::init", + "params": { + "ticker": "QTUM", + "activation_params": { + "mode": { + "rpc": "Electrum", + "rpc_data": { + "servers": [ + { + "url": "electrum2.cipig.net:10050" + }, + { + "url": "electrum3.cipig.net:20050", + "ws_url": "electrum3.cipig.net:30050", + "protocol": "SSL" + } + ] + } + }, + "scan_policy": "scan_if_new_wallet", + "priv_key_policy": "Trezor", + "min_addresses_number": 3, + "gap_limit": 20 + } + } + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "task_id": 1 + }, + "id": null + } + ``` + + +## status {{label : 'task::enable_qtum::status', tag : 'API-v2'}} + +After running the `task::enable_qtum::init` method, we can query the status of activation to check its progress. +The response will return the following: + +* Result of the task (success or error) +* Progress status (what state the task is in) +* Required user action (what user should do before the task can continue) + +#### Arguments + +| Parameter | Type | Description | +| -------------------- | ------- | ----------------------------------------------------------------------------------------- | +| task\_id | integer | The identifying number returned when initiating the initialisation process. | +| forget\_if\_finished | boolean | If `false`, will return final response for completed tasks. Optional, defaults to `true`. | + +#### Request + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::enable_qtum::status", + "params": { + "task_id": 0, + "forget_if_finished": false + } + } + ``` + + +The response formats for this method are the same as the [task::enable\_utxo::status](/atomicdex/api/v20-dev/task_enable_utxo/#status) responses. + +## user\_action {{label : 'task::enable_qtum::user_action', tag : 'API-v2'}} + +If the `task::enable_qtum::status` returns `UserActionRequired`, we need to use the `task::enable_qtum::user_action` method to enter our PIN + +#### Arguments + +| Parameter | Type | Description | +| ------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| task\_id | integer | The identifying number returned when initiating the initialisation process. | +| user\_action | object | Object containing the params below | +| user\_action.action\_type | string | Will be `TrezorPin` for this method | +| user\_action.pin | string (number) | When the Trezor device is displaying a grid of numbers for PIN entry, this param will contain your Trezor pin, as mapped through your keyboard numpad. See the image below for more information. | + + + +#### Response + +| Parameter | Type | Description | +| --------- | ------ | --------------------------- | +| result | string | The outcome of the request. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::enable_qtum::user_action", + "params": { + "task_id": 0, + "user_action": { + "action_type": "TrezorPin", + "pin": "862743" + } + } + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + + +## Error Cases + +`CoinCreationError`: Returned when a coin is not supported. + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Error on platform coin QTUM creation: Coin doesn't support Trezor hardware wallet. Please consider adding the 'trezor_coin' field to the coins config", + "error_path": "lib.init_qtum_activation.utxo_coin_builder", + "error_trace": "lib:103] init_qtum_activation:71] utxo_coin_builder:234]", + "error_type": "CoinCreationError", + "error_data": { + "ticker": "QTUM", + "error": "Coin doesn't support Trezor hardware wallet. Please consider adding the 'trezor_coin' field to the coins config" + } + } + }, + "id": null +} +``` +export const title = "AtomicDEX: UTXO Coin Activation Tasks"; +export const description = + "The methods in this document allow activation of UTXO coins."; + +import trezorpin from "@/public/images/api-images/trezor_pin.png"; + +# task::enable\_utxo + +## init {{label : 'task::enable_utxo::init', tag : 'API-v2'}} + +UTXO coins are activated using this method. For QTUM coins, refer to [task::enable\_qtum::init](/atomicdex/api/v20-dev/task_enable_qtum/#init) + +#### Arguments + +| Parameter | Type | Description | +| ------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ticker | string | The ticker of the coin you want to enable. | +| activation\_params | object | An object containing the actvation parameters below. | +| .priv\_key\_policy | string | Defaults to `ContextPrivkey`. Set as `Trezor` to activate in Trezor mode. | +| .min\_addresses\_number | integer | How many additional addreesses to generate at a minimum. | +| .scan\_policy | string | Whether or not to scan for new addresses. Select from `do_not_scan`, `scan_if_new_wallet` or `scan`. Note that `scan` will result in multple requests to the AtomicDEX-API. | +| .gap\_limit | integer | The max number of empty addresses in a row. If transactions were sent to an address outside the `gap_limit`, they will not be identified when scanning. | +| .mode | object | An object containing RPC type and data parameters as below. | +| ..rpc | string | UTXO RPC mode. Options: `{ "rpc":"Native" }` if running a native blockchain node, or `"rpc":"Electrum"` to use electrum RPCs. If using electrum, a list of electrum servers is required under `rpc_data.servers` | +| ..rpc\_data | object | An object containing electrum server information. | +| ...servers | list | A list of electrum server URLs | +| ....url | object | The url and port of a coins electrum server | +| ....ws\_url | object | Optional. Used to define electrum server url/port for websocket connections. | +| ....protocol | object | Defines electrum server protocol as `TCP` or `SSL`. Defaults to `TCP` | +| ....disable\_cert\_verification | boolean | Optional. For `SSL` electrum connections, this will allow expired certificates. | + +#### Response + +| Parameter | Type | Description | +| --------- | ------- | --------------------------------------------------------- | +| task\_id | integer | An identifying number which is used to query task status. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::enable_utxo::init", + "params": { + "ticker": "KMD", + "activation_params": { + "mode": { + "rpc": "Electrum", + "rpc_data": { + "servers": [ + { + "url": "electrum2.cipig.net:10001" + }, + { + "url": "electrum3.cipig.net:20001", + "ws_url": "electrum3.cipig.net:30001", + "protocol": "SSL" + } + ] + } + }, + "scan_policy": "scan_if_new_wallet", + "priv_key_policy": "Trezor", + "min_addresses_number": 3, + "gap_limit": 20 + } + } + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "task_id": 1 + }, + "id": null + } + ``` + + +## status {{label : 'task::enable_utxo::status', tag : 'API-v2'}} + +After running the `task::enable_utxo::init` method, we can query the status of activation to check its progress. +The response will return the following: + +* Result of the task (success or error) +* Progress status (what state the task is in) +* Required user action (what user should do before the task can continue) + +#### Arguments + +| Parameter | Type | Description | +| -------------------- | ------- | ----------------------------------------------------------------------------------------- | +| task\_id | integer | The identifying number returned when initiating the initialisation process. | +| forget\_if\_finished | boolean | If `false`, will return final response for completed tasks. Optional, defaults to `true`. | + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::enable_utxo::status", + "params": { + "task_id": 0, + "forget_if_finished": false + } + } + ``` + + +#### Response (ready, successful, Trezor mode) + +| Parameter | Type | Description | +| -------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| status | string | A short indication of how the requested process is progressing. | +| details.result | object | Depending on the state of process progress, this will contain different information as detailed in the items below. | +| .ticker | string | The ticker of the coin being activated | +| .current\_block | integer | The block height of the coin being activated | +| .wallet\_balance | object | Information about the addresses of the coin being activated | +| ..wallet\_type | string | In Trezor mode, this will return `HD` | +| ..accounts | list | A list of addresses and related information for the coin being activated | +| ...account\_index | integer | `ACCOUNT_ID` child in the `m/44'/COIN'/ACCOUNT_ID'/CHAIN/ADDRESS_ID` BIP44 derivation path. **Please don't confuse with mm2 global Iguana/HD/HW account.** | +| ...derivation\_path | string | Derivation path up to the `COIN` child. E.g. `"m/44'/141'/0'"` | +| ...total\_balance | object | Combined total spendable and unconfirmed balances of all account addresses | +| ....spendable | string(numeric) | Combined total spendable balance of all account addreesses | +| ....unspendable | string(numeric) | Combined total unspendable balance of all account addreesses | +| ...addresses | list | A list of addresses in the account for the coin being activated | +| ....address | string | One of the addresses in the account for the coin being activated | +| ....derivation\_path | string | The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) of the address. | +| ....chain | string | Returns `External` when `CHAIN=0` in the `m/44'/COIN'/ACCOUNT_ID'/CHAIN/ADDRESS_ID` derivation path. Returns `Internal` when `CHAIN=1` in the `m/44'/COIN'/ACCOUNT_ID'/CHAIN/ADDRESS_ID` derivation path. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| ....balance | object | Contains the spendable and unspendable balance for this address | +| .....spendable | string(numeric) | Spendable balance for this address | +| .....unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | + + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Ok", + "details": { + "result": { + "ticker": "DOC", + "current_block": 1529989, + "wallet_balance": { + "wallet_type": "HD", + "accounts": [ + { + "account_index": 0, + "derivation_path": "m/44'/141'/0'", + "total_balance": { + "spendable": "7.74199", + "unspendable": "0" + }, + "addresses": [ + { + "address": "RFarfkYdmMVv9q4dHTmHUgS5j6nBy6qate", + "derivation_path": "m/44'/141'/0'/0/0", + "chain": "External", + "balance": { + "spendable": "0", + "unspendable": "0" + } + }, + { + "address": "RUu1JYSAYVmSLL2Nb5eLNdenp1JtHcReYZ", + "derivation_path": "m/44'/141'/0'/0/1", + "chain": "External", + "balance": { + "spendable": "7.74199", + "unspendable": "0" + } + }, + { + "address": "RTnduXSuRJegfMXf7nQM6C5gS68sbpL7AY", + "derivation_path": "m/44'/141'/0'/1/0", + "chain": "Internal", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } + ] + } + ] + } + } + } + }, + "id": null + } + ``` + + +#### Response (ready, successful, Iguana mode) + +| Parameter | Type | Description | +| ---------------- | --------------- | ------------------------------------------------------------------------------------------------------------------- | +| status | string | A short indication of how the requested process is progressing. | +| details.result | object | Depending on the state of process progress, this will contain different information as detailed in the items below. | +| .ticker | string | The ticker of the coin being activated | +| .current\_block | integer | The block height of the coin being activated | +| .wallet\_balance | object | Information about the addresses of the coin being activated | +| ..wallet\_type | string | In Trezor mode, this will return `HD` | +| ..address | string | One of the addresses in the account for the coin being activated | +| ..balance | object | Contains the spendable and unspendable balance for this address | +| ...spendable | string(numeric) | Spendable balance for this address | +| ...unspendable | string(numeric) | Unspendable balance for this address (e.g. from unconfirmed incoming transactions) | + + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Ok", + "details": { + "result": { + "current_block": 1531669, + "wallet_balance": { + "wallet_type": "Iguana", + "address": "RKK5UzcZnXBZNGvS5RqrnycHRiFfnL8fMq", + "balance": { + "spendable": "0", + "unspendable": "0" + } + } + } + } + }, + "id": null + } + ``` + + +#### Response (in progress) + +| Parameter | Type | Description | +| --------- | ------ | ----------------------------------------------------------- | +| status | string | Will return `InProgress` if task is not yet comepleted | +| details | string | An indication of the current step of the activation process | + +Possible In Progress Cases: + +* `ActivatingCoin`: The first step of activation. It does not require any action from the user. +* `RequestingWalletBalance`: The first step of activation, while initial balances info is being requested. It does not require any action from the user. +* `Finishing`: Activation process completed +* `WaitingForTrezorToConnect`: Waiting for the user to plugin a Trezor device +* `FollowHwDeviceInstructions`: Waiting for the user to follow the instructions on the device + + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": "RequestingWalletBalance" + }, + "id": null + } + ``` + + +#### Response (ready, error) + +| Parameter | Type | Description | +| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | +| status | string | A short indication of how the requested process is progressing. | +| details.result | object | Depending on the state of process progress, this will contain different information as detailed in the items below. | +| .error | string | The ticker of the coin being activated | +| .error\_path | string | Used for debugging. A reference to the function in code base which returned the error | +| .error\_trace | string | Used for debugging. A trace of lines of code which led to the returned error | +| .error\_type | string | An enumerated error identifier to indicate the category of error | +| .error\_data | string | Additonal context for the error type | + +Possible Error Cases: + +* `TaskTimedOut` - Timed out waiting for coin activation, connecting to the device trezor or for user to confirm pubkey) +* `CoinCreationError` - Error during activation. E.g. incorrect or inactive electrum servers. +* `HwError` - **This is the most important error type.** Unlike other error types, `HwError` requires the GUI / User to check the details in `error_data` field to know which action is required. View the [HwError error type details](/atomicdex/api/v20-dev/hd_wallets_overview/#details-for-hw-error-error-type) for more info. + +## user\_action {{label : 'task::enable_utxo::user_action', tag : 'API-v2'}} + +If the `task::enable_utxo::status` returns `UserActionRequired`, we need to use the `task::enable_utxo::user_action` method to enter our PIN + +#### Arguments + +| Parameter | Type | Description | +| ------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| task\_id | integer | The identifying number returned when initiating the initialisation process. | +| user\_action | object | Object containing the params below | +| user\_action.action\_type | string | Will be `TrezorPin` for this method | +| user\_action.pin | string (number) | When the Trezor device is displaying a grid of numbers for PIN entry, this param will contain your Trezor pin, as mapped through your keyboard numpad. See the image below for more information. | + + + +#### Response + +| Parameter | Type | Description | +| --------- | ------ | --------------------------- | +| result | string | The outcome of the request. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::enable_utxo::user_action", + "params": { + "task_id": 0, + "user_action": { + "action_type": "TrezorPin", + "pin": "862743" + } + } + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + +export const title = "AtomicDEX: ZHTLC Coin Methods"; +export const description = + "The methods in this document allow activation and management of ZHTLC coins like ARRR, ZOMBIE."; + +# ZHTLC Coin Methods + +ZHTLC coins, like Pirate (ARRR) and the test coin ZOMBIE take a little longer to enable, and use a new two step method to enable. Activation can take a little while the first time, as we need to download some block cache data, and build a wallet database. Subsequent enabling will be faster, but still take a bit longer than other coins. The second step for activation is optional, but allows us to check the status of the activation process. + +To withdraw ZHTLC coins, you need to use the [task::withdraw](/atomicdex/api/v20-dev/task_withdraw/#withdraw-tasks) methods: + +* Generate a transaction with `task::withdraw::init` +* Query its status with `task::withdraw::status` +* Cancel generating the transaction with `task::withdraw::cancel` + +## Initialize Z Coin Activation {{label : 'task::enable_z_coin::init', tag : 'API-v2'}} + + + To enable Z coins you also need to [install some Zcash + Params](https://forum.komodoplatform.com/t/installing-zcash-params/603) + + +#### Arguments + +| Structure | Type | Description | +| ------------------ | ------ | -------------------------------------------------------------------------------------------------------- | +| ticker | string | Ticker of coin to activate | +| activation\_params | object | A standard [ActivationRpcData](/atomicdex/api/common_structures/activation/#activation-rpc-data) object. | + +#### Response + +| Structure | Type | Description | +| --------- | ------- | --------------------------------------------------------- | +| task\_id | integer | An identifying number which is used to query task status. | + +#### 📌 Examples + +#### Enable Z coin without any optional parameters + + + ```json + { + "userpass": "testpsw", + "method": "task::enable_z_coin::init", + "mmrpc": "2.0", + "params": { + "ticker": "ZOMBIE", + "activation_params": { + "mode": { + "rpc": "Light", + "rpc_data": { + "electrum_servers": [ + { + "url": "zombie.dragonhound.info:10033" + } + ], + "light_wallet_d_servers": [ + "http://zombie.dragonhound.info:443" + ] + } + }, + "zcash_params_path": "/home/username/path_to/.zcash-params", + "scan_blocks_per_iteration": 100, + "scan_interval_ms": 200 + } + } + } + ``` + + +#### Sync from block 2528700, with custom `.zcash-params` path and scan params + + + ```json + { + "userpass": "testpsw", + "method": "task::enable_z_coin::init", + "mmrpc": "2.0", + "params": { + "ticker": "ZOMBIE", + "activation_params": { + "mode": { + "rpc": "Light", + "rpc_data": { + "electrum_servers": [ + { + "url": "zombie.dragonhound.info:10033" + } + ], + "light_wallet_d_servers": [ + "http://zombie.dragonhound.info:443" + ], + "sync_params": { + "height": 2528700 + } + } + }, + "zcash_params_path": "/home/username/path_to/.zcash-params", + "scan_blocks_per_iteration": 100, + "scan_interval_ms": 200 + } + } + } + ``` + + +#### Sync from sapling activation height (earliest) + +The Z coin lightwallet client only supports blocks that are post-sapling. The sapling activation height for Z coins can be found in the [coins file](https://github.com/KomodoPlatform/coins/blob/master/coins) + + + ```json + { + "userpass": "testpsw", + "method": "task::enable_z_coin::init", + "mmrpc": "2.0", + "params": { + "ticker": "ZOMBIE", + "activation_params": { + "mode": { + "rpc": "Light", + "rpc_data": { + "electrum_servers": [ + { + "url": "zombie.dragonhound.info:10033" + } + ], + "light_wallet_d_servers": [ + "http://zombie.dragonhound.info:443" + ], + "sync_params": "earliest" + } + }, + "zcash_params_path": "/home/username/path_to/.zcash-params", + "scan_blocks_per_iteration": 100, + "scan_interval_ms": 200 + } + } + } + ``` + + +#### Using websockets to sync from [Proof of Keys Day](https://hackernoon.com/not-your-keys-not-your-bitcoin-jan3bitcoin-z6k3ktb), 2023. + + + ```json + { + "userpass": "testpsw", + "method": "task::enable_z_coin::init", + "mmrpc": "2.0", + "params": { + "ticker": "ZOMBIE", + "activation_params": { + "mode": { + "rpc": "Light", + "rpc_data": { + "electrum_servers": [ + { + "protocol": "SSL", + "url": "zombie.dragonhound.info:20133", + "ws_url": "zombie.dragonhound.info:30059" + } + ], + "light_wallet_d_servers": [ + "http://zombie.dragonhound.info:443" + ], + "sync_params": { + "date": 1672704000 + } + } + } + } + } + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "task_id": 0 + }, + "id": null + } + ``` + + +## Activation Status {{label : 'task::enable_z_coin::status', tag : 'API-v2'}} + +Z coins need to build sync a local block cache and wallet database before they can be used. Using `task_id` as an input, this method will return the current status of the activation process. + +#### Arguments + +| Parameter | Type | Description | +| -------------------- | ------- | ---------------------------------------------------------------------------------------- | +| task\_id | integer | The identifying number returned when initiating the initialisation process. | +| forget\_if\_finished | boolean | If `false`, will return final response for completed tasks. Optional, defaults to `true` | + +#### Response + +| Structure | Type | Description | +| --------- | ------ | --------------------------------------------------------------------------------------------------------------------- | +| status | string | A short indication of how the enabling is progressing. | +| details | object | Depending on the state of enabling progress, this will contain different information as shown in the responses below. | + +#### 📌 Examples + +#### Status of Z coin activation + + + ```json + { + "userpass": "testpsw", + "method": "task::enable_z_coin::status", + "mmrpc": "2.0", + "params": { + "task_id": 0, + "forget_if_finished": false + } + } + ``` + + + + #### Response (ActivatingCoin - enabling has started) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": "ActivatingCoin" + }, + "id": null + } + ``` + + #### Response (UpdatingBlocksCache) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": { + "UpdatingBlocksCache": { + "current_scanned_block": 265930, + "latest_block": 269656 + } + } + }, + "id": null + } + ``` + + #### Response (BuildingWalletDb) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": { + "BuildingWalletDb": { + "current_scanned_block": 265311, + "latest_block": 269656 + } + } + }, + "id": null + } + ``` + + #### Response (CoinCreationError - no Zcash Params) + + ```json + { + "error": "Error on platform coin ZOMBIE creation: ZCashParamsNotFound", + "error_path": "lib.z_coin_activation.z_coin", + "error_trace": "lib:104] z_coin_activation:218] z_coin:1007]", + "error_type": "CoinCreationError", + "error_data": { + "ticker": "ZOMBIE", + "error": "ZCashParamsNotFound" + } + } + ``` + + #### Response (error - NoSuchTask) + + You'll see this if the task number does not exist, or the task has already completed. + + ```json + { + "mmrpc": "2.0", + "error": "No such task '1'", + "error_path": "init_standalone_coin", + "error_trace": "init_standalone_coin:119]", + "error_type": "NoSuchTask", + "error_data": 1, + "id": null + } + ``` + + #### Response (error - InvalidRequest) + + ```json + { + "mmrpc": "2.0", + "error": "Error parsing request: invalid value: integer `-205`, expected u64", + "error_path": "dispatcher", + "error_trace": "dispatcher:109]", + "error_type": "InvalidRequest", + "error_data": "invalid value: integer `-205`, expected u64", + "id": 42 + } + ``` + + #### Response (Enabling complete) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Ok", + "details": { + "ticker": "ZOMBIE", + "current_block": 269657, + "wallet_balance": { + "wallet_type": "Iguana", + "address": "zs1e3puxpnal8ljjrqlxv4jctlyndxnm5a3mj5rarjvp0qv72hmm9caduxk9asu9kyc6erfx4zsauj", + "balance": { + "spendable": "29.99989008", + "unspendable": "0" + } + } + } + }, + "id": null + } + ``` + + #### Response (no Zcash Params) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Error on platform coin ZOMBIE creation: ZCashParamsNotFound", + "error_path": "lib.z_coin_activation.z_coin", + "error_trace": "lib:103] z_coin_activation:192] z_coin:761]", + "error_type": "CoinCreationError", + "error_data": { + "ticker": "ZOMBIE", + "error": "ZCashParamsNotFound" + } + } + }, + "id": null + } + ``` + + #### Response (error - no such task) + + You'll see this if the task number does not exist, or the task has already completed. + + ```json + { + "mmrpc": "2.0", + "error": "No such task '1'", + "error_path": "init_standalone_coin", + "error_trace": "init_standalone_coin:119]", + "error_type": "NoSuchTask", + "error_data": 1, + "id": null + } + ``` + + +## Cancel Initialization {{label : 'task::enable_z_coin::cancel', tag : 'API-v2'}} + +If you want to cancel the enabling process before it has completed, you can use this method. + +#### Arguments + +| Structure | Type | Description | +| --------- | ------- | --------------------------------------------------------------------- | +| task\_id | integer | The identifying number returned when initiating the enabling process. | + +#### Response + +| Structure | Type | Description | +| ------------ | ------ | -------------------------------------------------------------- | +| result | string | Indicates task cancellation was succesful. | +| error | string | An error message to explain what went wrong. | +| error\_path | string | An indicator of the class or function which reurned the error. | +| error\_trace | string | An indicator of where in the source code the error was thrown. | +| error\_type | string | An enumerated value for the returned error. | +| error\_data | string | The input task ID which resulted in the error. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "task::enable_z_coin::cancel", + "mmrpc": "2.0", + "params": { + "task_id": "" + } + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + + #### Response (success - already finished) + + ```json + { + "mmrpc": "2.0", + "error": "Task is finished already", + "error_path": "init_standalone_coin.manager", + "error_trace": "init_standalone_coin:144] manager:101]", + "error_type": "TaskFinished", + "error_data": 0, + "id": null + } + ``` + + #### Response (error - no such task) + + ```json + { + "mmrpc": "2.0", + "error": "No such task '1'", + "error_path": "init_standalone_coin", + "error_trace": "init_standalone_coin:119]", + "error_type": "NoSuchTask", + "error_data": 1, + "id": null + } + ``` + + +## Z Coin Transaction History {{label : 'z_coin_tx_history', tag : 'API-v2'}} + +To get the transaction history for ZHTLC coins, you need to use this special method - the [v2 my\_tx\_history](/atomicdex/api/v20/my_tx_history/) and [legacy my\_tx\_history](/atomicdex/api/legacy/my_tx_history/) methods are not compatible with ZHTLC coins. Currently trasaction memos will not be displayed in output, though they can be added to outgoing transactions with the [task::withdraw](/atomicdex/api/v20-dev/task_withdraw/#withdraw-tasks) methods. + +#### Arguments + +| Structure | Type | Description | +| -------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of the coin to get history for. | +| limit | integer | Optional. Limits the number of returned transactions. Defaults to `10`. Ignored if `max = true`. | +| paging\_options.FromId | string | Optional. AtomicDEX API will skip records until it reaches this ID, skipping the from\_id as well; track the internal\_id of the last displayed transaction to find the value of this field for the next page | +| paging\_options.PageNumber | integer | Optional. AtomicDEX API will return limit swaps from the selected page. Ignored if `FromId` . | + +#### Response + +| Structure | Type | Description | +| -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| transactions | array of objects | transactions data | +| from\_id | string | the from\_id specified in the request; this value is null if from\_id was not set | +| skipped | number | the number of skipped records (i.e. the position of `from_id` in the list + 1); this value is 0 if `from_id` was not set | +| limit | number | the limit that was set in the request; note that the actual number of transactions can differ from the specified limit (e.g. on the last page) | +| total | number | the total number of transactions available | +| page\_number | number | the page\_number that was set in the request | +| total\_pages | number | total pages available with the selected limit | +| current\_block | number | the number of the latest block of coin blockchain | +| sync\_status | object | A standard [SyncStatus](/atomicdex/api/common_structures/#sync-status/) object. Provides the information that helps to track the progress of transaction history preloading at background | + +#### 📌 Examples + + + ```json + { + "userpass": "testpsw", + "method": "z_coin_tx_history", + "mmrpc": "2.0", + "params": { + "coin": "ARRR", + "limit": 2, + "paging_options": { + "PageNumber": 2 + } + } + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "coin": "ARRR", + "target": { + "type": "iguana" + }, + "current_block": 2228711, + "transactions": [ + { + "tx_hash": "b7e8307778d7d61ebb2ebc7a130661ef6fbeb66ee5d15d0f84a3bfce3ebad5a1", + "from": [ + "zs1e3puxpnal8ljjrqlxv4jctlyndxnm5a3mj5rarjvp0qv72hmm9caduxk9asu9kyc6erfx4zsauj" + ], + "to": [ + "zs1e3puxpnal8ljjrqlxv4jctlyndxnm5a3mj5rarjvp0qv72hmm9caduxk9asu9kyc6erfx4zsauj" + ], + "spent_by_me": "17.65495855", + "received_by_me": "17.65494855", + "my_balance_change": "-0.00001000", + "block_height": 2224011, + "confirmations": 4701, + "timestamp": 1673018341, + "transaction_fee": "0.00001", + "coin": "ARRR", + "internal_id": 26 + }, + { + "tx_hash": "967deb0a8cbce0c1f0ba20deee7a955e1a82bd1173bb3dd15cc95f03738ca65c", + "from": [ + "zs1e3puxpnal8ljjrqlxv4jctlyndxnm5a3mj5rarjvp0qv72hmm9caduxk9asu9kyc6erfx4zsauj" + ], + "to": [ + "zs10ah73fpudlecg678jmqjdyeym5fgccvjytqry533rq2w04dekenxe8ekt349s3lelmlss3j4u9q", + "zs1e3puxpnal8ljjrqlxv4jctlyndxnm5a3mj5rarjvp0qv72hmm9caduxk9asu9kyc6erfx4zsauj" + ], + "spent_by_me": "20.65496855", + "received_by_me": "17.65495855", + "my_balance_change": "-3.00001000", + "block_height": 2196913, + "confirmations": 31799, + "timestamp": 1671100306, + "transaction_fee": "0.00001", + "coin": "ARRR", + "internal_id": 25 + } + ], + "sync_status": { + "state": "Finished" + }, + "limit": 2, + "skipped": 2, + "total": 28, + "total_pages": 14, + "paging_options": { + "PageNumber": 2 + } + }, + "id": null + } + ``` + + #### Response (error - coin not supported) + + ```json + { + "mmrpc": "2.0", + "error": "TKL", + "error_path": "my_tx_history_v2", + "error_trace": "my_tx_history_v2:523]", + "error_type": "NotSupportedFor", + "error_data": "TKL", + "id": null + } + ``` + + #### Response (error - coin not active) + + ```json + { + "mmrpc": "2.0", + "error": "ZOMBIE", + "error_path": "my_tx_history_v2.lp_coins", + "error_trace": "my_tx_history_v2:521] lp_coins:2849]", + "error_type": "CoinIsNotActive", + "error_data": "ZOMBIE", + "id": null + } + ``` + +export const title = "AtomicDEX: Trezor Initialisation"; +export const description = + "Prepare your Trezor device for use in the AtomicDEX API, and authenticate using your PIN or phrase."; + +import trezorpin from "@/public/images/api-images/trezor_pin.png"; + +# Trezor Initialisation + +The methods below prepare your Trezor device for use within the AtomicDEX API. Once completed, you can authenticate using your PIN or phrase with [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action). + +## init {{label : 'task::init_trezor::init', tag : 'API-v2'}} + +Before using this method, launch the AtomicDEX API, and plug in your Trezor. + +#### Arguments + +| Parameter | Type | Description | +| -------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| device\_pubkey | string | Optional. If known, you can specify the device pubkey. If not known, this will be part of the `task::init_trezor::status` response which you can save for future use | + +#### Response + +| Parameter | Type | Description | +| --------- | ------- | --------------------------------------------------------- | +| task\_id | integer | An identifying number which is used to query task status. | + +#### 📌 Examples + +#### Command (without device\_pubkey) + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::init_trezor::init", + "params": {} + } + ``` + + +#### Command (with device\_pubkey) + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::init_trezor::init", + "params": { + "device_pubkey": "066deb87b0d0500ec2e9b85f5314870b03a53517" + } + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": { + "task_id": 0 + }, + "id": null + } + ``` + + +## status {{label : 'task::init_trezor::status', tag : 'API-v2'}} + +After running the `task::init_trezor::init` method, we can query the status of device initialisation to check its progress. + +#### Arguments + +| Parameter | Type | Description | +| -------------------- | ------- | ----------------------------------------------------------------------------------------- | +| task\_id | integer | The identifying number returned when initiating the initialisation process. | +| forget\_if\_finished | boolean | If `false`, will return final response for completed tasks. Optional, defaults to `true`. | + +#### Response + +| Parameter | Type | Description | +| ---------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| status | string | A short indication of how the requested process is progressing. | +| details | object | Depending on the state of process progress, this will contain different information as detailed in the items below. | +| details.type | string | Type of hardware wallet device (e.g. `Trezor`) | +| details.model | string | The model of the hardware wallet device (e.g. `One` or `T`) | +| details.device\_name | string | The name of the device as defned by user in Trezor Suite or another wallet application. | +| details.device\_id | string (hex) | An unique identifier of the device, set during manufacturing. | +| details.device\_pubkey | string (hex) | The hardware wallet device's pubkey. If included in the `task::init_trezor::init` request, it wll be the same as input. If not, it should be stored for future use. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::init_trezor::status", + "params": { + "task_id": 0, + "forget_if_finished": false + } + } + ``` + + + + #### Response (in progress) + + Possible "In progress" Cases: + + * `Initializing` - This is the normal task state. It does not require any action from the user. + + * `WaitingForTrezorToConnect` - The AtomicDEX API is waiting for the user to plugin a Trezor device. + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": "WaitingForTrezorToConnect" + }, + "id": null + } + ``` + + * `FollowHwDeviceInstructions` - The AtomicDEX API is waiting for the user to follow instructions displayed on the device (e.g. clicking a button to confirm). + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": "FollowHwDeviceInstructions" + }, + "id": null + } + ``` + + * `UserActionRequired` - This will either be `EnterTrezorPin` or `EnterTrezorPassphrase`. Refer to the [task::init\_trezor::user\_action](/atomicdex/api/v20-dev/task_init_trezor/#user-action) section for more information. + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "UserActionRequired", + "details": "EnterTrezorPin" + }, + "id": null + } + ``` + + #### Response (ready, successful) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Ok", + "details": { + "result": { + "type": "Trezor", + "model": "One", + "device_name": "Fitzchivalry Farseer", + "device_id": "A1CCF11243A795A84111955E", + "device_pubkey": "066deb87b0d0500ec2e9b85f5314870b03a53517" + } + } + }, + "id": null + } + ``` + + #### Error Responses (by `error_type`) + + : + + * `HwContextInitializingAlready` - Returned if user calls `task::init_trezor::init` before the previous `task::init_trezor::init` task has been completed. + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Hardware Wallet context is initializing already", + "error_path": "init_hw.crypto_ctx", + "error_trace": "init_hw:151] crypto_ctx:235]", + "error_type": "HwContextInitializingAlready" + } + }, + "id": null + } + ``` + + * `Timeout` - Task timed out while trying to connect to a device. + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "RPC timed out 300s", + "error_path": "init_hw.crypto_ctx.hw_client", + "error_trace": "init_hw:151] crypto_ctx:248] crypto_ctx:354] hw_client:156]", + "error_type": "Timeout", + "error_data": { + "secs": 300, + "nanos": 0 + } + } + }, + "id": null + } + ``` + + * `NoSuchTask` - Something went wrong or `task::init_trezor::init` was not called. Refer to the [task::init\_trezor::init](/atomicdex/api/v20-dev/task_init_trezor/#init) section for more information. + + ```json + { + "mmrpc": "2.0", + "error": "No such task '0'", + "error_path": "init_hw", + "error_trace": "init_hw:184]", + "error_type": "NoSuchTask", + "error_data": 0, + "id": null + } + ``` + + * `HwError` - **This is the most important error type.** Unlike other error types, `HwError` requires the GUI / User to check the details in `error_data` field to know which action is required. View the [HwError error type details](/atomicdex/api/v20-dev/hd_wallets_overview/#details-for-hw-error-error-type) for more info. + + +## cancel {{label : 'task::init_trezor::cancel', tag : 'API-v2'}} + +Use the `task::init_trezor::cancel` method to cancel the initialisation task. + +#### Arguments + +| Parameter | Type | Description | +| --------- | ------- | --------------------------------------------------------------------------- | +| task\_id | integer | The identifying number returned when initiating the initialisation process. | + +#### Response + +| Parameter | Type | Description | +| ------------ | ------ | -------------------------------------------------------------------------------------- | +| result | string | Returns with value `success` when successful, otherwise returns the error values below | +| error | string | Description of the error | +| error\_path | string | Used for debugging. A reference to the function in code base which returned the error | +| error\_trace | string | Used for debugging. A trace of lines of code which led to the returned error | +| error\_type | string | An enumerated error identifier to indicate the category of error | +| error\_data | string | Additonal context for the error type | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::init_trezor::cancel", + "params": { + "task_id": 0 + } + } + ``` + + + + #### Response (ready, successful) + + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + + #### Response (error, task already finished) + + ```json + { + "mmrpc": "2.0", + "error": "Task is finished already", + "error_path": "init_hw.manager", + "error_trace": "init_hw:209] manager:104]", + "error_type": "TaskFinished", + "error_data": 0, + "id": null + } + ``` + + +## user\_action {{label : 'task::init_trezor::user_action', tag : 'API-v2'}} + +When you see the pin grid on your device, or it asks for a passphrase word, use this method. + +#### Arguments + +| Parameter | Type | Description | +| ------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| task\_id | integer | The identifying number returned when initiating the initialisation process. | +| user\_action | object | Object containing the params below | +| user\_action.action\_type | string | Either `TrezorPin` or `TrezorPassphrase`, depending on which is requested by responses from related methods returning `"status": "UserActionRequired"` | +| user\_action.pin | string (number) | When the Trezor device is displaying a grid of numbers for PIN entry, this param will contain your Trezor pin, as mapped through your keyboard numpad. See the image below for more information. | +| user\_action.passphrase | string | The [passphrase](https://trezor.io/learn/a/passphrases-and-hidden-wallets) functions like an extra word added to your recovery seed, and it used to access hidden wallets. To access the default wallet, input an empty string here. | + + + +#### Response + +| Parameter | Type | Description | +| --------- | ------ | --------------------------- | +| result | string | The outcome of the request. | + + + Even an incorrect PIN will return `success`. This doesn't mean the PIN was accepted, just that it was communicated without errors. If the PIN was incorrect, you will see an error like below in the next response for a method that requires authentication. + + +```json +{ + "mmrpc": "2.0", + "result": { + "status": "Error", + "details": { + "error": "Error on platform coin KMD creation: Hardware Wallet context is not initialized", + "error_path": "lib.init_utxo_standard_activation.utxo_coin_builder", + "error_trace": "lib:103] init_utxo_standard_activation:79] utxo_coin_builder:317]", + "error_type": "CoinCreationError", + "error_data": { + "ticker": "KMD", + "error": "Hardware Wallet context is not initialized" + } + } + }, + "id": null +} +``` + +#### 📌 Examples + +#### Command (for TrezorPin) + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::init_trezor::user_action", + "params": { + "task_id": 0, + "user_action": { + "action_type": "TrezorPin", + "pin": "862743" + } + } + } + ``` + + +#### Command (for TrezorPassphrase) + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::init_trezor::user_action", + "params": { + "task_id": 0, + "user_action": { + "action_type": "TrezorPassphrase", + "passphrase": "breakfast" + } + } + } + ``` + + + + #### Response (success) + + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + +export const title = "AtomicDEX: Withdraw Tasks"; +export const description = "The methods in this document allow withdrawal of coins from AtomicDEX."; + +# Withdraw Tasks + +## init {{label : 'task::withdraw::init', tag : 'API-v2'}} + +The `task::withdraw::init` method generates, signs, and returns a transaction that transfers the `amount` of `coin` to the address indicated in the `to` argument. The status of this method can be queried via the [withdraw\_status](/atomicdex/api/v20-dev/task_withdraw/#status) method. + +It will return the transaction hex (via `task::withdraw::status`), which then needs to be broadcast with the [sendrawtransaction](/atomicdex/api/legacy/send_raw_transaction/) to complete the withdrawal. This method is uses the same input fields as the [standard v2 withdraw method](/atomicdex/api/v20/withdraw/), with additional optional fields to specify the `from` address when using a hardware or HD wallet. There are two way to indicate which HW/HD address to send funds from: + +* Using `derivation_path` as a single input. E.g `m/44'/20'/0'/0/2` +* Using `account_id` (0), `chain` (External) & `address_id` (2) inputs. The bracketed values are the equavalent of the derivation path above. + +To cancel the transaction generation, use the [withdraw\_cancel](/atomicdex/api/v20-dev/task_withdraw/#cancel) method. + + + When used for ZHTLC coins like ARRR or ZOMBIE, it may take some time to + complete. + + +### Arguments + +| Structure | Type | Description | +| --------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | The name of the coin the user desires to withdraw | +| to | string | Coins are withdrawn to this address | +| amount | string (numeric) | The amount the user desires to withdraw, ignored when `max=true` | +| memo | string | Optional, used for ZHTLC and Tendermint coins only. Attaches a memo to the transaction. | +| from | string | Optional, used only for transactions using a hardware wallet. For more information, see the [Trezor Integration guide](/atomicdex/api/v20-dev/task_init_trezor/) | +| from.derivation\_path | string | Optional, HW/HD wallets only. Follows the format `m/44'/COIN_ID'/ACCOUNT_ID'/CHAIN/ADDRESS_ID` | +| from.account\_id | integer | Optional, HW/HD wallets only. Generally this will be `0` unless you have multiple accounts registered on your HW/HD wallet | +| from.chain | string | Optional, HW/HD wallets only. `Internal`, or `External`. External is used for addresses that are meant to be visible outside of the wallet (e.g. for receiving payments). Internal is used for addresses which are not meant to be visible outside of the wallet and is used for return transaction change. | +| from.address\_id | integer | Optional, HW/HD wallets only. Check the output from coin activation to find the ID of an address with balance. | +| max | bool | Optional. Withdraw the maximum available amount. Defaults to `false` | +| fee | object | Optional. Used only to set a custom fee, otherwise fee value will be derived from a deamon's `estimatefee` (or similar) RPC method | +| fee.type | string | Type of transaction fee; possible values: `UtxoFixed` or `UtxoPerKbyte` | +| fee.amount | string (numeric) | Fee amount in coin units, used only when type is `UtxoFixed` (fixed amount not depending on tx size) or `UtxoPerKbyte` (amount per Kbyte) | + +#### Response + +| Structure | Type | Description | +| --------- | ------- | --------------------------------------------------------- | +| task\_id | integer | An identifying number which is used to query task status. | + +#### 📌 Examples + +#### Command + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "task::withdraw::init", + "params": { + "coin": "COIN_NAME", + "to": "RECIPIENT_ADDRESS", + "amount": "AMOUNT" + }, + "id": 0 + } + ``` + + +#### Command (max = true) + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "task::withdraw::init", + "params": { + "coin": "COIN_NAME", + "to": "RECIPIENT_ADDRESS", + "max": true + }, + "id": 0 + } + ``` + + +#### Command (custom UtxoFixed fee) + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "task::withdraw::init", + "params": { + "coin": "COIN_NAME", + "to": "RECIPIENT_ADDRESS", + "amount": "AMOUNT", + "fee": { + "type": "UtxoFixed", + "amount": "0.001" + } + }, + "id": 0 + } + ``` + + +#### Command (custom UtxoPerKbyte fee) + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "task::withdraw::init", + "params": { + "coin": "COIN_NAME", + "to": "RECIPIENT_ADDRESS", + "amount": "AMOUNT", + "fee": { + "type": "UtxoPerKbyte", + "amount": "0.00097" + } + }, + "id": 0 + } + ``` + + +#### Command (HW/HD wallet: derivation path option) + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::withdraw::init", + "params": { + "coin": "COIN_NAME", + "to": "ADDRESS_OF_RECIPIENT", + "amount": "AMOUNT_TO_SEND", + "from": { + "derivation_path": "DERIVATION_PATH" + } + } + } + ``` + + +#### Command (HW/HD wallet: account\_id, chain & address\_id option) + + + ```json + { + "userpass": "testpsw", + "mmrpc": "2.0", + "method": "task::withdraw::init", + "params": { + "coin": "COIN_NAME", + "to": "ADDRESS_OF_RECIPIENT", + "amount": "AMOUNT_TO_SEND", + "from": { + "account_id": 0, + "chain": "External", + "address_id": "ADDRESS_ID" + } + } + } + ``` + + + + #### Response + + ```json + { + "mmrpc": "2.0", + "result": { + "task_id": 0 + }, + "id": null + } + ``` + + +## status {{label : 'task::withdraw::status', tag : 'API-v2'}} + +To get the status of your withdrawal transaction generation, use the `task::withdraw::status` method. Once ready, it will provide the raw hex used to broadcast your transaction with [sendrawtransaction](/atomicdex/api/legacy/send_raw_transaction/). The response returned is the same as what is returned from the [standard v2 withdraw method](/atomicdex/api/v20/withdraw/#response) + +#### Arguments + +| Parameter | Type | Description | +| -------------------- | ------- | ---------------------------------------------------------------------------------------- | +| task\_id | integer | The identifying number returned when initiating the initialisation process. | +| forget\_if\_finished | boolean | If `false`, will return final response for completed tasks. Optional, defaults to `true` | + +#### Response + +| Structure | Type | Description | +| ------------------------------------ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| status | string | A short indication of how the withdrawal is progressing. | +| details | object | Depending on the state of withdrawal progress, this will contain different information as shown in the responses below. | +| details.to | array of strings | Coins are withdrawn to these addresses; this may contain the `my_address` address, where change from UTXO coins is sent. | +| details.from | array of strings | Coins are withdrawn from this address; the array contains a single element, but transactions may be sent from several addresses (UTXO coins) | +| details.my\_balance\_change | string (numeric) | the expected balance of change in `my_address` after the transaction broadcasts | +| details.received\_by\_me | string (numeric) | the amount of coins received by `my_address` after the transaction broadcasts; the value may be above zero when the transaction requires that the AtomicDEX API send change to `my_address` | +| details.spent\_by\_me | string (numeric) | the amount of coins spent by `my_address`; this value differ from the request amount, as the transaction fee is added here | +| details.total\_amount | string (numeric) | the total amount of coins transferred | +| details.fee\_details | object | the fee details of the generated transaction; `fee_details.type` is "Utxo" for Z coins. `fee_details.coin` will be the same as `details.coin`, and `fee_details.amount` will be a numeric value. | +| details.tx\_hash | string | the hash of the generated transaction | +| details.tx\_hex | string | transaction bytes in hexadecimal format; use this value as input for the [send\_raw\_transaction](/atomicdex/api/legacy/send_raw_transaction/) | +| details.coin | string | the name of the coin the user wants to withdraw | +| details.transaction\_type | string | Transaction type will be `StandardTransfer` for Z coin transactions. | +| details.kmd\_rewards | object (optional) | If supported (e.g. when withdrawing `KMD`), an object containing information about accrued rewards. | +| details.kmd\_rewards.amount | string (numeric, optional) | The amount of accrued rewards | +| details.kmd\_rewards.claimed\_by\_me | bool (optional) | Whether or not the rewards been claimed by me. | + +#### 📌 Examples + +#### Command + + + ```json + { + "mmrpc": "2.0", + "userpass": "testpsw", + "method": "task::withdraw::status", + "params": { + "task_id": "", + "forget_if_finished": false + }, + "id": 0 + } + ``` + + + + #### Response (Generating transaction) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": "GeneratingTransaction" + }, + "id": 0 + } + ``` + + + + #### Response (Generating transaction complete) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Ok", + "details": { + "tx_hex": "0400008085202f8900000000000056390400e803000000000000017aef9bb6fda6cff496046976f57dea0848fc05a46ce948dd1dab7d551a5e5a5cdc41b3409adec489e1c4ffb33bfca7a949833fadfb7cc93546aab96a8bffca469bbd435682f5af367ab07dbbbecc448010e056103fa236251b2b74d4f43d031d43df8e32672e99dae0ee51ece01c523b7ce7fb9aa8682e23e122d732a67664d3822b04edd1a12ed586b1e7dcef08c4f870792eccc2ad74a48da134a9368adb5967b01681fd1d617c2ce972f5860f976cb828363b9501f167d99e8ac17422a54e055cbfc7fce40e95b4de7bb0c8fa9e61f8a0ec07f23a28a7c4897fa6fe372a2e0fb8a2706b71db38648782eac18529d7bbcb5fe42b9da26fb2adf050538bd21c42aecbad0626ad4f4094c337ff3e9cf19292c1f0cc37b0e506231647573fb9ba479675ed99471b7fad4e54213c98facb47af6851e182ee7142a86cfd80a7741bdbeab8a1a6b093c1c093599165c8a8e7ae43c47b87b97fb7363bebc34df4fc2a045c04f850d5bc693f481ab0028706c673fad02a93c3e8e170e08f438034a600027a2974f846c278dce35d564e4c0d5de17c341fbe97d0048b4129c7dc81c4a0172e0986a5568d240fb50c9dc746e5398603aaec588835165e17162f218b71e55bf1403e4d1b81a8c745c7e87571f6c62966154a10ae908293bc66270d8ebc8d835498c7bfd379f87a57babe18db1e379a2fdb4c7413915015b23a54cf6ea2344bbd4f7abbaaec007427c69be51ea7f696ac94741305860ced9cfe96a1cf6bfbbaa182769bc6c8a74169c52990ee27accb51835766397183f408cd6679ccb04ddfc957bedea7fd2dd81103425f886566658b99baf9e0b7c353c5b19a84fece3f35d3902406b1757149f89cab9fe1301bd03d6e3994f617d0bb8b7706b946a15deb2afa0e42e2b8f15f758c6909a51d3ace11fb465e1ed34986f728568088ca75b20b29e924f561534dd38a54ca79ddc318b06f4d2d9a107ecd7601caa3b766d435ad7099e1aff7a0e64f3dbf9500c4f8274b16a1a76858187cebcbde43c8fc30955ff09f0d2930fbcc54f2b931d76e7924f58dbe181a04c22dc8729cf04d0b939206b62f8abbb07bdeedc65086b0c1703570130f928427ff0b6d605c1760be7d32f6343d0c871575f88785c36db39133cf7ce40a712681baaa299706a69d816a24bb8009c4a900021e91530a952eb4dbf036f29cb7e7788665d7318e9486ae99c9ca0d108134fb79588e73bca79cf34cb50ccfdcfef6154f8a399c87dc212eb29961b7bb61454f455b0ff03b3a57cfaacafb437a9341c0fa1c107c27a065716c9de69c129557e35f6af63312f25138174c020c9754d57c45066e28b0d70d77ceef1f69a4c55ce7a33a4120924fb08207018da848bdc4f4e44fbfe0889ba9cd3741ca565516e34cbb260b3870927310d99059c2651ee645b7d9f755e59a9c3821a4d576d7f5b5db22a9befa3163189b09124789897bde57d662d3c7e25d99d709ffdc803acbb8fde2a93dca1525bb1123ed661f8c58113a7e6d1eeb04f738f31bf80ef687804c32de4ca82ae0c3100533e498d9551618b91424489d31526ea46f78d93aa8eef2a25cf53b83cad226d17ba92dc55366a011c494c7f7b9a9c4e1ac6c41fa96f03a66a402d6e6b1b864e8b640ec44bcaf0c00f5ed093823f0a10749708f69377cab25b393a4251f2b605e8022bbfc8c9832c31a5e98d7730042644b56507e00bc24ecf4979fa22e1b40bed2246f38baf715d25a38e400386847997adaf71fe50d29da6995bd50760b08faeec9360147d68175c7cc81be238b406b1e1d414f142a8053e119b2d1ee508fe510d2adad21bd4dff33f6400f17ef88055992b3335fb2a19836b1df3c7ac5ef1a342c9eadb69202d06bfe25ee84625cec62cf507caa2f5b7de8ccdc85921dbdc09e885ad2a7b1f86a6963086073d33f25fd5281f879e1b01d4422048a9a11d6fb6da1d457dd0f9583e38edc4cb4d0c7a7049fd7821c6ccf86160c3d2e4afba86cf154cabf3e8766607d017e348a15b576347e2fdc6742093b8635c0cb0a22835df10f93859875b36cffd1dcb23c6ea95542c9f3c9b5afe613438347b753af37d955dbbe169733beaaff57f1fc685e8c43abb3aaa4bbc4af0211677d87c7d7bcb69631acecd93110b572f3508ff49a0d64f3bd7c01c60cdfd45b01165e3682e8d68f614b523cc73d1a402d650bca867e5bc09c9a920ac8adf8c502db88da0579087e93125836b6398790dc3cba5c1dcfec974d58bf22a9fbc10ca63d5116da35e15eb149d85aa58de15784cfc2574cbc8c7cf81c0f44ea250925e176d2010f7864a393e43da8349dcaf26d7814d7da07d2069a1ee7bd6184351dfc8ae28757d65d15347eae69e9fac8453e1dc6506f4db9aa22db3f35b1782f7b43b1b85e6e0f8ac772712a044e5ef90235eb79ff83a7723ff78a7bba1381ada81507480ac1f0eca939061891b41c1b25aba3172916c3bab939d9f3baec391b2d503be7f63b44dd0fefd5ba769f2f699923531a7bf3a50079133dba31ff3c13b925e6e678b45e217c7ed0c328c15e36ebc56f2cd8c5e7961dadc99f42fe9a0a7d13e849308bcbd760f9570e821db1ea13d3f65ade8b50d3b9b95d2c0eb3e6b8b9796daa4ad0e1ab9dc6585a2dcf1d189e86c7698657f2684df36f31b5e955f9dd044dd3fd174fafcb814da305d15bfed40b4746875abe999bbfc97c58a24ba383dc7c4bb098e09df55f1ed05bbc3f3e0ea510d7dcfc01b1386a6e376c41879a77427e16cb7a0263b635c99713cfa95794cf7b5717836be632c1434970875f9b5c7886d0237f88c509b08a55981259fa08823bd455febd12ee3e5c6e41f66057a3039946052545694ada38babc3f421a531d90cd80461674e4b8efc0ada6a349e56fd12a60f083cce4169170e4a3bb1aeb7193c8b7f686f88240bda72e8fe682c1ad955689a9de678e143e67e04eefd18d86020829eb7603e4449c92189ddb9e41a63a59920d697f8a1a16f26697f31bd34faf02299e8b99a17523ccfa81ed72c6b7e4edd5d128432d353a8f53e0e6c76835d914e8c7348050f48ec68ddd44e6601502952b3d23afd7621ac7174223b7bbc59da87273fbb82f086df2669825de92e456c00734b072b28574a4fc2f4fba13618980f32df91a34bea01ecfeb619ee4ed52d4885f68f636427ca8fda56a9c4b716814bb9074002e18f369666b6fcef7c0008dd8863ea028f8b7c89575b23a871196846857b7f85bd0532503991342d9ab34dd6d9c7700cfb8e991f660a81f2b110740bec308d67d39998bf89d3d667b240e", + "tx_hash": "f708b9d83b786af26c186a192f14ba680f33f567189ac2e3cd438a29a05f554a", + "from": [ + "zs1e3puxpnal8ljjrqlxv4jctlyndxnm5a3mj5rarjvp0qv72hmm9caduxk9asu9kyc6erfx4zsauj" + ], + "to": [ + "zs1e3puxpnal8ljjrqlxv4jctlyndxnm5a3mj5rarjvp0qv72hmm9caduxk9asu9kyc6erfx4zsauj" + ], + "total_amount": "29.99989008", + "spent_by_me": "29.99989008", + "received_by_me": "29.99988008", + "my_balance_change": "-0.00001000", + "block_height": 0, + "timestamp": 0, + "fee_details": { + "type": "Utxo", + "coin": "ZOMBIE", + "amount": "0.00001" + }, + "coin": "ZOMBIE", + "internal_id": "f708b9d83b786af26c186a192f14ba680f33f567189ac2e3cd438a29a05f554a", + "transaction_type": "StandardTransfer" + } + }, + "id": 0 + } + ``` + + #### Response (Generating KMD transaction complete with rewards info) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "Ok", + "details": { + "tx_hex": "0400008085202f89051f43676aa53f06aaf67cfe76b4995a80c204aee630bf1909c37e2efc03c8ceac000000006b48304502210084c8d5345794b6bc78557a7aab71668020a6decf2537e9854044969f0125579202207d059c5cb465ffdd5920ddcca2760da49ce03252b4b3fd4b58605adbbc4d3ec1012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2fffffffffc4ba9e537032043caba0982f4b0d46b029ecb261edf9b22fd84a665158cc3d6000000006a47304402207d720393347252195c09b16b9e23a0da7e00979521a9277daa297cd2f5d6d5b902204a8b35f7088ba7e7e7327c2c4fb30de300c26ba1527f3979cf1ed7a85bd70a58012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffff19723c4dd6e57edbf623625370ffc8fbeef1ec367e4514491e3da333896f01260000000069463043021f488fa0fc7c8e1f2dbcff589c72f33d4354bc065b4d0e0c69592df293a81fb40220224e7cf3ec63dbbb6f9a2929baed7328af286b6b5f53c1ac0a9bc8156163d6e5012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffff59c28f535d6b73c7f622f7aade547ef1db2277d3a43207b289cf56afa5e37f6b010000006a473044022017fbc3310ce3ae66caaf6782cba58a6065af43052e0a97db93d0fa9f6a5eb59e02207d3f766a230bf5159333104f773e2c45daa91828ac53da9f87b6c7dcd255370c012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffffcdbbc54aabaa6d0f5984c444f4317500c2f2b2b77e70f310b1940987b5ce9d3c010000006a4730440220793808739a53e3eedec7aef12b833fdd0e1d789e5211170331f492250757cac002207a3b748b674cb875bdf0cce87d61da10ca2eb24788afe5b061dba01972d9cdb1012103d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2ffffffff0200e40b54020000001976a914e6d49471e6e83b5b69c0bee93caa4dc880205d9a88ac5856bb5b000000001976a914d346067e3c3c3964c395fee208594790e29ede5d88ac095cbe63000000000000000000000000000000", + "tx_hash": "7c201920db65b134a99c8405d84456bed7456bc29451c5bdcc92f30db62a4279", + "from": ["RUYJYSTuCKm9gouWzQN1LirHFEYThwzA2d"], + "to": ["RWKi9wkqMH4C9h4psPKjcKQaYNq5vsL89F"], + "total_amount": "115.39004992", + "spent_by_me": "115.39004992", + "received_by_me": "15.39003992", + "my_balance_change": "-100.00001", + "block_height": 0, + "timestamp": 1673421831, + "fee_details": { + "type": "Utxo", + "coin": "KMD", + "amount": "0.00001" + }, + "coin": "KMD", + "internal_id": "", + "kmd_rewards": { + "amount": "5.64955481", + "claimed_by_me": true + }, + "transaction_type": "StandardTransfer", + "memo": null + } + }, + "id": 0 + } + ``` + + + + #### Response (No such task / task expired) + + ```json + { + "mmrpc": "2.0", + "error": "No such task '1'", + "error_path": "init_withdraw", + "error_trace": "init_withdraw:57]", + "error_type": "NoSuchTask", + "error_data": 1, + "id": 0 + } + ``` + + #### Response (error, waiting for user to confirm signing on hardware wallet device) + + ```json + { + "mmrpc": "2.0", + "result": { + "status": "InProgress", + "details": "WaitingForUserToConfirmSigning" + }, + "id": null + } + ``` + + +## cancel {{label : 'task::withdraw::cancel', tag : 'API-v2'}} + +Use the `task::withdraw::cancel` method to cancel the withdrawal preparation task. + +#### Arguments + +| Structure | Type | Description | +| --------- | ------- | --------------------------------------------------------------------- | +| task\_id | integer | The identifying number returned when initiating the withdraw process. | + +#### Response + +| Structure | Type | Description | +| ------------ | ------ | -------------------------------------------------------------- | +| result | string | Indicates task cancellation was succesful. | +| error | string | An error message to explain what went wrong. | +| error\_path | string | An indicator of the class or function which reurned the error. | +| error\_trace | string | An indicator of where in the source code the error was thrown. | +| error\_type | string | An enumerated value for the returned error. | +| error\_data | string | The input task ID which resulted in the error. | + +#### 📌 Examples + +#### Command + + + ```json + { + "userpass": "testpsw", + "method": "task::withdraw::cancel", + "mmrpc": "2.0", + "params": { + "task_id": 6 + } + } + ``` + + + + #### Response (Success) + + ```json + { + "mmrpc": "2.0", + "result": "success", + "id": null + } + ``` + + + + #### Response (Error: No such task / task expired) + + ```json + { + "mmrpc": "2.0", + "error": "No such task '1'", + "error_path": "init_withdraw.manager", + "error_trace": "init_withdraw:92] manager:97]", + "error_type": "NoSuchTask", + "error_data": 1, + "id": 0 + } + ``` + + #### Response (Error: Task already finished) + + ```json + { + "mmrpc": "2.0", + "error": "Task is finished already", + "error_path": "init_withdraw.manager", + "error_trace": "init_withdraw:94] manager:104]", + "error_type": "TaskFinished", + "error_data": 4, + "id": null + } + ``` + +export const title = "ChangeLog"; +export const description = "Find the Changelogs of various versions of AtomicDEX-API on this page."; + +# Change Log + +Version 0.2.8 of the AtomicDEX API includes the following changes. + +#### List of Changes + +* add sound based notification +* use background service for mm2 +* new atomicDEX core +* add NAV +* optimise FTC integration +* update log tags +export const title = "Introduction to AtomicDEX"; +export const description = "Explore the technical documentation for AtomicDEX, the decentralized exchange powered by atomic swaps, and learn about the AtomicDEX API."; + +# Introduction to AtomicDEX + +Welcome to the AtomicDEX technical documentation. + +#### About the AtomicDEX Section + +This documentation is intended for developers utilizing the AtomicDEX API. + +Users who are not interested in development-related activities, but are searching for documentation assistance, can find support in the Komodo Support Center. + +[Link to Komodo Support Center](https://support.komodoplatform.com/support/home) + +#### Conceptual Overview + +A brief conceptual overview of AtomicDEX can be found in the Start Here > Product Introductions > AtomicDEX section. + +[Link to "AtomicDEX" Introduction](https://developers.komodoplatform.com/start-here/about-komodo-platform/product-introductions#AtomicDEX) + +The [AtomicDEX Tutorials](/atomicdex/tutorials/) section contains a more thorough conceptual explanation of AtomicDEX. + +Please consult our [Learning Path Outlines](https://developers.komodoplatform.com/start-here/learning-launchpad/#introduction) section for more details on approaches to learning AtomicDEX from both a conceptual and technical perspective. + +#### About AtomicDEX Setup + +The AtomicDEX Setup section contains basic information about setting up and using an AtomicDEX-enabled environment. + +#### About AtomicDEX Tutorials + +The AtomicDEX Tutorials section contains various tutorials that provide instruction for AtomicDEX usage and creation. + +For a walkthrough covering multiple tutorials in a targeted fashion, please see the [Learning Launchpad](https://developers.komodoplatform.com/start-here/learning-launchpad/#introduction) section. + +#### About AtomicDEX API + +The AtomicDEX API section contains all available API commands. + +These API commands can also be called Remote Procedure Calls, or RPCs. +export const title = "Add and Activate Coins on AtomicDEX Mobile"; +export const description = + "Activate coins on AtomicDEX Mobile by following simple steps and enjoy seamless trading."; + +import howToAdd1 from "@/public/images/mobile/how-to-add-01.jpg"; +import howToAdd2 from "@/public/images/mobile/how-to-add-02.jpg"; +import howToAdd3 from "@/public/images/mobile/how-to-add-03.jpg"; + +# How to Add and Activate Coins on AtomicDEX Mobile + +* Click on the "+" icon on the "Portfolio" screen + + + +* Select the coin you want to activate by clicking on the left side of each coin and press "DONE" + + + +Once activated, AtomicDEX Mobile brings you back to the "Portfolio" tab. Your coins should now be activated. + + +export const title = "Delete Seed From AtomicDEX Mobile"; +export const description = + "This guide describes how to delete your wallet in AtomicDEX Mobile by accessing Settings, entering your password, and confirming the deletion."; + +import howToDelete1 from "@/public/images/mobile/how-to-delete-wallet-01.jpg"; +import howToDelete2 from "@/public/images/mobile/how-to-delete-wallet-02.jpg"; +import howToDelete3 from "@/public/images/mobile/how-to-delete-wallet-03.jpg"; + +# How to Delete Seed (Wallet) From AtomicDEX Mobile + + + This action cannot be undone. Make sure that you backup your seed beforehand. + + + + Make sure that you backup your seed beforehand. + /atomicdex/mobile/how-to-recover-seed-on-atomicdex-mobile + + +* Click on "Settings" then scroll to the bottom and select the red "Delete Wallet" option + + + +* Enter the password you used to encrypt your seed and click on "UNLOCK" + + + +* Click on the "DELETE" button + + +export const title = "Create a New Wallet"; +export const description = + "This guide describes how to create a new wallet using AtomicDEX mobile."; + +import howToCreate1 from "@/public/images/mobile/how-to-create-01.png"; +import howToCreate2 from "@/public/images/mobile/how-to-create-02.jpg"; +import howToCreate3 from "@/public/images/mobile/how-to-create-03.jpg"; +import howToCreate4 from "@/public/images/mobile/how-to-create-04.jpg"; +import howToCreate5 from "@/public/images/mobile/how-to-create-05.jpg"; +import howToCreate6 from "@/public/images/mobile/how-to-create-06.jpg"; +import howToCreate7 from "@/public/images/mobile/how-to-create-07.jpg"; +import howToCreate8 from "@/public/images/mobile/how-to-create-08.jpg"; +import howToCreate9 from "@/public/images/mobile/how-to-create-09.jpg"; +import howToCreate10 from "@/public/images/mobile/how-to-create-10.jpg"; + +# How to Create a New Wallet Using AtomicDEX Mobile + +* Start AtomicDEX Mobile app + +* Select "CREATE A WALLET" button + + + +* Enter a memorable name to your wallet and press "LET'S GET SET UP!" + + + +* Write down your 12 words seed phrase and store in a safe place, then press "NEXT" + + + +* Confirm 3 random words in the next 3 steps from your seed list and press "CONTINUE" {{slugify: true}} + + + + + + + +* Create a password to encrypt your seed + +Make sure to use a strong password with a combination of at least one capital letter, one small letter, a symbol, and numbers. + +* Press "CONFIRM PASSWORD" + +If normal encryption takes longer on your phone, enable "Fast encryption" and try again. + + + +* Create a PIN + +In the next two steps you will be asked to provide a custom six digit PIN. You will need this PIN every time you want to access atomicDEX. + + + + + +Upon completion, AtomicDEX Mobile returns you to the dashboard. + + +export const title = "Perform Cross-Chain Atomic Swaps Using AtomicDEX Mobile"; +export const description = + "This guide describes how to perform cross-chain atomic swaps using AtomicDEX mobile."; + +import howToPerform1 from "@/public/images/mobile/how-to-perform-01.jpg"; +import howToPerform2 from "@/public/images/mobile/how-to-perform-02.jpg"; +import howToPerform3 from "@/public/images/mobile/how-to-perform-03.jpg"; +import howToPerform4 from "@/public/images/mobile/how-to-perform-04.jpg"; +import howToPerform5 from "@/public/images/mobile/how-to-perform-05.jpg"; + +# How to Perform Cross-Chain Atomic Swaps Using AtomicDEX Mobile + +#### Prerequisites + +* You need to have funds at least in 1 coin +* The coins you want to swap are activated + + + * You need to have funds at least in 1 coin + /atomicdex/mobile/how-to-view-your-receiving-address-to-send-funds-for-trading) + * The coins you want to swap are activated + /atomicdex/mobile/how-to-add-and-activate-coins-on-atomicdex-mobile/) + + + + AtomicDEX Mobile is still in a beta-testing phase. Do not use large funds for testing - use the DOC & MARTY test coins for swaps first to gain experience. + To obtain coins for testing, you can use the FluxBot bot in the [Komodo Platform Discord Server](https://komodoplatform.com/discord). + + **Flux Bot Commands** + + | Command | Description | + | ----------------------------------- | ------------------------------------------------------ | + | `/atomicdex-orderbook ` | Returns the current AtomicDEX orderbook for a pair. | + | `/faucet-balances` | Returns the current testcoin balances for the faucet. | + | `/faucet-drip
` | Sends testcoin funds to the requested address. | + | `/faucet-orders` | Returns active maker orders placed by the faucet. | + | `/faucet-recent` | Returns faucet funds distributed in the last 24 hours. | + | `/faucet-swaps-active` | Returns swaps currently in progress for the faucet. | + | `/faucet-swaps-recent` | Returns recent swaps or the faucet. | + + +#### Instructions + +* Click on the "DEX" tab at the bottom of AtomicDEX Mobile app + +This will bring you to the DEX view. + +In DEX tab you can perform cross-chain atomic swaps, and view current orders and your swap history. + +* Swip left or right to view either option + + + +* Select the coin you wish to sell and enter the desired amount + +* Select the coin you want to receive for the swap + +The amount modal will fill automatically, based on the amount you want to sell. + +You may also see the best available rate, based on the orders available. + +* When ready, click on the "TRADE" button + + + +On the next screen you will see details of the swap you are about to perform. + +* When ready, press the "CONFIRM" button to begin the swap + + + +You will see the progress of your swap in this screen. + +You may stay on this page until the swap completes, or you may return to another screen. The swap will progress automatically. + + + +If you are still on the swap monitoring page from before, when your swap completes you will see the following screen. + + +export const title = "Recover Seed on AtomicDEX Mobile"; +export const description = + "This guide describes how to recover a seed on AtomicDEX mobile."; + +import howToRecover1 from "@/public/images/mobile/how-to-recover-01.jpg"; +import howToRecover2 from "@/public/images/mobile/how-to-recover-02.jpg"; +import howToRecover3 from "@/public/images/mobile/how-to-recover-03.jpg"; + +# How to Recover Seed on AtomicDEX Mobile + +* Click on `Settings` > `View Seed` + + + +* Enter the password you used to encrypt your seed and click "CONTINUE" + + + +The app will display your seed that you used. + + +export const title = "Restore Wallet Using AtomicDEX Mobile"; +export const description = + "This guide describes how to restore a wallet using AtomicDEX mobile."; + +import howToRestore1 from "@/public/images/mobile/how-to-restore-01.jpg"; +import howToRestore2 from "@/public/images/mobile/how-to-restore-02.jpg"; +import howToRestore3 from "@/public/images/mobile/how-to-restore-03.jpg"; +import howToRestore4 from "@/public/images/mobile/how-to-restore-04.jpg"; +import howToRestore5 from "@/public/images/mobile/how-to-restore-05.jpg"; +import howToRestore6 from "@/public/images/mobile/how-to-restore-06.jpg"; +import howToRestore7 from "@/public/images/mobile/how-to-restore-07.jpg"; + +# How to Restore Wallet Using AtomicDEX Mobile + +* Start atomicDEX Mobile app + +* Click "RESTORE" button + + + +* Give a memorable name to your wallet and press "LET'S GET SET UP!" + + + +* Select "Allow custom seed" and paste or type your seed words + +Make sure to include spaces in your seed, just as before. + +If you would like to see what you are typing, click on the eye icon on the right to make the field visible. + +* Once ready, press the "CONFIRM" button + + + +* Create a password to encrypt your seed + +Make sure to use strong password with a combination of at least one capital letter, one small letter, a symbol, and numbers. + +* Press "CONFIRM PASSWORD" + +If normal encryption takes longer on your phone, enable "Fast encryption" and try again. + + + +* Create a PIN + +In the next two steps you will be asked to provide a custom six digit PIN. You will need this PIN every time you want to access atomicDEX. + + + + + +Upon completion, AtomicDEX Mobile returns you to the dashboard. + + +export const title = "View Ongoing Orders and Swap History"; +export const description = + "This guide describes how to view ongoing orders and swap history on AtomicDEX mobile."; + +import howToViewOngoingOrder1 from "@/public/images/mobile/how-to-view-ongoing-01.jpg"; +import howToViewOngoingOrder2 from "@/public/images/mobile/how-to-view-ongoing-02.jpg"; + +# How to View Ongoing Orders and Swap History on AtomicDEX Mobile + +#### View Ongoing Swaps and Orders + +* Click on the "DEX" tab at the bottom of the screen and swipe from right to left + +* Alternatively, click on the "ORDERS" button to view your ongoing swaps and your orders + + + +#### View Your Swap History + +The swap history tab is on the right of the "ORDERS" tab. You should see your swap history here. + + + If you delete app data in the settings menu or restore this seed on another + phone, your previous swap data will be lost. + + + +export const title = "View Your Receiving Address to Send Funds for Trading"; +export const description = + "This guide describes how to view your receiving address to send funds for trading on AomicDEX mobile."; + +import howToView1 from "@/public/images/mobile/how-to-view-01.jpg"; +import howToView2 from "@/public/images/mobile/how-to-view-02.jpg"; +import howToView3 from "@/public/images/mobile/how-to-view-03.jpg"; +import howToView4 from "@/public/images/mobile/how-to-view-04.jpg"; + +# How to View Your Receiving Address to Send Funds for Trading + +* From the "Portfolio" tab, select the coin for the receiving address to view + + + +* On the coin page, press the "RECEIVE" button + +This will display your receiving address, including a QR code of your address. + +Different coins may have different receiving addresses derived from your seed. + +On the other hand, Komodo (KMD) and any other Komodo-based Smart Chain will have same address. + + + +Example of a KMD receiving address. + + + +Example of a BTC receiving address. + + +export const title = "Withdraw or Send Funds"; +export const description = + "This guide describes how to withdraw or send funds using AtomicDEX mobile."; + +import howToWithdraw1 from "@/public/images/mobile/how-to-withdraw-01.jpg"; +import howToWithdraw2 from "@/public/images/mobile/how-to-withdraw-02.jpg"; +import howToWithdraw3 from "@/public/images/mobile/how-to-withdraw-03.jpg"; +import howToWithdraw4 from "@/public/images/mobile/how-to-withdraw-04.jpg"; + +# How to Withdraw or Send Funds Using AtomicDEX Mobile + +* On the "Portfolio" page, click on the coin you want to send and press the "SEND" button + + + +* Enter the amount and the destination address + +You can also use a QR scanner by pressing on the camera icon on left. + +* Then press on the "WITHDRAW" button + + + +On the next screen you will be shown details of your transaction. + +* If you are satisfied with the details, press the "CONFIRM" button + + + +Once your transaction is completed you will see a "Success!" message. + +You may check the block explorer of your coin to verify the transaction, if you like. + + +export const title = "AtomicDEX API configuration"; +export const description = + "Configure and activate coins on AtomicDEX API using MM2.json and the coins file."; + +# AtomicDEX API configuration + +AtomicDEX-API configuration parameters, along with additional runtime flags, and per-process environment variables are [listed in the source code](https://github.com/KomodoPlatform/komodo-defi-framework/blob/main/mm2src/mm2_main/src/mm2.rs#L151-L205) + + + `AtomicDEX-API configuration parameters are [listed in the source code](https://github.com/KomodoPlatform/atomicDEX-API/blob/mm2.1/mm2src/mm2.rs#L126), along with [additional runtime flags](https://github.com/KomodoPlatform/atomicDEX-API/blob/mm2.1/mm2src/mm2.rs#L115), and [per-process environment variables](https://github.com/KomodoPlatform/atomicDEX-API/blob/mm2.1/mm2src/mm2.rs#L171)` + + +## MM2.json + +When running the AtomicDEX API via commandline with the `mm2` binary, some basic configuration parameters need to be defined in either an `MM2.json` file, or at runtime. + +### Configuration Parameters + +| Parameter | Type | Description | +| ----------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| gui | string | Information to identify which app, tool or product is using the API, e.g. `AtomicDEX iOS 1.0.1`. Helps developers identify if an issue is related to specific builds or operating systems etc. | +| netid | integer | Nework ID number, telling the AtomicDEX-API which network to join. 7777 is the current main network, though alternative netids can be used for testing or "private" trades as long as seed nodes exist to support it. | +| passphrase | string | Your passphrase; this is the source of each of your coins private keys. [**KEEP IT SAFE!**](https://www.youtube.com/watch?v=WFpxVbTqhB8) | +| rpc\_password | string | For RPC requests that need authentication, this will need to match the `userpass` value in the request body. | +| allow\_weak\_password | boolean | Optional, defaults to `false`. If `true`, will allow low entropy rpc\_password. If `false` rpc\_password must not have 3 of the same characters in a row, must be between 8-32 characters in length, must contain at least one of each of the following: numeric, uppercase, lowercase, special character (e.g. !#$\*). It also can not contain the word "password", or the chars `<`, `>`, or `&`. | +| dbdir | string | Optional, defaults to a subfolder named `DB` in the path of your `mm2` binary. This path will store the AtomicDEX-API database data. | +| rpcip | string | Optional, defaults to `127.0.0.1`. IP address to bind to for RPC server. | +| rpcport | integer | Optional, defaults to `7783`. Port to use for RPC communication. | +| rpc\_local\_only | boolean | Optional, defaults to `true`. If `false` the AtomicDEX API will allow rpc methods sent from external IP addresses. **Warning:** Only use this if you know what you are doing, and have put the appropriate security measures in place. | +| i\_am\_seed | boolean | Optional, defaults to `false`. Runs AtomicDEX API as a seed node mode (acting as a relay for AtomicDEX API clients). Use of this mode is not reccomended on the main network (7777) as it could result in a pubkey ban if non-compliant. On alternative testing or private networks, at least one seed node is required to relay information to other AtomicDEX API clients using the same netID. | +| seednodes | list of strings | Optional. If operating on a test or private netID, the IP address of at least one seed node is required (on the main network, these are already hardcoded) | +| hd\_account\_id | integer | Optional. If this value is set, the AtomicDEX-API will work in only the [HD derivation mode](/atomicdex/api/v20-dev/hd_wallets_overview/), and coins will need to have a coin derivation path entry in the `coins` file for activation. The `hd_account_id` value effectively takes its place in the full derivation as follows: `m/44'/COIN_ID'/'/CHAIN/ADDRESS_ID` | +| message\_service\_cfg | object | Optional. This data is used to configure [Telegram](https://telegram.org/) messenger alerts for swap events when running using the [makerbot functionality](/atomicdex/api/v20/start_simple_market_maker_bot/). For more information check out the [telegram alerts guide](/atomicdex/api/v20/telegram_alerts/) | +| metrics | integer | Optional, defaults to `300`. The interval in seconds which metrics are logged. Set to `0` to disable metrics. | +| prometheusport | integer | Optional. Only used if you are logging metrics in [Prometheus](https://prometheus.io/) and [Grafana](https://grafana.com/). For more information check out the [AtomicDEX metrics guide](/atomicdex/tutorials/atomicdex-metrics/) | +| prometheus\_credentials | integer | Optional. Only used if you are logging metrics in [Prometheus](https://prometheus.io/) and [Grafana](https://grafana.com/) with authentication. For more information check out the [AtomicDEX metrics guide](/atomicdex/tutorials/atomicdex-metrics/) | + +#### Example (allowing weak password): + +```json +{ + "gui": "DEVDOCS_CLI", + "netid": 7777, + "rpc_password": "ENTER_UNIQUE_PASSWORD", + "passphrase": "ENTER_UNIQUE_SEED_PHRASE_DONT_USE_THIS_CHANGE_IT_OR_FUNDS_NOT_SAFU", + "allow_weak_password": true, + "dbdir": "/path/to/DB/folder" +} +``` + +#### Example (not allowing weak password): + +```json +{ + "gui": "DEVDOCS_CLI", + "netid": 7777, + "rpc_password": "Ent3r_Un1Qu3_Pa$$w0rd", + "passphrase": "ENTER_UNIQUE_SEED_PHRASE_DONT_USE_THIS_CHANGE_IT_OR_FUNDS_NOT_SAFU", + "allow_weak_password": false, + "dbdir": "/path/to/DB/folder" +} +``` + +#### Example for HD Wallets: + +If you are using HD wallets, you will need to add the `hd_account_id` value to your `MM2.json` file. This value will be used in the derivation path for all coins, and will take the place of the `COIN_ID` value in the following path: `m/44'/COIN_ID'/'/CHAIN/ADDRESS_ID`. + + + Using the same seed phrase with / without setting the `hd_account_id` value + will result in different addresses being generated. For example, when using + the seed phrase `february soldier message acid member jump shadow walk novel impose puppy tornado`: - If the `hd_account_id` value is set to `0` in + MM2.json, the first address in the wallet returns the address + `0x26cE5D1cD4CC673a1b0b980371C7c862B9503452` for ETH - If the `hd_account_id` + value is not set, the wallet will return the address + `0x8c40a6E127c7a13e26ce95deA88354C3fb134580` for ETH + + +```json +{ + "gui": "DEVDOCS_CLI", + "netid": 7777, + "rpc_password": "Ent3r_Un1Qu3_Pa$$w0rd", + "passphrase": "ENTER_UNIQUE_SEED_PHRASE_DONT_USE_THIS_CHANGE_IT_OR_FUNDS_NOT_SAFU", + "allow_weak_password": false, + "dbdir": "/path/to/DB/folder", + "hd_account_id": 0 +} +``` + +## Coins file configuration + +You can download and use [this file](https://github.com/KomodoPlatform/coins/blob/master/coins) as a starting point for your own `coins` file. It contains all of the coins that are currently supported by the AtomicDEX API, and is maintained by the Komodo Platform team. +The structure for adding additiona coins can vary, please refer to the [listing guide](/atomicdex/tutorials/listing-a-coin-on-atomicdex/) or [contact the KomodoPlatform team](https://komodoplatform.com/discord) for assistance. + +### Optional environment variables: + +| Variable | Type | Description | +| --------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| MM2\_CONF\_PATH | string | A file path to load the `MM2.json` configuration file. Defaults to `MM2.json` in the same folder as the `mm2` binary. | +| MM\_COINS\_PATH | string | A file path to load the `coins` configuration file. A comprehensive version for public use is maintained in the [Komodo Platform coins github repository](https://github.com/KomodoPlatform/coins/blob/master/coins) | +| MM\_LOG | string | A file path to store the AtomicDEX-API logs. | +| USERPASS | string | For convenience, this variable can store the value of your `rpc_password` to be referenced in any shell scripts | + +### What now? + +Check out the rest of the AtomicDEX API documentation for examples of how to: + +* [Enable coins](/atomicdex/api/legacy/coin_activation/) +* [Place orders](/atomicdex/api/legacy/buy/) +* [View the orderbook](/atomicdex/api/legacy/orderbook/) +* [Check your balance](/atomicdex/api/legacy/my_balance/) +* [Configure bot trading!](/atomicdex/api/v20/start_simple_market_maker_bot/) + +If you have any questions or feedback, join us on the [Komodo Platform Discord Server](https://komodoplatform.com/discord) and tell us about your experience! +export const title = "Installing the AtomicDEX API"; +export const description = + "Learn how to install the AtomicDEX API on MacOS, Windows, and Linux systems."; + +import rustupMinimal from "@/public/images/setup/rustup-minimal.png"; + +# Installing the AtomicDEX API + +## Minimum Requirements for Installation + +* MacOS, Windows (see note below), and Linux (see note below) + +* 64-bit (see note below for 32-bit) + +* Minimum 2GB of free RAM + +* Normal user account with admin/root privileges + + + If you would prefer to avoid building the AtomicDEX API from source, you can + download our pre-built binary [from our Github releases + page.](https://github.com/KomodoPlatform/komodo-defi-framework/releases) + + +### Note about Linux + +For Linux users, much of the following documentation assumes that you are building and running the AtomicDEX API on a Debian 9/10 or Ubuntu 18.04 host. If you have questions about other releases or distributions, [please reach out to us on the #dev-marketmaker channel on Discord.](https://komodoplatform.com/discord) + +### Note about Installing on Windows + +Developing software on Windows typically requires an installation of Git Bash. + +Git Bash is a terminal shell based on Unix. It is similar to the Windows Shell or Windows Command Prompt, but uses Unix-based syntax. + +All instructions in the AtomicDEX API documentation are given with Unix-based syntax, and therefore we recommend installing Git Bash before proceeding. + +You may download and install Git Bash for Windows here: + +[Download Git Bash for Windows](https://git-scm.com/download/win) + +The download should begin automatically. + +Double-click the downloaded `.exe` file and follow the Installation Wizard. + +Once Git Bash is open and running on your machine, you may continue. + +### Note About 32-bit Operating Systems + +We are currently testing 32-bit operating system functionality. As 32-bit machines can often be comparatively older hardware, we cannot guarantee that AtomicDEX API will run successfully by default. + +We invite users of 32-bit operating systems to test the software and [report any errors to our team on the #dev-marketmaker channel on Discord](https://komodoplatform.com/discord). + +### Installing Dependencies + +#### Rust + +Install [Rust](https://www.rust-lang.org/tools/install): + +undefined + +Choose `2)` to customize the installation, select `default host triple` and `default toolchain`, and choose the `minimal` profile. + + + +#### cmake Version 3.12 or Higher + +Download the cmake software here: [download link](https://cmake.org/download/) + +Unpack and follow the instructions here: [instructions link](https://cmake.org/resources/) + +#### Build Tools for Your OS + +##### Linux: + +```bash +sudo apt-get install build-essential +``` + +##### Windows: [Follow these instructions for MSVC](https://learn.microsoft.com/en-us/cpp/build/vscpp-step-0-installation?view=msvc-170\&viewFallbackFrom=vs-2017) + +##### MacOS: [Install XCode via the App Store](https://apps.apple.com/us/app/xcode/id497799835?mt=12) + +#### Install Additional Dependencies + +Install the following additional dependencies using the terminal. + +```bash +sudo apt-get install -y git llvm-3.9-dev libclang-3.9-dev clang-3.9 libssl-dev pkg-config +``` + +If you are using Ubuntu-20.04, run: + +```bash +sudo apt-get install -y git llvm-dev libclang-dev clang libssl-dev pkg-config +``` + +#### Install Additional Rust Components + +Install additional Rust components: + +```bash +rustup install nightly-2022-02-01 +``` + +```bash +rustup default nightly-2022-02-01 +``` + +(Optional) Skip this step if it fails. + +```bash +rustup component add rustfmt-preview +``` + +#### Install jq + +`jq` is an optional, but useful addition to our needed software. `jq` can provide a more readable format of JSON output in the terminal, which helps us more quickly digest the data respone output by the AtomicDEX API. + +##### Linux: + +```bash +sudo apt-get install jq +``` + +##### MacOS: + +Download the appropriate file from [this link.](https://stedolan.github.io/jq/download/) + +In your terminal, make the file executable by changing into the directory where the file downloaded and executing: + +```bash +chmod +x jq +``` + +Execute the file. + +##### Windows: + +Download and execute the appropriate file from [this link.](https://stedolan.github.io/jq/download/) + +### Build AtomicDEX API + +Clone the AtomicDEX API repository: + +```bash +cd ~ +git clone https://github.com/KomodoPlatform/komodo-defi-framework --branch mm2.1 --single-branch && cd atomicDEX-API +``` + +Compile the source code. + +```bash +cargo build --features native -vv +``` + +#### MacOS + +If the above command results in an error, use the following command instead. + +```bash +LIBRARY_PATH=/usr/local/opt/openssl/lib cargo build --features native -vv +``` + +Alternatively, create a permanent link called `libcrypto` to `/usr/local/lib`. + +```bash +ln -s /usr/local/opt/openssl/lib/libcrypto.a /usr/local/lib +``` + +If everything installed successfully, a response that is similar to the following should appear. + +``` +“Finished dev [optimized + debuginfo] target(s) in 3m 33s” +``` + +The AtomicDEX API executable is now built and available here: `~/atomicDEX-API/target/debug/mm2` +export const title = "Additional Information About AtomicDEX"; +export const description = "The AtomicDEX API is built to have a core component that can serve many front-end graphical-user interfaces (GUIs)."; + +# Additional Notes + +## A Back End for Front-End Implementations + +The AtomicDEX API is built to have a core component that can serve many front-end graphical-user interfaces (GUIs). + +Various front-end GUIs exist in our ecosystem, some of them built by the volunteer efforts of our community members. + +This also allows developers and entrepreneurs the freedom to create your own front-end implementation for your own purposes. For example, you can create your own front-end implementation that acts on the same atomic-swap network as other communities. Or, you could make a front-end implementation for your own private network. + +The documentation here only concerns the core component, the AtomicDEX API. This component is typically accessed via an API or a terminal interface. + +Documentation for GUIs based on AtomicDEX API are not yet available. + +## New Features of AtomicDEX API (Desktop) + +Users who worked with the previous version of the AtomicDEX API software, MarketMaker 1.0 (MM1), will note several differences with the new release. + +### New Off-Chain Technology + +MM1 used nanomsg technology for its off-chain network layer (e.g. orderbook propagation, ordermatching, client traffic routing, and other technologies that are not active on the blockchain itself). + +AtomicDEX API replaced nanomsg with Rust TCP implementation and also uses `libtorrent` as a torrent/DHT network system for the off-chain network layer. This p2p software is widely used and highly reliable, granting a greater development experience. + +### Rust Implementation + +MM1 was based on ANSI C. + +For AtomicDEX API we ported the system to Rust, utilizing the cargo ecosystem. Internal benchmarks prove this to be more efficient. Furthermore, the Rust code base supports mobile devices, including Android & iOS. This is a key benefit, as we expect mobile devices to be a key component of AtomicDEX API adoption. + +### Multi-Threading and Other Multi-Tasking Improvements + +MM1 had limited multi-tasking capabilities. Also, the bob-side technology was not reliable when using MM1 in lite mode (SPV), wherein blockchain syncing is not required for end-users. + +AtomicDEX API has multi-threading. This allows it to reliably manage multiple concurrent requests. + +## AtomicDEX API for Mobile (New!) + +Komodo is pleased to announce that AtomicDEX API is preparing for release on compatible Android and iOS devices. The software is currently undergoing quality tests and external reviews before publication. + +Notable aspects of the Mobile AtomicDEX software include: + +* Optimization for low-data usage and CPU consumption +* Low storage requirements (less than 50 MB) +* Integrates seamlessly with the desktop AtomicDEX API software + +Through the Komodo API, mobile-device developers can integrate AtomicDEX API for Mobile into other software packages. + +Please reach out to our team on [Discord](https://komodoplatform.com/discord) to be involved with the software release. + +## Add Your Coin to the AtomicDEX API + +All coins that are built on the BTC and ETH core software can be added to the AtomicDEX API quickly and simply. Coins built on other software frameworks may be able to be added as well, depending on specific details. Specifically, a coin must support functionality that is similar to the "CheckLockTimeVerify" of the Bitcoin protocol, wherein a utxo can be locked for a specific amount of time and then released in a manner determined by the developer. For more information, please reach out to our team on Discord. + +To add your BTC or ETH-based coin to AtomicDEX API, first follow the linked checklist below: + +[Link to checklist for adding coin to AtomicDEX API](https://github.com/KomodoPlatform/coins#about-this-repository) + +Upon completing the checklist, please submit your proposed coin configuration files to the same repository with a pull request. + +## Features Carried From MM1 + +##### SPV-based Trading + +AtomicDEX holds support for [SPV Electrum-based](https://en.bitcoin.it/wiki/Electrum) coins. This feature allows a user to trade with their coins without downloading their coins' blockchain data. This feature is available for all Bitcoin-protocol based coins running native-coin daemons, Ethereum, and Ethereum-based ERC20 tokens. The AtomicDEX API is built to handle the nature of the SPV requirements, providing additional functionality to developers. + +##### Liquidity Multiplication + +AtomicDEX also enables a feature known as Liquidity Multiplication, a protocol that allows the same funds to be used in multiple requests on AtomicDEX "orderbooks." The first request to fill completes the trade, and all outstanding requests are immediately cancelled. This feature is available to the user when providing liquidity to the exchange (called a "Bob-side" trade). + +Liquidity Multiplication therefore allows an initial amount of funding to create an exponentially higher amount of liquidity on the exchange. This also provides a special advantage for traders that like to wait for below-market dumps. While this feature is something that any other exchange could implement, few do. + +On AtomicDEX, all orderbook entries are 100% backed by real funds, as opposed to a centralized exchange’s vouchers, which may be one reason why AtomicDEX can more readily offer this feature. +export const title = "AtomicDEX Metrics"; +export const description = + "Monitor and analyze the performance and activity of your AtomicDEX API sessions with various metrics."; + +import prometheus1 from "@/public/images/atomic-dex-tutorials/prometheus1.png"; +import graphana1 from "@/public/images/atomic-dex-tutorials/graphana1.png"; +import graphana2 from "@/public/images/atomic-dex-tutorials/graphana2.png"; +import graphana3 from "@/public/images/atomic-dex-tutorials/graphana3.png"; +import graphana4 from "@/public/images/atomic-dex-tutorials/graphana4.png"; +import graphana5 from "@/public/images/atomic-dex-tutorials/graphana5.png"; +import graphana6 from "@/public/images/atomic-dex-tutorials/graphana6.png"; +import graphana7 from "@/public/images/atomic-dex-tutorials/graphana7.png"; +import graphana8 from "@/public/images/atomic-dex-tutorials/graphana8.png"; +import graphana9 from "@/public/images/atomic-dex-tutorials/graphana9.png"; + +# AtomicDEX Metrics + +The AtomicDEX-API collects data metrics that allow interested users to view a history of events of an AtomicDEX API session, such as incoming and outgoing traffic. + +The metrics can be: + +* Recorded to a log file at a specified frequency +* Requested using AtomicDEX API in JSON format +* Visualized using Prometheus and Grafana + +## Setting Up Log Recording + +By default, collected metrics are recorded to a log file every five minutes, but this value can be defined with the `metrics` parameter in a user's [MM2.json file](/atomicdex/setup/configure-mm2-json/). + +```bash +"metrics\": 0, +``` + +To disable the collection of metrics, set the `metrics` parameter to 0. + +### Requesting Metrics Manually + +Execute the following command to request a metrics snapshot. + + + ```json + { + "method": "metrics", + "userpass": "testpsw" + } + ``` + + + + ```json + { + "metrics": [ + { + "type": "counter", + "key": "tx.history.response.count", + "labels": { + "coin": "MARTY", + "method": "tx_detail_by_hash" + }, + "value": 25 + }, + { + "type": "counter", + "key": "rpc_client.request.count", + "labels": { + "client": "electrum", + "coin": "DOC" + }, + "value": 1224 + }, + { + "type": "counter", + "key": "tx.history.response.count", + "labels": { + "method": "tx_detail_by_hash", + "coin": "DOC" + }, + "value": 27 + }, + { + "type": "counter", + "key": "tx.history.request.count", + "labels": { + "coin": "DOC", + "method": "tx_detail_by_hash" + }, + "value": 27 + }, + { + "type": "counter", + "key": "rpc_client.traffic.in", + "labels": { + "client": "electrum", + "coin": "DOC" + }, + "value": 823841 + }, + { + "type": "counter", + "key": "rpc_client.traffic.out", + "labels": { + "coin": "MARTY", + "client": "electrum" + }, + "value": 139396 + }, + { + "type": "counter", + "key": "tx.history.response.total_length", + "labels": { + "client": "electrum", + "coin": "MARTY", + "method": "blockchain.scripthash.get_history" + }, + "value": 1041 + }, + { + "type": "counter", + "key": "tx.history.response.count", + "labels": { + "client": "electrum", + "coin": "MARTY", + "method": "blockchain.scripthash.get_history" + }, + "value": 11 + }, + { + "type": "counter", + "key": "tx.history.response.count", + "labels": { + "method": "blockchain.scripthash.get_history", + "client": "electrum", + "coin": "DOC" + }, + "value": 6 + }, + { + "type": "counter", + "key": "tx.history.request.count", + "labels": { + "coin": "MARTY", + "method": "tx_detail_by_hash" + }, + "value": 25 + }, + { + "type": "counter", + "key": "rpc_client.response.count", + "labels": { + "coin": "DOC", + "client": "electrum" + }, + "value": 1351 + }, + { + "type": "counter", + "key": "rpc_client.request.count", + "labels": { + "client": "electrum", + "coin": "MARTY" + }, + "value": 1237 + }, + { + "type": "counter", + "key": "rpc_client.traffic.in", + "labels": { + "client": "electrum", + "coin": "MARTY" + }, + "value": 772964 + }, + { + "type": "counter", + "key": "tx.history.response.total_length", + "labels": { + "coin": "DOC", + "client": "electrum", + "method": "blockchain.scripthash.get_history" + }, + "value": 767 + }, + { + "type": "counter", + "key": "tx.history.request.count", + "labels": { + "coin": "DOC", + "client": "electrum", + "method": "blockchain.scripthash.get_history" + }, + "value": 6 + }, + { + "type": "counter", + "key": "rpc_client.traffic.out", + "labels": { + "coin": "DOC", + "client": "electrum" + }, + "value": 136368 + }, + { + "type": "counter", + "key": "tx.history.request.count", + "labels": { + "coin": "MARTY", + "client": "electrum", + "method": "blockchain.scripthash.get_history" + }, + "value": 11 + }, + { + "type": "counter", + "key": "rpc_client.response.count", + "labels": { + "client": "electrum", + "coin": "MARTY" + }, + "value": 1361 + }, + { + "type": "gauge", + "key": "p2p.connected_peers.count", + "labels": {}, + "value": 8.0 + }, + { + "type": "gauge", + "key": "p2p.received_messages.count", + "labels": {}, + "value": 24.0 + }, + { + "type": "gauge", + "key": "p2p.connected_relays.len", + "labels": {}, + "value": 8.0 + }, + { + "type": "gauge", + "key": "p2p.relay_mesh.len", + "labels": {}, + "value": 2.0 + }, + { + "type": "gauge", + "key": "orderbook.memory_db", + "labels": {}, + "value": 297800390224.0 + }, + { + "type": "gauge", + "key": "orderbook.len", + "labels": {}, + "value": 15.0 + }, + { + "type": "gauge", + "key": "p2p.received_messages.period_in_secs", + "labels": {}, + "value": 60.0 + }, + { + "type": "histogram", + "key": "peer.outgoing_request.timing", + "labels": { + "peer": "12D3KooWJDoV9vJdy6PnzwVETZ3fWGMhV41VhSbocR1h2geFqq9Y" + }, + "count": 2.0, + "max": 0.801318629, + "min": 0.699428848 + } + ] + } + ``` + + +## Prometheus Integration + +AtomicDEX API 2.0 supports integration with [Prometheus](https://github.com/prometheus/prometheus#install). This software allows users to setup automated scraping of metrics at regular intervals and enables sophisticated queries on the stored [timeseries](https://en.wikipedia.org/wiki/Time_series) data. It also allows users to configure an elegant dashboard using built-in [graphs,](https://prometheus.io/docs/prometheus/latest/getting_started/#using-the-expression-browser) or to export data for graphical processing using [Grafana](https://prometheus.io/docs/visualization/grafana/). + +Prometheus scrapes metrics using an HTTP pull model. To provide Prometheus with the ability to scrape the metrics at [localhost:9001](http://localhost:9001), you need to add the `prometheusport` parameter to your [MM2.json file](/atomicdex/setup/configure-mm2-json/): + +``` +"prometheusport": 9001 +``` + +You can also define your username and password for Prometheus to enforce basic authorization security with the `prometheus_credentials` in your [MM2.json file](/atomicdex/setup/configure-mm2-json/). Note that this additional argument is NOT necessary. + +``` +"prometheus_credentials": "PROM_USERNAME:PROM_PASSWORD" +``` + +Replace `PROM_USERNAME` and `PROM_PASSWORD` with your actual Prometheus username and password. Make sure your username and password are separated by `:`. + +### Configuring Prometheus to monitor the AtomicDEX API + +The following basic Prometheus configuration file, named `prometheus.yml`, can simplify the process of connecting Prometheus to the AtomicDEX API. + +```yaml +global: + scrape_interval: 10s + +scrape_configs: + - job_name: "AtomicDEX_API" + + basic_auth: + username: "PROM_USERNAME" + password: "PROM_PASSWORD" + + static_configs: + - targets: ["0.0.0.0:9001"] + labels: + group: "atomicdex" +``` + +Replace `PROM_USERNAME` and `PROM_PASSWORD` with your actual Prometheus username and password. + +To learn more about creating a Prometheus configuration file, [read this documentation.](https://prometheus.io/docs/prometheus/latest/configuration/configuration/) + +### Starting Prometheus and Grafana + +A simple way to initiate Prometheus and Grafana is to have the standard Prometheus and Grafana [docker containers](https://www.infoworld.com/article/3310941/why-you-should-use-docker-and-containers.html) run together using `docker-compose`. + +Name the following compose file as `docker-compose.yml`. + +```yaml +version: "3.1" +volumes: + prometheus: + grafana: +services: + grafana: + image: grafana/grafana:latest + depends_on: + - prometheus + ports: + - "3000:3000" + network_mode: "host" + volumes: + - grafana:/var/lib/grafana + restart: always + prometheus: + image: prom/prometheus:latest + ports: + - "9090:9090" + network_mode: "host" + volumes: + - ./prometheus.yml:/etc/prometheus/prometheus.yml + - prometheus:/prometheus + restart: always +``` + +Use the following command to start both containers. + +```bash +docker-compose up +``` + +### Using the graphing interface + +#### Prometheus + +Once the docker containers are up and running, navigate to [http://localhost:9090/graph](http://localhost:9090/graph) and use the `Graph` tab to use Prometheus's built-in graph expressions. + +To visualize one of the available metrics, open the metric explorer (next to the execute button), select a metric and then click execute. + + + +More graphs can be added to the same page using the "Add Panel" button available. + +#### Grafana + +Grafana can access data scraped by Prometheus and it can analyze, transform and display it in a variety of ways. For more information see the [Prometheus guide.](https://prometheus.io/docs/visualization/grafana/#using) + +To use Grafana, navigate to [http://localhost:3000](http://localhost:3000) and log in using the default credentials: `admin` / `admin`. When offered to set a new password, do so and secure it in an encrypted password manager like [KeePassXC](https://keepassxc.org/). + +Next we need to add Prometheus as a data source. Click on the cog icon in the sidebar to open the configuration panel. + + + +Click the "Add data source" button, and select **Prometheus** from the menu. Set the URL to `http://localhost:9090`, leave other fields as default, and click the "Test and save" button at the bottom of the form. + + + +Next, navigate to [http://localhost:3000/dashboards](http://localhost:3000/dashboards) and click on the `New Dashboard` button + + + +Next, click on `Add a new panel` + + + +In the next screen, select `Prometheus` as the provider from the drop down menu in the `Query` tab. + + + +Click the `Metrics` menu and select one of the available options. These should be the same ones available directly in the Graphs tab of Prometheus: [http://localhost:9090/graph](http://localhost:9090/graph). + + + +Optionally, you can tweak the query options (shown in the image below). + + + +Once complete, click on `Run queries` to see the data displayed on the graph. If you like, you can also customise the graph, by adding a title, changing the colors, or using a different graph type. Click `Apply` in the top right corner once complete. + + + +Add any additional panels as desired, and save them to your dashboard. + + +export const title = "AtomicDEX API Walkthrough"; +export const description = + "This guide describes a step-by-step process to get started with AtomicDEX-API."; + +# AtomicDEX API Walkthrough + +Now that you have the AtomicDEX API [installed](/atomicdex/setup/) you are ready for your first atomic swap! +Since we're testing AtomicDEX API as a back end, we're going to be doing a few things that a normal user using a GUI will not be expected to do. +Let's open up the terminal and get started. + +## Setting Up the Coin List + +In the Komodo ecosystem we use two blockchain coins, DOC and MARTY, for testing purposes. These coins are freely distributed and have no blockchain scarcity, so don't treat these coins as having any real value. +If you lose them or destroy them, there's no need to stress. You can always grab more from our faucet in the [KomodoPlatform Discord server](https://komodoplatform.com/discord). +Let's set up a file in the `~/atomicDEX-API/target/debug` directory to import the settings for these test coins. Make a file called `coins` and place the following text into it: + +```json +[ + { + "coin": "DOC", + "asset": "DOC", + "fname": "DOC", + "rpcport": 62415, + "txversion": 4, + "overwintered": 1, + "mm2": 1, + "sign_message_prefix": "Komodo Signed Message:\n", + "is_testnet": true, + "required_confirmations": 1, + "requires_notarization": false, + "avg_blocktime": 60, + "protocol": { + "type": "UTXO" + }, + "derivation_path": "m/44'/141'", + "trezor_coin": "Komodo" + }, + { + "coin": "MARTY", + "asset": "MARTY", + "fname": "MARTY", + "rpcport": 52592, + "txversion": 4, + "overwintered": 1, + "mm2": 1, + "sign_message_prefix": "Komodo Signed Message:\n", + "is_testnet": true, + "required_confirmations": 1, + "requires_notarization": false, + "avg_blocktime": 60, + "protocol": { + "type": "UTXO" + }, + "derivation_path": "m/44'/141'", + "trezor_coin": "Komodo" + } +] +``` + +Save this file. AtomicDEX API will search for it automatically on launch. + + + The `coins` file in [this linked repository](https://github.com/KomodoPlatform/coins) contains the standard coin configuration file used in GUI software. + You can download and use [this file](https://github.com/KomodoPlatform/coins/blob/master/coins) if you want to activate other coins. + + Servers used for light mode activation are listed within [this file](https://github.com/KomodoPlatform/coins/blob/master/utils/coins_config.json), + and you can find many coin activation request body json examples at [https://stats.kmd.io/atomicdex/activation\_commands/](https://stats.kmd.io/atomicdex/activation_commands/). + + +## Launching the AtomicDEX-API + +We also need to create an MM2.json file in the same directory as the `coins` file. We'll use a minimal configuration for this example (check out the [configure mm2 guide](/atomicdex/setup/configure-mm2-json/) for more information about additional configuration parameters). + +### MM2.json Minimal Configuration + +| Parameter | Type | Description | +| ------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| gui | string | Information to identify which app, tool or product is using the API, e.g. `AtomicDEX iOS 1.0.1`. Helps developers identify if an issue is related to specific builds or operating systems etc. | +| netid | integer | Nework ID number, telling the AtomicDEX API which network to join. 7777 is the current main network, though alternative netids can be used for testing or "private" trades as long as seed nodes exist to support it. | +| passphrase | string | Your passphrase; this is the source of each of your coins private keys. KEEP IT SAFE! | +| rpc\_password | string | For RPC requests that need authentication, this will need to match the `userpass` value in the request body. | + + + Unless you include the `allow_weak_password` paramater and set it to `true`, your `rpc_password`: + + * Can't have 3 of the same characters in a row, + * Must be between 8-32 characters in length + * Must contain at least one each of the following: numeric, uppercase, lowercase, special character (e.g. !#$\*). + * Must not contain the word "password", or the chars `<`, `>`, or `&`. + + +The MM2.json configuration commands can also be supplied at runtime, as below: + +```bash +stdbuf -oL ./mm2 "{\"gui\":\"Docs_Walkthru\",\"netid\":7777, \"passphrase\":\"YOUR_PASSPHRASE_HERE\", \"rpc_password\":\"YOUR_PASSWORD_HERE\"}" & +``` + +Replace `YOUR_PASSPHRASE_HERE` and `YOUR_PASSWORD_HERE` with your actual passphrase and password, and then execute the command in the terminal. + +You should see output similar to the following: + +```bash +06 10:26:37, mm2:279] AtomicDEX API 1.0.3-beta_6444336 DT 2023-05-01T22:25:14+03:00 +06 10:26:37, mm2_main::mm2::lp_native_dex:424] INFO Version: 1.0.3-beta_6444336 DT 2023-05-01T22:25:14+03:00 +06 10:26:37, crypto::crypto_ctx:333] INFO Public key hash: d346c085a470963c399fe67e3c3b3e93e29ede5d +06 10:26:37, crypto::crypto_ctx:334] INFO Shared Database ID: 7d4df7c448a7b66c62f6ec3bb8798ca6f0d17862 +06 10:26:38, mm2_libp2p::atomicdex_behaviour:653] INFO Local peer id: PeerId("12D3KooWBGkWw6LMvXLwQsb4w5vffmnM2cunFhTjqQd9oeNuc18a") +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWEsuiKcQaBaKEzuMtT6uFjs89P1E8MK3wGRZbeuCbCw6P to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWKxavLCJVrQ5Gk1kd9m6cohctGQBmiKPS9XQFoXEoyGmS to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWAToxtunEBWCoAHjefSv74fmnM2cunFhTjjw6PNsmxran to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWSmEi8ypaVzFA1AGde2RjxNW5Pvxw3qa2fVe48PjNs63R to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWHKkHiNhZtKceQehHhPqwU5W1jXpoVBgS1qst899GjvTm to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWMrjLmrv8hNgAoVf1RfumfjyPStzd4nv5XL47zN4ZKisb to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWL6yrrNACb7t7RPyTEPxKmq8jtrcbkcNd6H5G2hK7bXaL to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWHBeCnJdzNk51G4mLnao9cDsjuqiMTEo5wMFXrd25bd1F to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooW9soGyPfX6kcyh3uVXNHq1y2dPmQNt2veKgdLXkBiCVKq to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWPR2RoPi19vQtLugjCdvVmCcGLP2iXAzbDfP3tp81ZL4d to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWKu8pMTgteWacwFjN7zRWWHb3bctyTvHU3xx5x4x6qDYY to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWJWBnkVsVNjiqUEPjLyHpiSmQVAJ5t6qt1Txv5ctJi9Xd to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWGrUpCAbkxhPRioNs64sbUmPmpEcou6hYfrqQvxfWDEuf to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWEaZpH61H4yuQkaNG5AsyGdpBhKRppaLdAY52a774ab5u to explicit relay list +06 10:26:38, atomicdex_gossipsub::behaviour:147] INFO Adding peer 12D3KooWAd5gPXwX7eDvKWwkr2FZGfoJceKDCA53SHmTFFVkrN7Q to explicit relay list +06 10:26:38, mm2_libp2p::atomicdex_behaviour:762] INFO Dialed /ip4/79.228.173.231/tcp/38890 +06 10:26:38, mm2_libp2p::atomicdex_behaviour:762] INFO Dialed /ip4/84.82.76.214/tcp/38890 +06 10:26:38, mm2_libp2p::atomicdex_behaviour:762] INFO Dialed /ip4/69.178.128.39/tcp/38890 +06 10:26:38, mm2_main::mm2::database:26] INFO Checking the current SQLite migration +06 10:26:38, mm2_main::mm2::database:30] INFO Current migration is 9, skipping the init, trying to migrate +06 10:26:38, mm2_main::mm2::database:119] INFO migrate_sqlite_database, current migration 9 +06 10:26:38, mm2_main::mm2::database:135] INFO migrate_sqlite_database complete, migrated to 9 +😉 2023-05-06 18:26:38 +0800 [] rpc:362] >>>>>>>>>> DEX stats 127.0.0.1:7783 DEX stats API enabled at unixtime.1683368798 <<<<<<<<< + +``` + +If you see something similar, the AtomicDEX API is up and running! + + + When using the AtomicDEX API on a VPS without accompanying tools such as `tmux` or `screen`, it is recommended to use [`nohup`](https://www.digitalocean.com/community/tutorials/nohup-command-in-linux) when launching the AtomicDEX-API. This will ensure that the AtomicDEX-API instance is not shutdown when the user logs out. + + ```bash + stdbuf -oL nohup ./mm2 "{\"gui\":\"Docs_Walkthru\",\"netid\":7777, \"passphrase\":\"YOUR_PASSPHRASE_HERE\", \"rpc_password\":\"YOUR_PASSWORD_HERE\"}" & + ``` + + +### Setting `userpass` Environment Variable + +Create a new file in the `~/atomicDEX-API/target/debug` folder called `userpass`, then enter the following text using the same `rpc_password` as is in your MM2.json file or runtime configuration string: + +```bash +export userpass="testpsw" +``` + +Save it, and then in the terminal execute: + +```bash +source userpass +``` + +Test it by executing: + +```bash +echo $userpass +``` + +You should now see your userpass printed to the console. + + + The `userpass` environment variable will remain in memory until the session is + closed. When you open up a new session later, you'll need to create the + `userpass` environment variable again. Additional environment variables for + the AtomicDEX API can be found in the [configure mm2 + guide](/atomicdex/setup/configure-mm2-json/). + + +### Connect to the Selected Coin Networks + +While we did set up the `coins` file for wach coin's configuration properties earlier, the AtomicDEX-API doesn't to connect to their blockchain networks until we send a [coin activation request](/atomicdex/api/legacy/coin_activation/). + +To activate DOC and MARTY, send the following requests to the AtomicDEX API: + + + ```json + { + "userpass": "testpsw", + "method": "electrum", + "coin": "MARTY", + "servers": [ + { + "url": "electrum1.cipig.net:10021" + }, + { + "url": "electrum2.cipig.net:10021" + }, + { + "url": "electrum3.cipig.net:10021" + } + ] + } + ``` + + + + ```json + { + "address": "RLgAgBFHFbG2ma9MDTHyKL5vovftMepBkE", + "coin": "MARTY", + "balance": 16.95595733, + "result": "success" + } + ``` + + +You are now connected to the MARTY test-blockchain network! + +Let's connect to DOC (note it uses a different Electrum port). + + + ```json + { + "userpass": "testpsw", + "method": "electrum", + "coin": "DOC", + "servers": [ + { + "url": "electrum1.cipig.net:10020" + }, + { + "url": "electrum2.cipig.net:10020" + }, + { + "url": "electrum3.cipig.net:10020" + } + ] + } + ``` + + + + ```json + {"address": "RLgAgBFHFbG2ma9MDTHyKL5vovftMepBkE","coin": "DOC","balance": 11.27710708,"result": "success"} + ``` + + +You are now connected to the DOC test-blockchain network! + +### Get MARTY from the Faucet + +Note that in the examples the address, `RLgAgBFHFbG2ma9MDTHyKL5vovftMepBkE`, is present in both returned responses. You will see a different address in your returned responses - your address is unique to to your `passphrase`. + +To get free DOC and MARTY coins, use the Flux-Bot faucet in the [KomodoPlatform Discord](https://komodoplatform.com/discord) with the slash command below: + +```bash +/faucet-drip MARTY RLgAgBFHFbG2ma9MDTHyKL5vovftMepBkE +``` + +In a minute or so a few MARTY coins will arrive in your address. You can [check your balance](/atomicdex/api/legacy/my_balance/) with the request below: + + + ```json + { + "userpass": "testpsw", + "method": "my_balance", + "coin": "MARTY" + } + ``` + + + + ```json + {"address": "RQNUR7qLgPUgZxYbvU9x5Kw93f6LU898CQ","balance": 77.7,"coin": "MARTY"} + ``` + + +Now you are ready to trade! + +### The AtomicDEX Orderbook + +AtomicDEX uses a decentralized, peer-to-peer orderbook empowering users to trade without having to rely on a centralized service. + +This avoids some serious problems which can affect centralized exchanges, such as: + +* Security risks: There's always a chance [hackers](https://www.wired.com/2014/03/bitcoin-exchange/), [founders](https://www.youtube.com/watch?v=20BEJouWBgY) or other [bad actors](https://www.youtube.com/watch?v=P14nZqx2ZdY) could steal a users assets or [personal information](https://www.bitdegree.org/crypto/news/crypto-exchange-coinsquare-suffers-from-user-data-breach) because everything is stored on the exchange's servers. +* Lack of transparency: It's difficult to know if the exchange is playing fair, which can lead to [market manipulation](https://www.youtube.com/watch?v=TRXdxiot5JM) or insider trading. +* Limited user control: Users don't have complete control over their funds, as they are held by the exchange. Remember: [**Not your keys, not your coins!**](https://www.youtube.com/watch?v=dnC5mFaIW3Q) +* Limited asset offerings: Centralized exchanges may not have as diverse a range of cryptocurrencies available for trading. +* High exit fees: Users might have to pay a lot of money just to withdraw their funds. If some cases, [withdrawals are suspended](https://www.youtube.com/shorts/LFOCppNHnds) altogether! + +To see the orders listed on the AtomicDEX orderbook, use the [`orderbook`](/atomicdex/api/legacy/orderbook/) method: + + + ```json + { + "userpass": "testpsw", + "method": "orderbook", + "base": "DOC", + "rel": "MARTY" + } + ``` + + +The response below shows a list of users willing to send DOC in exchange for MARTY. + + + ```json + {"bids": [],"numbids": 0,"biddepth": 0,"asks": [{"coin": "DOC","address": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh","price": "0.89999998","price_rat": [[1, [813957463, 471859]],[1, [0, 524288]]],"price_fraction": {"numer": "2026619787280727","denom": "2251799813685248"},"maxvolume": "10855.85028615","max_volume_rat": [[1, [3593286463, 1389548]],[1, [0, 128]]],"max_volume_fraction": {"numer": "5968066809508671","denom": "549755813888"},"pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12","age": 5,"uuid": "5bff6021-b086-477e-b874-f45d898933fe","is_mine": false}],"numasks": 1,"askdepth": 0,"base": "DOC","rel": "MARTY","timestamp": 1549319941,"netid": 7777} + ``` + + + + Notice that the output is not easily readable in the terminal. This is where + we start using `jq`. You may remember that we installed software called `jq` + during the setup process. `jq` is optional, but it is recommended as it makes + reading the output in the terminal easier. To use `jq`, simply add the + following to the end of any command: `| jq`. + + +Try again this time adding ` | jq` to the end of the `bash` example below: + + + ```json + { + "userpass": "testpsw", + "method": "orderbook", + "base": "DOC", + "rel": "MARTY" + } + ``` + + + + ``` + { + "bids": [], + "numbids": 0, + "biddepth": 0, + "asks": [{ + "coin": "DOC", + "address": "RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh", + "price": "2", + "maxvolume": "10855.85028615", + "price_rat": [ + [1, [2]], + [1, [1]] + ], + "price_fraction": { + "numer": "2", + "denom": "1" + }, + "max_volume_rat": [ + [1, [3593286463, 1389548]], + [1, [0, 128]] + ], + "max_volume_fraction": { + "numer": "5968066809508671", + "denom": "549755813888" + }, + "pubkey": "5a2f1c468b7083c4f7649bf68a50612ffe7c38b1d62e1ece3829ca88e7e7fd12", + "age": 9, + "zcredits": 0, + "uuid": "5bff6021-b086-477e-b874-f45d898933fe", + "is_mine": false + }], + "numasks": 1, + "askdepth": 0, + "base": "DOC", + "rel": "MARTY", + "timestamp": 1549320152, + "netid": 7777 + } + ``` + + +That's much easier to read. We can easily see someone with the address `RJTYiYeJ8eVvJ53n2YbrVmxWNNMVZjDGLh` is willing to swap DOC for MARTY. + +``` +"base": "DOC", +"rel": "MARTY", +``` + +They are asking `2` MARTY for every `1` DOC and have a total of `10855.85028615` available to trade. + +``` +"price": 2, +"maxvolume": 10855.85028615, +``` + +### Initiate a Swap + +Let's create a DOC/MARTY [`buy`](/atomicdex/api/legacy/buy/) order + + + ```json + { + "userpass": "testpsw", + "method": "buy", + "base": "DOC", + "rel": "MARTY", + "volume": "1", + "price": "2" + } + ``` + + + + ```json + { + "result": { + "action": "Buy", + "base": "DOC", + "base_amount": "1", + "dest_pub_key": "0000000000000000000000000000000000000000000000000000000000000000", + "method": "request", + "rel": "MARTY", + "rel_amount": "2", + "sender_pubkey": "c213230771ebff769c58ade63e8debac1b75062ead66796c8d793594005f3920", + "uuid": "288743e2-92a5-471e-92d5-bb828a2303c3" + } + } + ``` + + +If you see order data in the response, the order was successfully submitted to the network. + +Your swap is not yet started, however. + +From here, everything is automated. + +If your order is matched you will see something similar in terminal output as the steps of the swap are completed: + +```bash +· 2023-05-06 22:05:31 +0800 [] lp_ordermatch:3094] Entering the taker_swap_loop DOC/MARTY with uuid: a8122ae2-2f20-4c19-b2f7-c4fa53d9e52a +06 14:05:31, atomicdex_gossipsub::behaviour:189] INFO Subscribed to topic: swap/a8122ae2-2f20-4c19-b2f7-c4fa53d9e52a +· 2023-05-06 22:05:33 +0800 [] taker_swap:756] Taker swap a8122ae2-2f20-4c19-b2f7-c4fa53d9e52a has successfully started ++--- 06 14:05:33 ------- +| (0:00) [swap uuid=a8122ae2-2f20-4c19-b2f7-c4fa53d9e52a] Started... ++--- 06 14:05:49 ------- +| (0:16) [swap uuid=a8122ae2-2f20-4c19-b2f7-c4fa53d9e52a] Negotiated... +06 14:05:50, mm2_main::mm2::lp_swap::taker_swap:1245] INFO Taker fee tx hash 11da01de79647552cc541ce2e1c32680e664530c70e940247d2d275405438cab +06 14:05:51, mm2_main::mm2::lp_swap::taker_swap:1325] INFO Got maker payment c55fcdd5be98761cb181296a3dd76ac9b1b80b269a5236887c9f8d0fa46a8ffc +06 14:05:51, mm2_main::mm2::lp_swap::taker_swap:1338] INFO Before wait confirm +06 14:05:51, coins::utxo::rpc_clients:175] INFO Waiting for tx c55fcdd5be98761cb181296a3dd76ac9b1b80b269a5236887c9f8d0fa46a8ffc confirmations, now 0, required 1, requires_notarization false ++--- 06 14:07:10 ------- +| (1:37) [swap uuid=a8122ae2-2f20-4c19-b2f7-c4fa53d9e52a] Maker payment wait confirm started... +06 14:07:23, coins::utxo::rpc_clients:175] INFO Waiting for tx c55fcdd5be98761cb181296a3dd76ac9b1b80b269a5236887c9f8d0fa46a8ffc confirmations, now 0, required 1, requires_notarization false ++--- 06 14:07:34 ------- +| (2:01) [swap uuid=a8122ae2-2f20-4c19-b2f7-c4fa53d9e52a] Maker payment wait confirm started... +06 14:07:38, mm2_main::mm2::lp_swap::taker_swap:1356] INFO After wait confirm +06 14:07:40, mm2_main::mm2::lp_swap::taker_swap:1508] INFO Taker payment tx hash 431c28bcf749b90f035b6ec613fe07e3faac3191e2a7650c78dd6309e7724e7b ++--- 06 14:07:43 ------- +| (2:09) [swap uuid=a8122ae2-2f20-4c19-b2f7-c4fa53d9e52a] Taker payment sent... +06 14:07:52, mm2_main::mm2::lp_swap::taker_swap:1662] INFO Taker payment spend tx 1a8023d27231a00929b39f78ec919fe6ddd8195e76f846e26cdbc1bc18dd4b50 ++--- 06 14:07:52 ------- +| (2:19) [swap uuid=a8122ae2-2f20-4c19-b2f7-c4fa53d9e52a] Taker payment spent... +06 14:07:53, mm2_main::mm2::lp_swap::taker_swap:1734] INFO Maker payment spend tx a8f735e53996631049d7e0d9b79c6a5c776a94b684205c8539d8690dffe7fa86 +· 2023-05-06 22:07:58 +0800 [swap uuid=a8122ae2-2f20-4c19-b2f7-c4fa53d9e52a] Finished +``` + +When you see that last line, you know that your swap went through! Let's check by checking our DOC [balance](/atomicdex/api/legacy/my_balance/) again. + + + ```json + { + "userpass": "testpsw", + "method": "my_balance", + "coin": "DOC" + } + ``` + + + + ``` + { + "address": "RQNUR7qLgPUgZxYbvU9x5Kw93f6LU898CQ", + "balance": 0.99999, + "coin": "DOC" + } + ``` + + +Congratulations! You have successfully completed your first atomic swap! + +Once you are finished using the AtomicDEX-API, you can exit using the [`stop`](/atomicdex/api/legacy/stop/) method: + + + ```json + { + "userpass": "testpsw", + "method": "stop" + } + ``` + + +Don't forget to reach out to us [on Discord](https://komodoplatform.com/discord) or [Twitter](https://twitter.com/komodoplatform) tell us about your experience and ask any questions you may have! +export const title = "Coins File Update"; +export const description = "This guide describes how to update a coins file in a older format to work with the latest AtomicDEX-API."; + +# How to update the coins file to work with the latest atomicDEX-API + +## Instructions + +* Compile the latest `mm2` binary following [these instructions](/atomicdex/setup/) +* Place the `coins` file in the old format in the same directory as the compiled `mm2` binary +* Open a terminal and navigate to the directory with both the files +* Run the following command `./mm2 update_config coins coins_new` + + + `mm2` can accept any valid paths as the arguments for the source and destination files + + +* Output similar to the following will be shown. The "Success" message indicates that the conversion was successful + +```bash +03 09:13:56, mm2:169] AtomicDEX MarketMaker f48b4ad DT 2020-07-28T17:25:18+07:00 +Success +``` + +* You will find a new file named `coins_new` in the same directory with the new format expected by AtomicDEX +* Rename the file named `coins` to `coins_old` and then `coins_new` to `coins` +* `mm2` will use the `coins` file in the new format the next time it is launched + +## Examples + +### UTXO coin + +#### Old Format + +```json +{ + "coin": "KMD", + "name": "komodo", + "fname": "Komodo", + "rpcport": 7771, + "pubtype": 60, + "p2shtype": 85, + "wiftype": 188, + "txversion": 4, + "overwintered": 1, + "txfee": 1000, + "mm2": 1, + "required_confirmations": 2, + "requires_notarization": true +} +``` + +#### New Format + +```json +{ + "coin": "KMD", + "name": "komodo", + "fname": "Komodo", + "rpcport": 7771, + "pubtype": 60, + "p2shtype": 85, + "wiftype": 188, + "txversion": 4, + "overwintered": 1, + "txfee": 1000, + "mm2": 1, + "required_confirmations": 2, + "requires_notarization": true, + "protocol": { + "type": "UTXO" + } +} +``` + +### ERC20 Token + +#### Old Format + +```json +{ + "coin": "MKR", + "name": "maker", + "fname": "Maker", + "etomic": "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2", + "rpcport": 80, + "mm2": 1, + "required_confirmations": 3 +} +``` + +#### New Format + +```json +{ + "coin": "MKR", + "name": "maker", + "fname": "Maker", + "required_confirmations": 3, + "rpcport": 80, + "mm2": 1, + "protocol": { + "type": "ERC20", + "protocol_data": { + "platform": "ETH", + "contract_address": "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2" + } + } +} +``` +export const title = "Liquidity Provider"; +export const description = "This guide describes how to become a liquidity provider using the AtomicDEX-API."; + +# How To Become a Liquidity Provider on AtomicDEX + +The following tutorial introduces the reader to a simple method to become a liquidity provider on the main network of the AtomicDEX software. + +## Requirements + +#### Virtual Private Server (Recommended) + +We recommend that the user [have a Virtual Private Server (VPS)](https://developers.komodoplatform.com/smart-chains/tutorials/basic-environment-setup-for-linux-vps) with *at least* the following specifications. + +* 2 vCPU +* 4GB RAM +* OS: Ubuntu 18.04 (Preferably a clean installation) + +#### Home-Based Connection + +If the user prefers to use computer hardware at home, instead of a VPS, we recommend that the user have a very strong Internet connection. We also recommend that the user have a competitive hardware setup running on Ubuntu 18.04. + +* Internet speed - *at least* 1 MBPS +* RAM - *at least* 4 GB +* Processor - *at least* i5 or equivalent + +## Get the AtomicDEX API and Coins Configuration File + +#### Step 1: Get the AtomicDEX API binary + +You can get the AtomicDEX API binary by downloading pre-compiled versions from the official repository or by building from source. + +##### Downloading from the Official Repository (Option 1) + +We will create `~/atomicDEX-API/target/debug` directory for compatibility with building from source method. + +You can get the latest release of the AtomicDEX API binary from the [atomicDEX-API/releases](https://github.com/KomodoPlatform/komodo-defi-framework/releases) page on Github. Download and extract it to `~/atomicDEX-API/target/debug`. + +For example: + +```bash +mkdir -p ~/atomicDEX-API/target/debug +cd ~/atomicDEX-API/target/debug +wget https://github.com/KomodoPlatform/komodo-defi-framework/releases/download/beta-2.1.4315/mm2-9fe6e9402-Linux-Release.zip +unzip mm2-9fe6e9402-Linux-Release.zip +``` + +Then you can proceed to [download the coins configuration file](/atomicdex/tutorials/how-to-become-a-liquidity-provider/#step-2-download-the-coins-configuration-file). + +##### Building from Source (Option 2) + +If you decide to build from source, please follow the [Build AtomicDEX API from source guide](/atomicdex/tutorials/how-to-compile-mm2-from-source/) + +#### Step 2: Download the Coins Configuration File + +##### Command + +```bash +cd ~/atomicDEX-API/target/debug ; wget https://raw.githubusercontent.com/KomodoPlatform/coins/master/coins +``` + + + ``` + $ cd ~/atomicDEX-API/target/debug; wget https://raw.githubusercontent.com/KomodoPlatform/coins/master/coins + --2019-07-20 05:27:50-- https://raw.githubusercontent.com/KomodoPlatform/coins/master/coins + Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.8.133 + Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.8.133|:443... connected. + HTTP request sent, awaiting response... + 200 OK + Length: 58974 (58K) [text/plain] + Saving to: ‘coins’ + + coins 100%[=================================================================================================================================================>] 57.59K --.-KB/s in 0.002s + + 2019-07-20 05:27:50 (37.2 MB/s) - ‘coins’ saved [58974/58974] + + ``` + + +## Running the AtomicDEX API + +#### Step 1: Download and Edit Scripts to Provide Liquidity for the KMD/LTC Pair + +Navigate to the directory: `~/atomicDEX-API/target/debug` + +```bash +cd ~/atomicDEX-API/target/debug +``` + +Download the scripts used to start and interact with the AtomicDEX API. + +```bash +git clone https://github.com/gcharang/mm2scripts +``` + +Copy those scripts to the current directory. + +```bash +cp mm2scripts/* . +``` + +#### Create a Secure Seed Phrase + +The user must create a seed phrase that will serve as a type of password for accessing all coins in the user's digital wallet. + +Various tools are available in the cryptocurrency community to create a secure seed phrase. One available method is to use the automated procedure that is included in the [AtomicDEX Desktop Wallet](https://atomicdex.io). + +Backup these 24 words carefully. They provide access to the coins that are stored in the addresses created by the AtomicDEX API. + +To learn more about creating secure phrases, [read this linked content on the Bitcoin wiki.](https://en.bitcoin.it/wiki/Seed_phrase) + +#### Edit the start.sh File + + + We are about to place the seed phrase in the `start.sh` file. Failure to properly execute this step can lead to a loss of your funds. + + +Open the `start.sh` file in the current directory using the `nano` text-editor. + +```bash +nano start.sh +``` + +Replace the value `REPLACE_TRADING_WALLET_PASSPHRASE` in the file with the seed phrase. + +#### Create an RPC Control User Password + +Keep the nano software and `start.sh` file open. + +Separately, create an additional password for Remote Procedure Call (RPC) access. + +This should be a simple password that is sufficiently random, has at least eight digits, and is based on numbers and letters. + +#### Place the User Password into the start.sh File + +Replace the text `"testpsw"` with your RPC user password. + +##### Example + + + + The below example contains an example for launching the AtomicDEX API software with a 24-word passphrase. This is provided for demonstration purposes only. You should NOT copy/paste this example. Type this command in manually to your terminal, and MAKE SURE TO CHANGE THE PASSPHRASE TO YOUR OWN. + + Failure to properly manage your passphrase can (and likely will) result in lost funds. + + + undefined + + +Hit `Ctrl + X` to save and exit. + +Observe the bottom of the terminal for any prompts. Hit `y` when asked to save. When the file name is shown, hit `Enter` if the name matches `start.sh`. + +#### Edit the userpass File + +Replace the text `testpsw` with the same password used in the `start.sh` file. + + + `userpass=GlHjhvYlev8fh8xZgSB` + + +We now have basic scripts to use the AtomicDEX API as a liquidity provider. + +#### Step 2: Start the AtomicDEX API + +##### Command + +```bash +./start.sh +``` + + + `$ ./start.sh nohup: appending output to 'nohup.out'` + + + + Starting the AtomicDEX API in the above manner causes the passphrase to be visible to other programs such as `htop`. + + To avoid this issue, there is an alternate method that uses a json file to replace the command line parameters + + To use it: + + ```bash + cp MM2_sample.json MM2.json + nano MM2.json + ``` + + Edit the values of the keys `"rpc_password"` and `"passphrase"` with the same values used in the `start.sh` file. Save and close the file. + + To start the AtomicDEX API: + + ```bash + stdbuf -oL nohup ./mm2 + ``` + + +#### Step 3: Connect to the Coin Networks (KMD & LTC) + +Open a new terminal and navigate to the directory: `~/atomicDEX-API/target/debug` + +```bash +cd ~/atomicDEX-API/target/debug +``` + +#### Connect to the KMD network + +##### Command + +```bash +./KMDconnect.sh +``` + +##### Response + +```js +{"address":"RG1yR8UGqyHmRBcrwAakUEi8u1AC5jNABY","balance":"0","coin":"KMD","result":"success"} +``` + +Take note of the address. + + + We recommend here that you make sure that the public address above matches the address generated by the same passphrase, when entered into the AtomicDEX wallet or the Verus Desktop wallet. + + + + A sample response of the terminal output after the `start.sh` file is executed. + + ```js + 2019-07-20 08:07:13, lp_coins:669] ticker = "KMD", block_count = 1450741 + ``` + + +#### Connect to the LTC network + +##### Command + +```bash +./LTCconnect.sh +``` + +##### Response + +```js +{"address":"LRxjbptpKojFbywpe8avejShLx4sYvKSBZ","balance":"0","coin":"LTC","result":"success"} +``` + + + + Again, a best practice here is to ensure that the public address above matches with the address in the AtomicDEX or Verus Desktop wallets. + + + ```js + 2019-07-20 08:08:11, lp_coins:669] ticker = "LTC", block_count = 1670767 + ``` + + +#### Connecting to a Network Other Than KMD or LTC + +To connect to a coin network other than KMD or LTC, first make sure that the coin's details are present in the `coins` file you downloaded. Also make sure that the file has the property `"mm2": 1`. + +Next, create a new file named "COINNAMEconnect.sh" and add the following contents; replace the characters `<` and `>` and all text between them with values from your `coins` file. (For example: `` becomes `7771`.) + + + ```json + { + "userpass": "testpsw", + "method": "electrum", + "coin": "", + "servers": [ + { + "url": "" + }, + { + "url": "" + } + ] + } + ``` + + +Make the file executable + +```bash +cd ~/atomicDEX-API/target/debug +chmod +x COINNAMEconnect.sh +``` + +Execute the command `./COINNAMEconnect.sh` to instruct your AtomicDEX API instance to connect to the coin's electrum server. + +## Trading + +#### Step 0: Query the Current Orderbooks + +Display the KMD/LTC Orderbook. + + + See this [linked document](/atomicdex/api/legacy/orderbook/) for an explanation of the output. + + +##### Command + +```bash +./orderbook.sh KMD LTC | jq '.' +``` + + + ```js + { + "askdepth": 0, + "asks": [ + { + "coin": "KMD", + "address": "RT9MpMyucqXiX8bZLimXBnrrn2ofmdGNKd", + "price": "0.013215470000000002", + "price_rat": [ + [1, [1536963325, 1773750]], + [1, [0, 134217728]] + ], + "price_fraction": { + "numer": "7618199778243325", + "denom": "576460752303423488" + }, + "maxvolume": "485.99773485000003", + "max_volume_rat": [ + [1, [1550366371, 995323]], + [1, [0, 2048]] + ], + "max_volume_fraction": { + "numer": "4274881284322979", + "denom": "8796093022208" + }, + "pubkey": "1bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8", + "age": 10, + "zcredits": 0, + "uuid": "ac058b00-24e0-40e1-82f0-0ec4131450c5", + "is_mine": false + } + ], + "base": "KMD", + "biddepth": 0, + "bids": [ + { + "coin": "LTC", + "address": "Ld6814QT6fyChvvX3gmhNHbRDyiMBvPr9s", + "price": "0.011956849349654498", + "price_rat": [ + [1, [1238828453, 401205]], + [1, [0, 33554432]] + ], + "price_fraction": { + "numer": "1723163592820133", + "denom": "144115188075855872" + }, + "maxvolume": "1.03403044", + "max_volume_rat": [ + [1, [3226923691, 542129]], + [1, [0, 524288]] + ], + "max_volume_fraction": { + "numer": "2328429552136875", + "denom": "2251799813685248" + }, + "depth": 0, + "pubkey": "1bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8", + "age": 11, + "zcredits": 0, + "uuid": "80019ae0-5a42-40db-bc49-18975987e45b", + "is_mine": false + } + ], + "netid": 7777, + "numasks": 1, + "numbids": 1, + "rel": "LTC", + "timestamp": 1563610320 + } + ``` + + +Display the LTC/KMD Orderbook. + +##### Command + +```bash +./orderbook.sh LTC KMD | jq '.' +``` + + + ```js + { + "askdepth": 0, + "asks": [ + { + "coin": "LTC", + "address": "Ld6814QT6fyChvvX3gmhNHbRDyiMBvPr9s", + "price": "83.19879514", + "price_rat": [ + [1, [255867351, 1363129]], + [1, [0, 16384]] + ], + "price_fraction": { + "numer": "5854594731096535", + "denom": "70368744177664" + }, + "maxvolume": "1.03403044", + "max_volume_rat": [ + [1, [3226923691, 542129]], + [1, [0, 524288]] + ], + "max_volume_fraction": { + "numer": "2328429552136875", + "denom": "2251799813685248" + }, + "pubkey": "1bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8", + "age": 9, + "zcredits": 0, + "uuid": "80019ae0-5a42-40db-bc49-18975987e45b", + "is_mine": false + } + ], + "base": "LTC", + "biddepth": 0, + "bids": [ + { + "coin": "KMD", + "address": "RT9MpMyucqXiX8bZLimXBnrrn2ofmdGNKd", + "price": "75.27507393894138", + "price_rat": [ + [1, [3018734531, 308326]], + [1, [0, 4096]] + ], + "price_fraction": { + "numer": "1324253105241027", + "denom": "17592186044416" + }, + "maxvolume": "485.99773485000003", + "max_volume_rat": [ + [1, [1550366371, 995323]], + [1, [0, 2048]] + ], + "max_volume_fraction": { + "numer": "4274881284322979", + "denom": "8796093022208" + }, + "pubkey": "1bb83b58ec130e28e0a6d5d2acf2eb01b0d3f1670e021d47d31db8a858219da8", + "age": 10, + "zcredits": 0, + "uuid": "ac058b00-24e0-40e1-82f0-0ec4131450c5", + "is_mine": false + } + ], + "netid": 7777, + "numasks": 1, + "numbids": 1, + "rel": "KMD", + "timestamp": 1563610443 + } + ``` + + +#### Step 1: Fund the Address + +In this example, we sell KMD for LTC. + +To achieve this, we first fund the KMD address created by the AtomicDEX API. + +Use the following command to find the address and check the balance. + +```bash +./mybalance.sh KMD +``` + +##### Response + +```js +{"address":"RFmQiF4Zbzxchv9AG6dw6ZaX8PbrA8FXAb","balance":"2.98","coin":"KMD"} +``` + +#### Step 2: Place an Order + +Execute the following command to sell 2 KMD at the price of `1 KMD = 0.013 LTC`. + +##### Command + +```bash +./place_order.sh KMD LTC 0.013 2 | jq '.' +``` + +##### Response + +```js +{ + "result": { + "base": "KMD", + "created_at": 1563800688606, + "matches": {}, + "max_base_vol": "2", + "min_base_vol": "0", + "price": "0.013", + "rel": "LTC", + "started_swaps": [], + "uuid": "d375fce0-5d7c-4d1d-9cfa-6177c78df44a" + } +} +``` + +#### Step 3: Check the Status of an Order + +Check the status of an order by referring to its `uuid`. + +##### Command + +```bash +./order_status.sh 6621efd5-72dd-422c-89a8-7b655b744ead | jq '.' +``` + +##### Response + +```js +{ + "order": { + "available_amount": "2", + "base": "KMD", + "cancellable": true, + "created_at": 1563800688606, + "matches": {}, + "max_base_vol": "2", + "min_base_vol": "0", + "price": "0.013", + "rel": "LTC", + "started_swaps": [], + "uuid": "d375fce0-5d7c-4d1d-9cfa-6177c78df44a" + }, + "type": "Maker" +} +``` + +#### Step 4: Withdrawal of Coins + +After someone accepts the order and your trade is finished, the coins received (LTC) and the coins leftover (KMD) can be withdrawn. + +Execute the following command to withdraw `0.97` KMD to the address `RUFf4de7gZE7sp5vPcxaAsvv6j79ZbQgAu`. + +##### Command + +```bash +./withdraw.sh KMD RUFf4de7gZE7sp5vPcxaAsvv6j79ZbQgAu 0.97 | jq '.' +``` + +##### Response + +```json +{ + "tx_hex": "0400008085202f8901c25ecb12f5fc17120bf92ed18ff71754b5f58e6eece2fba44fc114f14176df04010000006a4730440220732047807944afcb062f5dc7af87fe5b9979e447cd235ef1b130e50008c3d51a02201b232814bcee9c0b5a29aa24d453e493cd121a0e21d94c0e84476de0a15e74a101210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06ffffffff02401ac805000000001976a914d020156e7d0fead249cfb5a458952ae941ac9f9e88ac5800fb0b000000001976a9144726f2838fc4d6ac66615e10604e18926e9b556e88ac06a5355d000000000000000000000000000000", + "tx_hash": "e07709088fa2690fdc71b43b5d7760689e42ca90f7dfb74b18bf47a1ad94c855", + "from": ["RFmQiF4Zbzxchv9AG6dw6ZaX8PbrA8FXAb"], + "to": ["RUFf4de7gZE7sp5vPcxaAsvv6j79ZbQgAu"], + "total_amount": 2.98, + "spent_by_me": 2.98, + "received_by_me": 2.00999, + "my_balance_change": -0.97001, + "block_height": 0, + "timestamp": 1563798788, + "fee_details": { + "type": "Utxo", + "amount": 1e-5 + }, + "coin": "KMD", + "internal_id": "" +} +``` + +Copy the `"tx_hex"` value from the above response and send it to the network using the `sendrawtransaction.sh` script. + +##### Command + +```bash +./sendrawtransaction.sh KMD 0400008085202f8901c25ecb12f5fc17120bf92ed18ff71754b5f58e6eece2fba44fc114f14176df04010000006a4730440220732047807944afcb062f5dc7af87fe5b9979e447cd235ef1b130e50008c3d51a02201b232814bcee9c0b5a29aa24d453e493cd121a0e21d94c0e84476de0a15e74a101210217a6aa6c0fe017f9e469c3c00de5b3aa164ca410e632d1c04169fd7040e20e06ffffffff02401ac805000000001976a914d020156e7d0fead249cfb5a458952ae941ac9f9e88ac5800fb0b000000001976a9144726f2838fc4d6ac66615e10604e18926e9b556e88ac06a5355d000000000000000000000000000000 +``` + +##### Response + +```json +{ + "tx_hash": "e07709088fa2690fdc71b43b5d7760689e42ca90f7dfb74b18bf47a1ad94c855" +} +``` + +The above `tx_hash` can be searched for in an explorer to check the status of the withdraw. + +## Miscellaneous + +#### Stop + +To stop the AtomicDEX API, use the `stop.sh` script. + +##### Command + +```bash +./stop.sh +``` + +##### Response + +```js +{ + "result": "success" +} +``` + +#### View All the Orders Placed by Our Node + +##### Command + +```bash +./myorders.sh | jq . +``` + +##### Response + +```js +{ + "result": { + "maker_orders": { + "d82357c5-22c9-483d-bf3d-1d09d0d921bf": { + "available_amount": "2", + "base": "KMD", + "cancellable": true, + "created_at": 1563797287088, + "matches": {}, + "max_base_vol": "2", + "min_base_vol": "0", + "price": "0.013", + "rel": "LTC", + "started_swaps": [], + "uuid": "d82357c5-22c9-483d-bf3d-1d09d0d921bf" + } + }, + "taker_orders": {} + } +} +``` + +#### Cancel an Order + +Cancel an order by referring to its `uuid`. + +##### Command + +```bash +./cancel_order.sh 6621efd5-72dd-422c-89a8-7b655b744ead +``` + +##### Response + +```js +{ + "result": "success" +} +``` +export const title = "Compile MM2 from Source"; +export const description = "This guide describes a simple method to build the AtomicDEX API from source."; + +# How To Compile AtomicDEX API from Source + +The following tutorial introduces the reader to a simple method to build the AtomicDEX API from source. + +## Installing Dependencies + +#### Step 1: OS Packages + +##### Command + +```bash +sudo apt update +sudo apt-get install build-essential git jq llvm-3.9-dev libclang-3.9-dev clang-3.9 cmake libssl-dev pkg-config +``` + +If you are using Ubuntu 20.04, run: + +```bash +sudo apt update +sudo apt-get install build-essential git jq llvm-dev libclang-dev clang cmake libssl-dev pkg-config +``` + +For rpm-based distributions: + +```bash +sudo dnf groupinstall "Development Tools" +sudo dnf install jq clang cmake openssl-devel clang-devel libzstd systemd-devel # systemd-devel is used for libudev dep instead of pkg-config +``` + +#### Step 2: Install Rust + +##### Command + +```bash +curl https://sh.rustup.rs -sSf | sh +``` + +When asked to select an installation type, select the following. + +``` +2) Customize installation +``` + +Choose default host triple and toolchain, then select minimal profile. + + + ``` + $ curl https://sh.rustup.rs -sSf | sh + info: downloading installer + + Welcome to Rust! + + This will download and install the official compiler for the Rust programming + language, and its package manager, Cargo. + + It will add the cargo, rustc, rustup and other commands to Cargo's bin + directory, located at: + + /home/mylo/.cargo/bin + + This path will then be added to your PATH environment variable by modifying the + profile file located at: + + /home/mylo/.profile + + You can uninstall at any time with rustup self uninstall and these changes will + be reverted. + + Current installation options: + + default host triple: x86_64-unknown-linux-gnu + default toolchain: stable + modify PATH variable: yes + + 1) Proceed with installation (default) + 2) Customize installation + 3) Cancel installation + >2 + + I'm going to ask you the value of each of these installation options. + You may simply press the Enter key to leave unchanged. + + Default host triple? + + + Default toolchain? (stable/beta/nightly/none) + + + Profile (which tools and data to install)? (minimal/default/complete) + minimal + + info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' + info: latest update on 2019-07-04, rust version 1.36.0 (a53f9df32 2019-07-03) + info: downloading component 'rustc' + info: downloading component 'rust-std' + info: downloading component 'cargo' + ... + ... + info: downloading component 'rust-docs' + info: installing component 'rustc' + 91.1 MiB / 91.1 MiB (100 %) 17.7 MiB/s in 5s ETA: 0s + info: installing component 'rust-std' + .... + ... + stable installed - rustc 1.36.0 (a53f9df32 2019-07-03) + + + Rust is installed now. Great! + + To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH + environment variable. Next time you log in this will be done automatically. + + To configure your current shell run source $HOME/.cargo/env + + ``` + + +Once the installation is complete, enter `Logout` and then `Login` again. + +Alternatively, you may execute the following command in each active shell until you reach the `Login` again. + +```bash +source $HOME/.cargo/env +``` + +#### Step 3: Install Rust components + +##### Command + +```bash +rustup install nightly-2022-02-01 +``` + + + ``` + $ rustup install nightly-2022-02-01 + info: syncing channel updates for 'nightly-2022-02-01-x86_64-unknown-linux-gnu' + 696.1 KiB / 696.1 KiB (100 %) 567.6 KiB/s in 2s ETA: 0s + info: latest update on 2022-02-01, rust version 1.49.0-nightly (ffa2e7ae8 2020-10-24) + info: downloading component 'cargo' + 5.3 MiB / 5.3 MiB (100 %) 426.6 KiB/s in 3s ETA: 0s + info: downloading component 'clippy' + 2.4 MiB / 2.4 MiB (100 %) 527.6 KiB/s in 2s ETA: 0s + info: downloading component 'rust-docs' + 13.6 MiB / 13.6 MiB (100 %) 4.3 MiB/s in 3s ETA: 0s + info: downloading component 'rust-std' + 22.3 MiB / 22.3 MiB (100 %) 7.1 MiB/s in 4s ETA: 0s + info: downloading component 'rustc' + 55.1 MiB / 55.1 MiB (100 %) 10.7 MiB/s in 7s ETA: 0s + info: downloading component 'rustfmt' + 3.6 MiB / 3.6 MiB (100 %) 289.6 KiB/s in 2s ETA: 0s + info: installing component 'cargo' + info: Defaulting to 500.0 MiB unpack ram + 5.3 MiB / 5.3 MiB (100 %) 4.4 MiB/s in 1s ETA: 0s + info: installing component 'clippy' + info: installing component 'rust-docs' + 13.6 MiB / 13.6 MiB (100 %) 3.8 MiB/s in 3s ETA: 0s + info: installing component 'rust-std' + 22.3 MiB / 22.3 MiB (100 %) 4.0 MiB/s in 5s ETA: 0s + info: installing component 'rustc' + 55.1 MiB / 55.1 MiB (100 %) 4.6 MiB/s in 12s ETA: 0s + info: installing component 'rustfmt' + + nightly-2022-02-01-x86_64-unknown-linux-gnu installed - rustc 1.49.0-nightly (ffa2e7ae8 2020-10-24) + + info: checking for self-updates + info: downloading self-update + + ``` + + +##### Command + +```bash +rustup default nightly-2022-02-01 +``` + + + ``` + $ rustup default nightly-2022-02-01 + info: using existing install for 'nightly-2022-02-01-x86_64-unknown-linux-gnu' + info: default toolchain set to 'nightly-2022-02-01-x86_64-unknown-linux-gnu' + + nightly-2022-02-01-x86_64-unknown-linux-gnu unchanged - rustc 1.49.0-nightly (ffa2e7ae8 2020-10-24) + ``` + + +##### Command (Optional, skip this step if it fails) + +```bash +rustup component add rustfmt-preview +``` + + + ``` + $ rustup component add rustfmt-preview + info: downloading component 'rustfmt' + 2.9 MiB / 2.9 MiB (100 %) 928.6 KiB/s in 1s ETA: 0s + info: installing component 'rustfmt' + ``` + + +## Install the AtomicDEX API + +#### Step 1: Download source code + +```bash +cd ~ ; git clone https://github.com/KomodoPlatform/komodo-defi-framework --branch mm2.1 --single-branch && cd atomicDEX-API +``` + + + ``` + $cd ~ ; git clone https://github.com/KomodoPlatform/komodo-defi-framework --branch mm2.1 --single-branch && cd atomicDEX-API + Cloning into 'atomicDEX-API'... + remote: Enumerating objects: 34, done. + remote: Counting objects: 100% (34/34), done. + remote: Compressing objects: 100% (23/23), done. + remote: Total 107436 (delta 14), reused 21 (delta 11), pack-reused 107402 + Receiving objects: 100% (107436/107436), 194.19 MiB | 9.59 MiB/s, done. + Resolving deltas: 100% (84045/84045), done. + ``` + + +#### Step 2: Compile Source Code + +##### Command + +```bash +cargo build --features native -vv +``` + + + ``` + … + … + Finished dev [optimized + debuginfo] target(s) in 6m 40s + ``` + +export const title = "Introduction to AtomicDEX"; +export const description = "One of Komodo's blockchain tools is an atomic-swap powered, decentralized exchange (DEX), called AtomicDEX."; + +# Introduction to AtomicDEX + +One of Komodo's blockchain tools is an atomic-swap powered, decentralized exchange (DEX), called AtomicDEX. + +Komodo’s AtomicDEX software is entirely separate from the `komodod` software that powers the rest of Komodo. + +Because AtomicDEX is built on atomic swaps, developers and users can rely on it to exchange cryptocurrencies at will, and without any middleman involvement. Users of this software maintain full control over the private keys of their assets at all times. This dramatically increases the security of the exchange process. + +This software is capable of facilitating atomic-swap exchanges between approximately 99% of the coins listed on [coinmarketcap.com](https://coinmarketcap.com). All coins were listed without charge. + +## Why is AtomicDEX Special? + +When it comes to DEX technology, Komodo has a remarkable story. + +In April 2014, Komodo’s lead developer experimented with his first atomic-swap prototypes. By August of 2017, Komodo released version 1.0 of the atomic-swap DEX software, allowing anonymous Internet users to perform over 100,000 atomic swaps via automation. These are but two examples of how Komodo has led the way in atomic-swap DEX technology since the beginning. + +To understand AtomicDEX, one must first understand what a decentralized exchange is, why it is important, and how atomic swaps come into play. + +This discussion requires a small amount of foundational knowledge. The reader should be generally familiar with blockchain technology and should understand the basic ideas of the Komodo project. + +For a broad overview of Komodo, head to the [About Komodo Platform section](https://developers.komodoplatform.com/start-here/about-komodo-platform/) For a more thorough understanding of general blockchain technology, check out [the Delayed Proof of Work section of the Core Technology Discussions.](https://developers.komodoplatform.com/start-here/core-technology-discussions/delayed-proof-of-work) This section gives an overview of how a blockchain works and why it matters. + +After reading the above articles, the following discussion should be attainable. + +## Understanding the Most Common Method of Cryptocurrency Exchange + +In the world of cryptocurrency, the goods we are trading are our digital assets. These can be coins, tokens, or other forms of digital rights and property. By nature, each digital asset is bound to the individual blockchain that secures its transaction history. + +### Trading Between Blockchains is a Challenge + +So long as a user exchanges these assets within their parent blockchains the normal methods of conducting transactions are sufficient for trading. However, questions arise once the user wants to exchange assets on one blockchain for assets on an entirely separate blockchain. + +Typically, separate blockchains have separate demographics of miners and stakers securing the history. When a user trades value between the two blockchains, by default there is no inter-chain security mechanism that can ensure that the user's trading partner does not cheat, and that technical difficulties do not destroy the user's assets. + +### The Centralized Exchange as a Method + +The simplest solution is to abandon decentralization during this process and trust a third party. This describes a normal "centralized exchange" (CEX), such as Coinbase, Kraken, and Binance. + +To conduct an exchange using a CEX the user must entrust their digital assets to the CEX's care during the process. The user sends their digital assets to the CEX, and the CEX then issues the user "I Owe You" (IOU) tokens that represent the user's ownership of these assets. + +The user is then within a single environment that is controlled by a centralized authority. This grants all the benefits of the old system to the trading process, including greater speed of development and design. + +Throughout this experience the user relies on the security of a centralized third party to ensure that their purchases and sales are conducted honestly and accurately. When the user is finished exchanging, they hand back their IOUs and tell the CEX the address where they would like to export their purchases. + +Once the user receives their digital assets back into an address which they control, they are again truly the "owner" of these assets. + +### Problems with Centralized Exchanges + +Assuming all goes as intended, a CEX is an efficient and effective tool for trading cryptocurrencies. However, reliable CEX's readily state that this model carries great risk. Many of the highest quality CEX's are looking to change their model to mitigate these dangers. + +The primary concern for a CEX is security. When a user places their assets on a centralized exchange, the private keys to these assets are held in a database that, by nature, must have some kind of connection to the public Internet. As the database must always be available online, an attacker can penetrate an individual user's account and gain control over the IOUs even when the user is offline. The attacker can then trade these IOUs at malicious prices into an account the attacker controls and withdraw the true assets. + +Furthermore, this database holds the assets of thousands of other users. Having a large amount of vulnerable funds on the Internet is an additional incentive for attackers. [As reported by IG Group studies,](https://www.group-ib.com/resources/research-hub/) from 2017 to 2018, nearly 1 billion US dollar's worth of digital assets were stolen from major exchanges around the world. + +A CEX has several challenges to consider as a result of this danger. From a legal perspective, [the infamous Mt. Gox case](https://www.coindesk.com/markets/2018/01/15/mississippi-doctors-sued-mt-gox-for-bitcoin-loss-now-worth-133-million/) illustrates how users may attempt to hold the CEX liable in the event of a theft. A CEX may struggle to find an insurance provider that will protect them. Also, compared to fiat currency, government authorities can do little to assist in recovering stolen funds. + +### Pros and Cons of the Centralized Exchange + +| Perspective | Pros | Cons | +| -------------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| User | The IOU exchange process is high-speed, simple, and often has a pleasant interface | Compromising the user's individual account is achievable for a determined hacker, and there are effectively no methods to recover funds stolen from a CEX | +| User | Because the CEX model has many users, a CEX is more likely to achieve high liquidity | The high user population motivates sophisticated attackers to compromise the entire site | +| User | A large CEX can handle the complexities of holding and using cryptocurrencies | Once a user gives up control over their funds to the CEX, the user can only trust that the funds will be returned | +| Exchange Owner | Without decentralization, business development is often faster | In holding thousands of user's personal funds, the exchange owners assume an enormous amount of liability | +| Exchange Owner | The automated aspect of cryptocurrency allows for fast profits through small fees | The owner must be wary of thieves even among their own employees | + +In light of these concerns, many reputable and established CEX's are turning to decentralized technologies. For example, Binance, one of the most popular CEX's on the Internet, [is moving swiftly into DEX technology](https://www.theblockcrypto.com/2019/02/07/binance-moves-away-from-ethereum-as-it-prepares-to-launch-dex/) to enhance both security and functionality for their users. + +## A Decentralized Exchange Can Bring Greater Safety + +To understand why a CEX may wish to implement decentralized technologies, one must first understand how a typical decentralized exchange (DEX) works. There are many types of DEXs, each having a unique technical structure. Perhaps the most popular DEX format is a decentralized gateway. + +### Types of Decentralized Exchanges + +| Type | Summary | Examples | +| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------- | +| Decentralized Gateway | A decentralized network of gateway keepers hold user funds in escrow and issue IOUs for trading | InstantDEX, Bitshares, Binance DEX | +| On-Chain Token Exchange | Tokens created on the parent blockchain are traded within the consensus rules; by adding gateway nodes, this can also extend to become a decentralized gateway | EtherDelta, 0x | +| Non-Custodial Exchange | A centralized website arranges for a moderately secure, but non-decentralized trade between liquidity providers and purchasers; there is no order book and the exchange's control over user funds is limited | ShapeShift, Changelly | + +A decentralized gateway can be thought of as a cryptocurrency holding station that is owned and controlled by several different parties. The gateway performs two functions: it holds the assets that users send to it, and it issues IOUs. + +The IOUs issued to the user do not derive from a centralized database. Rather, they are managed through a blockchain. The user maintains control over the private keys to their IOUs at all times. While this method is not as secure as having access to the private keys to the true digital assets, the method does provide some protection. Assuming the user knows how to secure their private keys, when the user is offline their IOUs are not vulnerable to attackers. This is one improvement over the CEX model. + +The user trades their IOUs with other users in much the same way as on a CEX. When a user is finished trading, they send their IOUs back to the gateway, and with this transaction they include an external address to which they would like their funds withdrawn. + +Now comes another key difference. The actual assets that the gateway is holding are contained in a special type of blockchain address. It is special because it is owned and controlled not by one person or central authority, but rather by several people or parties working together. This address can collect funds from anywhere and from anyone. However, it can only release funds when several of the address’s owners grant permission. This special type of blockchain address is called a “multi-signature” address. + +Because a multi-signature address requires several different parties to sign the release of funds, the gateway is able to provide an improved measure of security. For an attacker to succeed, they must compromise several different parties, rather than a central authority. + +In many ways, this popular DEX model is an improvement over the CEX model, and this is why many CEX's are expanding into this territory. Users have control over their IOUs, making them responsible for individual attacks, rather than the exchange owners. The risk of an exchange-wide attack is also shared across multiple parties. + +### The Decentralized Gateway + +| Pros | Cons | +| ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Tokens can be issued for any asset, including both cryptocurrency and fiat | This method requires a wide network of trustworthy and technically proficient business partners | +| Users maintain ownership over their IOUs at all times, limiting attackers' capabilities | All true assets are still in the ownership of a small group of people, albeit somewhat decentralized, and therefore susceptible to attacks, errors, and corruption | +| IOUs are on-chain, and therefore buying and selling funds can be performed at high speeds | Maintenance and improvements to the DEX are highly technical, time consuming, and cost prohibitive | + +For a developer and entrepreneur, the DEX method is more secure than the CEX model, but there remain many difficulties on technical and political levels. The entrepreneur must find trustworthy partners to be co-owners of the multi-signature address. The developer must ensure that their partners' infrastructure and other technical contributions are secure, as a failure by the partners can reflect poorly on the developer and entrepreneur's own brand. + +Furthermore, from the user's perspective, the primary danger persists in this DEX model. Once the user sends their assets to the gateway, the user loses control and responsibility over their true assets. + +## Atomic Swaps are a Significantly Superior Basis for Exchange + +What if there was a way to trade different types of cryptocurrencies without the user ever transferring control until the trade is complete? Could a user keep the private keys to their assets, and only deal directly with their trading partner and not with a third party? + +This is the idea of an atomic swap. It is simply a trade of assets between two users where, assuming both behave honestly, ownership over the assets is not released until both sides are secure in receiving a fair outcome. If one side tries to cheat or makes any kind of mistake, they cannot receive a financial reward from it, and the non-offending side cannot be penalized or lose their funds. + +An atomic swap can do everything else that both the DEX and CEX models can do. Atomic swaps can be conducted quickly; users may form networks of high liquidity trading; nearly all types of cryptocurrencies can be exchanged. + +However, the nature of an atomic swap is unique in comparison with the opposing models, as an atomic swap does not require third-party intervention. This can provide simplicity for both the user, the entrepreneur, and even the developer. Depending on the application, the cost may also be dramatically cheaper, as far less infrastructure and manpower is required. + +### Technical Comparisons + +| Capability | Atomic Swap | Decentralized Gateway | Centralized Exchange | +| ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| Third party is not required | Yes: The entire exchange happens between two users; no third party is required | No: The exchange relies on a decentralized network of gateway nodes, who must be trusted | No: Users depend on a centralized company to maintain and secure their funds | +| An exchange can be set up by anyone | Yes: Requires only two users and an Internet connection | No: Requires sufficient technical knowledge, funding, and committed business partners to serve as gateway nodes | No: Requires sufficient technical knowledge, funding, and a higher level of business and legal knowledge | +| Users maintain control over the funds throughout the process | Yes: Users maintain control over their funds until the trade is completed, at which point ownership is swapped atomically | No: Users relinquish ownership to the gateway nodes, although users do hold private keys to IOUs | No: Once the user sends funds to the CEX, they only own their funds in theory until the funds are returned | +| User funds remain distributed and decentralized throughout process | Yes: As users maintain ownership over their funds at all times, all funds in the exchange process are never in a central location | No: User funds are held in a collection of multi-signature addresses that are maintained by a small group of people | No: User funds are held in a centralized database, managed by company employees | + +This is probably enough to get the basic idea. If the reader desires a more thorough understanding of the atomic swap process, read the [AtomicDEX and Atomic Swaps section of the Core Technology Disucssions.](https://developers.komodoplatform.com/start-here/core-technology-discussions/atomicdex) + +The underlying ideas of atomic swaps were invented by Tier Nolan in 2013. He posted his ideas on an online community forum where Komodo's lead developer and primary visionary, JL777, or "James" for short, was also exploring blockchain technology. Here’s where Komodo enters the picture. + +### Komodo's Leadership in Atomic-Swap Technology + +Upon reading Nolan’s discussion, James began experimenting. In April 2014 he wrote his first experimental software for allowing anonymous users on the Internet to conduct on-chain atomic swaps between two assets on the NXT blockchain. + +In September 2015, James performed an experimental atomic swap between Bitcoin and NXT. Like all Bitcoin-based atomic swaps performed during this time period, James's atomic swap could not be considered secure as Bitcoin software lacked a feature called "Check Lock Time Verify." This feature was added in November 2015, and James performed a secure atomic swap shortly thereafter. + +At this time, James also began the creation of his current endeavor, the Komodo ecosystem. Additional team members were hired, money was raised, and large-scale software and company development began. + +From its foundation, the Komodo ecosystem is designed to facilitate blockchain interoperability and scalability, and our atomic-swap software plays a key role. In August 2017, Komodo released version 1.0 of the first atomic-swap based DEX to the public. Releasing this entirely new DEX software to the masses was an endeavor many years in the making, and countless volunteer developers and other dreamers contributed. + +Upon release of Komodo’s DEX 1.0, hundreds of members of the Komodo open-source community collectively performed over 100,000 atomic swaps. It was the first time in history that users with no coding knowledge could trade assets without either a third-party acting as an arbiter, or even without any public knowledge of who was trading with whom. + +Another point to mention is that while AtomicDEX is built upon atomic swaps, other software in the Komodo ecosystem is able to perform the rest of the functionality necessary to run other types of decentralized exchanges. As all Komodo software is natively integrated, this provides the Komodo entrepreneur with perhaps the widest range of DEX software packages in existence. + +### Capabilities of Komodo Software + +| Atomic Swaps | Decentralized Gateway | On-Chain Token Exchange | Cross-Chain Asset Transfers | ... and more! | +| ------------ | --------------------- | ----------------------- | --------------------------- | ------------- | +| Check! | Check! | Check! | Check! | Check! | + +Today, Komodo developers took what they learned from version 1.0 and rewrote the code from the ground up to enhance essentially all aspects of the user experience. This is the AtomicDEX 2.0 software. + +Recently, yet again Komodo forged into new territory with atomic swaps. In February of 2019, the Komodo team performed the first mobile-based atomic swap. The mobile version of AtomicDEX is available for Android and iOS devices, and the software interfaces seamlessly with our desktop software. + +While the code behind Komodo's technology is complex, the good news is, the code takes care of itself. A developer and entrepreneur building on Komodo can simply fire up the software and access its functionalities through the API. + +## AtomicDEX Software is an Industry-Wide Invitation + +AtomicDEX is open source, meaning that we do not keep the software's source code private. Also, the Komodo team is creating a network that is open to other financially motivated businesses and organizations seeking profit in the cryptocurrency-exchange industry. + +Many opportunities are available for cryptocurrency-exchange entrepreneurs to build their own audiences and businesses using Komodo software. Entrepreneurs can create their own market places on the main Komodo network for trading, or they can create their own private and public networks. Developers can use Komodo's back-end software API to feature atomic-swap DEX functionality in their existing or upcoming software innovations, including mobile software. Enterprise and other large-scale companies can reach out to Komodo for integration with Komodo technology, or even for consulting services. + +[Please reach out to the Komodo team for further information.](https://komodoplatform.com/contact-us/) +export const title = "Adding a new coin to the AtomicDEX-API"; +export const description = + "This guide describes how to add a new coin to the AtomicDEX-API"; + +import geckoapi from "@/public/images/api-images/gecko_api.png"; +import paprikaapi from "@/public/images/api-images/paprika_api.png"; +import nomicsapi from "@/public/images/api-images/nomics_api.png"; +import qtum from "@/public/images/api-images/qtum.png"; + +# Prerequisites for a coin to be compatible with AtomicDEX-API + +Before a coin can be listed in AtomicDEX, it needs to be confirmed for compatibility, and present within the [Komodo Platform coins repository](https://github.com/KomodoPlatform/coins). + +The information below details the requirements for creating a working coins configuration file and submitting a successful pull request to the [coins repository](https://github.com/KomodoPlatform/coins/#readme). Please contact our support team in the `#dev-support` channel on the [Komodo Platorm Discord](https://komodoplatform.com/discord) if you have any questions or need assistance with performing a [test swap](https://github.com/KomodoPlatform/coins/tree/master/swaps). + +## 1. Coins JSON config (required) + +## 1a. General parameters for all coins + +Different platforms & protocols vary slightly in what data is required. Review the parameter descriptions and examples below to understand what information is needed to list your coin. + +| Parameter | Type | Description | +| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| coin | string | Ticker of the coin/token. If the coin is a token, please use `COIN-PROTOCOL` as ticker, eg `USDC-BEP20`. | +| name | string | This is the value which is expected to be default data directory name for that coin - e.g. if coin's name is `litecoin` then it's expected data directory on `~/.litecoin/` on Linux, `~/Library/Applications Support/Litecoin/` on Mac, `%AppData%\Litecoin` on Windows. Please keep this key's value in small letters only. | +| fname | string | The full name of the coin/token. | +| mm2 | integer | Indicates trading compatibility with AtomicDEX API. `1` is compatible, `0` is not compatible. Non-compatible coins may still be listed as `wallet only` in AtomicDEX apps. | +| required\_confirmations | integer | Defaults to `1`. The number of confirmations AtomicDEX will wait for during the swap. WARNING, this setting affects the security of the atomic swap. 51% attacks (double spending) are a threat and have been succesfully conducted in the past. You can find a collection of coins and the theoretical cost of a 51% attack [here](https://www.crypto51.app/). Please be aware that some of the coins supported by AtomicDEX may be vulnerable to such attacks, so consider using higher confirmation values for them, especially when dealing with large amounts. | +| requires\_notarization | boolean | Defaults to `false`. For coins protected by [dPoW](https://komodoplatform.com/51-attack-how-komodo-can-help-prevent-one/) can be set to `true` wait for a notarization when sending transactions during a swap. If `true`, `"required_confirmations"` must be set to `2` or higher. | +| decimals | integer | Defines the number of digits after the decimal point that should be used to display the orderbook amounts, balance, and the value of inputs to be used in the case of order creation or a `withdraw` transaction. The default value used for a UTXO type coin (Bitcoin Protocol) is `8` and the default value used for a ERC20 Token is `18`. It is **very important** for this value to be set correctly. For example, if this value was set as `9` for BTC, a command to withdraw `1 BTC` tries to withdraw `10^9` satoshis of Bitcoin, i.e., `10 BTC` | +| protocol | string | Contains the coin protocol `"type"` (UTXO, ETH, etc.) and specific protocol configuration - `"protocol_data"` object that can have arbitrary format. | +| orderbook\_ticker | string | If set, coins with the same value will share the same orderbook. For example, if `BTC-Segwit` and `BTC-BEP20` are set with `"orderbook_ticker":"BTC"` the same orderbook is returned for KMD/BTC, KMD/BTC-BEP20 and KMD/BTC-Segwit pairs. | +| sign\_message\_prefix | string | Optional, required to allow for message signing in AtomicDEX API. Can normally be found within a projects github repository \[[example](https://github.com/KomodoPlatform/komodo/blob/master/src/main.cpp#L146)] and follows a standard format like `"Komodo Signed Message:\n"` | + +## 1b. UTXO coins (BTC, LTC, KMD, ZEC, DASH, DOGE, DGB) + +The following rpc methods should be available. + +```bash +estimatefee +getblock +getblockhash +getinfo +getrawtransaction +gettxout +importaddress +listunspent +listreceivedbyaddress +listtransactions +sendrawtransaction +``` + +| Parameter | Type | Description | +| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| name | string | This is the value which is expected to be default data directory name for that coin - e.g. if coin's name is `litecoin` then it's expected data directory on `~/.litecoin/` on Linux, `~/Library/Applications Support/Litecoin/` on Mac, `%AppData%\Litecoin` on Windows. Please keep this key's value in small letters only. | +| rpcport | integer | The coin's default RPC port. It is expected that it doesn't conflict with any existing coin in the coins db. | +| pubtype | integer | This information can be found in source code of a coin project in files like `src/init.cpp`, `src/base58.h`, and `src/chainparamsbase.h` if the project is following the **bitcoin** source code directory/files structure. If unsure, then please have these confirmed by that coin/project's developers to ensure it is correct. | +| p2shtype | integer | This information can be found in source code of a coin project in files like `src/init.cpp`, `src/base58.h`, and `src/chainparamsbase.h` if the project is following the **bitcoin** source code directory/files structure. If unsure, then please have these confirmed by that coin/project's developers to ensure it is correct. | +| wiftype | integer | This information can be found in source code of a coin project in files like `src/init.cpp`, `src/base58.h`, and `src/chainparamsbase.h` if the project is following the **bitcoin** source code directory/files structure. If unsure, then please have these confirmed by that coin/project's developers to ensure it is correct. | +| txfee | integer | The default transaction fee (in satoshi). AtomicDEX uses this as the default transaction fee value when making atomic swap transactions. If set to `0`, AtomicDEX will use a dynamic fee based on output from `estimatesmartfee`. | +| overwintered | integer | Must be `1` if Overwinter upgrade was activated for the coin. Defaults to `0`. | +| taddr | integer | Optional. Is only relevant for coins that forked the Zcash protocol and have both transparent addresses and z-addresses. The value to be set for this key can be found from the file `src/chainparams.cpp` of the coin's source code and it is the first value present in both `base58Prefixes[PUBKEY_ADDRESS]` and `base58Prefixes[SCRIPT_ADDRESS]`. But it has to be converted to decimal from HEX. So if `base58Prefixes[PUBKEY_ADDRESS]` = `{0x1C,0xB8}` , the `taddr` is `0x1C` coverted to decimal. As 0x1C in HEX = 28 in decimal, the entry in the json would be `"taddr" : 28` | +| force\_min\_relay\_fee | boolean | If `true` for coins with dynamic fees, when a new transaction is generated, AtomicDEX-API will check whether the total fee set (`sat * tx size`) is lower than relay fee and will use the relay fee instead. Defaults to `false` | +| mtp\_block\_count | integer | Optional. Number of blocks to be used for the calculation of `median time past`. Must be greater than `0`. Default value is `11`. While this parameter is applicable only in the case of KMD reward calculation for now, it will be used for calculating locktimes to be set for the atomic swap refund transactions. | +| estimate\_fee\_mode | string | Sets the fee mode for the `estimatesmartfee` call. Supported values are: `ECONOMICAL`,`CONSERVATIVE`, `UNSET`. Please note that some coins may not support some of these modes. Makes no effect for coins that do not have the `estimatesmartfee` RPC. | +| address\_format | object | Optional. Overwrites the address format from coins file, if set. A standard [AddressFormat](/atomicdex/api/common_structures/#address-format) object. | +| isPoS | integer | Optional, defaults to `0`. A value of `1` indicates the coin uses proof of stake, so transactions created will have the `nTime` field. | +| segwit | Boolean | If `true`, AtomicDEX-API will use to `P2SH` segwit addresses. | +| version\_group\_id | integer | Optional, used by Zcash (and its forks') transactions. | +| consensus\_branch\_id | integer | Optional, used in Zcash (and its forks') transactions' signature hash calculation. | +| mature\_confirmations | integer | Number of blockchain confirmations required for coinbase output to be considered mature (spendable). | + +### UTXO coin example + + + ```json + { + "coin": "LTC", + "name": "litecoin", + "fname": "Litecoin", + "rpcport": 9332, + "pubtype": 48, + "p2shtype": 50, + "wiftype": 176, + "txfee": 0, + "dust": 5460, + "segwit": true, + "mm2": 1, + "required_confirmations": 2, + "avg_blocktime": 2.5, + "protocol": { + "type": "UTXO" + } + } + ``` + + +### Antara smartchain example + + + ```json + { + "coin": "MCL", + "asset": "MCL", + "fname": "MarmaraCreditLoops", + "rpcport": 33825, + "txversion": 4, + "overwintered": 1, + "mm2": 1, + "required_confirmations": 5, + "requires_notarization": false, + "avg_blocktime": 1, + "protocol": { + "type": "UTXO" + } + } + ``` + + +## 1c. EVM-like tokens (ETH/ERC20, MATIC/PLG20, BNB/BEP20) + +The token's contract **must** have `approve` and `transferFrom` methods. Additionally, the `transfer` and `transferFrom` methods must return a boolean value (`true/false`) indicating whether a transfer was successful. This requirement is actually a part of the ERC20 standard, but many tokens seem to not follow it. + +* `chain_id` - ID of the chain, see [Chainlist](https://chainlist.org/) +* Protocol `"type"` field: `"ETH"` or `"ERC20"` +* Protocol `"protocol_data"` field (ERC20 only): `"platform"` - `"ETH"`, `"ETC"` or other Ethereum forks. `"contract_address"` - ERC20 token [checksummed](https://coincodex.com/article/2078/ethereum-address-checksum-explained/) smart contract address. + +| Parameter | Type | Description | +| ----------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chain\_id | integer | To find the EVM chain ID, see [Chainlist](https://chainlist.org/) | +| protocol.type | string | Platform / protocol - e.g `ETH` for Ethereum, `ERC20` for ERC20 tokens on the Ethereum network | +| protocol.protocol\_data | object | Required for tokens only. | +| protocol.protocol\_data.platform | string | The parent coin of the token's platform - e.g `MATIC` for PLG20 tokens | +| protocol.protocol\_data.contract\_address | string | **Must be mixed case** The indentifying hex string for the token's contract. Can be found on sites like [EthScan](https://etherscan.io/), [BscScan](https://bscscan.com/) & [PolygonScan](https://polygonscan.com/) | + +### ERC20 token example + + + ```json + { + "coin": "USDC-ERC20", + "name": "usdc_erc20", + "fname": "USD Coin", + "rpcport": 80, + "mm2": 1, + "chain_id": 1, + "required_confirmations": 3, + "avg_blocktime": 0.25, + "protocol": { + "type": "ERC20", + "protocol_data": { + "platform": "ETH", + "contract_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" + } + } + } + ``` + + +### BEP20 token example + + + ```json + { + "coin": "USDC-BEP20", + "name": "usdc_bep20", + "fname": "USD Coin", + "rpcport": 80, + "mm2": 1, + "chain_id": 56, + "avg_blocktime": 0.05, + "required_confirmations": 3, + "protocol": { + "type": "ERC20", + "protocol_data": { + "platform": "BNB", + "contract_address": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d" + } + } + }, + ``` + + +## 1d. QRC20 tokens + +QTUM & QRC20 tokens are a special case which also support all fields of UTXO specific config. + + + ```json + { + "coin": "QC-QRC20", + "name": "qtum", + "fname": "Qcash", + "rpcport": 3889, + "pubtype": 58, + "p2shtype": 50, + "wiftype": 128, + "segwit": true, + "txfee": 0, + "mm2": 1, + "required_confirmations": 3, + "mature_confirmations": 500, + "avg_blocktime": 2.133, + "protocol": { + "type": "QRC20", + "protocol_data": { + "platform": "QTUM", + "contract_address": "0xf2033ede578e17fa6231047265010445bca8cf1c" + } + } + } + ``` + + +## 2. Icon file (required) + +* The icon file is required. +* Icon must be a .png format file. +* Dimensions of icon file is at least 128x128 pixels. +* Icon file name MUST be the coin/token ticker in **small letters** without protocl suffix - e.g. for KMD or KMD-BEP20, use `kmd.png`. +* Icon file location is [icons\_original](https://github.com/KomodoPlatform/coins/tree/master/icons_original) folder. + +## 3. Explorer URL (required, excluding tokens) + +* Tokens do not need this data, they will use the values for their parent coin. +* Explorer file name must be coin's ticker name in all **capital** letters. +* Explorer file name must not have any file extension. It is a file without any `.` extension. +* It must have a valid JSON array with at least one Explorer URL in it. Multiple explorer URLs are recommended - e.g. `["https://komodod.com/","https://kmd.explorer.dexstats.info/"]` +* Add the path suffixes for the explorer's address and transaction URLs in [explorer\_paths.json](https://github.com/KomodoPlatform/coins/blob/master/explorers/explorer_paths.json) + +## 4. Electrum Servers (Optional; Required for listing in Mobile GUIs) + +* Electrum file name must be coin's ticker name in all **capital** letters. +* Electrum file name must not have any file extension. It is a file without any `.` extension. +* It must be a valid JSON format as shown in the following example: +* Details of at least 2 Electrum servers must be provided. +* The address and port of electrum server are required. The address of electrum server can either be a DNS or an IP address. +* Protocol can be "SSL" or "TCP". For WebDEX (wasm) listings, SSL is required. +* Contact information must be provided in case the server admin needs to be contacted in emergency situations. Failing servers will result in an automatic delisting of your coin upon the next release of the AtomicDEX apps. +* The status of currently listed [ElectrumX](https://electrumx.readthedocs.io/en/latest/) servers is monitored via a public [API](https://electrum-status.dragonhound.info/api/v1/electrums_status) and [Dashboard](https://stats.kmd.io/atomicdex/electrum_status/). For help setting up Telegram or Discord alerts for your servers, join the `#dev-support` channel in the [Komodo Platform Discord](https://komodoplatform.com/discord). + + + ```json + [ + { + "url": "nmc.bitcoins.sk:50002", + "protocol": "SSL", + "disable_cert_verification": true, + "contact": [ + { "email": "electrum1_admin_email@example.com" }, + { "matrix": "@electrum1_admin:matrix.org" }, + { "skype": "example_username" }, + { "twitter": "example_username" }, + { "reddit": "example_username" }, + { "github": "example_username" }, + { "keybaseio": "example_username" } + ] + }, + { + "url": "electrum-nmc.le-space.de:50002", + "protocol": "SSL", + "disable_cert_verification": false, + "contact": [{ "email": "electrum2_admin_email@example.com" }] + } + ] + ``` + + +## 5. Ethereum info file (Required for EVM-like platforms) + +* Ethereum file name must be coin's ticker name in all **capital** letters. +* Ethereum file name must not have any file extension. It is a file without any `.` extension. +* Swap contract address must be the address of [etomic swap smart contract](https://github.com/artemii235/etomic-swap) deployed to ETH network, [example](https://etherscan.io/address/0x8500afc0bc5214728082163326c2ff0c73f4a871). +* At least minimum 2 or more URLs of RPC nodes must be provided. +* Contact information must be provided in case the server admin needs to be contacted in urgent cases. It can be any contact information out of the examples provided. +* The RPC node URL can either be a DNS or an IP address with port. +* It must be a valid JSON format as shown in the following example: + + + ```json + { + "swap_contract_address": "0x8500AFc0bc5214728082163326C2FF0C73f4a871", + "rpc_nodes": [ + { + "url": "http://ethnode.com:8545", + "contact": [ + { "email": "ethnode_admin_email@example.com" }, + { "matrix": "@ethnode_admin:matrix.org" }, + { "skype": "example_username" }, + { "twitter": "example_username" }, + { "reddit": "example_username" }, + { "github": "example_username" }, + { "keybaseio": "example_username" } + ] + }, + { + "url": "http://ethnode2.com:8545", + "contact": [{ "email": "ethnode2_admin_email@example.com" }] + } + ] + } + ``` + + +## 5. Forex, Nomics, CoinGecko & CoinPaprika Price IDs (optional) + +The API IDs are stored in json files within the `/api_ids` folder, and used to source price and chart date in AtomicDEX apps. + +For [CoinGecko](https://www.coingecko.com/en/coins/komodo) it is conveniently displayed on the right had side of a coins page as below - + + + +For [CoinPaprika](https://coinpaprika.com/coin/kmd-komodo/) it is the same as displayed in a coin's URL - + + + + + Nomics was shutdown + For `[Nomics](https://nomics.com/assets/kmd-komodo/widget)` you can find it under the "widget" tab for a coin. + + + + +For For Forex the API ID is the same as the [ISO 4217 currency code](https://en.wikipedia.org/wiki/ISO_4217). + +Add these IDs to their respective json file within the `/api_ids` folder in the format `"TICKER": "API_ID"` + +## 6. Derivation Path + +The [BIP44 derivation path](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) is now required to ensure Heirarchical deterministic wallet functionality. The best source for this data is via [Satoshi Labs SLP-044](https://github.com/satoshilabs/slips/blob/master/slip-0044.md) + +## 7. Trezor coin name (optional) + +For Trezor compatibility, this field is required. You can find this value at [https://trezor.io/coins](https://trezor.io/coins). Not all coins are listed on this page by default, but if compatible can be found by searching the supported coins. The value is the name of the coin in larger black text (not the grey text in brackets). E.g. for the image below, the Trezor coin name would be `Qtum`. + + + +## 8. Successful swap confirmation + +The coin must have participated in a successful Atomic Swap using [AtomicDEX-API](https://github.com/KomodoPlatform/komodo-defi-framework/) + +When submitting your coin addition request, please submit the URLs of the 5 transactions (`takerfee sent`, `maker payment`, `taker payment` and `taker payment spent`, `maker payment spent`) produced by successful swap in a new file inside the swaps directory- here's an [example for KMD-ETH](https://github.com/KomodoPlatform/coins/blob/master/swaps/KMD-ETH.md). This means that, before going through the further steps and submitting the information to this coins database repo, you would have performed a successful atomic swap. The further steps explain the expected files/values to be submitted. + +You can learn about performing an atomic swap from our documentation at [this link](/atomicdex/tutorials/) + +Activating a coin at [this link](/atomicdex/api/legacy/coin_activation/) + +Walkthrough at [this link](/atomicdex/tutorials/atomicdex-walkthrough/) + +If you have any questions, please ask in the `#support` channel in [our Discord server](https://komodoplatform.com/discord) or you can get help from the team at [coinintegration@komodoplatform.com](mailto:coinintegration@komodoplatform.com) or [partners@komodplatform.com](mailto:partners@komodplatform.com) . +export const title = "Query the MM2 SQLite Database"; +export const description = "This guide describes how to query the MM2 SQLite database."; + +# How to Query the MM2 SQLite Database + +The AtomicDEX-API stores historical information such as swaps and orders within an SQLite database, located under the DB user data folder (e.g. {'{folder continaing mm2 binary}'}/DB/{'{wallet identifying hex string}'}/MM2.db'). + +There are a variety of methods to query sqlite databases. Examples below show how to do a sqlite query in Linux terminal, but first you might need to install sqlite with `sudo apt install sqlite3`. + +The tables and columns available to query are as follows: + +## my\_swaps + +This table keeps a record of all swaps successfully performed in this pubkey's MM2.db + +| ID | Name | Type | Description | +| -- | ----------- | ------------ | ------------- | +| 0 | id | INTEGER | Primary Key | +| 1 | my\_coin | VARCHAR(255) | Coin sent | +| 2 | other\_coin | VARCHAR(255) | Coin received | +| 3 | uuid | VARCHAR(255) | Swap UUID | +| 4 | started\_at | INTEGER | Timestamp | + +#### Query: + +`sqlite3 ${PATH_TO_MM2_DB_FILE} "SELECT * FROM my_swaps WHERE id=2 LIMIT 1"` + +#### Response: + +`2|MARTY|DOC|7086bc8e-bdaa-44b0-ac9b-01aa8760b62b|1636956829` + +## stats\_swaps + +This table keeps a detailed record of all swaps performed (including failed) in this pubkey's MM2.db + +| ID | Name | Type | Description | +| -- | ----------------------- | ------------ | ----------------------------------------------- | +| 0 | id | INTEGER | Primary key | +| 1 | maker\_coin | VARCHAR(255) | Maker coin | +| 2 | taker\_coin | VARCHAR(255) | Taker coin | +| 3 | uuid | VARCHAR(255) | Swap UUID | +| 4 | started\_at | INTEGER | Timestamp | +| 5 | finished\_at | INTEGER | Timestamp | +| 6 | maker\_amount | DECIMAL | Maker coin | +| 7 | taker\_amount | DECIMAL | Taker coin | +| 8 | is\_success | INTEGER | `1` for successful, `0` for failed | +| 9 | maker\_coin\_ticker | VARCHAR(255) | Maker coin ticker | +| 10 | maker\_coin\_platform | VARCHAR(255) | Maker coin platform | +| 11 | taker\_coin\_ticker | VARCHAR(255) | Taker coin ticker | +| 12 | taker\_coin\_platform | VARCHAR(255) | Taker coin platform | +| 13 | maker\_coin\_usd\_price | DECIMAL | USD price of maker coin at the time of the swap | +| 14 | taker\_coin\_usd\_price | DECIMAL | USD price of taker coin at the time of the swap | +| 15 | taker\_pubkey | DECIMAL | Taker pubkey | +| 16 | maker\_pubkey | DECIMAL | Maker pubkey | + +#### Query: + +`sqlite3 ${PATH_TO_MM2_DB_FILE} "SELECT * FROM stats_swaps WHERE taker_coin = 'DOGE' and maker_coin = 'DGB' ORDER BY finished_at DESC LIMIT 1;"` + +#### Response: + +``` +8|DGB|DOGE|c9515636-f5a4-4767-a0af-c69e59086899|1678815183|1678815631|200|28|1|DGB||DOGE||0.0108|0.07673|02d8064eece4fa5c0f8dc0267f68cee9bdd527f9e88f3594a323428718c391ecc2|03a93f666b9030958f282edd2904f0a33278c0c676ae132d2094840fe722f011c3 +``` + +## my\_orders + +This table keeps a detailed record of all orders placed in this pubkey's MM2.db + +| ID | Name | Type | Description | +| -- | --------------- | ------------ | ------------------------------------------------- | +| 0 | id | INTEGER | Primary Key | +| 1 | uuid | VARCHAR(255) | Order UUID | +| 2 | type | VARCHAR(255) | Order Type | +| 3 | initial\_action | VARCHAR(255) | `Buy` or `Sell`. Setprice maker orders are `Sell` | +| 4 | base | VARCHAR(255) | Base Coin | +| 5 | rel | VARCHAR(255) | Rel Coin | +| 6 | price | DECIMAL | Order Price | +| 7 | volume | DECIMAL | Order Volume | +| 8 | created\_at | INTEGER | Timestamp | +| 9 | last\_updated | INTEGER | Timestamp | +| 10 | was\_taker | INTEGER | `1` if taker, `2` if maker | +| 11 | status | VARCHAR(255) | Order status | + +#### Query: + +`sqlite3 ${PATH_TO_MM2_DB_FILE} "SELECT * FROM my_orders WHERE base = 'DOC' and rel= 'MARTY' LIMIT 6"` + +#### Response: + +``` +154|6053016b-e1ba-490f-9501-eafb69b4d3a7|Taker|Buy|DOC|MARTY|0.03|1|1640159991278|1640160021808|0|TimedOut +266|77d79265-da87-48bb-aee3-7cc87f442a55|Maker|Buy|DOC|MARTY|0.0505|3|1640857934304|1640874662778|1|InsufficientBalance +267|4c6341d6-1e89-4c3b-8612-a930754701f2|Taker|Sell|DOC|MARTY|1|2|1640872463330|1640872467129|0|Fulfilled +290|57c2b270-ee73-4a21-8fa4-4b8c2d76fc02|Maker|Buy|DOC|MARTY|0.1|0.1|1641539601576|1641539631823|1|ToMaker +291|9cba3b40-2426-4fbf-80c8-2a65c8661eed|Maker|Sell|DOC|MARTY|1|1|1641539652421|1641539813001|0|Cancelled +294|fedcc1e0-a059-47c6-bbfc-3a61454f1208|Maker|Sell|DOC|MARTY|1|12|1641546891912|1641546891912|0|Created +``` + +## nodes + +This table stores a record of all nodes [added for stats collection](/atomicdex/api/v20/add_node_to_version_stat/) in this pubkey's MM2.db + +| ID | Name | Type | Description | +| -- | -------- | ------------ | ----------- | +| 0 | id | INTEGER | Primary Key | +| 1 | name | VARCHAR(255) | Node name | +| 2 | address | VARCHAR(255) | Node IP | +| 3 | peer\_id | VARCHAR(255) | Node PeerID | + +#### Query: + +`sqlite3 ${PATH_TO_MM2_DB_FILE} "SELECT * FROM nodes WHERE name = 'dragonhound_DEV'"` + +#### Respose: + +`37|dragonhound_DEV|104.238.221.61|12D3KooWEnrvbqvtTowYMR8FnBeKtryTj9RcXGx8EPpFZHou2ruP` + +## stats\_nodes + +This table stores a record of results returned by registered nodes [tracked for node stats collection](/atomicdex/api/v20/start_version_stat_collection/) in this pubkey's MM2.db + +| ID | Name | Type | Description | +| -- | --------- | ------------ | -------------------------------- | +| 0 | id | INTEGER | Primary Key | +| 1 | name | VARCHAR(255) | Node name | +| 2 | version | VARCHAR(255) | Node AtomicDEX-API (mm2) version | +| 3 | timestamp | INTEGER | Timestamp | +| 4 | error | VARCHAR(255) | Error details | + +#### Query: + +`sqlite3 ${PATH_TO_MM2_DB_FILE} "SELECT * FROM stats_nodes WHERE name = 'dragonhound_DEV'" LIMIT 3` + +#### Response: + +``` +540|dragonhound_DEV||1638542507|DialFailure +70638|dragonhound_DEV|2.1.4401_mm2.1_87837cb54_Linux_Release|1640270702| +70692|dragonhound_DEV||1640271615|Error on request the peer PeerId("12D3KooWEnrvbqvtTowYMR8FnBeKtryTj9RcXGx8EPpFZHou2ruP"): "Canceled". Request next peer +``` +export const title = "Setup AtomicDEX AWS"; +export const description = "Learn how to set up and use the AtomicDEX API on an AWS EC2 instance."; + +# How to Setup and use the AtomicDEX API on an AWS EC2 instance + +## Create the AtomicDEX setup script + +* Create a file named `atomicDEX_API_setup.txt` +* Copy the code below into the file +* In the code, find the text, `SEED_WORDS_PLEASE_REPLACE`, and replace it with custom seed words of your own + * These seed words are used to generate new blockchain addresses, and therefore the seed words should be treated like a unique password +* Find the text, `RPC_PASS_PLEASE_REPLACE`, and replace this also with a strong password + * This is used to authenticate yourself while communicating with the AtomicDEX API + +```bash +#!/bin/bash +apt-get update +apt-get install -y unzip jq curl +wget $(curl --silent https://api.github.com/repos/KomodoPlatform/atomicDEX-API/releases | jq -r '.[0].assets[] | select(.name | endswith("Linux-Release.zip")).browser_download_url') +wget https://raw.githubusercontent.com/KomodoPlatform/coins/master/coins +unzip *Linux-Release.zip +./mm2 "{\"netid\":7777,\"gui\":\"aws_cli\",\"passphrase\":\"SEED_WORDS_PLEASE_REPLACE\",\"rpc_password\":\"RPC_PASS_PLEASE_REPLACE\",\"myipaddr\":\"0.0.0.0\"}" +``` + +## Install AWS CLI , get AWS access credentials + +#### Installation + +```bash +sudo apt-get install awscli +``` + +To obtain access credentials, log in to your AWS account and create an IAM user as described in this linked post [https://tntdrive.com/where-do-i-get-my-access-keys.aspx#create-iam-user-and-keys.](https://tntdrive.com/where-do-i-get-my-access-keys.aspx#create-iam-user-and-keys) While following the post, make sure to select the policy `AmazonEC2FullAccess` instead of `AmazonS3FullAccess`. Copy the "Access key ID" and "Secret access key" to another location while completing the post's instructions; these are necessary later. + +Make sure the SSH directory exists. + +```bash +mkdir -p ~/.ssh/ +``` + +## Create an EC2 Instance + +Open a terminal, navigate to the directory where the file `atomicDEX_API_setup.txt` is located, and issue the following commands. + +In the terminal commands below, note that you must first change the texts `REPLACE_ACCESS_KEY_ID` and `REPLACE_SECRET_ACCESS_KEY` with your "Access key ID" and "Secret access key" obtained during the setup procedure. If necessary, also change the region where the EC2 instance is hosted by changing all instances of `us-east-1` in the commands. + +```bash +export AWS_ACCESS_KEY_ID=REPLACE_ACCESS_KEY_ID +export AWS_SECRET_ACCESS_KEY=REPLACE_SECRET_ACCESS_KEY +aws ec2 create-key-pair --region us-east-1 --key-name mm2Keypair | jq -r .KeyMaterial > ~/.ssh/mm2.pem +chmod 400 ~/.ssh/mm2.pem +sgID=$(aws ec2 create-security-group --region us-east-1 --group-name sgMM2 --description "sg-mm2"| jq -r '.GroupId') +aws ec2 authorize-security-group-ingress --region us-east-1 --group-name sgMM2 --protocol all --cidr 0.0.0.0/0 +aws ec2 run-instances --region us-east-1 --image-id ami-083d24fb90054e5f0 --count 1 --instance-type t3.micro --key-name mm2Keypair --security-group-ids $sgID --user-data file://atomicDEX_API_setup.txt +``` + +If you see an error similar to the following, click the link that is found in the error. On the page to which your browser is directed click the button "Continue to Subscribe" and then click the button "Accept Terms". + +```bash +An error occurred (OptInRequired) when calling the RunInstances operation: In order to use this AWS Marketplace product you need to accept terms and subscribe. To do so please visit https://aws.amazon.com/marketplace/pp?sku=auhljmclkudu651zy27rih2x2 + +``` + +Wait for the Subscription to be processed and issue the last command again. + +Verify that the instance launched successfully by visiting [this linked page.](https://us-east-1.console.aws.amazon.com/ec2/v2/home?region=us-east-1) + +From the linked page above, copy the "IPv4 Public IP" of the instance and use it to replace the text `REPLACE_PUBLIC_IP` in the following command. + +```bash +nodeIp=REPLACE_PUBLIC_IP +ssh -o IdentitiesOnly=yes -i ~/.ssh/mm2.pem admin@$nodeIp 'curl -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"testpsw\",\"method\":\"version\"}"' +``` + +Edit the command above as necessary to exchange one curl command for another from [the AtomicDEX API.](https://developers.atomicdex.io/atomicdex/atomicdex-api) +export const title = "Chapter 00 - Bitcoin Protocol Basics"; +export const description = "Learn the basics of the Bitcoin protocol, including unspent transaction outputs (UTXOs) and the concept of the mempool, in this introductory chapter."; + +# Chapter 00 - Bitcoin Protocol Basics + +There are many aspects of the bitcoin protocol that isnt needed to understand the CC contracts dependence on it. Such details will not be discussed. The primary aspect is the utxo, unspent transaction output. Just a fancy name for `txid/vout`, so when you sendtoaddress some coins, it creates a `txid` and the first output is `vout.0`, combine it and `txid/0` is a specific utxo. + +Of course, to understand even this level of detail requires that you understand what a `txid` is, but there are plenty of reference materials on that. It is basically the 64 char long set of letters and numbers that you get when you send funds. + +Implicit with the utxo is that it prevents double spends. Once you spend a utxo, you cant spend it again. This is quite an important characteristic and while advanced readers will point out chain reorgs can allow a double spend, we will not confuse the issue with such details. The important thing is that given a blockchain at a specific height's blockhash, you can know if a `txid/vout` has been spent or not. + +There are also the transactions that are in memory waiting to be mined, the mempool. And it is possible for the utxo to be spent by a `tx` in the mempool. However since it isnt confirmed yet, it is still unspent at the current height, even if we are pretty sure it will be spent in the next block. + +A useful example is to think about a queue of people lined up to get into an event. They need to have a valid ticket and also to get into the queue. After some time passes, they get their ticket stamped and allowed into the event. + +In the utxo case, the ticket is the spending transaction and the event is the confirmed blockchain. The queue is the mempool. +export const title = "Chapter 01 - OP_CHECKCRYPTOCONDITION"; +export const description = "Explore Bitcoin payment scripts: P2PKH, P2SH, and the introduction of OP_CHECKCRYPTOCONDITION opcode for CryptoConditions."; + +# Chapter 01 - OP\_CHECKCRYPTOCONDITION + +In the prior chapter the utxo was explained. However, the specific mechanism used to send a payment was not explained. Contrary to what most people might think, on the blockchain there are not entries that say "pay X amount to address". Instead what exists is a bitcoin script that must be satisfied in order for the funds to be able to be spent. + +Originally, there was the pay to pubkey script: + +```bash + +``` + +About as simple of a payment script that you can get. Basically the pubkey's signature is checked and if it is valid, you get to spend it. One problem satoshi realized was that with Quantum Computers such payment scripts are vulnerable! So, he made a way to have a cold address, ie. an address whose pubkey isnt known. At least it isnt known until it is spent, so it is only Quantum resistant prior to the first spend. This line of reasoning is why we have one time use addresses and a new change address for each transaction. Maybe in some ways, this is too forward thinking as it makes things a lot more confusing to use and easier to lose track of all the required private keys. + +However, it is here to stay and its script is: + +```bash + +``` + +With this, the blockchain has what maps to "pay to address", just that the address is actually a base58 encoded (prefix + pubkeyhash). Hey, if it wasnt complicated, it would be easy! + +In order to spend a `p2pkh` (pay to pubkey hash) utxo, you need to divulge the pubkey in addition to having a valid signature. After the first spend from an address, its security is degraded to `p2pk` (pay to pubkey) as its pubkey is now known. The net result is that each reused address takes 25 extra bytes on the blockchain, and that is why for addresses that are expected to be reused, I just use the p2pk script. + +Originally, bitcoin allowed any type of script opcodes to be used directly. The problem was some of them caused problems and satoshi decided to disable them and only allow standard forms of payments. Thus the `p2pk` and `p2pkh` became 99%+ of bitcoin transactions. However, going from having a fully scriptable language that can create countless payment scripts (and bugs!), to having just 2 . . . well it was a "short term" limitation. It did last for some years but eventually a compromise `p2sh` script was allowed to be standard. This is a pay to script hash, so it can have a standard format as the normal `p2pkh`, but have infinitely more flexibility. + +```bash +