Last active
September 4, 2018 05:15
-
-
Save ssadler/65b654caa607813b9705e05d9ba6ddf4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# This script makes the neccesary transactions to migrate | |
# coin between 2 assetchains on the same -ac_cc id | |
set -x | |
set -e | |
source=TXSCL | |
target=TXSCL000 | |
address="RFw7byY4xZpZCrtkMk3nFuuG1NTs9rSGgQ" | |
amount=1 | |
# Alias for running cli on source chain | |
cli_source="komodo-cli -ac_name=$source" | |
# Raw tx that we will work with | |
txraw=`$cli_source createrawtransaction "[]" "{\"$address\":$amount}"` | |
# Convert to an export tx | |
exportData=`$cli_source migrate_converttoexport $txraw $target $amount` | |
exportRaw=`echo $exportData | jq -r .exportTx` | |
exportPayouts=`echo $exportData | jq -r .payouts` | |
# Fund it | |
exportFundedData=`$cli_source fundrawtransaction $exportRaw` | |
exportFundedTx=`echo $exportFundedData | jq -r .hex` | |
# Sign it | |
exportSignedData=`$cli_source signrawtransaction $exportFundedTx` | |
exportSignedTx=`echo $exportSignedData | jq -r .hex` | |
# Send it (almost like daft punk innit?) | |
echo "Sending export tx" | |
$cli_source sendrawtransaction $exportSignedTx | |
read -p "Wait for a notarisation to KMD, and then two more notarisations from the target chain, and then press enter to continue" | |
# Create import | |
importTx=`$cli_source migrate_createimporttransaction $exportSignedTx $payouts` | |
importTx=`komodo-cli migrate_completeimporttransaction $importTx` | |
# Send import | |
komodo-cli -ac_name=$target sendrawtransaction $importTx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment