Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
e2c9f3041c
  1. 4
      crypto777/hmac_sha512.c
  2. 481
      deprecated/obsolete.h
  3. 2
      iguana/iguana.sources
  4. 2
      iguana/iguana777.c
  5. 3
      iguana/iguana777.h
  6. 2
      iguana/iguana_init.c
  7. 1147
      iguana/iguana_json.c
  8. 33
      iguana/iguana_peers.c
  9. 44
      iguana/iguana_pubkeys.c
  10. 421
      iguana/iguana_tx.c
  11. 144
      iguana/iguana_wallet.c
  12. 2
      iguana/index.html
  13. 104
      iguana/main.c
  14. 325
      iguana/ramchain_api.c
  15. 6
      includes/iguana_api.h
  16. 282
      includes/iguana_apideclares.h
  17. 50
      includes/iguana_apidefs.h

4
crypto777/hmac_sha512.c

@ -458,7 +458,7 @@ static void hmac_sha512_final(hmac_sha512_ctx * ctx, unsigned char *mac,
memcpy(mac, mac_temp, mac_size);
}
void hmac_sha512(const unsigned char *key, unsigned int key_size,
void hmac_sha512str(const unsigned char *key, unsigned int key_size,
const unsigned char *message, unsigned int message_len,
unsigned char *mac, unsigned mac_size)
{
@ -499,7 +499,7 @@ char *hmac_sha512_str(char *dest,char *key,int32_t key_size,char *message)
{
unsigned char mac[SHA512_DIGEST_SIZE],checkbuf[SHA512_DIGEST_SIZE*2 + 1]; char dest2[SHA512_DIGEST_SIZE*2 + 1]; unsigned long size = sizeof(checkbuf);
//int i;
hmac_sha512((const unsigned char *)key,key_size,(const unsigned char *)message,(int)strlen(message),mac,SHA512_DIGEST_SIZE);
hmac_sha512str((const unsigned char *)key,key_size,(const unsigned char *)message,(int)strlen(message),mac,SHA512_DIGEST_SIZE);
//for (i=0; i<SHA512_DIGEST_SIZE; i++)
// sprintf(&dest[i*2],"%02x", mac[i]);
//dest[2 * SHA512_DIGEST_SIZE] = '\0';

481
deprecated/obsolete.h

@ -11475,5 +11475,486 @@ void iguana_dedicatedrecv(void *arg)
}
return(line);
}
if ( strcmp(method,"status") == 0 || strcmp(method,"getinfo") == 0 )
return(iguana_getinfo(myinfo,coin));
/* else if ( strcmp(method,"getbestblockhash") == 0 )
return(iguana_getbestblockhash(myinfo,coin));
else if ( strcmp(method,"getblockcount") == 0 )
return(iguana_getblockcount(myinfo,coin));
else if ( strcmp(method,"validatepubkey") == 0 )
return(iguana_validatepubkey(myinfo,coin,jstr(json,"pubkey")));
else if ( strcmp(method,"listtransactions") == 0 )
return(iguana_listtransactions(myinfo,coin,jstr(json,"account"),juint(json,"count"),juint(json,"from")));
else if ( strcmp(method,"getreceivedbyaddress") == 0 )
return(iguana_getreceivedbyaddress(myinfo,coin,jstr(json,"address"),juint(json,"minconf")));
else if ( strcmp(method,"listreceivedbyaddress") == 0 )
return(iguana_listreceivedbyaddress(myinfo,coin,juint(json,"minconf"),juint(json,"includeempty")));
else if ( strcmp(method,"listsinceblock") == 0 )
return(iguana_listsinceblock(myinfo,coin,jbits256(json,"blockhash"),juint(json,"target")));
else if ( strcmp(method,"getreceivedbyaccount") == 0 )
return(iguana_getreceivedbyaccount(myinfo,coin,jstr(json,"account"),juint(json,"minconf")));
else if ( strcmp(method,"listreceivedbyaccount") == 0 )
return(iguana_listreceivedbyaccount(myinfo,coin,jstr(json,"account"),juint(json,"includeempty")));
else if ( strcmp(method,"getnewaddress") == 0 )
return(iguana_getnewaddress(myinfo,coin,jstr(json,"account")));
else if ( strcmp(method,"makekeypair") == 0 )
return(iguana_makekeypair(myinfo,coin));
else if ( strcmp(method,"getaccountaddress") == 0 )
return(iguana_getaccountaddress(myinfo,coin,jstr(json,"account")));
else if ( strcmp(method,"setaccount") == 0 )
return(iguana_setaccount(myinfo,coin,jstr(json,"address"),jstr(json,"account")));
else if ( strcmp(method,"getaccount") == 0 )
return(iguana_getaccount(myinfo,coin,jstr(json,"account")));
else if ( strcmp(method,"getaddressesbyaccount") == 0 )
return(iguana_getaddressesbyaccount(myinfo,coin,jstr(json,"account")));
else if ( strcmp(method,"listaddressgroupings") == 0 )
return(iguana_listaddressgroupings(myinfo,coin));
else if ( strcmp(method,"getbalance") == 0 )
return(iguana_getbalance(myinfo,coin,jstr(json,"account"),juint(json,"minconf")));
else if ( strcmp(method,"listaccounts") == 0 )
return(iguana_listaccounts(myinfo,coin,juint(json,"minconf")));
else if ( strcmp(method,"dumpprivkey") == 0 )
return(iguana_dumpprivkey(myinfo,coin,jstr(json,"address")));
else if ( strcmp(method,"importprivkey") == 0 )
return(iguana_importprivkey(myinfo,coin,jstr(json,"wip")));
else if ( strcmp(method,"dumpwallet") == 0 )
return(iguana_dumpwallet(myinfo,coin));
else if ( strcmp(method,"importwallet") == 0 )
return(iguana_importwallet(myinfo,coin,jstr(json,"wallet")));
else if ( strcmp(method,"walletpassphrase") == 0 )
return(iguana_walletpassphrase(myinfo,coin,jstr(json,"passphrase"),juint(json,"timeout")));
else if ( strcmp(method,"walletpassphrasechange") == 0 )
return(iguana_walletpassphrasechange(myinfo,coin,jstr(json,"oldpassphrase"),jstr(json,"newpassphrase")));
else if ( strcmp(method,"walletlock") == 0 )
return(iguana_walletlock(myinfo,coin));
else if ( strcmp(method,"encryptwallet") == 0 )
return(iguana_encryptwallet(myinfo,coin,jstr(json,"passphrase")));
else if ( strcmp(method,"checkwallet") == 0 )
return(iguana_checkwallet(myinfo,coin));
else if ( strcmp(method,"repairwallet") == 0 )
return(iguana_repairwallet(myinfo,coin));
else if ( strcmp(method,"backupwallet") == 0 )
return(iguana_backupwallet(myinfo,coin,jstr(json,"filename")));
else if ( strcmp(method,"signmessage") == 0 )
return(iguana_signmessage(myinfo,coin,jstr(json,"address"),jstr(json,"message")));
else if ( strcmp(method,"verifymessage") == 0 )
return(iguana_verifymessage(myinfo,coin,jstr(json,"address"),jstr(json,"sig"),jstr(json,"message")));
else if ( strcmp(method,"listunspent") == 0 )
return(iguana_listunspent(myinfo,coin,juint(json,"minconf"),juint(json,"maxconf")));
else if ( strcmp(method,"lockunspent") == 0 )
return(iguana_lockunspent(myinfo,coin,juint(json,"flag"),jobj(json,"array")));
else if ( strcmp(method,"listlockunspent") == 0 )
return(iguana_listlockunspent(myinfo,coin));
else if ( strcmp(method,"gettxout") == 0 )
return(iguana_gettxout(myinfo,coin,jbits256(json,"txid"),juint(json,"vout"),juint(json,"mempool")));
else if ( strcmp(method,"gettxoutsetinfo") == 0 )
return(iguana_gettxoutsetinfo(myinfo,coin));
else if ( strcmp(method,"sendtoaddress") == 0 )
return(iguana_sendtoaddress(myinfo,coin,jstr(json,"address"),jdouble(json,"amount"),jstr(json,"comment"),jstr(json,"comment2")));
else if ( strcmp(method,"move") == 0 )
return(iguana_move(myinfo,coin,jstr(json,"fromaccount"),jstr(json,"toaccount"),jdouble(json,"amount"),juint(json,"minconf"),jstr(json,"comment")));
else if ( strcmp(method,"sendfrom") == 0 )
return(iguana_sendfrom(myinfo,coin,jstr(json,"fromaccount"),jstr(json,"toaddress"),jdouble(json,"amount"),juint(json,"minconf"),jstr(json,"comment"),jstr(json,"comment2")));
else if ( strcmp(method,"sendmany") == 0 )
return(iguana_sendmany(myinfo,coin,jstr(json,"fromaccount"),jobj(json,"payments"),juint(json,"minconf"),jstr(json,"comment")));
else if ( strcmp(method,"settxfee") == 0 )
return(iguana_settxfee(myinfo,coin,jdouble(json,"amount")));
else if ( strcmp(method,"getrawtransaction") == 0 )
return(iguana_getrawtransaction(myinfo,coin,jbits256(json,"txid"),juint(json,"verbose")));
else if ( strcmp(method,"createrawtransaction") == 0 )
return(iguana_createrawtransaction(myinfo,coin,jobj(json,"vins"),jobj(json,"vouts")));
else if ( strcmp(method,"decoderawtransaction") == 0 )
return(iguana_decoderawtransaction(myinfo,coin,jstr(json,"rawtx")));
else if ( strcmp(method,"decodescript") == 0 )
return(iguana_decodescript(myinfo,coin,jstr(json,"script")));
else if ( strcmp(method,"signrawtransaction") == 0 )
return(iguana_signrawtransaction(myinfo,coin,jstr(json,"rawtx"),jobj(json,"vins"),jobj(json,"privkeys")));
else if ( strcmp(method,"sendrawtransaction") == 0 )
return(iguana_sendrawtransaction(myinfo,coin,jstr(json,"rawtx")));
else if ( strcmp(method,"getrawchangeaddress") == 0 )
return(iguana_getrawchangeaddress(myinfo,coin,jstr(json,"account")));
*/
char *iguana_jsoncheck(char *retstr,int32_t freeflag)
{
cJSON *retjson; char *errstr;
if ( retstr != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
if ( (errstr= jstr(retjson,"error")) == 0 )
{
free_json(retjson);
return(retstr);
}
free_json(retjson);
}
if ( freeflag != 0 )
free(retstr);
}
return(0);
}
char *ramchain_parser(struct supernet_info *myinfo,char *method,cJSON *json,char *remoteaddr)
{
char *symbol,*str,*retstr; int32_t height; cJSON *argjson,*obj; struct iguana_info *coin = 0;
/*{"agent":"ramchain","method":"block","coin":"BTCD","hash":"<sha256hash>"}
{"agent":"ramchain","method":"block","coin":"BTCD","height":345600}
{"agent":"ramchain","method":"tx","coin":"BTCD","txid":"<sha txid>"}
{"agent":"ramchain","method":"rawtx","coin":"BTCD","txid":"<sha txid>"}
{"agent":"ramchain","method":"balance","coin":"BTCD","address":"<coinaddress>"}
{"agent":"ramchain","method":"balance","coin":"BTCD","addrs":["<coinaddress>",...]}
{"agent":"ramchain","method":"totalreceived","coin":"BTCD","address":"<coinaddress>"}
{"agent":"ramchain","method":"totalsent","coin":"BTCD","address":"<coinaddress>"}
{"agent":"ramchain","method":"unconfirmed","coin":"BTCD","address":"<coinaddress>"}
{"agent":"ramchain","method":"utxo","coin":"BTCD","address":"<coinaddress>"}
{"agent":"ramchain","method":"utxo","coin":"BTCD","addrs":["<coinaddress0>", "<coinadress1>",...]}
{"agent":"ramchain","method":"txs","coin":"BTCD","block":"<blockhash>"}
{"agent":"ramchain","method":"txs","coin":"BTCD","height":12345}
{"agent":"ramchain","method":"txs","coin":"BTCD","address":"<coinaddress>"}
{"agent":"ramchain","method":"status","coin":"BTCD"}*/
if ( (symbol= jstr(json,"coin")) != 0 && symbol[0] != 0 )
{
if ( coin == 0 )
coin = iguana_coinfind(symbol);
else if ( strcmp(symbol,coin->symbol) != 0 )
return(clonestr("{\"error\":\"mismatched coin symbol\"}"));
}
if ( strcmp(method,"explore") == 0 )
{
obj = jobj(json,"search");
if ( coin != 0 && obj != 0 )
{
argjson = cJSON_CreateObject();
jaddstr(argjson,"agent","ramchain");
jaddstr(argjson,"method","block");
jaddnum(argjson,"txids",1);
if ( is_cJSON_Number(obj) != 0 )
{
height = juint(obj,0);
jaddnum(argjson,"height",height);
}
else if ( (str= jstr(obj,0)) != 0 )
jaddstr(argjson,"hash",str);
else return(clonestr("{\"error\":\"need number or string to search\"}"));
if ( (retstr= iguana_jsoncheck(ramchain_coinparser(myinfo,coin,"block",argjson),1)) != 0 )
{
free_json(argjson);
return(retstr);
}
free_json(argjson);
argjson = cJSON_CreateObject();
jaddstr(argjson,"agent","ramchain");
jaddstr(argjson,"method","tx");
jaddstr(argjson,"txid",str);
if ( (retstr= iguana_jsoncheck(ramchain_coinparser(myinfo,coin,"tx",argjson),1)) != 0 )
{
free_json(argjson);
return(retstr);
}
free_json(argjson);
return(clonestr("{\"result\":\"explore search cant find height, blockhash, txid\"}"));
}
return(clonestr("{\"result\":\"explore no coin or search\"}"));
}
return(ramchain_coinparser(myinfo,coin,method,json));
}
/*int32_t pp_bind(char *hostname,uint16_t port)
{
int32_t opt; struct sockaddr_in addr; socklen_t addrlen = sizeof(addr);
struct hostent* hostent = gethostbyname(hostname);
if (hostent == NULL) {
PNACL_message("gethostbyname() returned error: %d", errno);
return -1;
}
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
memcpy(&addr.sin_addr.s_addr, hostent->h_addr_list[0], hostent->h_length);
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
printf("socket() failed: %s", strerror(errno));
return -1;
}
opt = 1;
setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(void*)&opt,sizeof(opt));
#ifdef __APPLE__
setsockopt(sock,SOL_SOCKET,SO_NOSIGPIPE,&opt,sizeof(opt));
#endif
//timeout.tv_sec = 0;
//timeout.tv_usec = 1000;
//setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(char *)&timeout,sizeof(timeout));
int result = bind(sock, (struct sockaddr*)&addr, addrlen);
if (result != 0) {
printf("bind() failed: %s", strerror(errno));
closesocket(sock);
return -1;
}
return(sock);
}*/
/*if ( strcmp(agent,"ramchain") == 0 )
return(ramchain_parser(myinfo,method,json,remoteaddr));
else if ( strcmp(agent,"InstantDEX") == 0 )
return(InstantDEX_parser(myinfo,method,json,remoteaddr));
else if ( strcmp(agent,"pangea") == 0 )
return(pangea_parser(myinfo,method,json,remoteaddr));
else if ( strcmp(agent,"jumblr") == 0 )
return(jumblr_parser(myinfo,method,json,remoteaddr));
else if ( strcmp(agent,"hash") == 0 )
return(hash_parser(myinfo,method,json,remoteaddr));*/
char *iguana_coinjson(struct iguana_info *coin,char *method,cJSON *json)
{
int32_t i,max,retval,num=0; char buf[1024]; struct iguana_peer *addr; char *ipaddr; cJSON *retjson = 0;
//printf("iguana_coinjson(%s)\n",jprint(json,0));
if ( strcmp(method,"peers") == 0 )
return(jprint(iguana_peersjson(coin,0),1));
else if ( strcmp(method,"getconnectioncount") == 0 )
{
for (i=0; i<sizeof(coin->peers.active)/sizeof(*coin->peers.active); i++)
if ( coin->peers.active[i].usock >= 0 )
num++;
sprintf(buf,"{\"result\":\"%d\"}",num);
return(clonestr(buf));
}
else if ( strcmp(method,"addnode") == 0 )
{
if ( (ipaddr= jstr(json,"ipaddr")) != 0 )
{
iguana_possible_peer(coin,ipaddr);
return(clonestr("{\"result\":\"addnode submitted\"}"));
} else return(clonestr("{\"error\":\"addnode needs ipaddr\"}"));
}
else if ( strcmp(method,"removenode") == 0 )
{
if ( (ipaddr= jstr(json,"ipaddr")) != 0 )
{
for (i=0; i<IGUANA_MAXPEERS; i++)
{
if ( strcmp(coin->peers.active[i].ipaddr,ipaddr) == 0 )
{
coin->peers.active[i].rank = 0;
coin->peers.active[i].dead = (uint32_t)time(NULL);
return(clonestr("{\"result\":\"node marked as dead\"}"));
}
}
return(clonestr("{\"result\":\"node wasnt active\"}"));
} else return(clonestr("{\"error\":\"removenode needs ipaddr\"}"));
}
else if ( strcmp(method,"oneshot") == 0 )
{
if ( (ipaddr= jstr(json,"ipaddr")) != 0 )
{
iguana_possible_peer(coin,ipaddr);
return(clonestr("{\"result\":\"addnode submitted\"}"));
} else return(clonestr("{\"error\":\"addnode needs ipaddr\"}"));
}
else if ( strcmp(method,"nodestatus") == 0 )
{
if ( (ipaddr= jstr(json,"ipaddr")) != 0 )
{
for (i=0; i<coin->MAXPEERS; i++)
{
addr = &coin->peers.active[i];
if ( strcmp(addr->ipaddr,ipaddr) == 0 )
return(jprint(iguana_peerjson(coin,addr),1));
}
return(clonestr("{\"result\":\"nodestatus couldnt find ipaddr\"}"));
} else return(clonestr("{\"error\":\"nodestatus needs ipaddr\"}"));
}
else if ( strcmp(method,"maxpeers") == 0 )
{
retjson = cJSON_CreateObject();
if ( (max= juint(json,"max")) <= 0 )
max = 1;
else if ( max > IGUANA_MAXPEERS )
max = IGUANA_MAXPEERS;
if ( max > coin->MAXPEERS )
{
for (i=max; i<coin->MAXPEERS; i++)
if ( (addr= coin->peers.ranked[i]) != 0 )
addr->dead = 1;
}
coin->MAXPEERS = max;
jaddnum(retjson,"maxpeers",coin->MAXPEERS);
jaddstr(retjson,"coin",coin->symbol);
return(jprint(retjson,1));
}
else if ( strcmp(method,"startcoin") == 0 )
{
coin->active = 1;
return(clonestr("{\"result\":\"coin started\"}"));
}
else if ( strcmp(method,"pausecoin") == 0 )
{
coin->active = 0;
return(clonestr("{\"result\":\"coin paused\"}"));
}
else if ( strcmp(method,"addcoin") == 0 )
{
if ( (retval= iguana_launchcoin(coin->symbol,json)) > 0 )
return(clonestr("{\"result\":\"coin added\"}"));
else if ( retval == 0 )
return(clonestr("{\"result\":\"coin already there\"}"));
else return(clonestr("{\"error\":\"error adding coin\"}"));
}
return(clonestr("{\"error\":\"unhandled request\"}"));
}
char *iguana_parser(struct supernet_info *myinfo,char *method,cJSON *json,char *remoteaddr)
{
char *coinstr,SYM[16]; int32_t j,k,l,r,rr; struct iguana_peer *addr;
cJSON *retjson = 0,*array; int32_t i,n; struct iguana_info *coin; char *symbol;
printf("remoteaddr.(%s)\n",remoteaddr!=0?remoteaddr:"local");
if ( remoteaddr == 0 || remoteaddr[0] == 0 || strcmp(remoteaddr,"127.0.0.1") == 0 ) // local (private) api
{
if ( strcmp(method,"list") == 0 )
{
retjson = cJSON_CreateObject();
array = cJSON_CreateArray();
for (i=0; i<sizeof(Coins)/sizeof(*Coins); i++)
{
if ( Coins[i] != 0 && Coins[i]->symbol[0] != 0 )
jaddistr(array,Coins[i]->symbol);
}
jadd(retjson,"coins",array);
return(jprint(retjson,1));
}
else if ( strcmp(method,"allpeers") == 0 )
{
retjson = cJSON_CreateObject();
array = cJSON_CreateArray();
for (i=0; i<sizeof(Coins)/sizeof(*Coins); i++)
{
if ( Coins[i] != 0 && Coins[i]->symbol[0] != 0 )
jaddi(array,iguana_peersjson(Coins[i],0));
}
jadd(retjson,"allpeers",array);
return(jprint(retjson,1));
}
else
{
if ( (symbol= jstr(json,"coin")) != 0 && strlen(symbol) < sizeof(SYM)-1 )
{
strcpy(SYM,symbol);
touppercase(SYM);
if ( (coin= iguana_coinfind(SYM)) == 0 )
{
if ( strcmp(method,"addcoin") == 0 )
coin = iguana_coinadd(SYM);
}
if ( coin != 0 )
return(iguana_coinjson(coin,method,json));
else return(clonestr("{\"error\":\"cant get coin info\"}"));
}
}
}
array = 0;
if ( strcmp(method,"getpeers") == 0 )
{
if ( (coinstr= jstr(json,"coin")) != 0 )
{
if ( (array= iguana_peersjson(iguana_coinfind(coinstr),1)) == 0 )
return(clonestr("{\"error\":\"coin not found\"}"));
}
else
{
n = 0;
array = cJSON_CreateArray();
r = rand();
for (i=0; i<IGUANA_MAXCOINS; i++)
{
j = (r + i) % IGUANA_MAXCOINS;
if ( (coin= Coins[j]) != 0 )
{
rr = rand();
for (k=0; k<IGUANA_MAXPEERS; k++)
{
l = (rr + k) % IGUANA_MAXPEERS;
addr = &coin->peers.active[l];
if ( addr->usock >= 0 && addr->supernet != 0 )
{
jaddistr(array,addr->ipaddr);
if ( ++n >= 64 )
break;
}
}
}
}
}
if ( array != 0 )
{
retjson = cJSON_CreateObject();
jaddstr(retjson,"agent","SuperNET");
jaddstr(retjson,"method","mypeers");
jaddstr(retjson,"result","peers found");
jadd(retjson,"peers",array);
return(jprint(retjson,1));
} else return(clonestr("{\"error\":\"no peers found\"}"));
}
else if ( strcmp(method,"mypeers") == 0 )
{
printf("mypeers from %s\n",remoteaddr!=0?remoteaddr:"local");
}
return(clonestr("{\"result\":\"stub processed generic json\"}"));
}
char *InstantDEX_parser(struct supernet_info *myinfo,char *method,cJSON *json,char *remoteaddr)
{
return(clonestr("{\"error\":\"InstantDEX API is not yet\"}"));
}
char *jumblr_parser(struct supernet_info *myinfo,char *method,cJSON *json,char *remoteaddr)
{
return(clonestr("{\"error\":\"jumblr API is not yet\"}"));
}
char *pangea_parser(struct supernet_info *myinfo,char *method,cJSON *json,char *remoteaddr)
{
return(clonestr("{\"error\":\"jumblr API is not yet\"}"));
}
/*
char *hash_parser(struct supernet_info *myinfo,char *hashname,cJSON *json,char *remoteaddr)
{
int32_t i,len,iter,n; uint8_t databuf[512];
char hexstr[1025],*password,*name,*msg;
typedef void (*hashfunc)(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len);
typedef char *(*hmacfunc)(char *dest,char *key,int32_t key_size,char *message);
struct hashfunc_entry { char *name; hashfunc hashfunc; };
struct hmacfunc_entry { char *name; hmacfunc hmacfunc; };
struct hashfunc_entry hashes[] = { {"NXT",calc_NXTaddr}, {"curve25519",calc_curve25519_str }, {"base64_encode",calc_base64_encodestr}, {"base64_decode",calc_base64_decodestr}, {"crc32",calc_crc32str}, {"rmd160_sha256",rmd160ofsha256}, {"sha256_sha256",sha256_sha256}, {"sha256",vcalc_sha256}, {"sha512",calc_sha512}, {"sha384",calc_sha384}, {"sha224",calc_sha224}, {"rmd160",calc_rmd160}, {"rmd256",calc_rmd256}, {"rmd320",calc_rmd320}, {"rmd128",calc_rmd128}, {"sha1",calc_sha1}, {"md5",calc_md5str}, {"md2",calc_md2str}, {"md4",calc_md4str}, {"tiger",calc_tiger}, {"whirlpool",calc_whirlpool} };
struct hmacfunc_entry hmacs[] = { {"hmac_sha256",hmac_sha256_str}, {"hmac_sha512",hmac_sha512_str}, {"hmac_sha384",hmac_sha384_str}, {"hmac_sha224",hmac_sha224_str}, {"hmac_rmd160",hmac_rmd160_str}, {"hmac_rmd256",hmac_rmd256_str}, {"hmac_rmd320",hmac_rmd320_str}, {"hmac_rmd128",hmac_rmd128_str}, {"hmac_sha1",hmac_sha1_str}, {"hmac_md52",hmac_md2_str},{"hmac_md4",hmac_md4_str},{"hmac_md5",hmac_md5_str}, {"hmac_tiger",hmac_tiger_str}, {"hmac_whirlpool",hmac_whirlpool_str} };
if ( (msg= jstr(json,"message")) == 0 )
return(clonestr("{\"error\":\"no message to hash\"}"));
if ( (password= jstr(json,"password")) == 0 || password[0] == 0 )
password = " ";
n = (int32_t)sizeof(hashes)/sizeof(*hashes);
printf("msg.(%s) password.(%s)\n",msg,password!=0?password:"");
for (iter=0; iter<2; iter++)
{
for (i=0; i<n; i++)
{
name = (iter == 0) ? hashes[i].name : hmacs[i].name;
//printf("iter.%d i.%d (%s) vs (%s) %d\n",iter,i,name,hashname,strcmp(hashname,name) == 0);
if ( strcmp(hashname,name) == 0 )
{
json = cJSON_CreateObject();
len = msg==0?0:(int32_t)strlen(msg);
if ( iter == 0 )
(*hashes[i].hashfunc)(hexstr,databuf,(uint8_t *)msg,len);
else (*hmacs[i].hmacfunc)(hexstr,password,password==0?0:(int32_t)strlen(password),msg);
jaddstr(json,"result","hash calculated");
jaddstr(json,"message",msg);
jaddstr(json,name,hexstr);
return(jprint(json,1));
}
}
n = (int32_t)sizeof(hmacs)/sizeof(*hmacs);
}
return(clonestr("{\"error\":\"cant find hash function\"}"));
}*/
#endif

2
iguana/iguana.sources

@ -1 +1 @@
SOURCES := SuperNET.c iguana_tx.c iguana_wallet.c iguana_html.c iguana_pubkeys.c iguana_recv.c iguana_bundles.c iguana_msg.c iguana_rpc.c iguana777.c iguana_chains.c iguana_peers.c iguana_accept.c iguana_bitmap.c iguana_init.c iguana_ramchain.c iguana_blocks.c iguana_json.c $(CRYPTO777_SRCS) main.c
SOURCES := SuperNET.c ramchain_api.c iguana_tx.c iguana_wallet.c iguana_html.c iguana_pubkeys.c iguana_recv.c iguana_bundles.c iguana_msg.c iguana_rpc.c iguana777.c iguana_chains.c iguana_peers.c iguana_accept.c iguana_bitmap.c iguana_init.c iguana_ramchain.c iguana_blocks.c iguana_json.c $(CRYPTO777_SRCS) main.c

2
iguana/iguana777.c

@ -361,7 +361,7 @@ void iguana_coinloop(void *arg)
{
if ( (coin= coins[i]) != 0 && coin->started == 0 )
{
iguana_startcoin(coin,coin->initialheight,coin->mapflags);
iguana_coinstart(coin,coin->initialheight,coin->mapflags);
printf("init.(%s) maxpeers.%d maxrecvcache.%s services.%llx MAXMEM.%s polltimeout.%d\n",coin->symbol,coin->MAXPEERS,mbstr(str,coin->MAXRECVCACHE),(long long)coin->myservices,mbstr(str,coin->MAXMEM),coin->polltimeout);
coin->started = coin;
coin->chain->minconfirms = coin->minconfirms;

3
iguana/iguana777.h

@ -550,7 +550,7 @@ int32_t iguana_updatebundles(struct iguana_info *coin);
void iguana_bundlestats(struct iguana_info *coin,char *str);
// init
struct iguana_info *iguana_startcoin(struct iguana_info *coin,int32_t initialheight,int32_t mapflags);
struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialheight,int32_t mapflags);
void iguana_initcoin(struct iguana_info *coin);
void iguana_coinloop(void *arg);
@ -689,6 +689,7 @@ void iguana_bundleQ(struct iguana_info *coin,struct iguana_bundle *bp,int32_t ti
void iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit);
void ramcoder_test(void *data,int64_t len);
void SuperNET_init(void *args);
char *SuperNET_parser(struct supernet_info *myinfo,char *agent,char *method,cJSON *json,char *remoteaddr);
extern queue_t bundlesQ;

2
iguana/iguana_init.c

@ -300,7 +300,7 @@ void iguana_parseline(struct iguana_info *coin,int32_t iter,FILE *fp)
}
}
struct iguana_info *iguana_startcoin(struct iguana_info *coin,int32_t initialheight,int32_t mapflags)
struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialheight,int32_t mapflags)
{
FILE *fp; char fname[512],*symbol; int32_t iter;
coin->sleeptime = 10000;

1147
iguana/iguana_json.c

File diff suppressed because it is too large

33
iguana/iguana_peers.c

@ -251,39 +251,6 @@ void iguana_iAkill(struct iguana_info *coin,struct iguana_peer *addr,int32_t mar
iguana_possible_peer(coin,ipaddr);
}
/*int32_t pp_bind(char *hostname,uint16_t port)
{
int32_t opt; struct sockaddr_in addr; socklen_t addrlen = sizeof(addr);
struct hostent* hostent = gethostbyname(hostname);
if (hostent == NULL) {
PNACL_message("gethostbyname() returned error: %d", errno);
return -1;
}
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
memcpy(&addr.sin_addr.s_addr, hostent->h_addr_list[0], hostent->h_length);
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
printf("socket() failed: %s", strerror(errno));
return -1;
}
opt = 1;
setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(void*)&opt,sizeof(opt));
#ifdef __APPLE__
setsockopt(sock,SOL_SOCKET,SO_NOSIGPIPE,&opt,sizeof(opt));
#endif
//timeout.tv_sec = 0;
//timeout.tv_usec = 1000;
//setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(char *)&timeout,sizeof(timeout));
int result = bind(sock, (struct sockaddr*)&addr, addrlen);
if (result != 0) {
printf("bind() failed: %s", strerror(errno));
closesocket(sock);
return -1;
}
return(sock);
}*/
int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port)
{
int32_t opt,sock,result; uint32_t ipbits; char ipaddr[64]; struct timeval timeout;

44
iguana/iguana_pubkeys.c

@ -1163,47 +1163,3 @@ cJSON *iguana_pubkeyjson(struct iguana_info *coin,char *pubkeystr)
cJSON *json = cJSON_CreateObject();
return(json);
}
char *iguana_signmessage(struct supernet_info *myinfo,struct iguana_info *coin,char *address,char *message)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_verifymessage(struct supernet_info *myinfo,struct iguana_info *coin,char *address,char *sig,char *message)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_getnewaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *account)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_makekeypair(struct supernet_info *myinfo,struct iguana_info *coin)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_vanitygen(struct supernet_info *myinfo,struct iguana_info *coin,char *vanity)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_validatepubkey(struct supernet_info *myinfo,struct iguana_info *coin,char *pubkey)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_createmultisig(struct supernet_info *myinfo,struct iguana_info *coin,int32_t M,cJSON *pubkeys,char *account)
{
return(clonestr("{\"error\":\"notyet\"}"));
}

421
iguana/iguana_tx.c

@ -16,104 +16,377 @@
#include "iguana777.h"
#include "SuperNET.h"
char *iguana_getrawchangeaddress(struct supernet_info *myinfo,struct iguana_info *coin)
cJSON *iguana_voutjson(struct iguana_info *coin,struct iguana_msgvout *vout,char *asmstr)
{
return(clonestr("{\"error\":\"notyet\"}"));
static bits256 zero;
char scriptstr[8192+1],coinaddr[65]; int32_t i,M,N; uint8_t rmd160[20],msigs160[16][20],addrtype;
cJSON *addrs,*json = cJSON_CreateObject();
jaddnum(json,"value",dstr(vout->value));
if ( asmstr[0] != 0 )
jaddstr(json,"asm",asmstr);
if ( vout->pk_script != 0 && vout->pk_scriptlen*2+1 < sizeof(scriptstr) )
{
if ( iguana_calcrmd160(coin,rmd160,msigs160,&M,&N,vout->pk_script,vout->pk_scriptlen,zero) > 0 )
addrtype = coin->chain->p2shval;
else addrtype = coin->chain->pubval;
btc_convrmd160(coinaddr,addrtype,rmd160);
jaddstr(json,"address",coinaddr);
init_hexbytes_noT(scriptstr,vout->pk_script,vout->pk_scriptlen);
jaddstr(json,"payscript",scriptstr);
if ( N != 0 )
{
jaddnum(json,"M",M);
jaddnum(json,"N",N);
addrs = cJSON_CreateArray();
for (i=0; i<N; i++)
{
btc_convrmd160(coinaddr,coin->chain->pubval,msigs160[i]);
jaddistr(addrs,coinaddr);
}
jadd(json,"addrs",addrs);
}
}
return(json);
}
char *iguana_settxfee(struct supernet_info *myinfo,struct iguana_info *coin,double amount)
cJSON *iguana_vinjson(struct iguana_info *coin,struct iguana_msgvin *vin)
{
return(clonestr("{\"error\":\"notyet\"}"));
char scriptstr[8192+1],str[65]; cJSON *json = cJSON_CreateObject();
jaddstr(json,"prev_hash",bits256_str(str,vin->prev_hash));
jaddnum(json,"prev_vout",vin->prev_vout);
jaddnum(json,"sequence",vin->sequence);
if ( vin->script != 0 && vin->scriptlen*2+1 < sizeof(scriptstr) )
{
init_hexbytes_noT(scriptstr,vin->script,vin->scriptlen);
jaddstr(json,"sigscript",scriptstr);
}
return(json);
}
//struct iguana_txid { bits256 txid; uint32_t txidind,firstvout,firstvin,locktime,version,timestamp; uint16_t numvouts,numvins; } __attribute__((packed));
char *iguana_listtransactions(struct supernet_info *myinfo,struct iguana_info *coin,char *account,int32_t count,int32_t skip,int32_t watchonly)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_listunspent(struct supernet_info *myinfo,struct iguana_info *coin,int32_t minconf,int32_t maxconf,cJSON *array)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_lockunspent(struct supernet_info *myinfo,struct iguana_info *coin,int32_t flag,cJSON *array)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_listlockunspent(struct supernet_info *myinfo,struct iguana_info *coin)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout,int32_t mempool)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_gettxoutsetinfo(struct supernet_info *myinfo,struct iguana_info *coin)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_getrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t verbose)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_createrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *vins,cJSON *vouts)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
//struct iguana_msgvin { bits256 prev_hash; uint8_t *script; uint32_t prev_vout,scriptlen,sequence; } __attribute__((packed));
//struct iguana_spend { uint32_t spendtxidind; int16_t prevout; uint16_t tbd:14,external:1,diffsequence:1; } __attribute__((packed));
char *iguana_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx)
void iguana_vinset(struct iguana_info *coin,int32_t height,struct iguana_msgvin *vin,struct iguana_txid *tx,int32_t i)
{
return(clonestr("{\"error\":\"notyet\"}"));
struct iguana_spend *s,*S; uint32_t spendind; struct iguana_bundle *bp;
struct iguana_ramchaindata *rdata; struct iguana_txid *T; bits256 *X;
memset(vin,0,sizeof(*vin));
if ( height >= 0 && height < coin->chain->bundlesize*coin->bundlescount && (bp= coin->bundles[height / coin->chain->bundlesize]) != 0 && (rdata= bp->ramchain.H.data) != 0 )
{
S = (void *)(long)((long)rdata + rdata->Soffset);
X = (void *)(long)((long)rdata + rdata->Xoffset);
T = (void *)(long)((long)rdata + rdata->Toffset);
spendind = (tx->firstvin + i);
s = &S[spendind];
if ( s->diffsequence == 0 )
vin->sequence = 0xffffffff;
vin->prev_vout = s->prevout;
iguana_ramchain_spendtxid(coin,&vin->prev_hash,T,rdata->numtxids,X,rdata->numexternaltxids,s);
}
}
char *iguana_decodescript(struct supernet_info *myinfo,struct iguana_info *coin,char *script)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_signrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx,cJSON *vins,cJSON *privkeys)
int32_t iguana_voutset(struct iguana_info *coin,uint8_t *scriptspace,char *asmstr,int32_t height,struct iguana_msgvout *vout,struct iguana_txid *tx,int32_t i)
{
return(clonestr("{\"error\":\"notyet\"}"));
struct iguana_unspent *u,*U; uint32_t unspentind,scriptlen = 0; struct iguana_bundle *bp;
struct iguana_ramchaindata *rdata; struct iguana_pkhash *P,*p;
memset(vout,0,sizeof(*vout));
if ( height >= 0 && height < coin->chain->bundlesize*coin->bundlescount && (bp= coin->bundles[height / coin->chain->bundlesize]) != 0 && (rdata= bp->ramchain.H.data) != 0 )
{
U = (void *)(long)((long)rdata + rdata->Uoffset);
P = (void *)(long)((long)rdata + rdata->Poffset);
unspentind = (tx->firstvout + i);
u = &U[unspentind];
if ( u->txidind != tx->txidind || u->vout != i || u->hdrsi != height / coin->chain->bundlesize )
printf("iguana_voutset: txidind mismatch %d vs %d || %d vs %d || (%d vs %d)\n",u->txidind,u->txidind,u->vout,i,u->hdrsi,height / coin->chain->bundlesize);
p = &P[u->pkind];
vout->value = u->value;
scriptlen = iguana_scriptgen(coin,scriptspace,asmstr,bp,p,u->type);
}
vout->pk_scriptlen = scriptlen;
return(scriptlen);
}
char *iguana_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx,int32_t allowhighfees)
cJSON *iguana_txjson(struct iguana_info *coin,struct iguana_txid *tx,int32_t height)
{
return(clonestr("{\"error\":\"notyet\"}"));
struct iguana_msgvin vin; struct iguana_msgvout vout; int32_t i; char asmstr[512],str[65]; uint8_t space[8192];
cJSON *vouts,*vins,*json;
json = cJSON_CreateObject();
jaddstr(json,"txid",bits256_str(str,tx->txid));
if ( height >= 0 )
jaddnum(json,"height",height);
jaddnum(json,"version",tx->version);
jaddnum(json,"timestamp",tx->timestamp);
jaddnum(json,"locktime",tx->locktime);
vins = cJSON_CreateArray();
vouts = cJSON_CreateArray();
for (i=0; i<tx->numvouts; i++)
{
iguana_voutset(coin,space,asmstr,height,&vout,tx,i);
jaddi(vouts,iguana_voutjson(coin,&vout,asmstr));
}
jadd(json,"vouts",vouts);
for (i=0; i<tx->numvins; i++)
{
iguana_vinset(coin,height,&vin,tx,i);
jaddi(vins,iguana_vinjson(coin,&vin));
}
jadd(json,"vins",vins);
return(json);
}
char *iguana_sendtoaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address,double amount,char *comment,char *comment2)
struct iguana_txid *iguana_blocktx(struct iguana_info *coin,struct iguana_txid *tx,struct iguana_block *block,int32_t i)
{
return(clonestr("{\"error\":\"notyet\"}"));
struct iguana_bundle *bp; uint32_t txidind;
if ( i >= 0 && i < block->RO.txn_count )
{
if ( block->height >= 0 ) //
{
if ( (bp= coin->bundles[block->hdrsi]) != 0 )
{
if ( (txidind= block->RO.firsttxidind) > 0 )//bp->firsttxidinds[block->bundlei]) > 0 )
{
if ( iguana_bundletx(coin,bp,block->bundlei,tx,txidind+i) == tx )
return(tx);
printf("error getting txidind.%d + i.%d from hdrsi.%d\n",txidind,i,block->hdrsi);
return(0);
} else printf("iguana_blocktx null txidind\n");
} else printf("iguana_blocktx no bp\n");
}
} else printf("i.%d vs txn_count.%d\n",i,block->RO.txn_count);
return(0);
}
char *iguana_getreceivedbyaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address,int32_t minconf)
cJSON *iguana_blockjson(struct iguana_info *coin,struct iguana_block *block,int32_t txidsflag)
{
return(clonestr("{\"error\":\"notyet\"}"));
char str[65]; int32_t i; struct iguana_txid *tx,T; cJSON *array,*json = cJSON_CreateObject();
jaddstr(json,"blockhash",bits256_str(str,block->RO.hash2));
jaddnum(json,"height",block->height);
jaddnum(json,"ipbits",block->fpipbits);
jaddstr(json,"merkle_root",bits256_str(str,block->RO.merkle_root));
jaddstr(json,"prev_block",bits256_str(str,block->RO.prev_block));
jaddnum(json,"timestamp",block->RO.timestamp);
jaddnum(json,"nonce",block->RO.nonce);
jaddnum(json,"nBits",block->RO.bits);
jaddnum(json,"version",block->RO.version);
jaddnum(json,"numvouts",block->RO.numvouts);
jaddnum(json,"numvins",block->RO.numvins);
jaddnum(json,"recvlen",block->RO.recvlen);
jaddnum(json,"hdrsi",block->hdrsi);
jaddnum(json,"PoW",block->PoW);
jaddnum(json,"bundlei",block->bundlei);
jaddnum(json,"mainchain",block->mainchain);
jaddnum(json,"valid",block->valid);
jaddnum(json,"txn_count",block->RO.txn_count);
if ( txidsflag != 0 )
{
array = cJSON_CreateArray();
for (i=0; i<block->RO.txn_count; i++)
{
if ( (tx= iguana_blocktx(coin,&T,block,i)) != 0 )
jaddistr(array,bits256_str(str,tx->txid));
}
jadd(json,"txids",array);
//printf("add txids[%d]\n",block->txn_count);
}
return(json);
}
char *iguana_listreceivedbyaddress(struct supernet_info *myinfo,struct iguana_info *coin,int32_t minconf,int32_t includeempty)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
/*
//char *hashstr,*txidstr,*coinaddr,*txbytes,rmd160str[41],str[65]; int32_t len,height,i,n,valid = 0;
//cJSON *addrs,*retjson,*retitem; uint8_t rmd160[20],addrtype; bits256 hash2,checktxid;
//memset(&hash2,0,sizeof(hash2)); struct iguana_txid *tx,T; struct iguana_block *block = 0;
if ( (coinaddr= jstr(json,"address")) != 0 )
{
if ( btc_addr2univ(&addrtype,rmd160,coinaddr) == 0 )
{
if ( addrtype == coin->chain->pubval || addrtype == coin->chain->p2shval )
valid = 1;
else return(clonestr("{\"error\":\"invalid addrtype\"}"));
} else return(clonestr("{\"error\":\"cant convert address to rmd160\"}"));
}
if ( strcmp(method,"block") == 0 )
{
height = -1;
if ( ((hashstr= jstr(json,"blockhash")) != 0 || (hashstr= jstr(json,"hash")) != 0) && strlen(hashstr) == sizeof(bits256)*2 )
decode_hex(hash2.bytes,sizeof(hash2),hashstr);
else
{
height = juint(json,"height");
hash2 = iguana_blockhash(coin,height);
}
retitem = cJSON_CreateObject();
if ( (block= iguana_blockfind(coin,hash2)) != 0 )
{
if ( (height >= 0 && block->height == height) || memcmp(hash2.bytes,block->RO.hash2.bytes,sizeof(hash2)) == 0 )
{
char str[65],str2[65]; printf("hash2.(%s) -> %s\n",bits256_str(str,hash2),bits256_str(str2,block->RO.hash2));
return(jprint(iguana_blockjson(coin,block,juint(json,"txids")),1));
}
}
else return(clonestr("{\"error\":\"cant find block\"}"));
}
else if ( strcmp(method,"tx") == 0 )
{
if ( ((txidstr= jstr(json,"txid")) != 0 || (txidstr= jstr(json,"hash")) != 0) && strlen(txidstr) == sizeof(bits256)*2 )
{
retitem = cJSON_CreateObject();
decode_hex(hash2.bytes,sizeof(hash2),txidstr);
if ( (tx= iguana_txidfind(coin,&height,&T,hash2)) != 0 )
{
jadd(retitem,"tx",iguana_txjson(coin,tx,height));
return(jprint(retitem,1));
}
return(clonestr("{\"error\":\"cant find txid\"}"));
}
else return(clonestr("{\"error\":\"invalid txid\"}"));
}
else if ( strcmp(method,"rawtx") == 0 )
{
if ( ((txidstr= jstr(json,"txid")) != 0 || (txidstr= jstr(json,"hash")) != 0) && strlen(txidstr) == sizeof(bits256)*2 )
{
decode_hex(hash2.bytes,sizeof(hash2),txidstr);
if ( (tx= iguana_txidfind(coin,&height,&T,hash2)) != 0 )
{
if ( (len= iguana_txbytes(coin,coin->blockspace,sizeof(coin->blockspace),&checktxid,tx,height,0,0)) > 0 )
{
txbytes = mycalloc('x',1,len*2+1);
init_hexbytes_noT(txbytes,coin->blockspace,len*2+1);
retitem = cJSON_CreateObject();
jaddstr(retitem,"txid",bits256_str(str,hash2));
jaddnum(retitem,"height",height);
jaddstr(retitem,"rawtx",txbytes);
myfree(txbytes,len*2+1);
return(jprint(retitem,1));
} else return(clonestr("{\"error\":\"couldnt generate txbytes\"}"));
}
return(clonestr("{\"error\":\"cant find txid\"}"));
}
else return(clonestr("{\"error\":\"invalid txid\"}"));
}
else if ( strcmp(method,"txs") == 0 )
{
if ( ((hashstr= jstr(json,"block")) != 0 || (hashstr= jstr(json,"blockhash")) != 0) && strlen(hashstr) == sizeof(bits256)*2 )
{
decode_hex(hash2.bytes,sizeof(hash2),hashstr);
if ( (block= iguana_blockfind(coin,hash2)) == 0 )
return(clonestr("{\"error\":\"cant find blockhash\"}"));
}
else if ( jobj(json,"height") != 0 )
{
height = juint(json,"height");
hash2 = iguana_blockhash(coin,height);
if ( (block= iguana_blockfind(coin,hash2)) == 0 )
return(clonestr("{\"error\":\"cant find block at height\"}"));
}
else if ( valid == 0 )
return(clonestr("{\"error\":\"txs needs blockhash or height or address\"}"));
retitem = cJSON_CreateArray();
if ( block != 0 )
{
for (i=0; i<block->RO.txn_count; i++)
{
if ( (tx= iguana_blocktx(coin,&T,block,i)) != 0 )
jaddi(retitem,iguana_txjson(coin,tx,-1));
}
}
else
{
init_hexbytes_noT(rmd160str,rmd160,20);
jaddnum(retitem,"addrtype",addrtype);
jaddstr(retitem,"rmd160",rmd160str);
jaddstr(retitem,"txlist","get list of all tx for this address");
}
return(jprint(retitem,1));
}
else
{
n = 0;
if ( valid == 0 )
{
if ( (addrs= jarray(&n,json,"addrs")) == 0 )
return(clonestr("{\"error\":\"need address or addrs\"}"));
}
for (i=0; i<=n; i++)
{
retitem = cJSON_CreateObject();
if ( i > 0 )
retjson = cJSON_CreateArray();
if ( i > 0 )
{
if ( (coinaddr= jstr(jitem(addrs,i-1),0)) == 0 )
return(clonestr("{\"error\":\"missing address in addrs\"}"));
if ( btc_addr2univ(&addrtype,rmd160,coinaddr) < 0 )
{
free_json(retjson);
return(clonestr("{\"error\":\"illegal address in addrs\"}"));
}
if ( addrtype != coin->chain->pubval && addrtype != coin->chain->p2shval )
return(clonestr("{\"error\":\"invalid addrtype in addrs\"}"));
}
if ( strcmp(method,"utxo") == 0 )
{
jaddstr(retitem,"utxo","utxo entry");
}
else if ( strcmp(method,"unconfirmed") == 0 )
{
jaddstr(retitem,"unconfirmed","unconfirmed entry");
}
else if ( strcmp(method,"balance") == 0 )
{
jaddstr(retitem,"balance","balance entry");
}
else if ( strcmp(method,"totalreceived") == 0 )
{
jaddstr(retitem,"totalreceived","totalreceived entry");
}
else if ( strcmp(method,"totalsent") == 0 )
{
jaddstr(retitem,"totalsent","totalsent entry");
}
else if ( strcmp(method,"validateaddress") == 0 )
{
jaddstr(retitem,"validate",coinaddr);
}
if ( n == 0 )
return(jprint(retitem,1));
else jaddi(retjson,retitem);
}
return(jprint(retjson,1));
}
*/
/*
char *iguana_listsinceblock(struct supernet_info *myinfo,struct iguana_info *coin,bits256 blockhash,int32_t target)
{
cJSON *retitem = cJSON_CreateObject();
return(jprint(retitem,1));
}
char *iguana_getinfo(struct supernet_info *myinfo,struct iguana_info *coin)
{
cJSON *retitem = cJSON_CreateObject();
jaddstr(retitem,"result",coin->statusstr);
return(jprint(retitem,1));
}
char *iguana_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *coin)
{
cJSON *retitem = cJSON_CreateObject();
char str[65]; jaddstr(retitem,"result",bits256_str(str,coin->blocks.hwmchain.RO.hash2));
return(jprint(retitem,1));
}
char *iguana_getblockcount(struct supernet_info *myinfo,struct iguana_info *coin)
{
cJSON *retitem = cJSON_CreateObject();
jaddnum(retitem,"result",coin->blocks.hwmchain.height);
return(jprint(retitem,1));
}*/

144
iguana/iguana_wallet.c

@ -164,147 +164,3 @@ char *sendtoaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *
}
return(clonestr("{\"error\":\"need address and amount\"}"));
}
char *iguana_getreceivedbyaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *account,int32_t minconf)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
/*char *iguana_listreceivedbyaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *account,int32_t includeempty)
{
return(clonestr("{\"error\":\"notyet\"}"));
}*/
char *iguana_getaccountaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *account)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_setaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *address,char *account)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_getaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *account)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_getaddressesbyaccount(struct supernet_info *myinfo,struct iguana_info *coin,char *account)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_listaddressgroupings(struct supernet_info *myinfo,struct iguana_info *coin)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
/*char *iguana_getbalance(struct supernet_info *myinfo,struct iguana_info *coin,char *account,int32_t minconf)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_listaccounts(struct supernet_info *myinfo,struct iguana_info *coin,int32_t minconf)
{
return(clonestr("{\"error\":\"notyet\"}"));
}*/
char *iguana_move(struct supernet_info *myinfo,struct iguana_info *coin,char *fromaccount,char *toaccount,double amount,int32_t minconf,char *comment)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_sendfrom(struct supernet_info *myinfo,struct iguana_info *coin,char *fromaccount,char *toaddress,double amount,int32_t minconf,char *comment,char *comment2)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_sendmany(struct supernet_info *myinfo,struct iguana_info *coin,char *fromaccount,cJSON *payments,int32_t minconf,char *comment)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_dumpprivkey(struct supernet_info *myinfo,struct iguana_info *coin,char *address)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
/*char *iguana_importprivkey(struct supernet_info *myinfo,struct iguana_info *coin,char *wip)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_dumpwallet(struct supernet_info *myinfo,struct iguana_info *coin)
{
return(clonestr("{\"error\":\"notyet\"}"));
}*/
char *iguana_importwallet(struct supernet_info *myinfo,struct iguana_info *coin,char *wallet)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_walletpassphrase(struct supernet_info *myinfo,struct iguana_info *coin,char *passphrase,int32_t timeout)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_walletpassphrasechange(struct supernet_info *myinfo,struct iguana_info *coin,char *oldpassphrase,char *newpassphrase)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_walletlock(struct supernet_info *myinfo,struct iguana_info *coin)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_encryptwallet(struct supernet_info *myinfo,struct iguana_info *coin,char *passphrase)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_checkwallet(struct supernet_info *myinfo,struct iguana_info *coin)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_repairwallet(struct supernet_info *myinfo,struct iguana_info *coin)
{
return(clonestr("{\"error\":\"notyet\"}"));
}
char *iguana_backupwallet(struct supernet_info *myinfo,struct iguana_info *coin,char *filename)
{
return(clonestr("{\"error\":\"notyet\"}"));
}

2
iguana/index.html

File diff suppressed because one or more lines are too long

104
iguana/main.c

@ -40,97 +40,14 @@ int32_t IGUANA_NUMHELPERS = 16;
int32_t IGUANA_NUMHELPERS = 8;
#endif
char *hash_parser(struct supernet_info *myinfo,char *hashname,cJSON *json,char *remoteaddr)
{
int32_t i,len,iter,n; uint8_t databuf[512];
char hexstr[1025],*password,*name,*msg;
typedef void (*hashfunc)(char *hexstr,uint8_t *buf,uint8_t *msg,int32_t len);
typedef char *(*hmacfunc)(char *dest,char *key,int32_t key_size,char *message);
struct hashfunc_entry { char *name; hashfunc hashfunc; };
struct hmacfunc_entry { char *name; hmacfunc hmacfunc; };
struct hashfunc_entry hashes[] = { {"NXT",calc_NXTaddr}, {"curve25519",calc_curve25519_str }, {"base64_encode",calc_base64_encodestr}, {"base64_decode",calc_base64_decodestr}, {"crc32",calc_crc32str}, {"rmd160_sha256",rmd160ofsha256}, {"sha256_sha256",sha256_sha256}, {"sha256",vcalc_sha256}, {"sha512",calc_sha512}, {"sha384",calc_sha384}, {"sha224",calc_sha224}, {"rmd160",calc_rmd160}, {"rmd256",calc_rmd256}, {"rmd320",calc_rmd320}, {"rmd128",calc_rmd128}, {"sha1",calc_sha1}, {"md5",calc_md5str}, {"md2",calc_md2str}, {"md4",calc_md4str}, {"tiger",calc_tiger}, {"whirlpool",calc_whirlpool} };
struct hmacfunc_entry hmacs[] = { {"hmac_sha256",hmac_sha256_str}, {"hmac_sha512",hmac_sha512_str}, {"hmac_sha384",hmac_sha384_str}, {"hmac_sha224",hmac_sha224_str}, {"hmac_rmd160",hmac_rmd160_str}, {"hmac_rmd256",hmac_rmd256_str}, {"hmac_rmd320",hmac_rmd320_str}, {"hmac_rmd128",hmac_rmd128_str}, {"hmac_sha1",hmac_sha1_str}, {"hmac_md52",hmac_md2_str},{"hmac_md4",hmac_md4_str},{"hmac_md5",hmac_md5_str}, {"hmac_tiger",hmac_tiger_str}, {"hmac_whirlpool",hmac_whirlpool_str} };
if ( (msg= jstr(json,"message")) == 0 )
return(clonestr("{\"error\":\"no message to hash\"}"));
if ( (password= jstr(json,"password")) == 0 || password[0] == 0 )
password = " ";
n = (int32_t)sizeof(hashes)/sizeof(*hashes);
printf("msg.(%s) password.(%s)\n",msg,password!=0?password:"");
for (iter=0; iter<2; iter++)
{
for (i=0; i<n; i++)
{
name = (iter == 0) ? hashes[i].name : hmacs[i].name;
//printf("iter.%d i.%d (%s) vs (%s) %d\n",iter,i,name,hashname,strcmp(hashname,name) == 0);
if ( strcmp(hashname,name) == 0 )
{
json = cJSON_CreateObject();
len = msg==0?0:(int32_t)strlen(msg);
if ( iter == 0 )
(*hashes[i].hashfunc)(hexstr,databuf,(uint8_t *)msg,len);
else (*hmacs[i].hmacfunc)(hexstr,password,password==0?0:(int32_t)strlen(password),msg);
jaddstr(json,"result","hash calculated");
jaddstr(json,"message",msg);
jaddstr(json,name,hexstr);
return(jprint(json,1));
}
}
n = (int32_t)sizeof(hmacs)/sizeof(*hmacs);
}
return(clonestr("{\"error\":\"cant find hash function\"}"));
}
char *InstantDEX_parser(struct supernet_info *myinfo,char *method,cJSON *json,char *remoteaddr)
{
return(clonestr("{\"error\":\"InstantDEX API is not yet\"}"));
}
char *jumblr_parser(struct supernet_info *myinfo,char *method,cJSON *json,char *remoteaddr)
{
return(clonestr("{\"error\":\"jumblr API is not yet\"}"));
}
char *pangea_parser(struct supernet_info *myinfo,char *method,cJSON *json,char *remoteaddr)
{
return(clonestr("{\"error\":\"jumblr API is not yet\"}"));
}
char *SuperNET_jsonstr(struct supernet_info *myinfo,char *jsonstr,char *remoteaddr)
{
cJSON *json,*retjson; char *agent,*method,*symbol;
cJSON *json; char *agent,*method;
if ( (json= cJSON_Parse(jsonstr)) != 0 )
{
method = jstr(json,"method");
if ( (agent= jstr(json,"agent")) != 0 && method != 0 )
{
if ( strcmp(agent,"iguana") == 0 )
return(iguana_parser(myinfo,method,json,remoteaddr));
else if ( strcmp(agent,"ramchain") == 0 )
return(ramchain_parser(myinfo,method,json,remoteaddr));
else if ( strcmp(agent,"InstantDEX") == 0 )
return(InstantDEX_parser(myinfo,method,json,remoteaddr));
else if ( strcmp(agent,"pangea") == 0 )
return(pangea_parser(myinfo,method,json,remoteaddr));
else if ( strcmp(agent,"jumblr") == 0 )
return(jumblr_parser(myinfo,method,json,remoteaddr));
else if ( strcmp(agent,"hash") == 0 )
return(hash_parser(myinfo,method,json,remoteaddr));
else if ( strcmp(agent,"SuperNET") == 0 )
{
if ( strcmp(method,"bitcoinrpc") == 0 && (symbol= jstr(json,"coin")) != 0 && strlen(symbol) < 8 && iguana_coinfind(symbol) != 0)
{
strcpy(myinfo->rpcsymbol,symbol);
return(clonestr("{\"result\":\"set bitcoin RPC coin\"}"));
}
else if ( strcmp(method,"help") == 0 )
{
retjson = cJSON_CreateObject();
jaddstr(retjson,"result",SUPERNET_HELPSTR);
return(jprint(retjson,1));
}
return(clonestr("{\"error\":\"unrecognized SuperNET method\"}"));
}
}
return(SuperNET_parser(myinfo,agent,method,json,remoteaddr));
else if ( method != 0 && is_bitcoinrpc(method) )
return(iguana_bitcoinRPC(myinfo,method,json,remoteaddr));
return(clonestr("{\"error\":\"need both agent and method\"}"));
@ -199,21 +116,8 @@ char *SuperNET_JSON(struct supernet_info *myinfo,cJSON *json,char *remoteaddr)
cJSON *retjson; uint64_t tag; uint32_t timeout; char *jsonstr; char *retjsonstr,*retstr = 0;
if ( json != 0 )
{
/*if ( localaccess != 0 && (method= jstr(json,"method")) != 0 && strcmp(method,"addcoin") == 0 )
{
if ( (retval= iguana_launchcoin(jstr(json,"coin"),json)) > 0 )
return(clonestr("{\"result\":\"launched coin\"}"));
else if ( retval == 0 ) return(clonestr("{\"result\":\"coin already launched\"}"));
else return(clonestr("{\"error\":\"error launching coin\"}"));
}*/
if ( (tag= j64bits(json,"tag")) == 0 )
OS_randombytes((uint8_t *)&tag,sizeof(tag));
/*if ( (symbol= jstr(json,"coin")) != 0 )
{
coin = iguana_coinfind(symbol);
if ( coin != 0 && localaccess != 0 && coin->launched == 0 )
iguana_launchcoin(symbol,json);
}*/
if ( (timeout= juint(json,"timeout")) == 0 )
timeout = IGUANA_JSONTIMEOUT;
jsonstr = jprint(json,0);
@ -325,12 +229,12 @@ void iguana_main(void *arg)
iguana_launch(iguana_coinadd("BTCD"),"rpcloop",iguana_rpcloop,iguana_coinadd("BTCD"),IGUANA_PERMTHREAD);
if ( coinargs != 0 )
iguana_launch(iguana_coinadd("BTCD"),"iguana_coins",iguana_coins,coinargs,IGUANA_PERMTHREAD);
else if ( 1 )
else if ( 0 )
{
#ifdef __APPLE__
sleep(1);
char *str;
if ( (str= SuperNET_JSON(&MYINFO,cJSON_Parse("{\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":0,\"maxpeers\":32,\"coin\":\"BTCD\",\"active\":1}"),0)) != 0 )
if ( (str= SuperNET_JSON(&MYINFO,cJSON_Parse("{\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":0,\"maxpeers\":2,\"coin\":\"BTCD\",\"active\":1}"),0)) != 0 )
{
printf("got.(%s)\n",str);
free(str);

325
iguana/ramchain_api.c

@ -0,0 +1,325 @@
/******************************************************************************
* Copyright © 2014-2015 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* SuperNET software, including this file may be copied, modified, propagated *
* or distributed except according to the terms contained in the LICENSE file *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
#include "iguana777.h"
#include "../includes/iguana_apidefs.h"
ZERO_ARGS(ramchain,getinfo)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
ZERO_ARGS(ramchain,getbestblockhash)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
ZERO_ARGS(ramchain,getblockcount)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
ZERO_ARGS(ramchain,listaddressgroupings)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
ZERO_ARGS(ramchain,walletlock)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
ZERO_ARGS(ramchain,checkwallet)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
ZERO_ARGS(ramchain,repairwallet)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
ZERO_ARGS(ramchain,makekeypair)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
ZERO_ARGS(ramchain,gettxoutsetinfo)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
ZERO_ARGS(ramchain,listlockunspent)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
ZERO_ARGS(ramchain,getrawchangeaddress)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
TWO_INTS(ramchain,listaccounts,minconf,includewatchonly)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
TWO_INTS(ramchain,listreceivedbyaddress,minconf,includeempty)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
TWOINTS_AND_ARRAY(ramchain,listunspent,minconf,maxconf,array)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(ramchain,dumpwallet,filename)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(ramchain,backupwallet,filename)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(ramchain,encryptwallet,passphrase)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(ramchain,validatepubkey,pubkey)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(ramchain,getnewaddress,account)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(ramchain,vanitygen,vanity)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(ramchain,getaddressesbyaccount,account)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(ramchain,getaccount,address)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(ramchain,getaccountaddress,account)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(ramchain,dumpprivkey,address)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(ramchain,importwallet,filename)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(ramchain,decoderawtransaction,rawtx)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_ARG(ramchain,decodescript,script)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
TWO_STRINGS(ramchain,setaccount,address,account)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
TWO_STRINGS(ramchain,walletpassphrasechange,oldpassphrase,newpassphrase)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
TWO_STRINGS(ramchain,signmessage,address,message)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
THREE_STRINGS(ramchain,verifymessage,address,sig,message)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
THREE_INTS(ramchain,listreceivedbyaccount,confirmations,includeempty,watchonly)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
THREE_INTS(ramchain,getbalance,confirmations,includeempty,watchonly)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
TWOSTRINGS_AND_INT(ramchain,importprivkey,wif,account,rescan)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_AND_INT(ramchain,getreceivedbyaccount,account,includeempty)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_AND_INT(ramchain,walletpassphrase,passphrase,timeout)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_AND_INT(ramchain,getreceivedbyaddress,address,minconf)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_AND_INT(ramchain,sendrawtransaction,rawtx,allowhighfees)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
HASH_AND_INT(ramchain,listsinceblock,blockhash,target)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
HASH_AND_INT(ramchain,getrawtransaction,txid,verbose)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_AND_THREEINTS(ramchain,listtransactions,account,count,skip,includewatchonly)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
HASH_AND_TWOINTS(ramchain,gettxout,txid,vout,mempool)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
DOUBLE_ARG(ramchain,settxfee,amount)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
INT_AND_ARRAY(ramchain,lockunspent,flag,array)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
INT_ARRAY_STRING(ramchain,createmultisig,M,array,account)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
TWO_ARRAYS(ramchain,createrawtransaction,vins,vouts)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
STRING_AND_TWOARRAYS(ramchain,signrawtransaction,rawtx,vins,privkeys)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
SS_D_I_S(ramchain,move,fromaccount,toaccount,amount,minconf,comment)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
SS_D_I_SS(ramchain,sendfrom,fromaccount,toaddress,amount,minconf,comment,comment2)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
S_A_I_S(ramchain,sendmany,fromaccount,array,minconf,comment)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
S_D_SS(ramchain,sendtoaddress,address,amount,comment,comment2)
{
cJSON *retjson = cJSON_CreateObject();
return(jprint(retjson,1));
}
#undef IGUANA_ARGS
#include "../includes/iguana_apiundefs.h"

6
includes/iguana_api.h

@ -16,10 +16,10 @@
#ifndef IGUANA_API_H
#define IGUANA_API_H
#include "iguana_apidefs.h"
#include "iguana_apideclares.h"
#include "../includes/iguana_apidefs.h"
#include "../includes/iguana_apideclares.h"
#undef IGUANA_ARGS
#include "iguana_apiundefs.h"
#include "../includes/iguana_apiundefs.h"
#endif

282
includes/iguana_apideclares.h

@ -13,168 +13,120 @@
* *
******************************************************************************/
/* from https://bitcoin.org/en/developer-reference#rpcs
Block Chain RPCs
GetBestBlockHash: returns the header hash of the most recent block on the best block chain. New in 0.9.0
GetBlock: gets a block with a particular header hash from the local block database either as a JSON object or as a serialized block.
GetBlockChainInfo: provides information about the current state of the block chain. New in 0.9.2, Updated in 0.10.0
GetBlockCount: returns the number of blocks in the local best block chain.
GetBlockHash: returns the header hash of a block at the given height in the local best block chain.
GetChainTips: returns information about the highest-height block (tip) of each local block chain. New in 0.10.0
GetDifficulty: returns the proof-of-work difficulty as a multiple of the minimum difficulty.
GetMemPoolInfo: returns information about the nodes current transaction memory pool. New in 0.10.0
GetRawMemPool: returns all transaction identifiers (TXIDs) in the memory pool as a JSON array, or detailed information about each transaction in the memory pool as a JSON object.
GetTxOut: returns details about a transaction output. Only unspent transaction outputs (UTXOs) are guaranteed to be available.
GetTxOutProof: returns a hex-encoded proof that one or more specified transactions were included in a block. New in 0.11.0
GetTxOutSetInfo: returns statistics about the confirmed unspent transaction output (UTXO) set. Note that this call may take some time and that it only counts outputs from confirmed transactionsit does not count outputs from the memory pool.
VerifyChain: verifies each entry in the local block chain database.
VerifyTxOutProof: verifies that a proof points to one or more transactions in a block, returning the transactions the proof commits to and throwing an RPC error if the block is not in our best block chain. New in 0.11.0
Control RPCs
GetInfo: prints various information about the node and the network. Updated in 0.10.0, Deprecated
Help: lists all available public RPC commands, or gets help for the specified RPC. Commands which are unavailable will not be listed, such as wallet RPCs if wallet support is disabled.
Stop: safely shuts down the Bitcoin Core server.
Generating RPCs
Generate: nearly instantly generates blocks (in regtest mode only) New in master
GetGenerate: returns true if the node is set to generate blocks using its CPU.
SetGenerate: enables or disables hashing to attempt to find the next block. Updated in master
Mining RPCs
GetBlockTemplate: gets a block template or proposal for use with mining software.
GetMiningInfo: returns various mining-related information. Updated in master
GetNetworkHashPS: returns the estimated current or historical network hashes per second based on the last n blocks.
PrioritiseTransaction: adds virtual priority or fee to a transaction, allowing it to be accepted into blocks mined by this node (or miners which use this node) with a lower priority or fee. (It can also remove virtual priority or fee, requiring the transaction have a higher priority or fee to be accepted into a locally-mined block.) New in 0.10.0
SubmitBlock: accepts a block, verifies it is a valid addition to the block chain, and broadcasts it to the network. Extra parameters are ignored by Bitcoin Core but may be used by mining pools or other programs.
Network RPCs
AddNode: attempts to add or remove a node from the addnode list, or to try a connection to a node once.
GetAddedNodeInfo: returns information about the given added node, or all added nodes (except onetry nodes). Only nodes which have been manually added using the addnode RPC will have their information displayed.
GetConnectionCount: returns the number of connections to other nodes.
GetNetTotals: returns information about network traffic, including bytes in, bytes out, and the current time.
GetNetworkInfo: returns information about the nodes connection to the network. New in 0.9.2, Updated in 0.10.0
GetPeerInfo: returns data about each connected network node. Updated in 0.10.0
Ping: sends a P2P ping message to all connected nodes to measure ping time. Results are provided by the getpeerinfo RPC pingtime and pingwait fields as decimal seconds. The P2P ping message is handled in a queue with all other commands, so it measures processing backlog, not just network ping.
Raw Transaction RPCs
CreateRawTransaction: creates an unsigned serialized transaction that spends a previous output to a new output with a P2PKH or P2SH address. The transaction is not stored in the wallet or transmitted to the network.
DecodeRawTransaction: decodes a serialized transaction hex string into a JSON object describing the transaction.
DecodeScript: decodes a hex-encoded P2SH redeem script.
GetRawTransaction: 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.
SendRawTransaction: validates a transaction and broadcasts it to the peer-to-peer network.
SignRawTransaction: signs a transaction in the serialized transaction format using private keys stored in the wallet or provided in the call.
Utility RPCs
CreateMultiSig: creates a P2SH multi-signature address.
EstimateFee: estimates the transaction fee per kilobyte that needs to be paid for a transaction to be included within a certain number of blocks. New in 0.10.0
EstimatePriority: estimates the priority that a transaction needs in order to be included within a certain number of blocks as a free high-priority transaction. New in 0.10.0
ValidateAddress: returns information about the given Bitcoin address.
VerifyMessage: verifies a signed message.
Wallet RPCs
Note: the wallet RPCs are only available if Bitcoin Core was built with wallet support, which is the default.
AddMultiSigAddress: adds a P2SH multisig address to the wallet.
BackupWallet: safely copies wallet.dat to the specified file, which can be a directory or a path with filename.
DumpPrivKey: returns the wallet-import-format (WIP) private key corresponding to an address. (But does not remove it from the wallet.)
DumpWallet: creates or overwrites a file with all wallet keys in a human-readable format.
EncryptWallet: 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.
GetAccountAddress: returns the current Bitcoin address for receiving payments to this account. If the account doesnt exist, it creates both the account and a new address for receiving payment. Once a payment has been received to an address, future calls to this RPC for the same account will return a different address.
GetAccount: returns the name of the account associated with the given address.
GetAddressesByAccount: returns a list of every address assigned to a particular account.
GetBalance: gets the balance in decimal bitcoins across all accounts or for a particular account.
GetNewAddress: returns a new Bitcoin address for receiving payments. If an account is specified, payments received with the address will be credited to that account.
GetRawChangeAddress: returns a new Bitcoin address for receiving change. This is for use with raw transactions, not normal use.
GetReceivedByAccount: returns the total amount received by addresses in a particular account from transactions with the specified number of confirmations. It does not count coinbase transactions.
GetReceivedByAddress: returns the total amount received by the specified address in transactions with the specified number of confirmations. It does not count coinbase transactions.
GetTransaction: gets detailed information about an in-wallet transaction. Updated in 0.10.0
GetUnconfirmedBalance: returns the wallets total unconfirmed balance.
GetWalletInfo: provides information about the wallet. New in 0.9.2
ImportAddress: adds an address or pubkey script to the wallet without the associated private key, allowing you to watch for transactions affecting that address or pubkey script without being able to spend any of its outputs. New in 0.10.0
ImportPrivKey: adds a private key to your wallet. The key should be formatted in the wallet import format created by the dumpprivkey RPC.
ImportWallet: imports private keys from a file in wallet dump file format (see the dumpwallet RPC). These keys will be added to the keys currently in the wallet. This call may need to rescan all or parts of the block chain for transactions affecting the newly-added keys, which may take several minutes.
KeyPoolRefill: fills the cache of unused pre-generated keys (the keypool).
ListAccounts: lists accounts and their balances. Updated in 0.10.0
ListAddressGroupings: lists groups of addresses that may have had their common ownership made public by common use as inputs in the same transaction or from being used as change from a previous transaction.
ListLockUnspent: returns a list of temporarily unspendable (locked) outputs.
ListReceivedByAccount: lists the total number of bitcoins received by each account. Updated in 0.10.0
ListReceivedByAddress: lists the total number of bitcoins received by each address. Updated in 0.10.0
ListSinceBlock: gets all transactions affecting the wallet which have occurred since a particular block, plus the header hash of a block at a particular depth. Updated in 0.10.0
ListTransactions: returns the most recent transactions that affect the wallet. Updated in 0.10.0
ListUnspent: returns an array of unspent transaction outputs belonging to this wallet. Updated in 0.10.0
LockUnspent: temporarily locks or unlocks specified transaction outputs. A locked transaction output will not be chosen by automatic coin selection when spending bitcoins. Locks are stored in memory only, so nodes start with zero locked outputs and the locked output list is always cleared when a node stops or fails.
Move: moves a specified amount from one account in your wallet to another using an off-block-chain transaction.
SendFrom: spends an amount from a local account to a bitcoin address.
SendMany: creates and broadcasts a transaction which sends outputs to multiple addresses.
SendToAddress: spends an amount to a given address.
SetAccount: puts the specified address in the given account.
SetTxFee: sets the transaction fee per kilobyte paid by transactions created by this wallet.
SignMessage: signs a message with the private key of an address.
WalletLock: removes the wallet encryption key from memory, locking the wallet. After calling this method, you will need to call walletpassphrase again before being able to call any methods which require the wallet to be unlocked.
WalletPassphrase: stores the wallet decryption key in memory for the indicated number of seconds. Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock time that overrides the old one.
WalletPassphraseChange: changes the wallet passphrase from old passphrase to new passphrase.
Removed RPCs
GetHashesPerSec: was removed in Bitcoin Core master (unreleased). It returned a recent hashes per second performance measurement when the node was generating blocks.
GetWork: was removed in Bitcoin Core 0.10.0.
RPCs
Warning icon Warning: the block chain and memory pool can include arbitrary data which several of the commands below will return in hex format. If you convert this data to another format in an executable context, it could be used in an exploit. For example, displaying a pubkey script as ASCII text in a webpage could add arbitrary Javascript to that page and create a cross-site scripting (XSS) exploit. To avoid problems, please treat block chain and memory pool data as an arbitrary input from an untrusted source.
*/
ZERO_ARGS(getinfo);
ZERO_ARGS(getbestblockhash);
ZERO_ARGS(getblockcount);
ZERO_ARGS(listaddressgroupings);
ZERO_ARGS(walletlock);
ZERO_ARGS(checkwallet);
ZERO_ARGS(repairwallet);
ZERO_ARGS(makekeypair);
ZERO_ARGS(gettxoutsetinfo);
ZERO_ARGS(listlockunspent);
ZERO_ARGS(getrawchangeaddress);
TWO_INTS(listaccounts,minconf,includewatchonly);
TWO_INTS(listreceivedbyaddress,minconf,includeempty);
TWOINTS_AND_ARRAY(listunspent,minconf,maxconf,array);
STRING_ARG(dumpwallet,filename);
STRING_ARG(backupwallet,filename);
STRING_ARG(encryptwallet,passphrase);
STRING_ARG(validatepubkey,pubkey);
STRING_ARG(getnewaddress,account);
STRING_ARG(vanitygen,vanity);
STRING_ARG(getaddressesbyaccount,account);
STRING_ARG(getaccount,address);
STRING_ARG(getaccountaddress,account);
STRING_ARG(dumpprivkey,address);
STRING_ARG(importwallet,filename);
STRING_ARG(decoderawtransaction,rawtx);
STRING_ARG(decodescript,script);
TWO_STRINGS(setaccount,address,account);
TWO_STRINGS(walletpassphrasechange,oldpassphrase,newpassphrase);
TWO_STRINGS(signmessage,address,message);
THREE_STRINGS(verifymessage,address,sig,message);
THREE_INTS(listreceivedbyaccount,confirmations,includeempty,watchonly);
THREE_INTS(getbalance,confirmations,includeempty,watchonly);
TWOSTRINGS_AND_INT(importprivkey,wif,account,rescan);
STRING_AND_INT(getreceivedbyaccount,account,includeempty);
STRING_AND_INT(walletpassphrase,passphrase,timeout);
STRING_AND_INT(getreceivedbyaddress,address,minconf);
STRING_AND_INT(sendrawtransaction,rawtx,allowhighfees);
HASH_AND_INT(listsinceblock,blockhash,target);
HASH_AND_INT(getrawtransaction,txid,verbose);
STRING_AND_THREEINTS(listtransactions,account,count,skip,includewatchonly);
HASH_AND_TWOINTS(gettxout,txid,vout,mempool);
DOUBLE_ARG(settxfee,amount);
INT_AND_ARRAY(lockunspent,flag,array);
INT_ARRAY_STRING(createmultisig,M,array,account);
TWO_ARRAYS(createrawtransaction,vins,vouts);
STRING_AND_TWOARRAYS(signrawtransaction,rawtx,vins,privkeys);
SS_D_I_S(move,fromaccount,toaccount,amount,minconf,comment);
SS_D_I_SS(sendfrom,fromaccount,toaddress,amount,minconf,comment,comment2);
S_A_I_S(sendmany,fromaccount,array,minconf,comment);
S_D_SS(sendtoaddress,address,amount,comment,comment2);
ZERO_ARGS(SuperNET,help);
TWO_STRINGS(SuperNET,html,agentform,htmlfile);
STRING_ARG(SuperNET,bitcoinrpc,setcoin);
ZERO_ARGS(iguana,peers);
INT_ARG(iguana,maxpeers,max);
ZERO_ARGS(iguana,getconnectioncount);
STRING_ARG(iguana,addcoin,newcoin);
ZERO_ARGS(iguana,startcoin);
ZERO_ARGS(iguana,pausecoin);
STRING_ARG(iguana,addnode,ipaddr);
STRING_ARG(iguana,removenode,ipaddr);
STRING_ARG(iguana,oneshot,ipaddr);
STRING_ARG(iguana,nodestatus,ipaddr);
ZERO_ARGS(ramchain,getinfo);
ZERO_ARGS(ramchain,getbestblockhash);
ZERO_ARGS(ramchain,getblockcount);
ZERO_ARGS(ramchain,listaddressgroupings);
ZERO_ARGS(ramchain,walletlock);
ZERO_ARGS(ramchain,checkwallet);
ZERO_ARGS(ramchain,repairwallet);
ZERO_ARGS(ramchain,makekeypair);
ZERO_ARGS(ramchain,gettxoutsetinfo);
ZERO_ARGS(ramchain,listlockunspent);
ZERO_ARGS(ramchain,getrawchangeaddress);
TWO_INTS(ramchain,listaccounts,minconf,includewatchonly);
TWO_INTS(ramchain,listreceivedbyaddress,minconf,includeempty);
TWOINTS_AND_ARRAY(ramchain,listunspent,minconf,maxconf,array);
STRING_ARG(ramchain,dumpwallet,filename);
STRING_ARG(ramchain,backupwallet,filename);
STRING_ARG(ramchain,encryptwallet,passphrase);
STRING_ARG(ramchain,validatepubkey,pubkey);
STRING_ARG(ramchain,getnewaddress,account);
STRING_ARG(ramchain,vanitygen,vanity);
STRING_ARG(ramchain,getaddressesbyaccount,account);
STRING_ARG(ramchain,getaccount,address);
STRING_ARG(ramchain,getaccountaddress,account);
STRING_ARG(ramchain,dumpprivkey,address);
STRING_ARG(ramchain,importwallet,filename);
STRING_ARG(ramchain,decoderawtransaction,rawtx);
STRING_ARG(ramchain,decodescript,script);
TWO_STRINGS(ramchain,setaccount,address,account);
TWO_STRINGS(ramchain,walletpassphrasechange,oldpassphrase,newpassphrase);
TWO_STRINGS(ramchain,signmessage,address,message);
THREE_STRINGS(ramchain,verifymessage,address,sig,message);
THREE_INTS(ramchain,listreceivedbyaccount,confirmations,includeempty,watchonly);
THREE_INTS(ramchain,getbalance,confirmations,includeempty,watchonly);
TWOSTRINGS_AND_INT(ramchain,importprivkey,wif,account,rescan);
STRING_AND_INT(ramchain,getreceivedbyaccount,account,includeempty);
STRING_AND_INT(ramchain,walletpassphrase,passphrase,timeout);
STRING_AND_INT(ramchain,getreceivedbyaddress,address,minconf);
STRING_AND_INT(ramchain,sendrawtransaction,rawtx,allowhighfees);
HASH_AND_INT(ramchain,listsinceblock,blockhash,target);
HASH_AND_INT(ramchain,getrawtransaction,txid,verbose);
STRING_AND_THREEINTS(ramchain,listtransactions,account,count,skip,includewatchonly);
HASH_AND_TWOINTS(ramchain,gettxout,txid,vout,mempool);
DOUBLE_ARG(ramchain,settxfee,amount);
INT_AND_ARRAY(ramchain,lockunspent,flag,array);
INT_ARRAY_STRING(ramchain,createmultisig,M,array,account);
TWO_ARRAYS(ramchain,createrawtransaction,vins,vouts);
STRING_AND_TWOARRAYS(ramchain,signrawtransaction,rawtx,vins,privkeys);
SS_D_I_S(ramchain,move,fromaccount,toaccount,amount,minconf,comment);
SS_D_I_SS(ramchain,sendfrom,fromaccount,toaddress,amount,minconf,comment,comment2);
S_A_I_S(ramchain,sendmany,fromaccount,array,minconf,comment);
S_D_SS(ramchain,sendtoaddress,address,amount,comment,comment2);
STRING_ARG(hash,NXT,passphrase);
STRING_ARG(hash,curve25519,pubkey);
STRING_ARG(hash,crc32,message);
STRING_ARG(hash,base64_encode,message);
STRING_ARG(hash,base64_decode,message);
STRING_ARG(hash,rmd160_sha256,message);
STRING_ARG(hash,sha256_sha256,message);
STRING_ARG(hash,sha224,message);
STRING_ARG(hash,sha256,message);
STRING_ARG(hash,sha384,message);
STRING_ARG(hash,sha512,message);
STRING_ARG(hash,rmd128,message);
STRING_ARG(hash,rmd160,message);
STRING_ARG(hash,rmd256,message);
STRING_ARG(hash,rmd320,message);
STRING_ARG(hash,sha1,message);
STRING_ARG(hash,md2,message);
STRING_ARG(hash,md4,message);
STRING_ARG(hash,md5,message);
STRING_ARG(hash,tiger,message);
STRING_ARG(hash,whirlpool,message);
TWO_STRINGS(hmac,sha224,message,passphrase);
TWO_STRINGS(hmac,sha256,message,passphrase);
TWO_STRINGS(hmac,sha384,message,passphrase);
TWO_STRINGS(hmac,sha512,message,passphrase);
TWO_STRINGS(hmac,rmd128,message,passphrase);
TWO_STRINGS(hmac,rmd160,message,passphrase);
TWO_STRINGS(hmac,rmd256,message,passphrase);
TWO_STRINGS(hmac,rmd320,message,passphrase);
TWO_STRINGS(hmac,sha1,message,passphrase);
TWO_STRINGS(hmac,md2,message,passphrase);
TWO_STRINGS(hmac,md4,message,passphrase);
TWO_STRINGS(hmac,md5,message,passphrase);
TWO_STRINGS(hmac,tiger,message,passphrase);
TWO_STRINGS(hmac,whirlpool,message,passphrase);

50
includes/iguana_apidefs.h

@ -1,29 +1,29 @@
#define IGUANA_ARGS struct supernet_info *myinfo,struct iguana_info *coin
#define IGUANA_CFUNC0(name) char *iguana_ ## name(IGUANA_ARGS)
#define IGUANA_CFUNC_S(name,str) char *iguana_ ## name(IGUANA_ARGS,char *str)
#define IGUANA_CFUNC_I(name,val) char *iguana_ ## name(IGUANA_ARGS,int32_t val)
#define IGUANA_CFUNC_SA(name,str,array) char *iguana_ ## name(IGUANA_ARGS,char *str,cJSON *array)
#define IGUANA_CFUNC_AA(name,array,array2) char *iguana_ ## name(IGUANA_ARGS,cJSON *array,cJSON *array2)
#define IGUANA_CFUNC_SAA(name,str,array,array2) char *iguana_ ## name(IGUANA_ARGS,char *str,cJSON *array,cJSON *array2)
#define IGUANA_CFUNC_IA(name,val,array) char *iguana_ ## name(IGUANA_ARGS,int32_t val,cJSON *array)
#define IGUANA_CFUNC_IAS(name,val,array,str) char *iguana_ ## name(IGUANA_ARGS,int32_t val,cJSON *array,char *str)
#define IGUANA_CFUNC_II(name,val,val2) char *iguana_ ## name(IGUANA_ARGS,int32_t val,int32_t val2)
#define IGUANA_CFUNC_III(name,val,val2,val3) char *iguana_ ## name(IGUANA_ARGS,int32_t val,int32_t val2,int32_t val3)
#define IGUANA_CFUNC_SIII(name,str,val,val2,val3) char *iguana_ ## name(IGUANA_ARGS,char *str,int32_t val,int32_t val2,int32_t val3)
#define IGUANA_CFUNC_IIA(name,val,val2,array) char *iguana_ ## name(IGUANA_ARGS,int32_t val,int32_t val2,cJSON *array)
#define IGUANA_CFUNC_SS(name,str,str2) char *iguana_ ## name(IGUANA_ARGS,char *str,char *str2)
#define IGUANA_CFUNC_SSI(name,str,str2,val) char *iguana_ ## name(IGUANA_ARGS,char *str,char *str2,int32_t val)
#define IGUANA_CFUNC_SSS(name,str,str2,str3) char *iguana_ ## name(IGUANA_ARGS,char *str,char *str2,char *str3)
#define IGUANA_CFUNC_SI(name,str,val) char *iguana_ ## name(IGUANA_ARGS,char *str,int32_t val)
#define IGUANA_CFUNC_SII(name,str,val,val2) char *iguana_ ## name(IGUANA_ARGS,char *str,int32_t val,int32_t val2)
#define IGUANA_CFUNC_HI(name,hash,val) char *iguana_ ## name(IGUANA_ARGS,bits256 hash,int32_t val)
#define IGUANA_CFUNC_HII(name,hash,val,val2) char *iguana_ ## name(IGUANA_ARGS,bits256 hash,int32_t val,int32_t val2)
#define IGUANA_CFUNC_D(name,val) char *iguana_ ## name(IGUANA_ARGS,double val)
#define IGUANA_CFUNC_SSDIS(name,str,str2,amount,val,str3) char *iguana_ ## name(IGUANA_ARGS,char *str,char *str2,double amount,int32_t val,char *str3)
#define IGUANA_CFUNC_SSDISS(name,str,str2,amount,val,str3,str4) char *iguana_ ## name(IGUANA_ARGS,char *str,char *str2,double amount,int32_t val,char *str3,char *str4)
#define IGUANA_CFUNC_SAIS(name,str,array,val,str2) char *iguana_ ## name(IGUANA_ARGS,char *str,cJSON *array,int32_t val,char *str2)
#define IGUANA_CFUNC_SDSS(name,str,amount,str2,str3) char *iguana_ ## name(IGUANA_ARGS,char *str,double amount,char *str2,char *str3)
#define IGUANA_ARGS struct supernet_info *myinfo,struct iguana_info *coin,cJSON *json,char *remoteaddr
#define IGUANA_CFUNC0(agent,name) char *agent ## _ ## name(IGUANA_ARGS)
#define IGUANA_CFUNC_S(agent,name,str) char *agent ## _ ## name(IGUANA_ARGS,char *str)
#define IGUANA_CFUNC_I(agent,name,val) char *agent ## _ ## name(IGUANA_ARGS,int32_t val)
#define IGUANA_CFUNC_SA(agent,name,str,array) char *agent ## _ ## name(IGUANA_ARGS,char *str,cJSON *array)
#define IGUANA_CFUNC_AA(agent,name,array,array2) char *agent ## _ ## name(IGUANA_ARGS,cJSON *array,cJSON *array2)
#define IGUANA_CFUNC_SAA(agent,name,str,array,array2) char *agent ## _ ## name(IGUANA_ARGS,char *str,cJSON *array,cJSON *array2)
#define IGUANA_CFUNC_IA(agent,name,val,array) char *agent ## _ ## name(IGUANA_ARGS,int32_t val,cJSON *array)
#define IGUANA_CFUNC_IAS(agent,name,val,array,str) char *agent ## _ ## name(IGUANA_ARGS,int32_t val,cJSON *array,char *str)
#define IGUANA_CFUNC_II(agent,name,val,val2) char *agent ## _ ## name(IGUANA_ARGS,int32_t val,int32_t val2)
#define IGUANA_CFUNC_III(agent,name,val,val2,val3) char *agent ## _ ## name(IGUANA_ARGS,int32_t val,int32_t val2,int32_t val3)
#define IGUANA_CFUNC_SIII(agent,name,str,val,val2,val3) char *agent ## _ ## name(IGUANA_ARGS,char *str,int32_t val,int32_t val2,int32_t val3)
#define IGUANA_CFUNC_IIA(agent,name,val,val2,array) char *agent ## _ ## name(IGUANA_ARGS,int32_t val,int32_t val2,cJSON *array)
#define IGUANA_CFUNC_SS(agent,name,str,str2) char *agent ## _ ## name(IGUANA_ARGS,char *str,char *str2)
#define IGUANA_CFUNC_SSI(agent,name,str,str2,val) char *agent ## _ ## name(IGUANA_ARGS,char *str,char *str2,int32_t val)
#define IGUANA_CFUNC_SSS(agent,name,str,str2,str3) char *agent ## _ ## name(IGUANA_ARGS,char *str,char *str2,char *str3)
#define IGUANA_CFUNC_SI(agent,name,str,val) char *agent ## _ ## name(IGUANA_ARGS,char *str,int32_t val)
#define IGUANA_CFUNC_SII(agent,name,str,val,val2) char *agent ## _ ## name(IGUANA_ARGS,char *str,int32_t val,int32_t val2)
#define IGUANA_CFUNC_HI(agent,name,hash,val) char *agent ## _ ## name(IGUANA_ARGS,bits256 hash,int32_t val)
#define IGUANA_CFUNC_HII(agent,name,hash,val,val2) char *agent ## _ ## name(IGUANA_ARGS,bits256 hash,int32_t val,int32_t val2)
#define IGUANA_CFUNC_D(agent,name,val) char *agent ## _ ## name(IGUANA_ARGS,double val)
#define IGUANA_CFUNC_SSDIS(agent,name,str,str2,amount,val,str3) char *agent ## _ ## name(IGUANA_ARGS,char *str,char *str2,double amount,int32_t val,char *str3)
#define IGUANA_CFUNC_SSDISS(agent,name,str,str2,amount,val,str3,str4) char *agent ## _ ## name(IGUANA_ARGS,char *str,char *str2,double amount,int32_t val,char *str3,char *str4)
#define IGUANA_CFUNC_SAIS(agent,name,str,array,val,str2) char *agent ## _ ## name(IGUANA_ARGS,char *str,cJSON *array,int32_t val,char *str2)
#define IGUANA_CFUNC_SDSS(agent,name,str,amount,str2,str3) char *agent ## _ ## name(IGUANA_ARGS,char *str,double amount,char *str2,char *str3)
// API functions
#define ZERO_ARGS IGUANA_CFUNC0

Loading…
Cancel
Save