cJSON *gen_lottotickets_json(uint64_t seed,int32_t numtickets)
{
cJSON *array = cJSON_CreateArray();
int32_t i;
bits256 hash,tmp;
uint64_t ticket = seed;
char numstr[64];
memset(&hash,0,sizeof(hash));
hash.txid = seed;
for (i=0; i<numtickets; i++)
{
sprintf(numstr,"%llu",(long long)ticket), cJSON_AddItemToArray(array,cJSON_CreateString(numstr));
tmp = sha256_key(hash);
ticket = tmp.txid;
hash = tmp;
}
return(array);
}
12:18:06 <jl777> the above is the hash chain code
12:19:08 <jl777> curl -k --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "SuperNET", "params": ["{\"requestType\":\"lotto\",\"refacct\":\"NXT-PY3K-SDTG-PHTV-GLYDA\",\"asset\":\"6932037131189568014\"}"] }' -H 'content-type: text/plain;'
https://127.0.0.1:7777/12:19:38 <jl777> just pushed version with "lotto" API, still without fancy things, just to make sure the results look sane
12:20:35 <jl777> this will be used to determine the winner, the source is in github.com/jl777/libjl777/blob/master/lotto.h
12:21:13 <jl777> the above will be the official draw method, regardless if there are bugs found, so if there are any bugs let me know and I will fix them
12:21:41 <jl777> it is currently only 150 lines of code, but probably will double in side to do the burning properly
I plan to do the drawing for the 3rd prize first, then the 2nd prize, the the 1st prize.
Probably about a day between drawings
James