]>
Commit | Line | Data |
---|---|---|
a839f9bc SS |
1 | #!/usr/bin/bash |
2 | ||
3 | # This script makes the neccesary transactions to migrate | |
4 | # coin between 2 assetchains on the same -ac_cc id | |
5 | ||
6 | set -e | |
7 | ||
8 | source=TXSCL | |
9 | target=TXSCL000 | |
10 | address="RFw7byY4xZpZCrtkMk3nFuuG1NTs9rSGgQ" | |
11 | amount=1 | |
12 | ||
13 | # Alias for running cli on source chain | |
14 | cli_source="komodo-cli -ac_name=$source" | |
15 | ||
16 | # Raw tx that we will work with | |
17 | txraw=`$cli_source createrawtransaction "[]" "{\"$address\":$amount}"` | |
18 | ||
19 | # Convert to an export tx | |
20 | exportData=`$cli_source migrate_converttoexport $txraw $target $amount` | |
21 | exportRaw=`echo $exportData | jq -r .exportTx` | |
22 | exportPayouts=`echo $exportData | jq -r .payouts` | |
23 | ||
24 | # Fund | |
25 | exportFundedData=`$cli_source fundrawtransaction $exportRaw` | |
26 | exportFundedTx=`echo $exportFundedData | jq -r .hex` | |
27 | ||
28 | # Sign | |
29 | exportSignedData=`$cli_source signrawtransaction $exportFundedTx` | |
30 | exportSignedTx=`echo $exportSignedData | jq -r .hex` | |
31 | ||
32 | # Send | |
33 | echo "Sending export tx" | |
34 | $cli_source sendrawtransaction $exportSignedTx | |
35 | ||
36 | read -p "Wait for a notarisation to KMD, and then two more notarisations from the target chain, and then press enter to continue" | |
37 | ||
38 | # Create import | |
39 | importTx=`$cli_source migrate_createimporttransaction $exportSignedTx $payouts` | |
40 | importTx=`komodo-cli migrate_completeimporttransaction $importTx` | |
41 | ||
42 | # Send import | |
43 | komodo-cli -ac_name=$target sendrawtransaction $importTx |