-
-
Save achamely/81264d3edff83385f539 to your computer and use it in GitHub Desktop.
Manual omni tx creation tests
This file contains 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
We'll be working with the following 4 cli commands | |
createrawtransaction | |
omni_createrawtx_multisig "rawtx" "payload" "seed(sending address)" "redeemkey (receiving non multisig address pubkey)" | |
omni_createrawtx_reference "rawtx" "destination" ( amount ) | |
omni_createrawtx_change "rawtx" "prevtxs" "destination" fee ( position ) | |
You'll need the following information to create the unsigned tx | |
source address: "34UsEfJjU4pBwWVvSnqdKE6o6gvp3WS1gE" | |
reference address (destination): "12wSMSUQRVH1qKxUJF2V5S2jDXaU57gKPv" | |
reference pubkey (destination): "0216e22d5e07b43a7402dcef62a9cb1dd25d7b201655799e19f0713c45d251ff97" | |
Property Id: 31 | |
Amount: 298.59 | |
payload : 000000000000000100000006f3bc2ec0 | |
generate payload from http://builder.bitwatch.co/ | |
UTXO information prepare it in the format below: | |
[{ | |
"txid": "39a1ce0b2ceb8efee5fe27896ea8cd49fa10c6a98ecd1cb5449a4bd3a51f8144", | |
"vout": 45, | |
"value": 0.00031776, | |
"scriptPubKey": "a9141e9c223cee12bd7904b48f57d524f9a59a8b404987" | |
}] | |
#Note: Use gettxout to get the scriptPubKey for the utxo transaction you will be using ex: | |
omnicore-cli gettxout 39a1ce0b2ceb8efee5fe27896ea8cd49fa10c6a98ecd1cb5449a4bd3a51f8144 45 | |
{ | |
"bestblock": "00000000000000000417ebb6f37ce27d512b94a93cd19bf4fab04a0b75228ed9", | |
"confirmations": 11532, | |
"value": 0.00031776, | |
"scriptPubKey": { | |
"asm": "OP_HASH160 1e9c223cee12bd7904b48f57d524f9a59a8b4049 OP_EQUAL", | |
"hex": "a9141e9c223cee12bd7904b48f57d524f9a59a8b404987", // <----------- scriptpubkey | |
"reqSigs": 1, | |
"type": "scripthash", | |
"addresses": [ | |
"34UsEfJjU4pBwWVvSnqdKE6o6gvp3WS1gE" | |
] | |
}, | |
"version": 1, | |
"coinbase": false | |
} | |
#Now we start by creating the base raw transaction using the utxo information above. Take note of the escaping \ on all the internal quotation marks " | |
./omnicore-cli createrawtransaction "[{\"txid\":\"39a1ce0b2ceb8efee5fe27896ea8cd49fa10c6a98ecd1cb5449a4bd3a51f8144\",\"vout\":45,\"value\": 0.00031776,\"scriptPubKey\": \"a9141e9c223cee12bd7904b48f57d524f9a59a8b404987\"}]" "{}" | |
#this should generate a rawtx hex output which will be used in the next command ex: | |
010000000144811fa5d34b9a44b51ccd8ea9c610fa49cda86e8927fee5fe8eeb2c0bcea1392d00000000ffffffff0000000000 | |
# Now we call omni_createrawtx_multisig "rawtx" "payload" "seed(sending address)" "redeemkey (receiving non multisig address pubkey)" where | |
# rawtx: is the output from previous command, | |
# payload: is the output from the builder.bitwatch.co website | |
# seed: is the sending address | |
# redeemkey: pubkey of destination/receiving address | |
# Ex: | |
./omnicore-cli omni_createrawtx_multisig 010000000144811fa5d34b9a44b51ccd8ea9c610fa49cda86e8927fee5fe8eeb2c0bcea1392d00000000ffffffff0000000000 000000000000000100000006f3bc2ec0 34UsEfJjU4pBwWVvSnqdKE6o6gvp3WS1gE 0216e22d5e07b43a7402dcef62a9cb1dd25d7b201655799e19f0713c45d251ff97 | |
#This will generate an updated new rawtx hex output: | |
010000000144811fa5d34b9a44b51ccd8ea9c610fa49cda86e8927fee5fe8eeb2c0bcea1392d00000000ffffffff025c0d0000000000004751210216e22d5e07b43a7402dcef62a9cb1dd25d7b201655799e19f0713c45d251ff9721029b75d7d45edd2ae2fb5d2d4d1c800c174520c645b96a0385802a1c8cabe849c952aeaa0a0000000000001976a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288ac00000000 | |
#Now we need to call omni_createrawtx_reference "rawtx" "destination" ( amount ) where | |
#rawtx: is the output from last command | |
#destination: destination/receiving address | |
#amount: is optional, if unspecified the internal defaults will be used. If you need to override it you can but it is recommended not to unless you know what you're doing. | |
#ex: | |
./omnicore-cli omni_createrawtx_reference 010000000144811fa5d34b9a44b51ccd8ea9c610fa49cda86e8927fee5fe8eeb2c0bcea1392d00000000ffffffff025c0d0000000000004751210216e22d5e07b43a7402dcef62a9cb1dd25d7b201655799e19f0713c45d251ff9721029b75d7d45edd2ae2fb5d2d4d1c800c174520c645b96a0385802a1c8cabe849c952aeaa0a0000000000001976a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288ac00000000 12wSMSUQRVH1qKxUJF2V5S2jDXaU57gKPv | |
#this should generate an updated rawtx hex output ex: | |
010000000144811fa5d34b9a44b51ccd8ea9c610fa49cda86e8927fee5fe8eeb2c0bcea1392d00000000ffffffff035c0d0000000000004751210216e22d5e07b43a7402dcef62a9cb1dd25d7b201655799e19f0713c45d251ff9721029b75d7d45edd2ae2fb5d2d4d1c800c174520c645b96a0385802a1c8cabe849c952aeaa0a0000000000001976a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288acaa0a0000000000001976a9141543c036e92d6bfa10514d0d4147f17b6c6c773088ac00000000 | |
#optional. If the UTXO input amount is large enough to require a change output use the following to add a change output. | |
#If the remaining amount in the utxo is enough to cover miners fee +-~dust amount then it can be left as is and procede to the last step/decode. | |
# | |
#If adding a change output we'll need to call omni_createrawtx_change "rawtx" "prevtxs" "destination" fee ( position ) where | |
# rawtx is the rawhex output from the last command | |
# prevtxs: a JSON array of transaction inputs Take note of the escapes \ for the quotes " | |
# destination: the destination for the change | |
# fee: the desired transcation/miner fees (Note: If the fee amount results in a change output that is less than dust levels no change output is added | |
# position: (optional) position for the change address (default 1): Note: Omni Protocol has strict guidelines about where change addresses are in the tx. It is recomended to leave this alone unless you really know what you are doing | |
# Ex: | |
./omnicore-cli omni_createrawtx_change 010000000144811fa5d34b9a44b51ccd8ea9c610fa49cda86e8927fee5fe8eeb2c0bcea1392d00000000ffffffff035c0d0000000000004751210216e22d5e07b43a7402dcef62a9cb1dd25d7b201655799e19f0713c45d251ff9721029b75d7d45edd2ae2fb5d2d4d1c800c174520c645b96a0385802a1c8cabe849c952aeaa0a0000000000001976a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288acaa0a0000000000001976a9141543c036e92d6bfa10514d0d4147f17b6c6c773088ac00000000 "[{\"txid\":\"39a1ce0b2ceb8efee5fe27896ea8cd49fa10c6a98ecd1cb5449a4bd3a51f8144\",\"vout\":45,\"value\": 0.00031776,\"scriptPubKey\": \"a9141e9c223cee12bd7904b48f57d524f9a59a8b404987\"}]" 34UsEfJjU4pBwWVvSnqdKE6o6gvp3WS1gE 0.00010000 | |
#Produces a final rawtx hex output of : | |
010000000144811fa5d34b9a44b51ccd8ea9c610fa49cda86e8927fee5fe8eeb2c0bcea1392d00000000ffffffff04603200000000000017a9141e9c223cee12bd7904b48f57d524f9a59a8b4049875c0d0000000000004751210216e22d5e07b43a7402dcef62a9cb1dd25d7b201655799e19f0713c45d251ff9721029b75d7d45edd2ae2fb5d2d4d1c800c174520c645b96a0385802a1c8cabe849c952aeaa0a0000000000001976a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288acaa0a0000000000001976a9141543c036e92d6bfa10514d0d4147f17b6c6c773088ac00000000 | |
#Now we can check out work by calling omni_decodetransaction "rawtx" | |
./omnicore-cli omni_decodetransaction 010000000144811fa5d34b9a44b51ccd8ea9c610fa49cda86e8927fee5fe8eeb2c0bcea1392d00000000ffffffff04603200000000000017a9141e9c223cee12bd7904b48f57d524f9a59a8b4049875c0d0000000000004751210216e22d5e07b43a7402dcef62a9cb1dd25d7b201655799e19f0713c45d251ff9721029b75d7d45edd2ae2fb5d2d4d1c800c174520c645b96a0385802a1c8cabe849c952aeaa0a0000000000001976a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288acaa0a0000000000001976a9141543c036e92d6bfa10514d0d4147f17b6c6c773088ac00000000 | |
{ | |
"txid" : "ba88e28523596a2005a5d3e47e146aa593b0c60a331efbab6e1f1a1f4d4c2465", | |
"fee" : "0.00010000", | |
"sendingaddress" : "34UsEfJjU4pBwWVvSnqdKE6o6gvp3WS1gE", | |
"referenceaddress" : "12wSMSUQRVH1qKxUJF2V5S2jDXaU57gKPv", | |
"ismine" : false, | |
"version" : 0, | |
"type_int" : 0, | |
"type" : "Simple Send", | |
"propertyid" : 1, | |
"divisible" : true, | |
"amount" : "298.59000000", | |
"confirmations" : 0 | |
} | |
#If everything looks correct you can take the final rawtx hex output to the omnicore/bitcoin client which contains the private key and call | |
# ./omnicore-cli signrawtransaction rawtx | |
# Note: if you use a wallet password you may need to unlock your wallet first. | |
# ex: | |
./omnicore-cli signrawtransaction 010000000144811fa5d34b9a44b51ccd8ea9c610fa49cda86e8927fee5fe8eeb2c0bcea1392d00000000ffffffff04603200000000000017a9141e9c223cee12bd7904b48f57d524f9a59a8b4049875c0d0000000000004751210216e22d5e07b43a7402dcef62a9cb1dd25d7b201655799e19f0713c45d251ff9721029b75d7d45edd2ae2fb5d2d4d1c800c174520c645b96a0385802a1c8cabe849c952aeaa0a0000000000001976a914946cb2e08075bcbaf157e47bcb67eb2b2339d24288acaa0a0000000000001976a9141543c036e92d6bfa10514d0d4147f17b6c6c773088ac00000000 | |
#Once complete you will have a signed transaction which you can check with ./omnicore-cli omni_decodetransaction "signedrawtx" | |
#and/or broadcast with ./omnicore-cli sendrawtransaction "signedrawtx" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment