Kafh钱包交易技术演示

kafh钱包交易

钱包地址生成

1.生成一个16进制表示的32字符长度的随机数

假设为

123456789ABCDEF123456789ABCDEF12

2.使用随机数生成BIP39标准的12~24个助记词

./qx mnemonic-new 12345678912345678912345678912345
banana pencil owner car crowd record cattle educate filter setup emotion memory

3.使用助记词生成随机数种子

./qx mnemonic-to-seed "banana pencil owner car crowd record cattle educate filter setup emotion memory"
696ffef0da38d3472b8d6e115b758aa50657650b29f92e0828a23daf8e66bf4885482d9af0f8dbac22d89011d20a24c707bf7b9ddb90a5f98ad365446d765bdb

4.通过种子生成私钥

./qx ec-new 696ffef0da38d3472b8d6e115b758aa50657650b29f92e0828a23daf8e66bf4885482d9af0f8dbac22d89011d20a24c707bf7b9ddb90a5f98ad365446d765bdb
71b4fefcbed5dfc383acfee1b05bb58c04d03da9b7e54c4a32d6ccc651c2e5ab

5.通过私钥生成公钥

./qx ec-to-public 71b4fefcbed5dfc383acfee1b05bb58c04d03da9b7e54c4a32d6ccc651c2e5ab
03f3d480289e4edc9a65c1858b9aa7a2f8221aa385b67c45a09a975c28a74ff69e

6.通过公钥生成地址

./qx ec-to-addr 03f3d480289e4edc9a65c1858b9aa7a2f8221aa385b67c45a09a975c28a74ff69e
TmgK1rqp5aXHvSqkKKF2TLb1JwcS6NBrp9v

交易过程

1.先给该地址转一笔账

./kahf tx -s -from TmYHBEGw4XD39NUhuSBzDbd9fR1brsByt9A -to TmgK1rqp5aXHvSqkKKF2TLb1JwcS6NBrp9v -amt 20.001
send tx success, txid: 4dd401d5f063241136a09741dba04e5aeff19e9df34575e1750de550faa6f6cb

2.查询下该地址的可用余额

./kahf out -u -addr TmgK1rqp5aXHvSqkKKF2TLb1JwcS6NBrp9v
total: 20.000000

3.创建转账的raw transaction

假设从账户中转走5个币

./qitmeer-cli createRawTransaction 4dd401d5f063241136a09741dba04e5aeff19e9df34575e1750de550faa6f6cb:1 TmYHBEGw4XD39NUhuSBzDbd9fR1brsByt9A:5 TmgK1rqp5aXHvSqkKKF2TLb1JwcS6NBrp9v:14.999
0100000001cbf6a6fa50e50d75e17545f39d9ef1ef5a4ea0db4197a036112463f0d501d44d01000000ffffffff020065cd1d000000001976a9146655a55627d41556a3823051d4e6896c03760ea588ac60a86659000000001976a914be6fa9a9a11de5ffe624f18dc787d92eadecf72b88ac000000000000000001000000000000000000000000ffffffff00

4.用钱包私钥签名交易

./qx tx-sign -k 71b4fefcbed5dfc383acfee1b05bb58c04d03da9b7e54c4a32d6ccc651c2e5ab 0100000001cbf6a6fa50e50d75e17545f39d9ef1ef5a4ea0db4197a036112463f0d501d44d01000000ffffffff020065cd1d000000001976a9146655a55627d41556a3823051d4e6896c03760ea588ac60a86659000000001976a914be6fa9a9a11de5ffe624f18dc787d92eadecf72b88ac000000000000000001000000000000000000000000ffffffff00

0100000001cbf6a6fa50e50d75e17545f39d9ef1ef5a4ea0db4197a036112463f0d501d44d01000000ffffffff020065cd1d000000001976a9146655a55627d41556a3823051d4e6896c03760ea588ac60a86659000000001976a914be6fa9a9a11de5ffe624f18dc787d92eadecf72b88ac000000000000000001000000000000000000000000ffffffff6b483045022100f1e87709f6bc035a8f4a7189270409c54e24459b95d2502db3bdd9dc9f0b1874022059046fa008b905a63a7521590f42ee87994ef3e1e5eeddd55b1c47d1ea9bd7ef012103f3d480289e4edc9a65c1858b9aa7a2f8221aa385b67c45a09a975c28a74ff69e

5.发送签名后的交易给网络

./kahf tx -t -rawtx 0100000001cbf6a6fa50e50d75e17545f39d9ef1ef5a4ea0db4197a036112463f0d501d44d01000000ffffffff020065cd1d000000001976a9146655a55627d41556a3823051d4e6896c03760ea588ac60a86659000000001976a914be6fa9a9a11de5ffe624f18dc787d92eadecf72b88ac000000000000000001000000000000000000000000ffffffff6b483045022100f1e87709f6bc035a8f4a7189270409c54e24459b95d2502db3bdd9dc9f0b1874022059046fa008b905a63a7521590f42ee87994ef3e1e5eeddd55b1c47d1ea9bd7ef012103f3d480289e4edc9a65c1858b9aa7a2f8221aa385b67c45a09a975c28a74ff69e
send raw tx  0100000001cbf6a6fa50e50d75e17545f39d9ef1ef5a4ea0db4197a036112463f0d501d44d01000000ffffffff020065cd1d000000001976a9146655a55627d41556a3823051d4e6896c03760ea588ac60a86659000000001976a914be6fa9a9a11de5ffe624f18dc787d92eadecf72b88ac000000000000000001000000000000000000000000ffffffff6b483045022100f1e87709f6bc035a8f4a7189270409c54e24459b95d2502db3bdd9dc9f0b1874022059046fa008b905a63a7521590f42ee87994ef3e1e5eeddd55b1c47d1ea9bd7ef012103f3d480289e4edc9a65c1858b9aa7a2f8221aa385b67c45a09a975c28a74ff69e
send raw tx success, txid: "ebd28e99941a6c11d27bb282bfbb52296974c858f18c7051441384ff2bad3aaf"

6.查询交易

./kahf tx -r
Key                                                                 Amount         Height    To                                    From                                  Status    Change         Fee
ebd28e99941a6c11d27bb282bfbb52296974c858f18c7051441384ff2bad3aaf    500000000      0         TmYHBEGw4XD39NUhuSBzDbd9fR1brsByt9A   TmgK1rqp5aXHvSqkKKF2TLb1JwcS6NBrp9v   1         1499900000     100000

线上视频演示讲解地址:https://v.qq.com/x/page/x09141tswqt.html

1 Like

学习了