Cross-Chain API
The Crosschain API allows a user to transfer (or "migrate") assets from one chain to another. Compatible forms of assets include coins and tokens.
The fundamental principle of migration is that a specific amount of assets are burned in the source chain and then the same specific amount of assets are created on the destination chain.
- MoMoM notarized migration
- "MoMoM" stands for "Merkle root of Merkle roots of Merkle roots"
- An alternative migration method with notarization of the given burn transaction by notary operators (this is a backup solution to the above MoMoM method)
- Self-managed import
- Make an export or burn transaction in the source chain.
- Create an "import" transaction for the burned value.
- This is created on the source chain, but the transaction is sent on the destination chain
- Komodo's validation code checks that for the import transaction there exists a corresponding burn transaction, and that this transaction is not spent more than once.
The source and destination chains should have the same CCid
parameter (ac_cc). The value of this parameter should be greater than 100; this indicates to the Komodo software that the coins on both chains are fungible with each other.
- In the examples, we use two chains. The source chain is CFEKHOUND and the destination chain is CFEKDRAGON.
The MoMoM notarized migration API allows the migration of coin or token value using Komodo's notary network. This facilitates the highly scalable multi-chain architecture of Smart Chains on the Komodo Platform.
Notary nodes store "fingerprints" of the blocks belonging to the blockchains of the various assets in the main Komodo chain (KMD). The "fingerprints" can also be referred to as MoM, or merkle root of merkle roots
.
The fingerprints of fingerprints are delivered back into the blockchain of the assets as back notarizations. To learn more about the notarization process, please visit this linked article.
- On the source chain, the user calls the method migrate_createburntransaction and broadcasts the hex of the returned burn transaction (
BurnTxHex
) using the sendrawtransaction method. The user also receives thepayouts object
from this method - On the source chain, the user runs migrate_createimporttransaction with the hex value of the burn transaction and the
payouts object
in hex format as arguments - On the main Komodo chain (KMD) the user calls migrate_completeimporttransaction with the import transaction in hex format which was received from the previous call as an argument.
- As a part of this process, the proof object for the burn transaction inside the import transaction is extended with MoMoM data. This allows verification of the burn transaction on the destination chain by using the standard Komodo notarization process without the need to create additional proof objects
migrate_createburntransaction destChain destAddress amount [tokenid]
The migrate_createburntransaction
method creates a transaction burning a specific amount of coins or tokens. This method also creates a payouts object
which is later used to create an import transaction for the value corresponding to the burned amount. This method should be called on the source chain.
The method creates a burn transaction and returns it. This should be broadcast to the source chain using the sendrawtransaction method. After the burn transaction is successfully mined, the user might have to wait for some amount of time for the back notarization to reach the source chain. The back notarization contains the MoMoM
fingerprints of the mined block that contains the burn transaction.
The hex value of the burn transaction along with the other returned value payouts
are used as arguments for the migrate_createimporttransaction
method.
Name | Type | Description |
---|---|---|
"destChain" | (string, required) | the name of the destination chain |
"destAddress" | (string, required) | the address on the destination chain where coins are to be sent; the pubkey if tokens are to be sent |
"amount" | (numeric, required) | the amount in coins or tokens that should be burned on the source chain and created on the destination chain; if the indicated assets are tokens, the amount can be set only to 1, as only migration of non-fungible tokens are supported at this time |
"tokenid" | (string, optional) | token id in hex; if set, the software assumes that the user is migrating tokens |
Name | Type | Description |
---|---|---|
"payouts" | (string) | a hex string of the created payouts; this value is passed into the migrate_createimporttransaction method |
"BurnTxHex" | (string) | a hex string of the returned burn transaction |
Command:
./komodo-cli -ac_name=CFEKHOUND migrate_createburntransaction CFEKDRAGON RBQ1XwmzduHvciRJbXbWY9YBSNtaqZvfC4 7.77
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "migrate_createburntransaction", "params": ["CFEKDRAGON","RBQ1XwmzduHvciRJbXbWY9YBSNtaqZvfC4","7.77"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
Broadcast the transaction:
./komodo-cli -ac_name=CFEKHOUND sendrawtransaction 0400008085202f8901a91010764d209bb4bdc9586f44cfced36ea75289026e714e040acac9eea475c00c0000006b483045022100e57af148204d15daa51fde4d21f0a0e54e7dd237f2bb4ee4a82bf34b27002178022052dc8e4601dd0bcbab3024ef47517391258fe5ef0fc2d4be38cc10e0c15fdbb6012103336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8ffffffff02403b5a0c00000000232103336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8ac503b502e000000003b6a39e283150a4346454b445241474f4e8c5970dd6f483fef99e6be0bbc64adc1ab1060e341a5c2c8b0f0a56a6d7936e80a094346454b484f554e4400000000466c00000000000000000000000000
migrate_converttoexport rawtx dest_symbol
The migrate_converttoexport
method allows the user to create a customized burn transaction (as opposed to a fully automated burn transaction). This method converts a given transaction to a burn transaction.
The method adds proof data to the transaction, extracts the transaction vouts, calculates their value, and burns the value by sending it to an opreturn vout. This vout is then added to the created transaction. (An opreturn vout cannot be spent at a later date, and therefore funds sent to an opreturn vout are permanently burnt.)
The other returned value, payouts
, is used in the migrate_createimporttransaction
method.
The caller of the method bears the responsibility to fund and sign the returned burn transaction using the methods fundrawtransaction and signrawtransaction.
The signed burn transaction must be broadcast to the source chain using the sendrawtansaction method.
Limitations
- The migrate_converttoexport method supports only coins (tokens are not supported)
- The burn transaction must be stored in the import transaction's opreturn vout. Because an opreturn's data size is limited to 10,001 bytes, we recommend that the user limit the burn transaction's size to 30% of the opreturn object
Name | Type | Description |
---|---|---|
"burntx" | (string, required) | the burn transaction in hex format |
"destChain" | (string, required) | the name of the destination chain |
Name | Type | Description |
---|---|---|
"payouts" | (string) | a hex string of the created payouts; this is passed into the migrate_createimporttransaction method |
"exportTx" | (string) | a hex string of the returned burn transaction |
Create a raw transaction:
./komodo-cli -ac_name=CFEKHOUND createrawtransaction '[{"txid":"ad930d24e0d1c060d7acf46170e31b6863cb429969449d81babd7a644745bfff","vout":6}]' '{"RBQ1XwmzduHvciRJbXbWY9YBSNtaqZvfC4":0.077}'
Convert it to an export transaction:
./komodo-cli -ac_name=CFEKHOUND migrate_converttoexport 0400008085202f8901ffbf4547647abdba819d44699942cb63681be37061f4acd760c0d1e0240d93ad0600000000ffffffff01207e7500000000001976a914173a5c80d8956eed4f1b2d46e3855fc97b3b64cf88ac00000000f36f00000000000000000000000000 CFEKDRAGON
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "migrate_converttoexport", "params": ["0400008085202f8901ffbf4547647abdba819d44699942cb63681be37061f4acd760c0d1e0240d93ad0600000000ffffffff01207e7500000000001976a914173a5c80d8956eed4f1b2d46e3855fc97b3b64cf88ac00000000f36f00000000000000000000000000","CFEKDRAGON"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
Sign the export transaction:
./komodo-cli -ac_name=CFEKHOUND signrawtransaction 0400008085202f8901ffbf4547647abdba819d44699942cb63681be37061f4acd760c0d1e0240d93ad0600000000ffffffff0130a57500000000003b6a39e283150a4346454b445241474f4efa2fe05c5d6cb0bf5a9be2aec4f1cd7a10c9472d6abc1e9bb9dc5903a4ec1a5b0a094346454b484f554e4400000000f36f00000000000000000000000000
Broadcast the export transaction (using the method sendrawtransaction, with the option allowhighfees
set to true
)
./komodo-cli -ac_name=CFEKHOUND sendrawtransaction 0400008085202f8901ffbf4547647abdba819d44699942cb63681be37061f4acd760c0d1e0240d93ad0600000049483045022100f609176d691bade4060799424d7d3813ea3337ad8aabc79bb6fd51797b6ec9c80220073d1ba3a74da7e33bcccf5851c2152d66fcd7aa0d2c1521ec8b2ab444d656f801ffffffff0130a57500000000003b6a39e283150a4346454b445241474f4efa2fe05c5d6cb0bf5a9be2aec4f1cd7a10c9472d6abc1e9bb9dc5903a4ec1a5b0a094346454b484f554e4400000000f36f00000000000000000000000000 true
To see the rest of the process when migrate_converttoexport
is used, click the following button:
migrate_createimporttransaction burntx payouts [notaryTxid1]...[notaryTxidN]
- The
migrate_createimporttransaction
method performs the initial step in creating an import transaction. This method should be called on the source chain. - This method returns a created import transaction in hex format. This string should be passed to the
migrate_completeimporttransaction
method on the main KMD chain to be extended with theMoMoM
proof object. - When using the MoMoM backup solution (described later), the created import transaction is not passed to the
migrate_completeimporttransaction
method. - The user may need to wait for some time before the back notarizations objects are stored in the destination chain.
Name | Type | Description |
---|---|---|
"burntx" | (string, required) | the burn transaction in hex format returned from the previous method |
"payouts" | (string, required) | the payouts object in hex format returned from the previous method and used for creating an import transaction |
"notaryTxid1" | (string, optional) | the notary approval transaction id 1, to be passed if the MoMoM backup solution is used for notarization |
"notaryTxidN" | (string, optional) | the notary approval transaction id N, to be passed if the MoMoM backup solution is used for notarization |
Name | Type | Description |
---|---|---|
"ImportTxHex" | (string) | the created import transaction in hex format |
Command:
./komodo-cli -ac_name=CFEKHOUND migrate_createimporttransaction 0400008085202f8901a91010764d209bb4bdc9586f44cfced36ea75289026e714e040acac9eea475c00c0000006b483045022100e57af148204d15daa51fde4d21f0a0e54e7dd237f2bb4ee4a82bf34b27002178022052dc8e4601dd0bcbab3024ef47517391258fe5ef0fc2d4be38cc10e0c15fdbb6012103336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8ffffffff02403b5a0c00000000232103336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8ac503b502e000000003b6a39e283150a4346454b445241474f4e8c5970dd6f483fef99e6be0bbc64adc1ab1060e341a5c2c8b0f0a56a6d7936e80a094346454b484f554e4400000000466c00000000000000000000000000 014014502e000000001976a914173a5c80d8956eed4f1b2d46e3855fc97b3b64cf88ac
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "migrate_createimporttransaction", "params": ["0400008085202f8901a91010764d209bb4bdc9586f44cfced36ea75289026e714e040acac9eea475c00c0000006b483045022100e57af148204d15daa51fde4d21f0a0e54e7dd237f2bb4ee4a82bf34b27002178022052dc8e4601dd0bcbab3024ef47517391258fe5ef0fc2d4be38cc10e0c15fdbb6012103336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8ffffffff02403b5a0c00000000232103336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8ac503b502e000000003b6a39e283150a4346454b445241474f4e8c5970dd6f483fef99e6be0bbc64adc1ab1060e341a5c2c8b0f0a56a6d7936e80a094346454b484f554e4400000000466c00000000000000000000000000","014014502e000000001976a914173a5c80d8956eed4f1b2d46e3855fc97b3b64cf88ac"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
migrate_completeimporttransaction importtx
The migrate_completeimporttransaction
method performs the finalizing step in creating an import transaction. This method should be called on the KMD (Komodo) chain.
This method returns the import transaction in hex format, updated with the MoMoM
proof object. This object provides confirmation that the burn transaction exists in the source chain.
The finalized import transaction should be broadcast on the destination chain through the sendrawtransaction method.
Komodo recommends that the user wait until the notarization objects are stored in the destination chain before broadcasting the import transaction. Otherwise an error message is returned.
In the event that an error is returned, simply wait until the notarization objects are stored in the KMD chain and try again.
Name | Type | Description |
---|---|---|
"importtx" | (string, required) | the import transaction in hex format created using the previous method |
"offset" | (string, optional) | the number of blocks below the current KMD(Komodo) blockchain height in which a MoMoM proof must be searched |
Name | Type | Description |
---|---|---|
"ImportTxHex" | (string) | import transaction in hex extended with the MoMoM proof of burn transaction |
Command:
./komodo-cli migrate_completeimporttransaction 0400008085202f89011016cf36b2605abe44354cd328d8cba6638c6cc53808d4e16609637e3f1c9fd100ca9a3b0201e2ffffffff024014502e000000001976a914173a5c80d8956eed4f1b2d46e3855fc97b3b64cf88ac0000000000000000fdc9016a4dc501e211da14c5a904dcf9dcc5c4471bae0f3e90274bc782fcaf7a828c23190dbbd3392205042cd74dc8b4504472d782478b374fe3fa406f9b9199d5b8ccac7c202a73c812b6f7fb8e5644af270917b10fa879a0c5636de719d308efd245ff5613450b934a5f32fd21b84a67d7b6be78b5d625af836cf7efddab3c6e8fea54345bab9ea7732cf073ef25f0b8a0764d928c8a420d45beb793fa8ea93432a908c808e4f47daadf0400008085202f8901a91010764d209bb4bdc9586f44cfced36ea75289026e714e040acac9eea475c00c0000006b483045022100e57af148204d15daa51fde4d21f0a0e54e7dd237f2bb4ee4a82bf34b27002178022052dc8e4601dd0bcbab3024ef47517391258fe5ef0fc2d4be38cc10e0c15fdbb6012103336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8ffffffff02403b5a0c00000000232103336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8ac503b502e000000003b6a39e283150a4346454b445241474f4e8c5970dd6f483fef99e6be0bbc64adc1ab1060e341a5c2c8b0f0a56a6d7936e80a094346454b484f554e4400000000466c0000000000000000000000000000000000000000000000000000000000000000
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "migrate_completeimporttransaction", "params": ["0400008085202f89011016cf36b2605abe44354cd328d8cba6638c6cc53808d4e16609637e3f1c9fd100ca9a3b0201e2ffffffff024014502e000000001976a914173a5c80d8956eed4f1b2d46e3855fc97b3b64cf88ac0000000000000000fd49026a4d4502e211a2f7550475bf21bac89b760b8c1e6a114d77c22de1584f3d65a09b98fe73360945082cd74dc8b4504472d782478b374fe3fa406f9b9199d5b8ccac7c202a73c812b6f7fb8e5644af270917b10fa879a0c5636de719d308efd245ff5613450b934a5f32fd21b84a67d7b6be78b5d625af836cf7efddab3c6e8fea54345bab9ea7732cf073ef25f0b8a0764d928c8a420d45beb793fa8ea93432a908c808e4f47daadfdfaa753cfdd54be8cc63b15bc2544964c03c43e0645a1ea9302522a1c9daf4c19dd9ff959973a556e4761ae171363572f782f5660a89acde315cd811a1b42140fa6d1de2ced3e371e4f8e4bca493a23d6121a608ccc0d66eb45b3ccce9518612bef75468f0fe5310972c8059e9aabf86b59a824bf5e2ac6f6b6eeb7dc171ebcb0400008085202f8901a91010764d209bb4bdc9586f44cfced36ea75289026e714e040acac9eea475c00c0000006b483045022100e57af148204d15daa51fde4d21f0a0e54e7dd237f2bb4ee4a82bf34b27002178022052dc8e4601dd0bcbab3024ef47517391258fe5ef0fc2d4be38cc10e0c15fdbb6012103336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8ffffffff02403b5a0c00000000232103336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8ac503b502e000000003b6a39e283150a4346454b445241474f4e8c5970dd6f483fef99e6be0bbc64adc1ab1060e341a5c2c8b0f0a56a6d7936e80a094346454b484f554e4400000000466c0000000000000000000000000000000000000000000000000000000000000000"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
Broadcast the transaction:
./komodo-cli CFEKDRAGON sendrawtransaction 0400008085202f89011016cf36b2605abe44354cd328d8cba6638c6cc53808d4e16609637e3f1c9fd100ca9a3b0201e2ffffffff024014502e000000001976a914173a5c80d8956eed4f1b2d46e3855fc97b3b64cf88ac0000000000000000fd49026a4d4502e211a2f7550475bf21bac89b760b8c1e6a114d77c22de1584f3d65a09b98fe73360945082cd74dc8b4504472d782478b374fe3fa406f9b9199d5b8ccac7c202a73c812b6f7fb8e5644af270917b10fa879a0c5636de719d308efd245ff5613450b934a5f32fd21b84a67d7b6be78b5d625af836cf7efddab3c6e8fea54345bab9ea7732cf073ef25f0b8a0764d928c8a420d45beb793fa8ea93432a908c808e4f47daadfdfaa753cfdd54be8cc63b15bc2544964c03c43e0645a1ea9302522a1c9daf4c19dd9ff959973a556e4761ae171363572f782f5660a89acde315cd811a1b42140fa6d1de2ced3e371e4f8e4bca493a23d6121a608ccc0d66eb45b3ccce9518612bef75468f0fe5310972c8059e9aabf86b59a824bf5e2ac6f6b6eeb7dc171ebcb0400008085202f8901a91010764d209bb4bdc9586f44cfced36ea75289026e714e040acac9eea475c00c0000006b483045022100e57af148204d15daa51fde4d21f0a0e54e7dd237f2bb4ee4a82bf34b27002178022052dc8e4601dd0bcbab3024ef47517391258fe5ef0fc2d4be38cc10e0c15fdbb6012103336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8ffffffff02403b5a0c00000000232103336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8ac503b502e000000003b6a39e283150a4346454b445241474f4e8c5970dd6f483fef99e6be0bbc64adc1ab1060e341a5c2c8b0f0a56a6d7936e80a094346454b484f554e4400000000466c0000000000000000000000000000000000000000000000000000000000000000
There is an alternative solution to notarize burn transactions. This method is useful when the automated MoMoM notarization method fails or is slow.
In this method, the user sends burn transactions to a special publishing resource that is monitored by the notary operators. The notary operators check this publishing resource, pick a burn transaction, validate and check the existence of the burn transaction in its source chain. The notary operators then create an approval transaction in the destination chain and return the transaction ids to the publishing resource.
- A user creates a burn transaction using the migrate_createburntransaction method and publishes the transaction in hex format to a publishing resource
- The publishing resource is monitored by the notary operators (currently the discord channel: #cc-momom)
- The notary operators must collect the burn transaction, and check its validity and existence in the source chain
- To check the transaction, the notary operators use the
migrate_checkburntransactionsource
method - If the burn transaction is successfully validated, the notary operators must create approval transactions using the method migrate_createnotaryapprovaltransaction in the destination chain and publish their transaction ids back into the publishing resource
- To check the transaction, the notary operators use the
- The user collects the transaction ids and calls the migrate_createimporttransaction method, passing the collected notary approval transaction ids as arguments in the destination chain
- Currently, the user must have at least 5 successful notary-approval transactions for an import transaction to be considered as valid in the destination chain
migrate_checkburntransactionsource burntxid
The migrate_checkburntransactionsource
method allows a notary operator to check the burn transaction's structure and verify its presence in the source chain.
Name | Type | Description |
---|---|---|
"burntxid" | (string, required) | the burn transaction's id |
Name | Type | Description |
---|---|---|
"sourceSymbol" | (string) | the source chain's name |
"targetSymbol" | (string) | the target chain's name |
"targetCCid" | (number) | the target chain's CCid |
"tokenid" | (string, optional) | the token id if a token is to be migrated |
"TxOutProof" | (string) | the proof of the burn transaction's existence in the source chain |
Command:
./komodo-cli -ac_name=CFEKHOUND migrate_checkburntransactionsource d19f1c3f7e630966e1d40838c56c8c63a6cbd828d34c3544be5a60b236cf1610
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "migrate_checkburntransactionsource", "params": ["d19f1c3f7e630966e1d40838c56c8c63a6cbd828d34c3544be5a60b236cf1610"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
migrate_createnotaryapprovaltransaction burntxid txoutproof
A notary operator uses the migrate_createnotaryapprovaltransaction
method to create an approval transaction in the destination chain with the proof of the burn transaction's existence in the source chain.
The returned notary approval transaction should be broadcast to the destination chain using the sendrawtransaction method.
Name | Type | Description |
---|---|---|
"burntxid" | (string, required) | the burn transaction's id |
"txoutproof" | (string, required) | the proof of the burn transaction's existence |
Name | Type | Description |
---|---|---|
"NotaryTxHex" | (string) | notary approval transaction in hex format |
Command:
./komodo-cli -ac_name=CFEKHOUND migrate_createnotaryapprovaltransaction d19f1c3f7e630966e1d40838c56c8c63a6cbd828d34c3544be5a60b236cf1610 040000009c6c2e1c0607ea57d44d6d0518cebc341a76e8f294ad6d2844d84f09983b35013bfacfeb3d1a412c1261f59f122fae6ae3d657d3a1871902282519a0b0d08045fbc2f4300c01f0b7820d00e3347c8da4ee614674376cbc45359daa54f9b5493ec64bd45c8fab0220360057fb64b4378bb1a33d9dcf9acf6e5b7c42f6a08db8eb87bfaad001910000143427efb28257954cb4e6596f4e06bdcad43cb9a402000000022cd74dc8b4504472d782478b374fe3fa406f9b9199d5b8ccac7c202a73c812b61016cf36b2605abe44354cd328d8cba6638c6cc53808d4e16609637e3f1c9fd10105
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "migrate_createnotaryapprovaltransaction", "params": ["d19f1c3f7e630966e1d40838c56c8c63a6cbd828d34c3544be5a60b236cf1610","040000009c6c2e1c0607ea57d44d6d0518cebc341a76e8f294ad6d2844d84f09983b35013bfacfeb3d1a412c1261f59f122fae6ae3d657d3a1871902282519a0b0d08045fbc2f4300c01f0b7820d00e3347c8da4ee614674376cbc45359daa54f9b5493ec64bd45c8fab0220360057fb64b4378bb1a33d9dcf9acf6e5b7c42f6a08db8eb87bfaad001910000143427efb28257954cb4e6596f4e06bdcad43cb9a402000000022cd74dc8b4504472d782478b374fe3fa406f9b9199d5b8ccac7c202a73c812b61016cf36b2605abe44354cd328d8cba6638c6cc53808d4e16609637e3f1c9fd10105"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
The Self Import API is a special API available only in chains that need a pubkey to create new coins arbitrarily.
selfimport destAddress amount
The Self Import API allows a trusted pubkey to create more coins on the same chain.
The chain must have the custom parameters -ac_import=PUBKEY
and -ac_pubkey
set to a pubkey which is allowed to create coins.
- For creating more coins in the chain with
-ac_import=PUBKEY
enabled, use the selfimport method - The method returns a source transaction that contains a parameter with the amount of coins to create
- The returned value is a proof of the trusted pubkey owner's intention to create new coins in the chain
- The returned source transaction should be broadcast to the chain using the sendrawtransaction method. The source transaction spends a
txfee=10000 satoshis
from the-ac_pubkey
owner's uxtos - After the source transaction is mined, the import transaction should also be broadcasted to the chain with the sendrawtransaction method. After this transaction is mined, its vout contains the amount of created coins in the chosen destination address
Name | Type | Description |
---|---|---|
"destAddress" | (string, required) | the address where the created coins should be sent |
"amount" | (number, required) | the amount in coins to create |
Name | Type | Description |
---|---|---|
"SourceTxHex" | (string) | the source transaction in hex format |
"ImportTxHex" | (string) | the import transaction in hex format |
Command:
./komodo-cli -ac_name=IMPORTTEST selfimport RM9n6rts1CBKX4oXziLp1WBBgEUjKKWHb3 100000
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "selfimport", "params": ["RM9n6rts1CBKX4oXziLp1WBBgEUjKKWHb3","100000"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
To see the rest of the process of the migrate_converttoexport
method, click the following button.
The following methods are available to the notary nodes for retrieving the blockchain "fingerprints" and notarization data.
calc_MoM height MoMdepth
The calc_MoM
method calculates the value of the merkle root of the blocks' merkle roots (MoM), starting from the block of the indicated height for the chosen depth.
Name | Type | Description |
---|---|---|
"height" | (number, required) | the block height from which the MoM calculation must begin |
"MoMdepth" | (number, required) | the number of blocks to include in the MoM calculation |
Name | Type | Description |
---|---|---|
"coin" | (string) | the chain's name |
"height" | (string) | the starting block height |
"MoMdepth" | (number) | the number of blocks included in the MoM calculation |
"MoM" | (string) | the MoM value |
Command:
./komodo-cli -ac_name=CFEKHOUND calc_MoM 1000 100
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "calc_MoM", "params": ["1000","100"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
MoMoMdata symbol kmdheight ccid
The MoMoMdata
method calculates the value of the merkle root of merkle roots of the blocks' merkle roots (MoMoM), starting from the block of the indicated height for the data of the indicated chain.
Execute this method on the KMD chain.
Name | Type | Description |
---|---|---|
"symbol" | (string, required) | the chain's name whose data's MoMoM value is to be calculated |
"kmdheight" | (number, required) | the number of blocks to include in the MoM calculation |
"ccid" | (number, required) | the chain's CCid |
Name | Type | Description |
---|---|---|
"coin" | (string) | the chain's name |
"kmdheight" | (string) | the starting block's height |
"ccid" | (number) | the chain's CCid |
"MoMs" | (string) | the array of MoM values |
"notarizationHash" | (string) | the first found notarization transaction id for the chain |
"MoMoM" | (string) | the MoMoM value |
Command:
./komodo-cli MoMoMdata CFEKHOUND 1350074 533
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "MoMoMdata", "params": ["CFEKHOUND","1350074","533"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
assetchainproof txid
The assetchainproof
method scans the chain for the back MoM
notarization for a transaction corresponding to the given transaction id and returns a proof object with MoM branch. Scanning is performed from the height up to the chain tip, with a limit of 1440
blocks.
Name | Type | Description |
---|---|---|
"txid" | (string, required) | the transaction id for which a proof object must be returned |
Name | Type | Description |
---|---|---|
"proof object" | (string) | the returned proof object with MoM branch in hex format |
Command:
./komodo-cli -ac_name=CFEKHOUND assetchainproof d19f1c3f7e630966e1d40838c56c8c63a6cbd828d34c3544be5a60b236cf1610
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "assetchainproof", "params": ["d19f1c3f7e630966e1d40838c56c8c63a6cbd828d34c3544be5a60b236cf1610"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
getNotarisationsForBlock height
The getNotarisationsForBlock
method returns the notarization transactions within the block of the given block hash.
Name | Type | Description |
---|---|---|
"height" | (number, required) | the block number of the block to be searched |
Name | Type | Description |
---|---|---|
"Notary Cluster" | (string) | refers to the notary group which performed the notarizations; KMD for the main Komodo notaries, LABS for the LABS notaries |
"txid" | (string) | the notarization transaction's id |
"chain" | (string) | the chain that has been notarized |
"height" | (number) | the notarization transaction's block height |
"blockhash" | (string) | the hash of the notarization transaction's block |
"notaries" | (array) | the ids of the notaries who performed the notarization |
Command:
./komodo-cli getNotarisationsForBlock 1350074
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getNotarisationsForBlock", "params": [1350074] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
scanNotarisationsDB blockHeight symbol [blocksLimit=1440]
The scanNotarisationsDB
method scans the notarization database backwards from the given block height for a notarization of the chain with the given name (symbol).
Name | Type | Description |
---|---|---|
"blockHeight" | (number, required) | the starting block height from which notarizations are to be searched |
"symbol" | (string, required) | the chain's name whose notarizations are to be searched |
"blocksLimit" | (number, optional) | an optional block depth to search for notarizations |
Name | Type | Description |
---|---|---|
"height" | (number) | the block height of the notarization transaction id that has been found |
"hash" | (string) | the hash of the notarization transaction id that has been found |
"opreturn" | (string) | the notarization data in hex format |
Command:
./komodo-cli scanNotarisationsDB 1350074 EMC2
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "scanNotarisationsDB", "params": ["1350074","EMC2"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
The following are utility methods available to user. These methods assist in retrieving information about burn and import transactions.
getimports hash|height
The getimports
method lists import transactions in the indicated block of the chain.
Name | Type | Description |
---|---|---|
"hash or height" | (string or number, required) | the block's hash or height to be searched |
Name | Type | Description |
---|---|---|
"imports" | (array) | |
"txid" | (string) | the import transaction id |
"amount" | (number) | the import transaction's value in coins |
"export" | (json) | the export or burn transaction's infomation |
"txid" | (string) | the export transaction's id |
"amount" | (number) | the export transaction's value |
"txid" | (string) | the export transaction's id |
"source" | (string) | the source chain's name |
"tokenid" | (string,optional) | the source chain's token id, if tokens are imported |
"TotalImported" | (number) | the total imported amount in coins |
Command:
./komodo-cli -ac_name=CFEKDRAGON getimports 027366fc75eb2adda37f54092f29130d3feafd5bf453b4005fbdc68a27391a8f
If the transaction id of an import is known, use the gettransaction method to retrieve its block hash.
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getimports", "params": ["027366fc75eb2adda37f54092f29130d3feafd5bf453b4005fbdc68a27391a8f"] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
getwalletburntransactions "count"
The getwalletburntransactions
method lists all the burn transactions in the current wallet.
Name | Type | Description |
---|---|---|
"count" | (number, optional) | the number of burn transactions to be returned; if omitted, defaults to 10 burn transactions |
Name | Type | Description |
---|---|---|
"txid" | (string) | the burn transaction's id |
"burnedAmount" | (number) | the burned value in coins |
"tokenid" | (string, optional) | the token id, if tokens are burned |
"targetSymbol" | (string) | the target chain's name |
"targetCCid" | (number) | the target chain's CCid |
Command:
./komodo-cli -ac_name=CFEKHOUND getwalletburntransactions
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getwalletburntransactions", "params": [""] }' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/