-
Notifications
You must be signed in to change notification settings - Fork 7
Exchange Token Between Two Forks
zhongjin edited this page Nov 19, 2019
·
1 revision
- First, complete the relevant operations according to the "Create Forks", and our next operations will be based on the normal creation of fork and the generation of blocks by Pow.
- PoW Guide:https://github.com/bigbangcore/BigBang/wiki/PoW-Guide
- Create Forks:https://github.com/bigbangcore/BigBang/wiki/Create-Forks
- Download address of executable program (please select the latest version): https://github.com/bigbangcore/BigBang/releases
./bigbang listfork
[
{
"fork" : "557384528669a894e14afe48725ef2b243f6dba3d0735b71effc21adf3bbc783",
"name" : "BigBangA",
"symbol" : "BA",
"isolated" : true,
"private" : false,
"enclosed" : false,
"owner" : "15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28"
},
{
"fork" : "92099485ffec67128fe4dbaca96ed8faf54ccc0b4760cd0d78a3d1e051a2498f",
"name" : "BigBang Network",
"symbol" : "BBC",
"isolated" : true,
"private" : false,
"enclosed" : false,
"owner" : "1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm"
}
]
./bigbang getbalance
[
{
"address" : "15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28",
"avail" : 0.000000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
},
{
"address" : "20g08xexyx0hakeg3sfa7ve6y3skpv19gt15mg3f784q6ejqp5a67xa7q",
"avail" : 3586.150000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
},
{
"address" : "1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm",
"avail" : 745000000.000000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
},
{
"address" : "20c07j7pt2faqc7xspvz8c2qx1xp2zhsenx1379cjjd9xvrnph1kx8gj8",
"avail" : 1000.000000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
}
]
./bigbang getbalance -f=557384528669a894e14afe48725ef2b243f6dba3d0735b71effc21adf3bbc783
[
{
"address" : "15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28",
"avail" : 100000000.000000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
},
{
"address" : "20g08xexyx0hakeg3sfa7ve6y3skpv19gt15mg3f784q6ejqp5a67xa7q",
"avail" : 0.000000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
},
{
"address" : "1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm",
"avail" : 0.000000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
},
{
"address" : "20c07j7pt2faqc7xspvz8c2qx1xp2zhsenx1379cjjd9xvrnph1kx8gj8",
"avail" : 0.000000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
}
]
# fork1
fork_m:92099485ffec67128fe4dbaca96ed8faf54ccc0b4760cd0d78a3d1e051a2498f
# fork2
fork_s:557384528669a894e14afe48725ef2b243f6dba3d0735b71effc21adf3bbc783
# the main wallet address
addr_m:1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm
# the second wallet address
addr_s:15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28
# The agreed lock block height of the fork chain where the first wallet will be located (not the number of locks, so please check the current block height before setting this value)
height_m:200
# The agreed lock block height of the fork chain where the second wallet will be located
height_s:210
./bigbang addnewtemplate exchange "{\"addr_m\":\"1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm\",\"addr_s\":\"15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28\",\"height_m\":200,\"height_s\":210,\"fork_m\":\"92099485ffec67128fe4dbaca96ed8faf54ccc0b4760cd0d78a3d1e051a2498f\",\"fork_s\":\"557384528669a894e14afe48725ef2b243f6dba3d0735b71effc21adf3bbc783\"}"
20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3
- Send tokens to the address of exchange template specified by both sides of exchange. The transfer out address of token can be any address has tokens. Remember to set the fork parameter "-f" to specify which fork to operate.
./bigbang sendfrom 1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm 20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3 13.345 1 -f="92099485ffec67128fe4dbaca96ed8faf54ccc0b4760cd0d78a3d1e051a2498f"
5ce76b63c1d8b3cc62db8b794c51988daa2b45b50043a0099c6975125e19ed05
./bigbang sendfrom 15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28 20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3 9.875 1 -f="557384528669a894e14afe48725ef2b243f6dba3d0735b71effc21adf3bbc783"
5ce76b9825f8a09616c709fc2298cde2ed95631d85e74659a38529c7d5174083
./bigbang gettransaction 5ce76b63c1d8b3cc62db8b794c51988daa2b45b50043a0099c6975125e19ed05
{
"transaction" : {
"txid" : "5ce76b63c1d8b3cc62db8b794c51988daa2b45b50043a0099c6975125e19ed05",
"version" : 1,
"type" : "token",
"time" : 1558670179,
"lockuntil" : 0,
"anchor" : "89e0a4ede2b32e670b1f6ed0840b4e04cca0b9aa2cab8314639a5bbfd009d922",
"vin" : [
{
"txid" : "5a586f845d2b565547cc9f03fd98f931bf3a695c103c380f377f56f021485300",
"vout" : 0
}
],
"sendto" : "20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3",
"amount" : 13.345000,
"txfee" : 1.000000,
"data" : "",
"sig" : "99d9b3081a0a11742e0d1b6210f450fa74a9cd1a6f10ce6cfd6ac66d5befb25ef4906120518d7733e77c631ad5669dee672dfb3b5cad96db21cebc236b1d190b",
"fork" : "92099485ffec67128fe4dbaca96ed8faf54ccc0b4760cd0d78a3d1e051a2498f",
"confirmations" : 1
}
}
./bigbang gettransaction 5ce76b9825f8a09616c709fc2298cde2ed95631d85e74659a38529c7d5174083
{
"transaction" : {
"txid" : "5ce76b9825f8a09616c709fc2298cde2ed95631d85e74659a38529c7d5174083",
"version" : 1,
"type" : "token",
"time" : 1558670232,
"lockuntil" : 0,
"anchor" : "fd29796e92ee4a86588f8667ed654defe72b8fc647f88b959d5544cf49f89fc8",
"vin" : [
{
"txid" : "5ce4ff12391e49080f93136d14da797c900777e37c696b326a23aa6588f332c4",
"vout" : 0
}
],
"sendto" : "20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3",
"amount" : 9.875000,
"txfee" : 1.000000,
"data" : "",
"sig" : "604c27240579d6d236e7fe40a8936a09d8ed1ef66d58a33aaa78f80149875f773b1d0ce88e671b9ce60c4524c15febca5c692168987e1815325f26b40301b302",
"fork" : "557384528669a894e14afe48725ef2b243f6dba3d0735b71effc21adf3bbc783",
"confirmations" : 0
}
}
./bigbang validateaddress 20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3
{
"isvalid" : true,
"addressdata" : {
"address" : "20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3",
"ismine" : true,
"type" : "template",
"template" : "exchange",
"templatedata" : {
"type" : "exchange",
"hex" : "060001498b63009dfb70f7ee0902ba95cc171f7d7a97ff16d89fd96e1f1b9e7d5f91da01e21d19ac52602eca9f9f70f5b43abfff29ed552b3d4f08478f50829c6c3b8c5ac8000000d20000008f49a251e0d1a3780dcd60470bcc4cf5fad86ea9acdbe48f1267ecff8594099283c7bbf3ad21fcef715b73d0a3dbf643b2f25e7248fe4ae194a8698652847355",
"exchange" : {
"spend_m" : "1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm",
"spend_s" : "15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28",
"height_m" : 200,
"height_s" : 210,
"fork_m" : "92099485ffec67128fe4dbaca96ed8faf54ccc0b4760cd0d78a3d1e051a2498f",
"fork_s" : "557384528669a894e14afe48725ef2b243f6dba3d0735b71effc21adf3bbc783"
}
}
}
}
- Use the public key to sign the template address. At this time, the wallet must be unlocked, or the signature will not succeed.The parameter "-a" represents the signature to the address
# First signature:
./bigbang unlockkey da915f7d9e1b1f6ed99fd816ff977a7d1f17cc95ba0209eef770fb9d00638b49 123456
./bigbang signmessage da915f7d9e1b1f6ed99fd816ff977a7d1f17cc95ba0209eef770fb9d00638b49 20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3 -a
1b8c6b0807472627cec2f77b2a33428539b64493f7f1b9f7be4dfbdee72f9aeb3b5763fa39ce5df2425d8d530698de9c1cea993bccfce6596901b6b8cb054103
# Second signature:
./bigbang unlockkey 14d39e3a7e7c408eceb8dbb213cfe047bed25aa1e8e317e08c65f3f577f73e2f 123456
./bigbang signmessage 14d39e3a7e7c408eceb8dbb213cfe047bed25aa1e8e317e08c65f3f577f73e2f 20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3 -a
a51a925a50a7101ca25c8165050b61421f9e54aad5b0cfb4a4947da82f5fb62fec8e96fb80bd697db33f391bf1f875179d446ac08829f85cf8fe6483ec9acf0c
- Verification signature by each other, return true to indicate that the information is correct, the parameter "-a" indicates that the signature is for the address
./bigbang verifymessage 14d39e3a7e7c408eceb8dbb213cfe047bed25aa1e8e317e08c65f3f577f73e2f 20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3 a51a925a50a7101ca25c8165050b61421f9e54aad5b0cfb4a4947da82f5fb62fec8e96fb80bd697db33f391bf1f875179d446ac08829f85cf8fe6483ec9acf0c -a
./bigbang verifymessage da915f7d9e1b1f6ed99fd816ff977a7d1f17cc95ba0209eef770fb9d00638b49 20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3 1b8c6b0807472627cec2f77b2a33428539b64493f7f1b9f7be4dfbdee72f9aeb3b5763fa39ce5df2425d8d530698de9c1cea993bccfce6596901b6b8cb054103 -a
- First, let's see how many tokens are deposited by each party involved in the exchange in our transaction template
./bigbang getbalance -a=20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3
[
{
"address" : "20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3",
"avail" : 13.345000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
}
]
./bigbang getbalance -a=20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3 -f=557384528669a894e14afe48725ef2b243f6dba3d0735b71effc21adf3bbc783
[
{
"address" : "20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3",
"avail" : 9.875000,
"locked" : 0.000000,
"unconfirmed" : 9.875000
}
]
Command:./bigbang sendfrom "exchange template address" "wallet address" "amount" "fee" "-sm:the first signature" "-ss:the second signature" "-f:forkID"
**NOTE:**The tokens are taken from the fork where the trading partner's wallet is located.
./bigbang sendfrom 20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3 15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28 13.345 1 -sm="1b8c6b0807472627cec2f77b2a33428539b64493f7f1b9f7be4dfbdee72f9aeb3b5763fa39ce5df2425d8d530698de9c1cea993bccfce6596901b6b8cb054103" -ss="a51a925a50a7101ca25c8165050b61421f9e54aad5b0cfb4a4947da82f5fb62fec8e96fb80bd697db33f391bf1f875179d446ac08829f85cf8fe6483ec9acf0c" -f="92099485ffec67128fe4dbaca96ed8faf54ccc0b4760cd0d78a3d1e051a2498f"
{
"code" : -401,
"message" : "Failed to create transaction"
}
NOTE:
Deduct transaction fee from template address balance.
./bigbang sendfrom 20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3 15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28 12.345 1 -sm="1b8c6b0807472627cec2f77b2a33428539b64493f7f1b9f7be4dfbdee72f9aeb3b5763fa39ce5df2425d8d530698de9c1cea993bccfce6596901b6b8cb054103" -ss="a51a925a50a7101ca25c8165050b61421f9e54aad5b0cfb4a4947da82f5fb62fec8e96fb80bd697db33f391bf1f875179d446ac08829f85cf8fe6483ec9acf0c" -f="92099485ffec67128fe4dbaca96ed8faf54ccc0b4760cd0d78a3d1e051a2498f"
5ce79ba78b44f8710710c8e35b8d3b725c2f994d4038b74fda84f0b061c01a76
- View the balance situation
./bigbang getbalance -a=15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28
[
{
"address" : "15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28",
"avail" : 12.345000,
"locked" : 0.000000,
"unconfirmed" : 12.345000
}
]
./bigbang getbalance -a=15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28 -f=557384528669a894e14afe48725ef2b243f6dba3d0735b71effc21adf3bbc783
[
{
"address" : "1w8ehkb2jc0qcn7wze3tv8enzzwmytn9b7n7gghwfa219rv1vhhd82n6h",
"avail" : 99999989.125000,
"locked" : 0.000000,
"unconfirmed" : 99999989.125000
}
]
- Transfer situation of another account
./bigbang sendfrom 20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3 1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm 8.875 1 -sm="1b8c6b0807472627cec2f77b2a33428539b64493f7f1b9f7be4dfbdee72f9aeb3b5763fa39ce5df2425d8d530698de9c1cea993bccfce6596901b6b8cb054103" -ss="a51a925a50a7101ca25c8165050b61421f9e54aad5b0cfb4a4947da82f5fb62fec8e96fb80bd697db33f391bf1f875179d446ac08829f85cf8fe6483ec9acf0c" -f="557384528669a894e14afe48725ef2b243f6dba3d0735b71effc21adf3bbc783"
5ce79c872d1aee489291fd97270639a4631014334feb37a5df7fcb27904c0b9f
- View the balance situation at last
./bigbang getbalance -a=1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm
[
{
"address" : "1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm",
"avail" : 744999985.655000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
}
]
./bigbang getbalance -a=1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm -f=557384528669a894e14afe48725ef2b243f6dba3d0735b71effc21adf3bbc783
[
{
"address" : "1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm",
"avail" : 8.875000,
"locked" : 0.000000,
"unconfirmed" : 8.875000
}
]
./bigbang gettransaction 5ce79ba78b44f8710710c8e35b8d3b725c2f994d4038b74fda84f0b061c01a76
{
"transaction" : {
"txid" : "5ce79ba78b44f8710710c8e35b8d3b725c2f994d4038b74fda84f0b061c01a76",
"version" : 1,
"type" : "token",
"time" : 1558682535,
"lockuntil" : 0,
"anchor" : "c8d7b6d138cc5e6d4871b92f5a6323eb32f02b7d86c1581333968689d929a28b",
"vin" : [
{
"txid" : "5ce76b63c1d8b3cc62db8b794c51988daa2b45b50043a0099c6975125e19ed05",
"vout" : 0
}
],
"sendto" : "15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28",
"amount" : 12.345000,
"txfee" : 1.000000,
"data" : "",
"sig" : "01498b63009dfb70f7ee0902ba95cc171f7d7a97ff16d89fd96e1f1b9e7d5f91da01e21d19ac52602eca9f9f70f5b43abfff29ed552b3d4f08478f50829c6c3b8c5ac8000000d20000008f49a251e0d1a3780dcd60470bcc4cf5fad86ea9acdbe48f1267ecff8594099283c7bbf3ad21fcef715b73d0a3dbf643b2f25e7248fe4ae194a8698652847355400000001b8c6b0807472627cec2f77b2a33428539b64493f7f1b9f7be4dfbdee72f9aeb3b5763fa39ce5df2425d8d530698de9c1cea993bccfce6596901b6b8cb05410340000000a51a925a50a7101ca25c8165050b61421f9e54aad5b0cfb4a4947da82f5fb62fec8e96fb80bd697db33f391bf1f875179d446ac08829f85cf8fe6483ec9acf0c400000008c3fa5efc865e2ad49ce0c48bda370334ba608243229064c21c5719ff06d58b672a753e47367d96c9eda016426bcf7db74e4d0ed4db62c2ecda73875b2307806",
"fork" : "92099485ffec67128fe4dbaca96ed8faf54ccc0b4760cd0d78a3d1e051a2498f",
"confirmations" : 1
}
}
./bigbang gettransaction 5ce79c872d1aee489291fd97270639a4631014334feb37a5df7fcb27904c0b9f
{
"transaction" : {
"txid" : "5ce79c872d1aee489291fd97270639a4631014334feb37a5df7fcb27904c0b9f",
"version" : 1,
"type" : "token",
"time" : 1558682759,
"lockuntil" : 0,
"anchor" : "76c378a30ec85c1561a30a4ec35f0ab7a9bc03512bbb16aa96ee3432ab22a581",
"vin" : [
{
"txid" : "5ce76b9825f8a09616c709fc2298cde2ed95631d85e74659a38529c7d5174083",
"vout" : 0
}
],
"sendto" : "1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm",
"amount" : 8.875000,
"txfee" : 1.000000,
"data" : "",
"sig" : "01498b63009dfb70f7ee0902ba95cc171f7d7a97ff16d89fd96e1f1b9e7d5f91da01e21d19ac52602eca9f9f70f5b43abfff29ed552b3d4f08478f50829c6c3b8c5ac8000000d20000008f49a251e0d1a3780dcd60470bcc4cf5fad86ea9acdbe48f1267ecff8594099283c7bbf3ad21fcef715b73d0a3dbf643b2f25e7248fe4ae194a8698652847355400000001b8c6b0807472627cec2f77b2a33428539b64493f7f1b9f7be4dfbdee72f9aeb3b5763fa39ce5df2425d8d530698de9c1cea993bccfce6596901b6b8cb05410340000000a51a925a50a7101ca25c8165050b61421f9e54aad5b0cfb4a4947da82f5fb62fec8e96fb80bd697db33f391bf1f875179d446ac08829f85cf8fe6483ec9acf0c4000000049ea84bd8d1bf6735ac141a33a9634b3fb8e222bb03a332ccec5a5a8adfcd32653ee08d84e7069cb91425eea1dd806e69ae50246e0e8e3f13cde7660a3a12e0b",
"fork" : "557384528669a894e14afe48725ef2b243f6dba3d0735b71effc21adf3bbc783",
"confirmations" : 0
}
}
./bigbang getbalance -a=20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3
[
{
"address" : "20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3",
"avail" : 0.000000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
}
]
./bigbang getbalance -a=20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3 -f=557384528669a894e14afe48725ef2b243f6dba3d0735b71effc21adf3bbc783
[
{
"address" : "20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3",
"avail" : 0.000000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
}
]
./bigbang getbalance
[
{
"address" : "15wzfexznydjrsr0qwfma2ppjqs3y1krkpbdvhkme81y7wemytcaf8k28",
"avail" : 12.345000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
},
{
"address" : "1965p604xzdrffvg90ax9bk0q3xyqn5zz2vc9zpbe3wdswzazj7d144mm",
"avail" : 744999985.655000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
},
{
"address" : "20r07rwj0032jssv0d3xaes1kq6z1cvjmz1jwhme0m1jf23vx48v683s3",
"avail" : 0.000000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
},
{
"address" : "20c07j7pt2faqc7xspvz8c2qx1xp2zhsenx1379cjjd9xvrnph1kx8gj8",
"avail" : 1000.000000,
"locked" : 0.000000,
"unconfirmed" : 0.000000
}
]
- Source Installation
- Executable Programs
- Take A Tour of BigBang
- CPoW SOLO Guide
- Create Forks
- Exchange Token Between Two Forks
- Mining by Connect to The Pool
- Miner Program
- EDPoS Vote Guide
- JSON RPC
- Command Line Tool
- TX vchdata serialization definition
- Tx signature field structure
- Multisignature
- IO Stream
- Data Stream