Browse Source

tests scripts and regression script relating bitcoin RPC by Kashi

release/v0.1
kashifali 8 years ago
parent
commit
3d73541f86
  1. 12
      iguana/Kashi/Getnewaddress_dumpprivkey
  2. 1034
      iguana/Kashi/Reg_bitcoinRPCs
  3. 1
      iguana/Kashi/activehandle
  4. 2
      iguana/Kashi/addmultisig
  5. 1
      iguana/Kashi/backupwallet
  6. 1
      iguana/Kashi/bitcoinrpc
  7. 47
      iguana/Kashi/bjsoncmp.c
  8. 5
      iguana/Kashi/checkwallet
  9. 7
      iguana/Kashi/createmultisig
  10. 2
      iguana/Kashi/createrawtransaction
  11. 1
      iguana/Kashi/decoderawtransaction
  12. 1
      iguana/Kashi/decoderawtransactionB
  13. 1
      iguana/Kashi/decodescript
  14. 9
      iguana/Kashi/dumpprivkey
  15. 1
      iguana/Kashi/dumpprivkeyB
  16. 1
      iguana/Kashi/dumpprivkeyC
  17. 3
      iguana/Kashi/dumpprivkeyI
  18. 1
      iguana/Kashi/dumpprivkeyP
  19. 1
      iguana/Kashi/dumpprivkeyR
  20. 1
      iguana/Kashi/dumpwallet
  21. 1
      iguana/Kashi/dumpwallet_B
  22. 1
      iguana/Kashi/encryptwallet
  23. 18
      iguana/Kashi/encryptwallet_LP
  24. 4
      iguana/Kashi/encryptwallet_SP
  25. 18
      iguana/Kashi/encryptwallet_WOP
  26. 16
      iguana/Kashi/getaccount
  27. 21
      iguana/Kashi/getaccount_WOA
  28. 23
      iguana/Kashi/getaccount_WVA
  29. 1
      iguana/Kashi/getaccountaddress
  30. 5
      iguana/Kashi/getaccountaddress_WVA
  31. 2
      iguana/Kashi/getaddressFromBundle
  32. 21
      iguana/Kashi/getaddressbyaccount_DA
  33. 4
      iguana/Kashi/getaddressbyaccount_WVN
  34. 3
      iguana/Kashi/getbalance_PA
  35. 19
      iguana/Kashi/getbalance_casuingCrash
  36. 5
      iguana/Kashi/getbestblockhash
  37. 3
      iguana/Kashi/getblock
  38. 5
      iguana/Kashi/getblockcount
  39. 4
      iguana/Kashi/getblockhash
  40. 340
      iguana/Kashi/getblockhash.c
  41. 4
      iguana/Kashi/getblockhash_cp
  42. 4
      iguana/Kashi/getinfo
  43. 1
      iguana/Kashi/getnewaddress
  44. 20
      iguana/Kashi/getrawchangeaddress_notImplemented
  45. 18
      iguana/Kashi/getrawtransaction
  46. 13
      iguana/Kashi/getreceivedbyaccount_WIA
  47. 13
      iguana/Kashi/getreceivedbyaccount_WVA
  48. 1
      iguana/Kashi/getreceivedbyaddress
  49. 25
      iguana/Kashi/getreceivedbyaddress_WVA
  50. 30
      iguana/Kashi/getrecev
  51. 15
      iguana/Kashi/gettransaction
  52. 11
      iguana/Kashi/gettxout
  53. 3
      iguana/Kashi/gettxoutsetinfo
  54. 19
      iguana/Kashi/getwalletinfo
  55. 1
      iguana/Kashi/importprivkey
  56. 1
      iguana/Kashi/importprivkeyB
  57. 1
      iguana/Kashi/importprivkeyR
  58. BIN
      iguana/Kashi/json_extract
  59. 25
      iguana/Kashi/json_extract.c
  60. BIN
      iguana/Kashi/json_extracta
  61. 25
      iguana/Kashi/json_extracta.c
  62. BIN
      iguana/Kashi/json_extractd
  63. 25
      iguana/Kashi/json_extractd.c
  64. BIN
      iguana/Kashi/json_extracti
  65. 25
      iguana/Kashi/json_extracti.c
  66. BIN
      iguana/Kashi/jsoncmp
  67. 45
      iguana/Kashi/jsoncmp.c
  68. 4
      iguana/Kashi/listaccount_ALL
  69. 5
      iguana/Kashi/listaddressgrouping
  70. 5
      iguana/Kashi/listaddressgroupings
  71. 3
      iguana/Kashi/listlockunspent
  72. 3
      iguana/Kashi/listreceivedbyaccount
  73. 17
      iguana/Kashi/listreceivedbyaddress
  74. 7
      iguana/Kashi/listtransactions
  75. 1
      iguana/Kashi/listunspent
  76. 12
      iguana/Kashi/listunspent_WIA
  77. 5
      iguana/Kashi/listunspent_WVA
  78. 1
      iguana/Kashi/lockunspent
  79. 1
      iguana/Kashi/login
  80. 1
      iguana/Kashi/logout
  81. 1
      iguana/Kashi/make_jsoncmp
  82. 3
      iguana/Kashi/makekeypair
  83. 1
      iguana/Kashi/move
  84. 1
      iguana/Kashi/prv2pub
  85. 1
      iguana/Kashi/prv2pub1
  86. 1
      iguana/Kashi/rates
  87. 1
      iguana/Kashi/repairwallet
  88. 11
      iguana/Kashi/sendfrom
  89. 6
      iguana/Kashi/sendmany
  90. 2
      iguana/Kashi/sendrawtransaction
  91. 2
      iguana/Kashi/sendtoaddress
  92. 18
      iguana/Kashi/sendtoaddress_WVA
  93. 1
      iguana/Kashi/setaccount
  94. 14
      iguana/Kashi/setaccount_WIA
  95. 14
      iguana/Kashi/setaccount_WVA
  96. 1
      iguana/Kashi/settx
  97. 12
      iguana/Kashi/signmessage
  98. 9
      iguana/Kashi/signmessagewithwrongaddress
  99. 2
      iguana/Kashi/signrawtransaction
  100. 2
      iguana/Kashi/signrawtransaction2

12
iguana/Kashi/Getnewaddress_dumpprivkey

@ -0,0 +1,12 @@
#!/bin/bash
echo "unlocking the wallet"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"walletpassphrase\",\"password\":\"kashifAli!123\",\"timeout\":300}"
echo ""
echo "Generating new address"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getnewaddress\",\"account\":\"kashif\"}" >/tmp/newAddresses
echo ""
./json_extract /tmp/newAddresses address

1034
iguana/Kashi/Reg_bitcoinRPCs

File diff suppressed because it is too large

1
iguana/Kashi/activehandle

@ -0,0 +1 @@
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"SuperNET\",\"method\":\"activehandle\"}"

2
iguana/Kashi/addmultisig

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"addmultisig\",\"params\":[2, [\"1CHzgAakwGCvGX2BG1duWygDuVE6s7tzZ6\", \"d0296ed1364639c696c374730320480301f3194c86231f62f0409cd76467f87c\", \"d045925b3e6f648bca6ed0c65149ee445137f0ab14e88cf60013d88419bcdd60\"], \"msigs\"]}"

1
iguana/Kashi/backupwallet

@ -0,0 +1 @@
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"backupwallet\",\"filename\":\"wallet1.txt\"}"

1
iguana/Kashi/bitcoinrpc

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"SuperNET\",\"method\":\"bitcoinrpc\",\"setcoin\":\"$1\"}"

47
iguana/Kashi/bjsoncmp.c

@ -0,0 +1,47 @@
#include <stdio.h>
#include <stdint.h>
#include "../../includes/cJSON.h"
#include "../../crypto777/OS_portable.h"
int32_t main(int32_t argc,char **argv)
{
cJSON *argjson,*array,*filejson,*obj,*fobj; char *fname,*filestr,*fstr,*str,*field; int32_t i,n; long filesize;
printf("argv[2]: %s\n",argv[2]);
if ( argc > 2 && (argjson= cJSON_Parse(argv[2])) != 0 )
{
fname = argv[1];
printf("got file: %s\n",fname);
if ( (filestr= OS_filestr(&filesize,fname)) != 0 )
{
if ( (filejson= cJSON_Parse(filestr)) != 0 )
{
if ( (array= jarray(&n,argjson,"fields")) != 0 )
{
for (i=0; i<n; i++)
{
obj = jitem(array,i);
if ( (field= jfieldname(obj)) != 0 && (obj= obj->child) != 0 )
{
if ( (fobj= jobj(filejson,field)) != 0 )
{
fstr = jprint(fobj,0);
str = jprint(obj,0);
if ( strcmp(fstr,str) != 0 )
{
printf("{\"error\":\"field.(%s) in (%s) i.%d of n.%d mismatch (%s) != (%s)\"}\n",field,fname,i,n,fstr,str);
fprintf(stderr,"{\"error\":\"field.(%s) in (%s) i.%d of n.%d mismatch (%s) != (%s)\"}\n",field,fname,i,n,fstr,str);
}
else printf("{\"result\":\"MATCHED.[%s] (%s).(%s)\"}\n",fname,field,fstr);
free(str);
free(fstr);
} else fprintf(stderr,"cant find field.(%s) in (%s)\n",field,fname);
} else fprintf(stderr,"no fieldname array[%d]\n",i);
}
} else fprintf(stderr,"no fields array\n");
free_json(filejson);
} else fprintf(stderr,"cant parse.(%s)\n",filestr);
free(filestr);
} else fprintf(stderr,"cant load (%s)\n",fname);
} else fprintf(stderr,"argc.%d fname.(%s) error\n",argc,argv[1]);
}

5
iguana/Kashi/checkwallet

@ -0,0 +1,5 @@
#!/bin/bash
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"checkwallet\"}"

7
iguana/Kashi/createmultisig

@ -0,0 +1,7 @@
#!/bin/bash
#curl --url "http://127.0.0.1:7778" --data "{\"method\":\"createmultisig\",\"params\":[2, [\"026b49ef6a53346455a947c462bbb2a6af25d68ea08fcacb9c288dc7ca727937fe\"]}"
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"createmultisig\",\"Message\":\"1\",\"pubkeys\":\"026b49ef6a53346455a947c462bbb2a6af25d68ea08fcacb9c288dc7ca727937fe\",\"ignore\":\"\"}"

2
iguana/Kashi/createrawtransaction

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"createrawtransaction\",\"params\":[[{\"txid\":\"d8e4c1e92fad9e58ecc3352f35b90298fc0b81241577897b11f414ee88ff11e3\",\"vout\":1}], {\"RAoMou7euzvDwa9dQwjrNB5A41hrAWgvBt\":0.01}]}"

1
iguana/Kashi/decoderawtransaction

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"decoderawtransaction\",\"params\":[\"9869064cd9d571ebc6690cd42dcefeafa2245af625da0e9d34dd540cca3ca6c2","signedtx":"010000005280b357019a1cfa971b8f66f39494d8ec369cfcdbc5096461f52a6d71ec23d9b5867b67a9010000006b483045022100dcffe92e3d1d74a55341f4262141ee0ccff56778d5df58922e00451303f82384022039d5162c9369aaa42d5d20b685b8656fe52cf95313c41d235da71b3b29a353b001210300f1c5870675f3fb332213967ebf6a6af16a036cd324297afc6c32a2d27a0953ffffffff02409c0000000000001976a914b7592ae8a9edd516e6b64731bf575ed5c094fc6288acb0feea0b000000001976a914c7d64ee16ec73e65a7274271170081100f09f89388ac00000000\"]}"

1
iguana/Kashi/decoderawtransactionB

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"decoderawtransaction\",\"params\":[\"01000000dc4f24570156bb006164173811be6647f68f9a46eab4322e6fdef816aeb3e71e419ca49bfe180000006a473044022027e0e1983c88832e9adcad681692e905333f32905553bedc6df2fcacc250574d0220259aa91c7fb0378561c37477c2b5e7872b5c9a1daababe087945639fe79593e0012102d14a195654f536df6dfe5a38278d1b470d00f17de78eeb5ce9e9eea9edb2c212ffffffff01588c0200000000001976a914d8b8c039206af6cec82bca950f592801e62808cb88ac00000000\"]}"

1
iguana/Kashi/decodescript

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"decodescript\",\"scriptstr\":\"76a914dcc39f9cfc5558b09fc7862535cafc98e5a4d63088ac\"}"

9
iguana/Kashi/dumpprivkey

@ -0,0 +1,9 @@
<<<<<<< Updated upstream
<<<<<<< Updated upstream
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"dumpprivkey\",\"params\":[\"RLaBkgU3Y61VLXPNjBd2cW1RfkghXU8yHt\"]}"
=======
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"dumpprivkey\",\"params\":[\"RTzXyTyEYQAELSsSzdfG3orcNyES9jrXGX\"]}"
>>>>>>> Stashed changes
=======
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"dumpprivkey\",\"params\":[\"RTzXyTyEYQAELSsSzdfG3orcNyES9jrXGX\"]}"
>>>>>>> Stashed changes

1
iguana/Kashi/dumpprivkeyB

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"dumpprivkey\",\"params\":[\"RLaBkgU3Y61VLXPNjBd2cW1RfkghXU8yHt\"]}"

1
iguana/Kashi/dumpprivkeyC

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"dumpprivkey\",\"params\":[\"RBNzdRUrY2iDsjucQVEtEF1jyohYLg1d7U\"]}"

3
iguana/Kashi/dumpprivkeyI

@ -0,0 +1,3 @@
#!/bin/bash
curl -s --url "http://127.0.0.1:7778" --data "{\"method\":\"dumpprivkey\",\"params\":[\"RJy9q8GbvqKGZkHmHn6cav96fJqCREWr8d\"]}"

1
iguana/Kashi/dumpprivkeyP

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"dumpprivkey\",\"params\":[\"RPEz7SQ5qn3F5A1uXkab19kzwDf3ryvhvP\"]}"

1
iguana/Kashi/dumpprivkeyR

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"dumpprivkey\",\"params\":[\"522102c866c51b603e2d943774314b88aff1eb04aef3971fcf34503c8f07d27915bc1d2102e053cc9d98d9e157917ed74bcabeaf72006b1ecf019d148dd3eac06271b6bcf02102869ca05bf6b476bb8cb433e08846a67037b921062f49cd0f9f66087454e88abb53ae\"]}"

1
iguana/Kashi/dumpwallet

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"dumpwallet\",\"params\":[]}"

1
iguana/Kashi/dumpwallet_B

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"dumpwallet\",\"filename\":\"dump.txt\"}"

1
iguana/Kashi/encryptwallet

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"encryptwallet\",\"passphrase\":\"testingaccount\"}"

18
iguana/Kashi/encryptwallet_LP

@ -0,0 +1,18 @@
#!/bin/bash
clear
echo ""
echo "
The encryptwallet RPC encrypts the wallet with a passphrase.
This is only to enable encryption for the first time. After encryption is enabled,
you will need to enter the passphrase to use private keys"
echo ""
echo ""
echo "Scenario: Test encryptwallet RPC with long passphrase]"
echo "Result: Should Return status:locked"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"encryptwallet\",\"passphrase\":\"This is a very long passphrase i set to test the encryptwallet rpc\"}"
echo ""
echo ""

4
iguana/Kashi/encryptwallet_SP

@ -0,0 +1,4 @@
#!/bin/bash
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"encryptwallet\",\"passphrase\":\"Admin1234@\"}"

18
iguana/Kashi/encryptwallet_WOP

@ -0,0 +1,18 @@
#!/bin/bash
clear
echo ""
echo "
The encryptwallet RPC encrypts the wallet with a passphrase.
This is only to enable encryption for the first time. After encryption is enabled,
you will need to enter the passphrase to use private keys"
echo ""
echo ""
echo "Scenario: Test encryptwallet RPC without passphrase"
echo "Result: Should Return an error message indicating passphrase required"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"encryptwallet\",\"passphrase\":\"\"}"
echo ""
echo ""

16
iguana/Kashi/getaccount

@ -0,0 +1,16 @@
#!/bin/bash
echo ""
echo "
The getaccount RPC returns the name of the account associated with the given address.
Parameter #1—a Bitcoin address
Result—an account name
"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getaccount\",\"address\":\"RQbUDfuCitztPgJkG8edBU5dy59GD7WQqT\"}"
echo ""

21
iguana/Kashi/getaccount_WOA

@ -0,0 +1,21 @@
#!/bin/bash
echo ""
echo "
The getaccount RPC returns the name of the account associated with the given address.
Parameter #1—a Bitcoin address
Result—an account name"
echo ""
echo ""
echo "Scenario: Verify the error return incase address field is set empty"
echo "Expected: No account for that address"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getaccount\",\"address\":\"RSrtzi1tPkdxD9KfHkXmxDynvPqYc7scV6\"}"
echo ""

23
iguana/Kashi/getaccount_WVA

@ -0,0 +1,23 @@
#!/bin/bash
echo ""
echo "
The getaccount RPC returns the name of the account associated with the given address.
Parameter #1—a Bitcoin address
Result—an account name"
echo ""
echo ""
echo "Dependencies:"
echo "Getaccountaddress RPC, use the address return by getaccountaddress RPC"
echo ""
echo "Scenario: Verify the valid account's name is returned"
echo "Expected: RPCtesting account name should be returned"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getaccount\",\"address\":\"RQ9mx8ZMc5TcrsjZ8HJmgGzGZcT1DEqM1K\"}"
echo ""

1
iguana/Kashi/getaccountaddress

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getaccountaddress\",\"account\":\"check\"}"

5
iguana/Kashi/getaccountaddress_WVA

@ -0,0 +1,5 @@
#!/bin/bash
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getaccountaddress\",\"account\":\"IGUANA\"}"

2
iguana/Kashi/getaddressFromBundle

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"iguana\",\"method\":\"bundleaddresses\",\"activecoin\":\"BTCD\",\"height\":\"500\"}"

21
iguana/Kashi/getaddressbyaccount_DA

@ -0,0 +1,21 @@
#!/bin/bash
echo ""
echo "
The getaddressesbyaccount RPC returns a list of every address assigned to a particular account.
Parameter #1—the account name
Result—a list of addresses
"
echo ""
echo "Dependencies:"
echo "getaccountaddress_WVA RPC"
echo ""
echo "Scenario: Verify the addresses associated with default account"
echo "Result: List of default account addresses"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getaddressesbyaccount\",\"account\":\"\"}"
echo ""

4
iguana/Kashi/getaddressbyaccount_WVN

@ -0,0 +1,4 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getaddressesbyaccount\",\"account\":\"change\"}"
echo ""

3
iguana/Kashi/getbalance_PA

@ -0,0 +1,3 @@
#!/bin/bash
curl -s --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"getbalance\",\"params\":[\"IGUANA\",1,0]}"

19
iguana/Kashi/getbalance_casuingCrash

@ -0,0 +1,19 @@
#!/bin/bash
echo ""
echo "
The getbalance RPC gets the balance in decimal bitcoins across all accounts or for a particular account.
Parameter #1—an account name
Parameter #2—the minimum number of confirmations
Parameter #3—whether to include watch-only addresses
Result—the balance in bitcoins
"
echo ""
echo ""
#curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getbalance\",\"confirmations\":\"\",\"includeempty\":\"0\",\"watchonly\":\"0\"}"
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"getbalance\",\"params\":[*,6,0]}"

5
iguana/Kashi/getbestblockhash

@ -0,0 +1,5 @@
#!/bin/bash
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getbestblockhash\"}"

3
iguana/Kashi/getblock

@ -0,0 +1,3 @@
#!/bin/bash
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getblock\",\"blockhash\":\"50a4f738d4319ad1f437df56ec90fdfb2592b95f5508db379c41227b2cc992c0\",\"verbose\":\"1\",\"remoteonly\":\"0\"}"

5
iguana/Kashi/getblockcount

@ -0,0 +1,5 @@
#!/bin/bash
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getblockcount\"}"

4
iguana/Kashi/getblockhash

@ -0,0 +1,4 @@
#!/bin/bash
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getblockhash\",\"height\":\"345324\"}"

340
iguana/Kashi/getblockhash.c

@ -0,0 +1,340 @@
/******************************************************************************
* *
* *
* Using Brute force techinque program will randomly pick the block and *
* would compare is header hash. The expected header hashes for the blocks *
* are accurate and caculated using local bitcoind *
* *
* All api calls are made on Iguana Core *
* *
******************************************************************************/
#include<stdlib.h>
#include<string.h>
#include<assert.h>
#include<curl/curl.h>
#include<unistd.h>
#include<stdlib.h>
#define MAX_HEADER 45
#define STR_LEN 64
struct MemoryStruct
{
char *memory;
size_t size;
};
static size_t
WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
size_t realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *)userp;
mem->memory = realloc(mem->memory, mem->size + realsize + 1);
if(mem->memory == NULL) {
/* out of memory! */
printf("not enough memory (realloc returned NULL)\n");
return 0;
}
memcpy(&(mem->memory[mem->size]), contents, realsize);
mem->size += realsize;
mem->memory[mem->size] = 0;
return realsize;
}
void fetchBlockHeader(const char * jsonrpc);
void bruteforceHashComparer();
int hash_index = 0;
int in=0;
int ind=0;
//char ActualHash[STR_LEN];
//char ExpectedHash[STR_LEN];
char *ActualHash;
char *ExpectedHash;
const char *hashes[MAX_HEADER] =
{"00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048",
"0000000026f34d197f653c5e80cb805e40612eadb0f45d00d7ea4164a20faa33",
"000000007bc154e0fa7ea32218a72fe2c1bb9f86cf8c9ebf9a715ed27fdb229a",
"000000009ca75733b4cf527fe193b919201a2ed38c9e147a5665fdfade551f4d",
"000000008f1a7008320c16b8402b7f11e82951f44ca2663caf6860ab2eeef320",
"000000004e833644bc7fb021abd3da831c64ec82bae73042cfa63923d47d3303",
"0000000062b69e4a2c3312a5782d7798b0711e9ebac065cd5d19f946439f8609",
"00000000e286ad94972e44b0532f2823bcda3977661a5136ff4d9d7db107d944",
"000000002dd9919f0a67590bb7c945cb57270a060ce39e85d8d37536a71928c3",
"00000000e474895c09bcdaf9261845960b35ea54ed3ecaf60d8a392940f1f3f9",
"000000004ff664bfa7d217f6df64c1627089061429408e1da5ef903b8f3c77db",
"00000000314ff43c77573a3b8094951ce4b0f86aceee65e226914eb737ada575",
"00000000c7f956a913bbef9c94f517c318805821b59ea6227175f3841792ea88",
"00000000d3ebca0f1cf140987959ba9231e9da43f3f76aed02d0cfe9d88b71d7",
"0000000084d973c18381c87a63a2430ad2eff1d84934ec34e3bfd78ffd3cd9c1",
"00000000ad8174a71c1b2c01fd6076143c2cf57d768bf80d7c11b6721d3a2525",
"00000000def8545899ea7274e5c59bda5982f8f960052774df45b7d5c64f9c5d",
"00000000923a992877f070d2c8fa5ae67e66f6edcd828b321caa75885136386b",
"00000000e684309e67fabdf765bea193cdf8532111079b7f53a0839746d19240",
"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09",
"000000009cd3f93cd2d843202155561eb773b2a7b7c97561ddef31e707f4eb4b",
"00000000f0b6da96d1e3272e87e181a7057c3d79bf984b420d4f6fd6d7a49fc7",
"0000000047a712b762d9c91aa1cc2e33fb48ea64276a7086c3c10aa252a934ab",
"00000000c9c28d2bb760225beaddbc212a01720869b624f088e9311df5b5d8f2",
"000000007d07681a955b7bb9d96c473e847395b592b6e9e5a73b15b594bd4013",
"00000000f6b38fee667afb9cb2eedc5a9988d345e7b61ce220d34005d2d5b8bf",
"000000009bf03aa138b1bb31491261221f8d4562941c1022a798acda7e3158d4",
"00000000046d4e2de13c9a31dec05fafcae393ae7de773242abd4db47e9e747f",
"00000000e67f39a80dbba80e5bf130294ef460b89022c7a56c3df76ab2df2e71",
"00000000dfd5d65c9d8561b4b8f60a63018fe3933ecb131fb37f905f87da951a",
"00000000d5092034c3a92473d42f28e3fd279f0652e2d5b0049c7d40fcbc990b",
"0000000070118b55e0436a721d4533fc3d09a0238f72a5380e8a694c9dbf948e",
"0000000091a5fdf4b5f5fe07ed869bf82049b3d61a403f2771b5cbd1937dad09",
"00000000081038eb250216ebb27f94d8896d2984dc962020c53e6a2852b92967",
"00000000d84724559f1691d916b2ed63a44884d495d155197647ce7667116b16",
"0000000091a7488531bb1050f24c0f8f90d4da873673eb4dec62bbce56a32910",
"000000001731f7bb532ebd8ff11c253f128a9e3108eaf038d8155fedeba5bc0c",
"00000000d10250150162aefbf7d64ab10f3b4706ffe4d04ae59ca410f672e97b",
"00000000a4342e04aa766386cdb4da70137efd47ac271f1a4e18429af3020a7c",
"000000004a81b9aa469b11649996ecb0a452c16d1181e72f9f980850a1c5ecce",
"00000000bccaab487030fe7c0d8d66a80fefc157bd75f0de40b6b8d61ea1d287",
"00000000b6641cc18693437c5208bf362730c533fd3ea4cca364793603bba957",
"00000000bfa35a68d94bf878a712c538484d8bc272c6ddd70de4e636d55f45de",
"00000000b590a5ff44afeb50e51444d8b6ccd08f6232951316f33e19b5ca5ff2",
"00000000922e2aa9e84a474350a3555f49f06061fd49df50a9352f156692a842"
};
const char *jsonRPC[MAX_HEADER] =
{ "{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [1] }",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [50] }",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [100]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [150]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [200]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [250]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [300]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [350]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [400]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [450]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [500]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [550]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [600]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [650]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [700]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [750]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [800]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [850]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [900]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [1000]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [1100]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [1200]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [1300]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [1400]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [1500]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [1600]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [1700]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [1800]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [1900]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [2000]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [2100]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [2200]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [2300]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [2400]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [2500]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [2600]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [2700]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [2800]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [2900]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [3000]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [3200]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [3400]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [3600]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [3800]}",
"{\"id\":\"jl777\", \"method\": \"getblockhash\", \"params\": [4000]}"};
int main()
{
int api;
CURL *curl;
CURLcode res;
// struct MemoryStruct chunk;
// chunk.memory = malloc(1); /* will be grown as needed by the realloc above */
// chunk.size = 0; /* no data at this point */
// curl_global_init(CURL_GLOBAL_ALL);
// initialize all sub modules and return an easy handle for upcoming easy transfer
// curl = curl_easy_init();
// raise an assertion if handle is NULL
for(api=0; api<(MAX_HEADER-1); api++)
{
// printf("api == %d\n",api);
fetchBlockHeader(jsonRPC[api]);
}
return 0;
}
void fetchBlockHeader(const char* jsonrpc)
{
CURL *curl;
CURLcode res;
struct MemoryStruct chunk;
chunk.memory = malloc(1); /* will be grown as needed by the realloc above */
chunk.size = 0; /* no data at this point */
curl_global_init(CURL_GLOBAL_ALL);
// initialize all sub modules and return an easy handle for upcoming easy transfer
curl = curl_easy_init();
if(curl == NULL)
{
assert(curl);
}
ActualHash = (char*)calloc(64,sizeof(char));
ExpectedHash = (char*)calloc(64,sizeof(char));
if(ActualHash == NULL)
{
printf("ERROR: memory allocation failed for ActualHash\n");
exit(1);
}
if(ExpectedHash == NULL)
{
printf("ERROR: memory allocation failed for ExpectedHash\n");
exit(1);
}
printf("\n");
printf("RPC:%s\n\n",jsonrpc);
// set the properties and options for curl
// printf("1\n");
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:7778");
/* send all data to this function */
// printf("2\n");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
/* we pass our 'chunk' struct to the callback function */
// printf("3\n");
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
// calculate the length of data that will be passed using POST method to server
// printf("4\n");
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) strlen(jsonrpc));
// the data parameter should be a pointer to character
// printf("5\n");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, jsonrpc);
// request using SSL for the transfer, otherwise normal transfer
// printf("6\n");
curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY);
// printf("7\n");
res =curl_easy_perform(curl);
// printf("8\n");
/* check for errors */
if(res != CURLE_OK) {
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
}
else
{
// printf("9\n");
strcpy(ActualHash,chunk.memory);
//remove space from string
/*
while(ActualHash[in] !='\0')
{
if((ActualHash[in] != ' ') (ActualHash[in+1] != ' '))
{
iguanaResp[ind] = ActualHash[in];
ind++;
}
else
{
printf("Got whitespace\n");
}
in++;
}
iguanaResp[ind] = '\0';
*/
// printf("10\n");
bruteforceHashComparer(curl);
}
sleep(2);
free(ActualHash);
// printf("11\n");
free(ExpectedHash);
// printf("12\n");
free(chunk.memory);
// printf("13\n");
in=0;
ind=0;
curl_easy_cleanup(curl);
//printf("14\n");
}
void bruteforceHashComparer()
{
int ret;
strcpy(ExpectedHash,hashes[hash_index]);
printf("Expect Hash: %s\n",ExpectedHash);
printf("Acutal Hash: %s\n",ActualHash);
ret = strncmp(ExpectedHash,ActualHash,64);
if(ret == 0)
{
printf("\t****************** PASSED ****************\n");
}
else
{
printf("\t****************** FAILED ****************\n");
}
hash_index++;
if(hash_index == MAX_HEADER)
{
hash_index = 0;
// curl_easy_cleanup(curl);
}
}

4
iguana/Kashi/getblockhash_cp

@ -0,0 +1,4 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getblockhash\",\"height\":\"50\"}"

4
iguana/Kashi/getinfo

@ -0,0 +1,4 @@
#!/bin/bash
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getinfo\"}"

1
iguana/Kashi/getnewaddress

@ -0,0 +1 @@
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getnewaddress\",\"account\":\"IGUANA\"}"

20
iguana/Kashi/getrawchangeaddress_notImplemented

@ -0,0 +1,20 @@
#!/bin/bash
echo ""
echo "
The getrawchangeaddress RPC returns a new Bitcoin address for receiving change.
This is for use with raw transactions, not normal use."
echo ""
echo "Result:
A P2PKH address which has not previously been returned by this RPC.
The address will be removed from the keypool but not marked as a receiving address,
so RPCs such as the dumpwallet RPC will show it as a change address."
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getrawchangeaddress\"}"
echo ""

18
iguana/Kashi/getrawtransaction

@ -0,0 +1,18 @@
#!/bin/bash
echo ""
echo "
The getrawtransaction RPC gets a hex-encoded serialized transaction or a JSON object describing the transaction. By default, Bitcoin Core only stores complete transaction data for UTXOs and your own transactions, so the RPC may fail on historic transactions unless you use the non-default txindex=1 in your Bitcoin Core startup settings.
Parameter #1—the TXID of the transaction to get
Parameter #2—whether to get the serialized or decoded transaction
Result (if transaction not found)—null
"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"getrawtransaction\",\"params\":[\"7173c6a02ed2882ffaf6365cad9ed256bd5a60515658a26ab7ba5fcf4793c3bc\"]}"
echo ""

13
iguana/Kashi/getreceivedbyaccount_WIA

@ -0,0 +1,13 @@
#!/bin/bash
echo ""
echo "Dependencies:"
echo "getaccoutaddress, setaccount"
echo ""
echo "Scenario: Verify that correct total amount is retured for mentioned account"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getreceivedbyaccount\",\"account\":\"R\",\"includeempty\":\"2\"}"
echo ""

13
iguana/Kashi/getreceivedbyaccount_WVA

@ -0,0 +1,13 @@
#!/bin/bash
echo ""
echo "Dependencies:"
echo "getaccoutaddress, setaccount"
echo ""
echo "Scenario: Verify that correct total amount is retured for mentioned account"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getreceivedbyaccount\",\"account\":\"IGUANA\",\"includeempty\":\"2\"}"
echo ""

1
iguana/Kashi/getreceivedbyaddress

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"getreceivedbyaddress\",\"params\":[\"17outUgtsnLkguDuXm14tcQ7dMbdD8KZGK\"]}"

25
iguana/Kashi/getreceivedbyaddress_WVA

@ -0,0 +1,25 @@
#!/bin/bash
echo ""
echo " The getreceivedbyaddress RPC returns the total amount received by the specified address in transactions with the specified number of confirmations. It does not count coinbase transactions.
Parameter #1—the address
Parameter #2—the minimum number of confirmations
Result—the number of bitcoins receiv"
echo ""
echo "Dependencies:"
echo "Wallpassphrase, incase wallet is locked"
echo "getaccountaddres, incase account and address don't exist already"
echo "sendtoaddress, if you want to send some coins to that address"
echo ""
echo "Senario: Verify that correct amount is returned for mentioned address"
echo "Result: Correct amount for provided address should be returned"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"getreceivedbyaddress\",\"params\":[\"RMcHHn9RtkdtgVHiCxysrG8q2EQTYiJfRT\"]}"
echo ""

30
iguana/Kashi/getrecev

@ -0,0 +1,30 @@
#!/bin/bash
#GETRECEIVEDBYACCOUNT RPC
sleep 3
printf "\n"
printf "Executing [RPC: GETRECEIVEDBYACCOUNT]\n"
printf "=====================================\n"
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getreceivedbyaccount\",\"account\":\"RMcHHn9RtkdtgVHiCxysrG8q2EQTYiJfRT\",\"includeempty\":\"2\"}" > /tmp/getreceivedbyaccount
printf "\n"
# call json_extract script to get the RPC results value
r_grba=$(~/tests/./json_extract /tmp/getreceivedbyaccount result)
err_grba=$(~/tests/./json_extract /tmp/getreceivedbyaccount error)
if [ "$r_grba" -eq 0 ]
then
printf "PASSED: GETRECEIVEDBYACCOUNT\n\n"
let passed+=1
rm -f /tmp/getreceivedbyaccount
else
printf "FAILED: (Returning Integer WILL IMPLEMENT LATER)\n"
printf "ERROR: %s:\n\n" "$err_grba"
let failed+=1
fi

15
iguana/Kashi/gettransaction

@ -0,0 +1,15 @@
#!/bin/bash
echo ""
echo "
The gettransaction RPC gets detailed information about an in-wallet transaction.
Parameter #1—a transaction identifier (TXID)
Parameter #2—whether to include watch-only addresses in details and calculations
Result—a description of the transaction
"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"gettransaction\",\"params\":[\"e3c08af74ca337ec632294c78c1deb461944e824f9272a280e4e750e70782714\"]}"
echo ""

11
iguana/Kashi/gettxout

@ -0,0 +1,11 @@
#!/bin/bash
echo ""
echo "The gettxout RPC returns details about a transaction output. Only unspent transaction outputs (UTXOs) are guaranteed to be available.
Parameter #1—the TXID of the output to get
Parameter #2—the output index number (vout) of the output to get
Parameter #3—whether to display unconfirmed outputs from the memory "
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"gettxout\",\"params\":[\"51ae6e4cef61c9f496ab9df81800afacd1397bebafafb426b3c5eee1d069e84d\", 1]}"
echo ""

3
iguana/Kashi/gettxoutsetinfo

@ -0,0 +1,3 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"gettxoutsetinfo\"}"

19
iguana/Kashi/getwalletinfo

@ -0,0 +1,19 @@
#!/bin/bash
echo ""
echo "
The getbalance RPC gets the balance in decimal bitcoins across all accounts or for a particular account.
Parameter #1—an account name
Parameter #2—the minimum number of confirmations
Parameter #3—whether to include watch-only addresses
Result—the balance in bitcoins
"
echo ""
echo ""
#curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"getbalance\",\"confirmations\":\"\",\"includeempty\":\"0\",\"watchonly\":\"0\"}"
curl --url "http://127.0.0.1:7778" --data "{\"agents\":\"bitcoinrpc\",\"coin\":\"BTCD\",\"method\":\"getwalletinfo\",\"params\":[]}"

1
iguana/Kashi/importprivkey

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"importprivkey\",\"params\":[\"UwoZ8tmhWth5bNacdL2YHiYv3mUZpoXhTjjFXdsm2Fhzft3fUDUF\"]}"

1
iguana/Kashi/importprivkeyB

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"importprivkey\",\"params\":[\"b81e824a58cefff953eb53e9743059d001be0f5cfeb7599fbdd6bd18dba6616c\"]}"

1
iguana/Kashi/importprivkeyR

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"importprivkey\",\"params\":[\"522102c866c51b603e2d943774314b88aff1eb04aef3971fcf34503c8f07d27915bc1d2102e053cc9d98d9e157917ed74bcabeaf72006b1ecf019d148dd3eac06271b6bcf02102869ca05bf6b476bb8cb433e08846a67037b921062f49cd0f9f66087454e88abb53ae\"]}"

BIN
iguana/Kashi/json_extract

Binary file not shown.

25
iguana/Kashi/json_extract.c

@ -0,0 +1,25 @@
#include <stdio.h>
#include <stdint.h>
#include "../../includes/cJSON.h"
#include "../../crypto777/OS_portable.h"
int32_t main(int32_t argc,char **argv)
{
cJSON *filejson; char *fname,*filestr,*field; long filesize;
if ( argc > 2 )
{
fname = argv[1];
field = argv[2];
if ( (filestr= OS_filestr(&filesize,fname)) != 0 )
{
if ( (filejson= cJSON_Parse(filestr)) != 0 )
{
if ( jstr(filejson,field) != 0 )
printf("%s\n",jstr(filejson,field));
free_json(filejson);
} else fprintf(stderr,"cant parse.(%s)\n",filestr);
free(filestr);
} else fprintf(stderr,"cant load (%s)\n",fname);
} else fprintf(stderr,"argc.%d fname.(%s) error\n",argc,argv[1]);
}

BIN
iguana/Kashi/json_extracta

Binary file not shown.

25
iguana/Kashi/json_extracta.c

@ -0,0 +1,25 @@
#include <stdio.h>
#include <stdint.h>
#include "../../includes/cJSON.h"
#include "../../crypto777/OS_portable.h"
int32_t main(int32_t argc,char **argv)
{
cJSON *filejson; char *fname,*filestr,*field; long filesize; int32_t n;
if ( argc > 2 )
{
fname = argv[1];
field = argv[2];
if ( (filestr= OS_filestr(&filesize,fname)) != 0 )
{
if ( (filejson= cJSON_Parse(filestr)) != 0 )
{
if ( jarray(&n,filejson,field) != 0 )
printf("%s\n",jprint(jobj(filejson,field),0));
free_json(filejson);
} else fprintf(stderr,"cant parse.(%s)\n",filestr);
free(filestr);
} else fprintf(stderr,"cant load (%s)\n",fname);
} else fprintf(stderr,"argc.%d fname.(%s) error\n",argc,argv[1]);
}

BIN
iguana/Kashi/json_extractd

Binary file not shown.

25
iguana/Kashi/json_extractd.c

@ -0,0 +1,25 @@
#include <stdio.h>
#include <stdint.h>
#include "../../includes/cJSON.h"
#include "../../crypto777/OS_portable.h"
int32_t main(int32_t argc,char **argv)
{
cJSON *filejson; char *fname,*filestr,*field; long filesize;
if ( argc > 2 )
{
fname = argv[1];
field = argv[2];
if ( (filestr= OS_filestr(&filesize,fname)) != 0 )
{
if ( (filejson= cJSON_Parse(filestr)) != 0 )
{
if ( jobj(filejson,field) != 0 )
printf("%.8f\n",jdouble(filejson,field));
free_json(filejson);
} else fprintf(stderr,"cant parse.(%s)\n",filestr);
free(filestr);
} else fprintf(stderr,"cant load (%s)\n",fname);
} else fprintf(stderr,"argc.%d fname.(%s) error\n",argc,argv[1]);
}

BIN
iguana/Kashi/json_extracti

Binary file not shown.

25
iguana/Kashi/json_extracti.c

@ -0,0 +1,25 @@
#include <stdio.h>
#include <stdint.h>
#include "../../includes/cJSON.h"
#include "../../crypto777/OS_portable.h"
int32_t main(int32_t argc,char **argv)
{
cJSON *filejson; char *fname,*filestr,*field; long filesize;
if ( argc > 2 )
{
fname = argv[1];
field = argv[2];
if ( (filestr= OS_filestr(&filesize,fname)) != 0 )
{
if ( (filejson= cJSON_Parse(filestr)) != 0 )
{
if ( jobj(filejson,field) != 0 )
printf("%d\n",jint(filejson,field));
free_json(filejson);
} else fprintf(stderr,"cant parse.(%s)\n",filestr);
free(filestr);
} else fprintf(stderr,"cant load (%s)\n",fname);
} else fprintf(stderr,"argc.%d fname.(%s) error\n",argc,argv[1]);
}

BIN
iguana/Kashi/jsoncmp

Binary file not shown.

45
iguana/Kashi/jsoncmp.c

@ -0,0 +1,45 @@
#include <stdio.h>
#include <stdint.h>
#include "../../includes/cJSON.h"
#include "../../crypto777/OS_portable.h"
int32_t main(int32_t argc,char **argv)
{
cJSON *argjson,*array,*filejson,*obj,*fobj; char *fname,*filestr,*fstr,*str,*field; int32_t i,n; long filesize;
if ( argc > 2 && (argjson= cJSON_Parse(argv[2])) != 0 )
{
fname = argv[1];
if ( (filestr= OS_filestr(&filesize,fname)) != 0 )
{
if ( (filejson= cJSON_Parse(filestr)) != 0 )
{
if ( (array= jarray(&n,argjson,"fields")) != 0 )
{
for (i=0; i<n; i++)
{
obj = jitem(array,i);
if ( (field= jfieldname(obj)) != 0 && (obj= obj->child) != 0 )
{
if ( (fobj= jobj(filejson,field)) != 0 )
{
fstr = jprint(fobj,0);
str = jprint(obj,0);
if ( strcmp(fstr,str) != 0 )
{
printf("{\"error\":\"field.(%s) in (%s) i.%d of n.%d mismatch (%s) != (%s)\"}\n",field,fname,i,n,fstr,str);
fprintf(stderr,"{\"error\":\"field.(%s) in (%s) i.%d of n.%d mismatch (%s) != (%s)\"}\n",field,fname,i,n,fstr,str);
}
else printf("{\"result\":\"MATCHED.[%s] (%s).(%s)\"}\n",fname,field,fstr);
free(str);
free(fstr);
} else fprintf(stderr,"cant find field.(%s) in (%s)\n",field,fname);
} else fprintf(stderr,"no fieldname array[%d]\n",i);
}
} else fprintf(stderr,"no fields array\n");
free_json(filejson);
} else fprintf(stderr,"cant parse.(%s)\n",filestr);
free(filestr);
} else fprintf(stderr,"cant load (%s)\n",fname);
} else fprintf(stderr,"argc.%d fname.(%s) error\n",argc,argv[1]);
}

4
iguana/Kashi/listaccount_ALL

@ -0,0 +1,4 @@
#!/bin/bash
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"listaccounts\",\"minconf\":\"0\",\"includewatchonly\":\"0\"}"
echo ""

5
iguana/Kashi/listaddressgrouping

@ -0,0 +1,5 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"listaddressgroupings\"}"

5
iguana/Kashi/listaddressgroupings

@ -0,0 +1,5 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"listaddressgroupings\"}"

3
iguana/Kashi/listlockunspent

@ -0,0 +1,3 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"listlockunspent\"}"

3
iguana/Kashi/listreceivedbyaccount

@ -0,0 +1,3 @@
#!/bin/bash
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"listreceivedbyaccount\",\"confirmations\":\"10\",\"includeempty\":\"1\",\"watchonly\":\"0\"}"

17
iguana/Kashi/listreceivedbyaddress

@ -0,0 +1,17 @@
#!/bin/bash
echo ""
echo "
The listreceivedbyaddress RPC lists the total number of bitcoins received by each address.
Parameter #1—the minimum number of confirmations a transaction must have to be counted
Parameter #2—whether to include empty accounts
Parameter #3—whether to include watch-only addresses in results
Result—addresses, account names, balances, and minimum confirmations
"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"listreceivedbyaddress\",\"minconf\":\"1\",\"includeempty\":\"1\",\"flag\":\"0\"}"
echo ""

7
iguana/Kashi/listtransactions

@ -0,0 +1,7 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"listtransactions\",\"account\":\"IGUANA\",\"count\":\"1\",\"skip\":\"0\",\"includewatchonly\":\"0\"}"
echo ""

1
iguana/Kashi/listunspent

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"listunspent\",\"params\":[\"RQK4mc7ZySXtQ6EweC4r2fcCdBTvsZqDc6\"]}"

12
iguana/Kashi/listunspent_WIA

@ -0,0 +1,12 @@
#!/bin/bash
echo ""
echo "The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet"
echo ""
echo "Dependencies:"
echo "Walletpassphrase"
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"listunspent\",\"params\":[\"185oP\"]}"
echo ""

5
iguana/Kashi/listunspent_WVA

@ -0,0 +1,5 @@
#!/bin/bash
curl -s --url "http://127.0.0.1:7778" --data "{\"method\":\"listunspent\",\"params\":[\"RQCP1TcfevTQU35ZftPNx2TZpB9ZkSZQ3S\"]}"
echo ""

1
iguana/Kashi/lockunspent

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"lockunspent\",\"flag\":\"1\",\"array\":\"e3c08af74ca337ec632294c78c1deb461944e824f9272a280e4e750e70782714\"}"

1
iguana/Kashi/login

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"SuperNET\",\"method\":\"login\",\"passphrase\":\"test\"}"

1
iguana/Kashi/logout

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"SuperNET\",\"method\":\"logout\"}"

1
iguana/Kashi/make_jsoncmp

@ -0,0 +1 @@
gcc -o jsoncmp jsoncmp.c ../../agents/libcrypto777.a -pthread -lm

3
iguana/Kashi/makekeypair

@ -0,0 +1,3 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"makekeypair\"}"

1
iguana/Kashi/move

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"move\",\"fromaccount\":\"iguana\",\"toaccount\":\"iguana\",\"amount\":\"0.004\",\"minconf\":\"0\",\"comment\":\"moving\"}"

1
iguana/Kashi/prv2pub

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"SuperNET\",\"method\":\"priv2pub\",\"privkey\":\"1deb4ff7875c83563e7e3c5b9a427e9a7798bae9b69a78caca960295b8d837\",\"addrtype\":\"\"}"

1
iguana/Kashi/prv2pub1

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"SuperNET\",\"method\":\"priv2pub\",\"privkey\":\"6590e46b4f16cdca3a0516d84fd5ca29b24fa6a04006a9243d080daa1fc5b285\",\"addrtype\":\"\"}"

1
iguana/Kashi/rates

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"iguana\",\"method\":\"rates\",\"quotes\":[\"BTC/USD\", \"EUR/USD\", \"BTC/EUR\"]}"

1
iguana/Kashi/repairwallet

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"repairwallet\"}"

11
iguana/Kashi/sendfrom

@ -0,0 +1,11 @@
#!/bin/bash
echo ""
echo "The sendfrom RPC spends an amount from a local address to bitcoin address"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"sendfrom\",\"fromaccount\":\"change\",\"toaddress\":\"REX9Qs25nJjDkPSx65kt1FTpA9om14cnos\",\"amount\":\"0.00400000\",\"minconf\":\"1\",\"comment\":\"Test_transaction\",\"comment2\":\"sendingFrom change account\"}"
echo""

6
iguana/Kashi/sendmany

@ -0,0 +1,6 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"sendmany\", \"params\":[\"RVQV5spiARDTqfwBCxstWnMbrT6Q8mhRYz\", {\"RL1tyXPK5NzT1d4upgcHnujgG5v3xjLaYC\":0.04, \"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\":0.04}, 2]}"

2
iguana/Kashi/sendrawtransaction

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:14632" --user "user:rzDbtP9UDZEbPcn" --data "{\"method\":\"sendrawtransaction\",\"params\":[\"0100000095f4265701f6d17d847b7096cdd9b79e4df4b74aabb9ac34b7abd4f9fce19d761e97cca0e8000000006a47304402207ddad8357583b7b3707b3de1a2625b6054367c42a893edb10cd8fce4ea766895022079043096f5e278d131fafcc12d360c65f8cd4eaa81bc09ec709b5e34da7c0bdc012102d14a195654f536df6dfe5a38278d1b470d00f17de78eeb5ce9e9eea9edb2c212ffffffff0240420f00000000001976a91410acba3a841fae68aba4b5ff162714c493bcc04e88acd0300e00000000001976a914d8b8c039206af6cec82bca950f592801e62808cb88ac00000000\"]}"

2
iguana/Kashi/sendtoaddress

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"sendtoaddress\",\"params\":[\"17outUgtsnLkguDuXm14tcQ7dMbdD8KZGK\", 0.4]}"

18
iguana/Kashi/sendtoaddress_WVA

@ -0,0 +1,18 @@
#!/bin/bash
echo ""
echo "The sendtoaddress RPC spends an amount to a given address.
Parameter #1—to address
Parameter #2—amount to spend"
echo ""
echo "Dependencies:"
echo "Walletpassphrase, Incase valid is locked"
echo "getaccountaddress, incase account and address don't exist already"
echo ""
echo "Scenario: Verify that amount is sent to given account"
echo "Results: Amount should be sent to the given account"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"sendtoaddress\",\"params\":[\"RQbUDfuCitztPgJkG8edBU5dy59GD7WQqT\", 0.0004]}"
echo ""

1
iguana/Kashi/setaccount

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"setaccount\",\"params\":[\"RQK4mc7ZySXtQ6EweC4r2fcCdBTvsZqDc6\", \"change\"]}"

14
iguana/Kashi/setaccount_WIA

@ -0,0 +1,14 @@
#!/bin/bash
echo ""
echo "The setaccount RPC put the specified address in the given account"
echo ""
echo "Dependencies:"
echo "Getnewaddress RPC, if you don't have an address already"
echo "Getaccountaddress RPC, if account doesn't exist already"
echo ""
echo "Scenario: Verify that ERROR is returned incase of invalid or empty account name"
echo "Result: Need address and account "
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"setaccount\",\"params\":[\"RW8oinV4TjRobRWNcNx2cjoexnGS5g8yh5\", \"\"]}"

14
iguana/Kashi/setaccount_WVA

@ -0,0 +1,14 @@
#!/bin/bash
echo ""
echo "The setaccount RPC put the specified address in the given account"
echo ""
echo "Dependencies:"
echo "Getnewaddress RPC, if you don't have an address already"
echo "Getaccountaddress RPC, if account doesn't exist already"
echo ""
echo "Scenario: Verify that user is able to linked address with specified account"
echo "Result: Address should be linked to mentioned account"
echo ""
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"setaccount\",\"params\":[\"RQK4mc7ZySXtQ6EweC4r2fcCdBTvsZqDc6\", \"IGUANA_CHANGE\"]}"

1
iguana/Kashi/settx

@ -0,0 +1 @@
curl -s --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"settxfee\",\"amount\":\"0.00002\"}"

12
iguana/Kashi/signmessage

@ -0,0 +1,12 @@
#!/bin/bash
echo 'Sign a Message with the Private Key of Given Address'
echo 'Parameter1: Address Corresponding to Private key to sign with'
echo 'Parameter2: Message To Sign'
echo 'Return Signature for corresponding Message'
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"signmessage\",\"address\":\"REurKb7jWHJgE2WKMqvqiDdbFf6Tmd2CEX\",\"message\":\"testMessage\"}"
echo ""

9
iguana/Kashi/signmessagewithwrongaddress

@ -0,0 +1,9 @@
o 'Sign a Message with the Private Key of Given Address'
echo 'Parameter1: Address Corresponding to Private key to sign with'
echo 'Parameter2: Message To Sign'
echo 'Return Signature for corresponding Message'
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"bitcoinrpc\",\"method\":\"signmessage\",\"address\":\"REurKb7jWHJgE2WKMqvqiDdbFf6Tmd2C\",\"message\":\"testMessage\"}"

2
iguana/Kashi/signrawtransaction

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:7778" --data "{\"method\":\"signrawtransaction\",\"params\":[\"0100000095f4265701f6d17d847b7096cdd9b79e4df4b74aabb9ac34b7abd4f9fce19d761e97cca0e80000000000ffffffff0240420f00000000001976a91410acba3a841fae68aba4b5ff162714c493bcc04e88acd0300e00000000001976a914d8b8c039206af6cec82bca950f592801e62808cb88ac00000000\", [{\"txid\":\"e8a0cc971e769de1fcf9d4abb734acb9ab4ab7f44d9eb7d9cd96707b847dd1f6\",\"vout\":0,\"scriptPubKey\":\"2102d14a195654f536df6dfe5a38278d1b470d00f17de78eeb5ce9e9eea9edb2c212ac\"}], [\"UqvuZXEAVXDXJkL4j4Xq6qoMdeJfPF1aNsCzmzfZaQ1ZgBTwfmWn\"], \"ALL\"] }"

2
iguana/Kashi/signrawtransaction2

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTC\",\"method\":\"signrawtransaction\",\"params\":[\"01000000dc4f24570156bb006164173811be6647f68f9a46eab4322e6fdef816aeb3e71e419ca49bfe1800000000ffffffff01588c0200000000001976a914d8b8c039206af6cec82bca950f592801e62808cb88ac00000000\", [{\"txid\":\"fe9ba49c411ee7b3ae16f8de6f2e32b4ea469a8ff64766be113817646100bb56\",\"vout\":24}], [\"UqvuZXEAVXDXJkL4j4Xq6qoMdeJfPF1aNsCzmzfZaQ1ZgBTwfmWn\"], \"ALL\"] }"

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save