Commit cc706574 authored by 张振华's avatar 张振华

update

parent 47463a79
This source diff could not be displayed because it is too large. You can view the blob instead.
File added
1.测试主网地址 1.测试主网地址
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
"msg": "" "msg": ""
} }
./chain33-cli account list ./chain33-cli account list
./chain33-cli --rpc_laddr="http://192.168.0.155:8801" wallet unlock -p zzh -t 0
{ {
"wallets": [ "wallets": [
{ {
...@@ -59,7 +60,7 @@ ...@@ -59,7 +60,7 @@
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" wallet unlock -p zzh -t 0 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" wallet unlock -p zzh -t 0
{ {
"isOK": true, "isOK": true,
"msg": "" "msg": ""./chain33-cli --rpc_laddr="http://192.168.0.155:8801" wallet unlock -p zzh -t 0
} }
...@@ -81,7 +82,7 @@ zzh@zzh-Vostro-3470:~/work/para$ ./chain33-cli --rpc_laddr="http://192.168.0.233 ...@@ -81,7 +82,7 @@ zzh@zzh-Vostro-3470:~/work/para$ ./chain33-cli --rpc_laddr="http://192.168.0.233
"frozen": "0.0000", "frozen": "0.0000",
"addr": "1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU" "addr": "1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU"
}, },
"label": "zzh" "label": "zzh"./chain33-cli --rpc_laddr="http://192.168.0.155:8801" wallet unlock -p zzh -t 0
} }
] ]
} }
...@@ -112,16 +113,18 @@ zzh@zzh-Vostro-3470:~/work/testnet$ ./chain33-cli --rpc_laddr="http://192.168.0. ...@@ -112,16 +113,18 @@ zzh@zzh-Vostro-3470:~/work/testnet$ ./chain33-cli --rpc_laddr="http://192.168.0.
} }
./chain33-cli --rpc_laddr="http://192.168.0.170:8801" bty transfer -a 1 -t 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k 主链上转账:
./chain33-cli --rpc_laddr="http://192.168.0.170:8801" bty transfer -a 10000 -t 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k
0a05636f696e73122d18010a291080c2d72f2222314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b20a08d0630f5f0a9d7cf90d9ac5d3a22314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b 0a05636f696e73122d18010a291080c2d72f2222314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b20a08d0630f5f0a9d7cf90d9ac5d3a22314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b
./chain33-cli --rpc_laddr="http://192.168.0.170:8801" wallet sign -a 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -d 0a05636f696e73122d18010a291080c2d72f2222314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b20a08d0630f5f0a9d7cf90d9ac5d3a22314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b ./chain33-cli --rpc_laddr="http://192.168.0.170:8801" wallet sign -a 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -d 0a05636f696e73122d18010a291080c2d72f2222314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b20a08d0630f5f0a9d7cf90d9ac5d3a22314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b
0a05636f696e73122d18010a291080c2d72f2222314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b1a6d0801122102504fa1c28caaf1d5a20fefb87c50a49724ff401043420cb3ba271997eb5a43871a463044022074c3aef8d85b0a3103848f2aa7d7a677fe05173b6417dea5f096021ee2f2764a022002d53296d2e2e5d455201609d0bd7550ed0a8fb0e7fc5141d0dc60cd98b6bcf820a08d0628ddb89ee00530f5f0a9d7cf90d9ac5d3a22314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b 0a05636f696e73122d18010a291080c2d72f2222314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b1a6d0801122102504fa1c28caaf1d5a20fefb87c50a49724ff401043420cb3ba271997eb5a43871a463044022074c3aef8d85b0a3103848f2aa7d7a677fe05173b6417dea5f096021ee2f2764a022002d53296d2e2e5d455201609d0bd7550ed0a8fb0e7fc5141d0dc60cd98b6bcf820a08d0628ddb89ee00530f5f0a9d7cf90d9ac5d3a22314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b
./chain33-cli --rpc_laddr="http://192.168.0.170:8801" wallet send -d 0a05636f696e73122d18010a291080c2d72f2222314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b1a6d0801122102504fa1c28caaf1d5a20fefb87c50a49724ff401043420cb3ba271997eb5a43871a463044022074c3aef8d85b0a3103848f2aa7d7a677fe05173b6417dea5f096021ee2f2764a022002d53296d2e2e5d455201609d0bd7550ed0a8fb0e7fc5141d0dc60cd98b6bcf820a08d0628ddb89ee00530f5f0a9d7cf90d9ac5d3a22314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b ./chain33-cli --rpc_laddr="http://192.168.0.170:8801" wallet send -d 0a05636f696e73122d18010a291080c2d72f2222314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b1a6d0801122102504fa1c28caaf1d5a20fefb87c50a49724ff401043420cb3ba271997eb5a43871a463044022074c3aef8d85b0a3103848f2aa7d7a677fe05173b6417dea5f096021ee2f2764a022002d53296d2e2e5d455201609d0bd7550ed0a8fb0e7fc5141d0dc60cd98b6bcf820a08d0628ddb89ee00530f5f0a9d7cf90d9ac5d3a22314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b
0xb942163e3276ae11e9357a590d3d70f012b6a80a8d35063c41ebdabe07d3b340 0xb942163e3276ae11e9357a590d3d70f012b6a80a8d35063c41ebdabe07d3b340
./chain33-cli --rpc_laddr="http://192.168.0.170:8801" tx query -s "0xb942163e3276ae11e9357a590d3d70f012b6a80a8d35063c41ebdabe07d3b340" ./chain33-cli --rpc_laddr="http://192.168.0.170:8801" tx query -s "0xdaf386800c2cf699839a018ec7083b4f53936ab45339c1154fe6eb351272a7d9"
./chain33-cli --rpc_laddr="http://192.168.0.170:8801" account dump_key -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k ./chain33-cli --rpc_laddr="http://192.168.0.170:8801" account dump_key -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k
{ {
...@@ -131,7 +134,7 @@ zzh@zzh-Vostro-3470:~/work/testnet$ ./chain33-cli --rpc_laddr="http://192.168.0. ...@@ -131,7 +134,7 @@ zzh@zzh-Vostro-3470:~/work/testnet$ ./chain33-cli --rpc_laddr="http://192.168.0.
平行链子链上执行: 平行链子链上执行:
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." bty transfer -a 100 -t 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." bty transfer -a 1000 -t 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k
0a12757365722e702e67756573732e636f696e73122e18010a2a1080c8afa0252222314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b20a08d0630d685b5dedca786d26f3a223146396861747666666e637a4373754d7535485a45423268657a697439786d705542 0a12757365722e702e67756573732e636f696e73122e18010a2a1080c8afa0252222314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b20a08d0630d685b5dedca786d26f3a223146396861747666666e637a4373754d7535485a45423268657a697439786d705542
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet sign -a 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -d 0a12757365722e702e67756573732e636f696e73122e18010a2a1080c8afa0252222314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b20a08d0630d685b5dedca786d26f3a223146396861747666666e637a4373754d7535485a45423268657a697439786d705542 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet sign -a 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -d 0a12757365722e702e67756573732e636f696e73122e18010a2a1080c8afa0252222314d33424b67683968417a59357863456d434374416b61696e6a437472627155336b20a08d0630d685b5dedca786d26f3a223146396861747666666e637a4373754d7535485a45423268657a697439786d705542
...@@ -143,7 +146,7 @@ zzh@zzh-Vostro-3470:~/work/testnet$ ./chain33-cli --rpc_laddr="http://192.168.0. ...@@ -143,7 +146,7 @@ zzh@zzh-Vostro-3470:~/work/testnet$ ./chain33-cli --rpc_laddr="http://192.168.0.
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" tx query -s "0xb1b62da8b0761a5eb14f1f5ffaa07676a6405fa7479c368fff3ae4e00c2aeb65" ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" tx query -s "0xb1b62da8b0761a5eb14f1f5ffaa07676a6405fa7479c368fff3ae4e00c2aeb65"
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." bty transfer -a 100 -t 1Kv4NXEHbptdQMYbHBAjGr43kS3rggV225 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." bty transfer -a 1000 -t 1Kv4NXEHbptdQMYbHBAjGr43kS3rggV225
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet sign -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -d ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet sign -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -d
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet send -d ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet send -d
...@@ -157,7 +160,8 @@ zzh@zzh-Vostro-3470:~/work/testnet$ ./chain33-cli --rpc_laddr="http://192.168.0. ...@@ -157,7 +160,8 @@ zzh@zzh-Vostro-3470:~/work/testnet$ ./chain33-cli --rpc_laddr="http://192.168.0.
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." bty transfer -a 100 -t 19EZ1ngq8p2TPs5TLpEZwTjnnAgftaYanh ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." bty transfer -a 100 -t 19EZ1ngq8p2TPs5TLpEZwTjnnAgftaYanh
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." bty send_exec -a 100 -e user.p.guess.guess //向平项链地址转账:
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." bty send_exec -a 300 -e user.p.guess.guess
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet sign -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -d ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet sign -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -d
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet send -d ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet send -d
...@@ -165,12 +169,12 @@ zzh@zzh-Vostro-3470:~/work/testnet$ ./chain33-cli --rpc_laddr="http://192.168.0. ...@@ -165,12 +169,12 @@ zzh@zzh-Vostro-3470:~/work/testnet$ ./chain33-cli --rpc_laddr="http://192.168.0.
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -e user.p.guess.guess ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -e user.p.guess.guess
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU -e user.p.guess.guess ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU -e user.p.guess.guess
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -e user.p.guess.guess ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -e user.p.guess.guess
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." bty send_exec -a 100 -e user.p.guess.guess ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." bty send_exec -a 100 -e user.p.guess.guess
合约地址: 合约地址:GetStateDB
19EZ1ngq8p2TPs5TLpEZwTjnnAgftaYanh 19EZ1ngq8p2TPs5TLpEZwTjnnAgftaYanh
...@@ -183,7 +187,7 @@ ex ...@@ -183,7 +187,7 @@ ex
./predict testCreate 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt ./predict testCreate 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
得到一个tx hash 得到一个tx hash
根据tx hash查询交易,并得到gameid 根据tx hash查询交易,并得到gameid
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" tx query -s "0xc510231189aa4983cd72a046b7aef3a6cca5737264d0d4333fef8755ee226a52" ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" tx query -s "0xbc5d283009d8e5393471d62efcb2ac2e212d3cd2ccde6c46d76954872badb85c"
使用测试程序参与游戏 使用测试程序参与游戏
./predict testBet "0xafe2b9e70ad67476b131112ba465fa611d4197136e9cbd3632bf42cba4e84714" "A" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt" ./predict testBet "0xafe2b9e70ad67476b131112ba465fa611d4197136e9cbd3632bf42cba4e84714" "A" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
...@@ -197,17 +201,19 @@ ex ...@@ -197,17 +201,19 @@ ex
取消游戏 取消游戏
./predict testAbort "0xac8f3dc36eb9b6148ea3593cbb766ce3bd40fbb1b15060a37634a53947ac6f4f" ./predict testAbort "0xac8f3dc36eb9b6148ea3593c./chain33-cli --rpc_laddr="http://192.168.0.155:8801" wallet unlock -p zzh -t 0bb766ce3bd40fbb1b15060a37634a53947ac6f4f"
查询 查询
./predict testQueryGamesByIds "0x9fda83a900faa12aad6c6532fd53668df92b1d151707bc402e264ed25568d71e" ./predict testQueryGamesByIDs "0x423ef65773dc170f014cab13854d4be454009bf289d6823d4953dac4320e9650"
./predict testQueryGameById "0xac8f3dc36eb9b6148ea3593cbb766ce3bd40fbb1b15060a37634a53947ac6f4f" ./predict testQueryGameByID "0x423ef65773dc170f014cab13854d4be454009bf289d6823d4953dac4320e9650"
./predict testQueryGamesByAddr 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k 0 ./predict testQueryGamesByAddr 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k 0
./predict testQueryGamesByAddr 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt 0 ./predict testQueryGamesByAddr 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt 0
./predict testQueryGamesByAddr 1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU 0
./predict testQueryGamesByStatus 11 0 ./predict testQueryGamesByStatus 11 0
GuessGameStatusStart = 11 GuessGameStatusStart = 11
GuessGameStatusBet GuessGameStatusBet
...@@ -218,22 +224,20 @@ ex ...@@ -218,22 +224,20 @@ ex
./predict testQueryGamesByAdminAddr 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k 0 ./predict testQueryGamesByAdminAddr 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k 0
./predict testQueryGamesByAdminAddr 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt 0
./predict testQueryGamesByAddrStatus 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt 12 0 ./predict testQueryGamesByAddrStatus 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt 12 0
./predict testQueryGamesByAddrStatus 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k 12 0
./predict testQueryGamesByAddrStatus 1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU 15 0
./predict testQueryGamesByStatus 11 0 ./predict testQueryGamesByStatus 11 0
./predict testQueryGamesByAdminStatus 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k 11 0 ./predict testQueryGamesByAdminStatus 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt 11 0
./predict testQueryGamesByCategoryStatus football 11 0 ./predict testQueryGamesByCategoryStatus football 11 0
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -e user.p.guess.guess ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -e user.p.guess.guess
{ {
"balance": "100.0000", "balance": "100.0000",
...@@ -259,12 +263,9 @@ ex ...@@ -259,12 +263,9 @@ ex
./predict testAbort "0x56a8bc427ecc0578eba02063b36929cc1e4b0995630954c8c8b6b4dd840bc69d" 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt ./predict testAbort "0x56a8bc427ecc0578eba02063b36929cc1e4b0995630954c8c8b6b4dd840bc69d" 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
一次完整的游戏过程: 一次完整的游戏过程:
游戏开始前: 游戏开始前:
zzh@zzh-Vostro-3470:~/work/para$ ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account list ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account list
{ {
"wallets": [ "wallets": [
{ {
...@@ -294,13 +295,14 @@ zzh@zzh-Vostro-3470:~/work/para$ ./chain33-cli --rpc_laddr="http://192.168.0.233 ...@@ -294,13 +295,14 @@ zzh@zzh-Vostro-3470:~/work/para$ ./chain33-cli --rpc_laddr="http://192.168.0.233
] ]
} }
zzh@zzh-Vostro-3470:~/work/para$ ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -e user.p.guess.guess ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -e user.p.guess.guess
{ {
"balance": "100.0000", "balance": "100.0000",
"frozen": "0.0000", "frozen": "0.0000",
"addr": "1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k" "addr": "1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k"
} }
zzh@zzh-Vostro-3470:~/work/para$ ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU -e user.p.guess.guess
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU -e user.p.guess.guess
{ {
"balance": "100.0000", "balance": "100.0000",
"frozen": "0.0000", "frozen": "0.0000",
...@@ -308,20 +310,20 @@ zzh@zzh-Vostro-3470:~/work/para$ ./chain33-cli --rpc_laddr="http://192.168.0.233 ...@@ -308,20 +310,20 @@ zzh@zzh-Vostro-3470:~/work/para$ ./chain33-cli --rpc_laddr="http://192.168.0.233
} }
游戏开始: 游戏开始:
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." tx query -s ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." tx query -s 0x31543bb9d245786ed18ee4775244d692cd477cb8b5ac3a445940a1515471fe85
./predict testCreate 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt ./predict testCreate 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
./predict testBet "0x76dae82fcbe554d4b8df5ed1460d71dcac86a50864649a0df43e0c50b245f004" "A" "1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k" ./predict testBet "0xacee3159fb003d0d4540498c17c556e1a61f2acd2d1b913081fa04b02e6e45b8" "A" "1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k"
./predict testBet "0x76dae82fcbe554d4b8df5ed1460d71dcac86a50864649a0df43e0c50b245f004" "B" "1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU" ./predict testBet "0xacee3159fb003d0d4540498c17c556e1a61f2acd2d1b913081fa04b02e6e45b8" "B" "1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU"
./predict testQueryGameById "0x76dae82fcbe554d4b8df5ed1460d71dcac86a50864649a0df43e0c50b245f004" ./predict testQueryGameByID "0xacee3159fb003d0d4540498c17c556e1a61f2acd2d1b913081fa04b02e6e45b8"
./predict testStopBet "0x76dae82fcbe554d4b8df5ed1460d71dcac86a50864649a0df43e0c50b245f004" "1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k" ./predict testStopBet "0xacee3159fb003d0d4540498c17c556e1a61f2acd2d1b913081fa04b02e6e45b8" "1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k"
./predict testPublish "0x76dae82fcbe554d4b8df5ed1460d71dcac86a50864649a0df43e0c50b245f004" "A" "1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU" ./predict testPublish "0xacee3159fb003d0d4540498c17c556e1a61f2acd2d1b913081fa04b02e6e45b8" "A" "1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU"
./predict testStopBet "0x76dae82fcbe554d4b8df5ed1460d71dcac86a50864649a0df43e0c50b245f004" "1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k" ./predict testStopBet "0xacee3159fb003d0d4540498c17c556e1a61f2acd2d1b913081fa04b02e6e45b8" "1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k"
./predict testQueryGameById "0x76dae82fcbe554d4b8df5ed1460d71dcac86a50864649a0df43e0c50b245f004" ./predict testQueryGameById "0xacee3159fb003d0d4540498c17c556e1a61f2acd2d1b913081fa04b02e6e45b8"
./predict testStopBet "0x76dae82fcbe554d4b8df5ed1460d71dcac86a50864649a0df43e0c50b245f004" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt" ./predict testStopBet "0xacee3159fb003d0d4540498c17c556e1a61f2acd2d1b913081fa04b02e6e45b8" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
./predict testQueryGameById "0x76dae82fcbe554d4b8df5ed1460d71dcac86a50864649a0df43e0c50b245f004" ./predict testQueryGameById "0xacee3159fb003d0d4540498c17c556e1a61f2acd2d1b913081fa04b02e6e45b8"
./predict testPublish "0x76dae82fcbe554d4b8df5ed1460d71dcac86a50864649a0df43e0c50b245f004" "A" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt" ./predict testPublish "0xacee3159fb003d0d4540498c17c556e1a61f2acd2d1b913081fa04b02e6e45b8" "A" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
游戏结束: 游戏结束:
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -e user.p.guess.guess ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -e user.p.guess.guess
...@@ -341,40 +343,60 @@ zzh@zzh-Vostro-3470:~/work/para$ ./chain33-cli --rpc_laddr="http://192.168.0.233 ...@@ -341,40 +343,60 @@ zzh@zzh-Vostro-3470:~/work/para$ ./chain33-cli --rpc_laddr="http://192.168.0.233
./predict testCreate 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt ./predict testCreate 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
./predict testBet "0xf63c6bde670011e4905949aff34b97bd00dd3ae3091e2a6ffc390f3f7665b0a1" "A" "1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k" ./predict testBet "0x12f552bbaed59dabd8b510c90e7d3cd3f650640a66072f4058223eb69b8e0b99" "A" "1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k"
./predict testBet "0xf63c6bde670011e4905949aff34b97bd00dd3ae3091e2a6ffc390f3f7665b0a1" "B" "1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU" ./predict testBet "0x12f552bbaed59dabd8b510c90e7d3cd3f650640a66072f4058223eb69b8e0b99" "B" "1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU"
./predict testQueryGameById "0xf63c6bde670011e4905949aff34b97bd00dd3ae3091e2a6ffc390f3f7665b0a1"" ./predict testQueryGameById "0x12f552bbaed59dabd8b510c90e7d3cd3f650640a66072f4058223eb69b8e0b99"
./predict testStopBet "0xf63c6bde670011e4905949aff34b97bd00dd3ae3091e2a6ffc390f3f7665b0a1" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt" ./predict testStopBet "0x12f552bbaed59dabd8b510c90e7d3cd3f650640a66072f4058223eb69b8e0b99" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
./predict testQueryGameById "0xf63c6bde670011e4905949aff34b97bd00dd3ae3091e2a6ffc390f3f7665b0a1" ./predict testQueryGameById "0x12f552bbaed59dabd8b510c90e7d3cd3f650640a66072f4058223eb69b8e0b99"
./predict testPublish "0xf63c6bde670011e4905949aff34b97bd00dd3ae3091e2a6ffc390f3f7665b0a1" "A" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt" ./predict testPublish "0x12f552bbaed59dabd8b510c90e7d3cd3f650640a66072f4058223eb69b8e0b99" "A" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
./predict testQueryGameById "0xf63c6bde670011e4905949aff34b97bd00dd3ae3091e2a6ffc390f3f7665b0a1" ./predict testQueryGameById "0x12f552bbaed59dabd8b510c90e7d3cd3f650640a66072f4058223eb69b8e0b99"
./predict testQueryGamesByStatus 12 0 ./predict testQueryGamesByStatus 12 0
定位问题: 定位问题:
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -e user.p.guess.guess ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -e user.p.guess.guess
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU -e user.p.guess.guess ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." account balance -a 1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU -e user.p.guess.guess
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" wallet unlock -p zzh -t 0 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" wallet unlock -p zzh -t 0
./chain33-cli --rpc_laddr="http://192.168.0.155:8801" wallet unlock -p zzh -t 0
./chain33-cli --rpc_laddr="http://192.168.0.155:8801" account balance -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -e guess
./chain33-cli --rpc_laddr="http://192.168.0.155:8801" account balance -a 1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU -e guess
//向合约地址转账:
./chain33-cli --rpc_laddr="http://192.168.0.155:8801" bty send_exec -a 300 -e guess
./chain33-cli --rpc_laddr="http://192.168.0.155:8801" wallet sign -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -d
./chain33-cli --rpc_laddr="http://192.168.0.155:8801" wallet send -d
./chain33-cli --rpc_laddr="http://192.168.0.155:8801" account balance -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -e guess
./chain33-cli --rpc_laddr="http://192.168.0.155:8801" account balance -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -e guess
./chain33-cli --rpc_laddr="http://192.168.0.155:8801" account balance -a 1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU -e guess
./chain33-cli --rpc_laddr="http://192.168.0.155:8801" account balance -a 14KEKbYtKKQm4wMthSK9J4La4nA转iidGozt -e guess
./chain33-cli --rpc_laddr="http://192.168.0.155:8801" tx query -s 0x9d66c62c6db540946ec2eb1b7da7f3c50a8bb830517ebf6e253235ef3355fbc4
./predict testCreate 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt ./predict testCreate 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
./predict testBet "0x09c972ddf49bc52269cc6c6426691a360bf2e60544588b8135c6f833f732ee96" "A" "1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k" ./predict testBet "0xc3c4c2f63f7941077374493ca417ad499d94d73d53048088cab2bef39c2fdaa9" "A" "1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k"
./predict testBet "0xb2e8fb328a0a7f88661a304497ff256e0803c8a73874c70c273950be7408ef3a" "B" "1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU" ./predict testBet "0xc3c4c2f63f7941077374493ca417ad499d94d73d53048088cab2bef39c2fdaa9" "B" "1hb93FMDVVxhfzK2ziDLCZqL3wxggoFZU"
./predict testQueryGameById "0xb2e8fb328a0a7f88661a304497ff256e0803c8a73874c70c273950be7408ef3a" ./predict testQueryGameByID "0xc3c4c2f63f7941077374493ca417ad499d94d73d53048088cab2bef39c2fdaa9"
./predict testStopBet "0xb2e8fb328a0a7f88661a304497ff256e0803c8a73874c70c273950be7408ef3a" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt" ./predict testStopBet "0xc3c4c2f63f7941077374493ca417ad499d94d73d53048088cab2bef39c2fdaa9" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
./predict testQueryGameById "0xc4ee4b059523ac61b509eadc94b05e6813ad7facc7a7003264e1494ae77e0bc3" ./predict testQueryGameByID "0xc3c4c2f63f7941077374493ca417ad499d94d73d53048088cab2bef39c2fdaa9"
./predict testPublish "0xb2e8fb328a0a7f88661a304497ff256e0803c8a73874c70c273950be7408ef3a" "B" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt" ./predict testPublish "0xc3c4c2f63f7941077374493ca417ad499d94d73d53048088cab2bef39c2fdaa9" "B" "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
./predict testQueryGameById "0xb2e8fb328a0a7f88661a304497ff256e0803c8a73874c70c273950be7408ef3a" ./predict testQueryGameByID "0xc3c4c2f63f7941077374493ca417ad499d94d73d53048088cab2bef39c2fdaa9"
./predict testQueryGamesByStatus 12 0 ./predict testQueryGamesByStatus 12 0
./predict testAbort "0xdfae36ed64454d27ca76aeac2615ccd92214c72043769fc483152a2cc7d0d757" 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt ./predict testAbort "0xc3c4c2f63f7941077374493ca417ad499d94d73d53048088cab2bef39c2fdaa9" 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." tx query -s 0x8537fd4fb989b79f4f72d21733e7ce02fdd21a8738faf9eff0153937a4d8eb9d
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." tx query -s 0x02a0e0f1f11c2a001c6b794b29f9bf8ba8b7191228ea02acda4b2e93d227730c
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." tx query -s 0x40ee853e40e1ee2df05bb04129bac7eaf691b977590e8d0dc7665f8bd9fa9eb8
对chain33-cli guess的测试: 对chain33-cli guess的测试:
sudo ifconfig enp1s0:1 192.168.0.233 netmask 255.255.255.0
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" wallet unlock -p zzh -t 0 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" wallet unlock -p zzh -t 0
./chain33-cli --rpc_laddr="http://192.168.0.155:8801" wallet unlock -p zzh -t 0
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query --help zzh@zzh-Vostro-3470:~/code/go/src/github.com/33cn/plugin/build$ ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query --help
query info query info
Usage: Usage:
...@@ -389,37 +411,38 @@ Flags: ...@@ -389,37 +411,38 @@ Flags:
-h, --help help for query -h, --help help for query
-i, --index int index -i, --index int index
-s, --status int32 status -s, --status int32 status
-t, --type int32 query type, 1:Ids,2:Id,3:Addr,4:Status,5:AdminAddr,6:AddrStatus,7:AdminStatus,8:CategoryStatus (default 1) -t, --type string query type:ids,id,addr,status,adminAddr,addrStatus,adminStatus,categoryStatus
Global Flags: Global Flags:
--paraName string parachain --paraName string parachain
--rpc_laddr string http url (default "http://localhost:8801") --rpc_laddr string http url (default "http://localhost:8801")
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query --help ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query --help
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t 1 -d "0xb2e8fb328a0a7f88661a304497ff256e0803c8a73874c70c273950be7408ef3a" ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t ids -d "0x423ef65773dc170f014cab13854d4be454009bf289d6823d4953dac4320e9650"
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t 2 -g "0x09c972ddf49bc52269cc6c6426691a360bf2e60544588b8135c6f833f732ee96" ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t id -g "0x09c972ddf49bc52269cc6c6426691a360bf2e60544588b8135c6f833f732ee96"
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t 3 -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t addr -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t 4 -s 12 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t status -s 12
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t 5 -m 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t adminAddr -m 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t 6 -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -s 12 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t addrStatus -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -s 12
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t 7 -m 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -s 12 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t adminStatus -m 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -s 12
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t 8 -c football -s 12 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess query -t categoryStatus -c football -s 12
创建游戏 创建游戏
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess start -t "WorldCup Final" -o "A:France;B:Claodia" -c "sport" -m 1000 -s 10 -n 100 -e 10000 -d 5 -p 5 -g 0.01 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess start -t "WorldCup Final" -o "A:France;B:Claodia" -c "sport" -m 1000 -s 10 -n 100 -e 10000 -d 5 -p 5
参与游戏 参与游戏
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess bet -b 2000000000 -f 0.01 -g 0x5203a692d73406e447b99a151dd9c63b40064fff3ed86a7bda4a821b669edb43 -o "B" ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess bet -b 2000000000 -g 0x5203a692d73406e447b99a151dd9c63b40064fff3ed86a7bda4a821b669edb43 -o "B"
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess bet -b 2000000000 -f 0.01 -g 0x5203a692d73406e447b99a151dd9c63b40064fff3ed86a7bda4a821b669edb43 -o "A" ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess bet -b 2000000000 -g 0x5203a692d73406e447b99a151dd9c63b40064fff3ed86a7bda4a821b669edb43 -o "A"
停止投注 停止投注
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess stop -g 0x09c972ddf49bc52269cc6c6426691a360bf2e60544588b8135c6f833f732ee96 -f 0.01 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess stop -g 0x09c972ddf49bc52269cc6c6426691a360bf2e60544588b8135c6f833f732ee96
公布游戏 公布游戏
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess publish -g 0x5203a692d73406e447b99a151dd9c63b40064fff3ed86a7bda4a821b669edb43 -f 0.01 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess publish -g 0x5203a692d73406e447b99a151dd9c63b40064fff3ed86a7bda4a821b669edb43 -r "A"
撤销游戏 撤销游戏
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess abort -g 0xc4ee4b059523ac61b509eadc94b05e6813ad7facc7a7003264e1494ae77e0bc3 -f 0.01 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." guess abort -g 0xc4ee4b059523ac61b509eadc94b05e6813ad7facc7a7003264e1494ae77e0bc3
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet sign -a 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -d ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet sign -a 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -d
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet sign -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -d ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet sign -a 1M3BKgh9hAzY5xcEmCCtAkainjCtrbqU3k -d
...@@ -427,7 +450,7 @@ Global Flags: ...@@ -427,7 +450,7 @@ Global Flags:
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet send -d ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." wallet send -d
./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." tx query -s 0xa4cb61f1a9008cd0378cf8c06ff1e9baa2127e94178af4a0405c93c0aa606c95 ./chain33-cli --rpc_laddr="http://192.168.0.233:8901" --paraName="user.p.guess." tx query -s 0x27a0258149549253daa7855c265a025c8eada32185e04539e58d3b8ff03442b1
...@@ -13,6 +13,7 @@ import ( ...@@ -13,6 +13,7 @@ import (
"strconv" "strconv"
//jsonrpc "github.com/33cn/chain33/rpc/jsonclient" //jsonrpc "github.com/33cn/chain33/rpc/jsonclient"
//pty "github.com/33cn/plugin/plugin/dapp/guess/types" //pty "github.com/33cn/plugin/plugin/dapp/guess/types"
"encoding/hex"
) )
var ( var (
...@@ -42,7 +43,7 @@ var ( ...@@ -42,7 +43,7 @@ var (
4.对历史数据进行查询 4.对历史数据进行查询
 //待补充  //待补充
*/ */
Jrpc_Url = "http://192.168.0.233:8901" Jrpc_Url = "http://192.168.0.143:9901"
//Jrpc_Url = "http://localhost:8801" //Jrpc_Url = "http://localhost:8801"
//Jrpc_Url = "http://192.168.0.159:8901" //Jrpc_Url = "http://192.168.0.159:8901"
//Jrpc_Url = "http://192.168.0.159:8901" //Jrpc_Url = "http://192.168.0.159:8901"
...@@ -73,6 +74,25 @@ func init() { ...@@ -73,6 +74,25 @@ func init() {
} }
//FromHex hex -> []byte
func FromHex(s string) ([]byte, error) {
if len(s) > 1 {
if s[0:2] == "0x" || s[0:2] == "0X" {
s = s[2:]
}
if len(s)%2 == 1 {
s = "0" + s
}
return Hex2Bytes(s)
}
return []byte{}, nil
}
//Hex2Bytes hex -> []byte
func Hex2Bytes(str string) ([]byte, error) {
return hex.DecodeString(str)
}
func main() { func main() {
fmt.Println(len(os.Args)) fmt.Println(len(os.Args))
...@@ -84,7 +104,7 @@ func main() { ...@@ -84,7 +104,7 @@ func main() {
} }
if os.Args[1] == "testCreate" { if os.Args[1] == "testCreate" {
testCreateGuess(os.Args[2]) testCreateGuess(os.Args[2])//FromHex hex -> []byte
} else if os.Args[1] == "testBet" { } else if os.Args[1] == "testBet" {
testBetGuess(os.Args[2], os.Args[3], os.Args[4]) testBetGuess(os.Args[2], os.Args[3], os.Args[4])
} else if os.Args[1] == "testPublish" { } else if os.Args[1] == "testPublish" {
...@@ -93,32 +113,52 @@ func main() { ...@@ -93,32 +113,52 @@ func main() {
testStopBetGuess(os.Args[2], os.Args[3]) testStopBetGuess(os.Args[2], os.Args[3])
} else if os.Args[1] == "testAbort" { } else if os.Args[1] == "testAbort" {
testAbortGuess(os.Args[2], os.Args[3]) testAbortGuess(os.Args[2], os.Args[3])
} else if os.Args[1] == "testQueryGameById" { } else if os.Args[1] == "testQueryGameByID" {
testQueryGameById(os.Args[2]) testQueryGameByID(os.Args[2])
} else if os.Args[1] == "testQueryGamesByAddr" { } else if os.Args[1] == "testQueryGamesByAddr" {
index, _ := strconv.ParseInt(os.Args[3], 10, 64) if len(os.Args) < 4 {
testQueryGamesByAddr(os.Args[2], index) testQueryGamesByAddr(os.Args[2], "")
} else {
testQueryGamesByAddr(os.Args[2], os.Args[3])
}
} else if os.Args[1] == "testQueryGamesByStatus" { } else if os.Args[1] == "testQueryGamesByStatus" {
status, _ := strconv.Atoi(os.Args[2]) status, _ := strconv.Atoi(os.Args[2])
index, _ := strconv.ParseInt(os.Args[3], 10, 64) if len(os.Args) < 4 {
testQueryGamesByStatus(int32(status), index) testQueryGamesByStatus(int32(status), "")
} else {
testQueryGamesByStatus(int32(status), os.Args[3])
}
} else if os.Args[1] == "testQueryGamesByAdminAddr" { } else if os.Args[1] == "testQueryGamesByAdminAddr" {
index, _ := strconv.ParseInt(os.Args[3], 10, 64)
testQueryGamesByAdminAddr(os.Args[2], index) if len(os.Args) < 4 {
testQueryGamesByAdminAddr(os.Args[2], "")
} else {
testQueryGamesByAdminAddr(os.Args[2], os.Args[3])
}
} else if os.Args[1] == "testQueryGamesByAddrStatus" { } else if os.Args[1] == "testQueryGamesByAddrStatus" {
status, _ := strconv.Atoi(os.Args[3]) status, _ := strconv.Atoi(os.Args[3])
index, _ := strconv.ParseInt(os.Args[4], 10, 64) if len(os.Args) < 5 {
testQueryGamesByAddrStatus(os.Args[2], int32(status), index) testQueryGamesByAddrStatus(os.Args[2], int32(status), "")
} else {
testQueryGamesByAddrStatus(os.Args[2], int32(status), os.Args[4])
}
} else if os.Args[1] == "testQueryGamesByAdminStatus" { } else if os.Args[1] == "testQueryGamesByAdminStatus" {
status, _ := strconv.Atoi(os.Args[3]) status, _ := strconv.Atoi(os.Args[3])
index, _ := strconv.ParseInt(os.Args[4], 10, 64) if len(os.Args) < 5 {
testQueryGamesByAdminStatus(os.Args[2], int32(status), index) testQueryGamesByAdminStatus(os.Args[2], int32(status), "")
} else {
testQueryGamesByAdminStatus(os.Args[2], int32(status), os.Args[4])
}
} else if os.Args[1] == "testQueryGamesByCategoryStatus" { } else if os.Args[1] == "testQueryGamesByCategoryStatus" {
status, _ := strconv.Atoi(os.Args[3]) status, _ := strconv.Atoi(os.Args[3])
index, _ := strconv.ParseInt(os.Args[4], 10, 64) if len(os.Args) < 5 {
testQueryGamesByCategoryStatus(os.Args[2], int32(status), index) testQueryGamesByCategoryStatus(os.Args[2], int32(status), "")
}else if os.Args[1] == "testQueryGamesByIds" { } else {
testQueryGamesByIds(os.Args[2:]) testQueryGamesByCategoryStatus(os.Args[2], int32(status), os.Args[4])
}
}else if os.Args[1] == "testQueryGamesByIDs" {
testQueryGamesByIDs(os.Args[2:])
} }
} }
...@@ -157,39 +197,39 @@ func constructTx(poststr string) (string, error) { ...@@ -157,39 +197,39 @@ func constructTx(poststr string) (string, error) {
} }
func createGuessGameStartTx() (string, error) { func createGuessGameStartTx() (string, error) {
poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction","params":[{"execer":"guess","actionName":"GuessStart", "payload":{"topic":"%v","options":"%v", "category":"%v","maxBets":%v,"maxBetsNumber":%v,"fee":%v,"devFeeFactor":%v,"devFeeAddr":"%v","platFeeFactor":%v, "platFeeAddr":"%v"}}]}`,"WorldCup Final", "A:France;B:Claodia", "football", int64(100e8), int64(1000e8),fee, 5, "1D6RFZNp2rh6QdbcZ1d7RWuBUz61We6SD7", 5, "1PHtChNt3UcfssR7v7trKSk3WJtAWjKjjX") poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction","params":[{"execer":"guess","actionName":"Start", "payload":{"topic":"%v","options":"%v", "category":"%v","maxBetsOneTime":%v,"maxBetsNumber":%v,"devFeeFactor":%v,"devFeeAddr":"%v","platFeeFactor":%v, "platFeeAddr":"%v"}}]}`,"WorldCup Final", "A:France;B:Claodia", "football", int64(100e8), int64(1000e8),5, "1D6RFZNp2rh6QdbcZ1d7RWuBUz61We6SD7", 5, "1PHtChNt3UcfssR7v7trKSk3WJtAWjKjjX")
fmt.Println(poststr) fmt.Println(poststr)
return constructTx(poststr) return constructTx(poststr)
} }
func createGuessGameBetTx(id, option string) (string, error) { func createGuessGameBetTx(id, option string) (string, error) {
poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction", poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction",
"params":[{"execer":"guess","actionName":"GuessBet", "payload":{"gameId":"%v","option":"%v", "betsNum":%v,"fee":%v}}]}`, "params":[{"execer":"guess","actionName":"Bet", "payload":{"gameID":"%v","option":"%v", "betsNum":%v}}]}`,
id, option, int64(500000000),fee) id, option, int64(500000000))
fmt.Println(poststr) fmt.Println(poststr)
return constructTx(poststr) return constructTx(poststr)
} }
func createGuessGamePublishTx(id, option string) (string, error) { func createGuessGamePublishTx(id, option string) (string, error) {
poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction", poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction",
"params":[{"execer":"guess","actionName":"GuessPublish", "payload":{"gameId":"%v","result":"%v", "fee":%v}}]}`, "params":[{"execer":"guess","actionName":"Publish", "payload":{"gameID":"%v","result":"%v"}}]}`,
id, option, fee) id, option)
fmt.Println(poststr) fmt.Println(poststr)
return constructTx(poststr) return constructTx(poststr)
} }
func createGuessGameStopBetTx(id string) (string, error) { func createGuessGameStopBetTx(id string) (string, error) {
poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction", poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction",
"params":[{"execer":"guess","actionName":"GuessStopBet", "payload":{"gameId":"%v", "fee":%v}}]}`, "params":[{"execer":"guess","actionName":"StopBet", "payload":{"gameID":"%v"}}]}`,
id, fee) id)
fmt.Println(poststr) fmt.Println(poststr)
return constructTx(poststr) return constructTx(poststr)
} }
func createGuessGameAbortTx(id string) (string, error) { func createGuessGameAbortTx(id string) (string, error) {
poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction", poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction",
"params":[{"execer":"guess","actionName":"GuessAbort", "payload":{"gameId":"%v", "fee":%v}}]}`, "params":[{"execer":"guess","actionName":"Abort", "payload":{"gameID":"%v"}}]}`,
id, fee) id)
fmt.Println(poststr) fmt.Println(poststr)
return constructTx(poststr) return constructTx(poststr)
} }
...@@ -322,14 +362,14 @@ func SendTx(hexTx string) { ...@@ -322,14 +362,14 @@ func SendTx(hexTx string) {
fmt.Printf("returned JSON: %s\n", string(b)) fmt.Printf("returned JSON: %s\n", string(b))
} }
func testQueryGamesByIds(gameIds []string) { func testQueryGamesByIDs(gameIds []string) {
str := fmt.Sprintf("\"%s\"", gameIds[0]) str := fmt.Sprintf("\"%s\"", gameIds[0])
for i := 1 ; i < len(gameIds); i++ { for i := 1 ; i < len(gameIds); i++ {
str = str + fmt.Sprintf(",\"%s\"", gameIds[i]) str = str + fmt.Sprintf(",\"%s\"", gameIds[i])
} }
fmt.Println("str:", str) fmt.Println("str:", str)
poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query", poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByIds","payload":{"gameIds":[%s]}}]}`,str) "params":[{"execer":"guess","funcName":"QueryGamesByIDs","payload":{"gameIDs":[%s]}}]}`,str)
fmt.Println("post data:", poststr) fmt.Println("post data:", poststr)
resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr)) resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr))
...@@ -352,9 +392,9 @@ func testQueryGamesByIds(gameIds []string) { ...@@ -352,9 +392,9 @@ func testQueryGamesByIds(gameIds []string) {
return return
} }
func testQueryGameById(gameId string) { func testQueryGameByID(gameId string) {
poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query", poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGameById","payload":{"gameId":"%v"}}]}`, gameId) "params":[{"execer":"guess","funcName":"QueryGameByID","payload":{"gameID":"%v"}}]}`, gameId)
fmt.Println("post data:", poststr) fmt.Println("post data:", poststr)
...@@ -378,9 +418,9 @@ func testQueryGameById(gameId string) { ...@@ -378,9 +418,9 @@ func testQueryGameById(gameId string) {
return return
} }
func testQueryGamesByAddr(addr string,index int64) { func testQueryGamesByAddr(addr string,nextkey string) {
poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query", poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByAddr","payload":{"addr":"%v","index":"%v"}}]}`, addr, index) "params":[{"execer":"guess","funcName":"QueryGamesByAddr","payload":{"addr":"%v","primaryKey":"%v"}}]}`, addr, nextkey)
fmt.Println("post data:", poststr) fmt.Println("post data:", poststr)
resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr)) resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr))
...@@ -403,9 +443,9 @@ func testQueryGamesByAddr(addr string,index int64) { ...@@ -403,9 +443,9 @@ func testQueryGamesByAddr(addr string,index int64) {
return return
} }
func testQueryGamesByStatus(status int32, index int64) { func testQueryGamesByStatus(status int32, nextkey string) {
poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query", poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByStatus","payload":{"status":"%v","index":"%v"}}]}`, status, index) "params":[{"execer":"guess","funcName":"QueryGamesByStatus","payload":{"status":"%v","primaryKey":"%v"}}]}`, status, nextkey)
fmt.Println("post data:", poststr) fmt.Println("post data:", poststr)
resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr)) resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr))
if err != nil { if err != nil {
...@@ -427,9 +467,13 @@ func testQueryGamesByStatus(status int32, index int64) { ...@@ -427,9 +467,13 @@ func testQueryGamesByStatus(status int32, index int64) {
return return
} }
func testQueryGamesByAdminAddr(addr string,index int64) { func testQueryGamesByAdminAddr(addr string,nextKey string) {
poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query", var poststr string
"params":[{"execer":"guess","funcName":"QueryGamesByAdminAddr","payload":{"adminAddr":"%v","index":"%v"}}]}`, addr, index)
poststr = fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByAdminAddr","payload":{"adminAddr":"%v","primaryKey":"%v"}}]}`, addr, nextKey)
fmt.Println("post data:", poststr) fmt.Println("post data:", poststr)
resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr)) resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr))
if err != nil { if err != nil {
...@@ -452,9 +496,9 @@ func testQueryGamesByAdminAddr(addr string,index int64) { ...@@ -452,9 +496,9 @@ func testQueryGamesByAdminAddr(addr string,index int64) {
} }
func testQueryGamesByAddrStatus(addr string,status int32, index int64) { func testQueryGamesByAddrStatus(addr string,status int32, nextkey string) {
poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query", poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByAddrStatus","payload":{"addr":"%v","status":"%v","index":"%v"}}]}`, addr, status, index) "params":[{"execer":"guess","funcName":"QueryGamesByAddrStatus","payload":{"addr":"%v","status":"%v","primaryKey":"%v"}}]}`, addr, status, nextkey)
fmt.Println("post data:", poststr) fmt.Println("post data:", poststr)
resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr)) resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr))
if err != nil { if err != nil {
...@@ -476,9 +520,9 @@ func testQueryGamesByAddrStatus(addr string,status int32, index int64) { ...@@ -476,9 +520,9 @@ func testQueryGamesByAddrStatus(addr string,status int32, index int64) {
return return
} }
func testQueryGamesByAdminStatus(addr string,status int32, index int64) { func testQueryGamesByAdminStatus(addr string,status int32, nextkey string) {
poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query", poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByAdminStatus","payload":{"adminAddr":"%v","status":"%v","index":"%v"}}]}`, addr, status, index) "params":[{"execer":"guess","funcName":"QueryGamesByAdminStatus","payload":{"adminAddr":"%v","status":"%v","primaryKey":"%v"}}]}`, addr, status, nextkey)
fmt.Println("post data:", poststr) fmt.Println("post data:", poststr)
resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr)) resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr))
if err != nil { if err != nil {
...@@ -500,9 +544,9 @@ func testQueryGamesByAdminStatus(addr string,status int32, index int64) { ...@@ -500,9 +544,9 @@ func testQueryGamesByAdminStatus(addr string,status int32, index int64) {
return return
} }
func testQueryGamesByCategoryStatus(category string,status int32, index int64) { func testQueryGamesByCategoryStatus(category string,status int32, nextkey string) {
poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query", poststr := fmt.Sprintf(`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByCategoryStatus","payload":{"category":"%v","status":"%v","index":"%v"}}]}`, category, status, index) "params":[{"execer":"guess","funcName":"QueryGamesByCategoryStatus","payload":{"category":"%v","status":"%v","primaryKey":"%v"}}]}`, category, status, nextkey)
fmt.Println("post data:", poststr) fmt.Println("post data:", poststr)
resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr)) resp, err := http.Post(getJrpc(), "application/json", bytes.NewBufferString(poststr))
if err != nil { if err != nil {
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment