From 29b96e8bebd1fb4050e669ef49dd712e16a1e3dd Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 14 Oct 2018 20:27:48 -1100 Subject: [PATCH 1/5] Opreturn to blast --- iguana/exchanges/LP_transaction.c | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 76539117b..1668cbb5c 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1660,6 +1660,65 @@ char *LP_createblasttransaction(uint64_t *changep,int32_t *changeoutp,cJSON **tx txobj = bitcoin_txoutput(txobj,script,scriptlen,change); *changeoutp = numvouts; } + char *opretstr = "deadbeef"; + if ( opretstr != 0 ) + { + spendlen = (int32_t)strlen(opretstr) >> 1; + if ( spendlen < sizeof(script)-60 ) + { + if ( passphrase != 0 && passphrase[0] != 0 ) + { + decode_hex(data,spendlen,opretstr); + offset = 2 + (spendlen >= 16); + origspendlen = spendlen; + crc32 = calc_crc32(0,data,spendlen); + spendlen = LP_opreturn_encrypt(&script[offset],(int32_t)sizeof(script)-offset,data,spendlen,passphrase,crc32&0xffff); + if ( spendlen < 0 ) + { + printf("error encrpting opreturn data\n"); + free_json(txobj); + return(0); + } + } else offset = crc32 = 0; + len = 0; + script[len++] = SCRIPT_OP_RETURN; + if ( spendlen < 76 ) + script[len++] = spendlen; + else if ( spendlen <= 0xff ) + { + script[len++] = 0x4c; + script[len++] = spendlen; + } + else if ( spendlen <= 0xffff ) + { + script[len++] = 0x4d; + script[len++] = (spendlen & 0xff); + script[len++] = ((spendlen >> 8) & 0xff); + } + if ( passphrase != 0 && passphrase[0] != 0 ) + { + if ( offset != len ) + { + printf("offset.%d vs len.%d, reencrypt\n",offset,len); + spendlen = LP_opreturn_encrypt(&script[len],(int32_t)sizeof(script)-len,data,origspendlen,passphrase,crc32&0xffff); + if ( spendlen < 0 ) + { + printf("error encrpting opreturn data\n"); + free_json(txobj); + return(0); + } + } //else printf("offset.%d already in right place\n",offset); + } else decode_hex(&script[len],spendlen,opretstr); + txobj = bitcoin_txoutput(txobj,script,len + spendlen,0); + //printf("OP_RETURN.[%d, %d] script.(%s)\n",len,spendlen,opretstr); + } + else + { + printf("custom script.%d too long %d\n",i,spendlen); + free_json(txobj); + return(0); + } + } if ( (rawtxbytes= bitcoin_json2hex(coin->symbol,coin->isPoS,&txid,txobj,V)) == 0 ) fprintf(stderr,"LP_createblasttransaction: error making rawtx suppress.%d\n",suppress_pubkeys); *txobjp = txobj; From d789efa0f4a87b6285dc61ec46193885665d0e79 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 14 Oct 2018 20:29:24 -1100 Subject: [PATCH 2/5] Passphrase and hexstr for opreturn --- iguana/exchanges/LP_transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 1668cbb5c..f10854942 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1660,7 +1660,7 @@ char *LP_createblasttransaction(uint64_t *changep,int32_t *changeoutp,cJSON **tx txobj = bitcoin_txoutput(txobj,script,scriptlen,change); *changeoutp = numvouts; } - char *opretstr = "deadbeef"; + int32_t origspendlen; char *passphrase = 0,*opretstr = "deadbeef"; if ( opretstr != 0 ) { spendlen = (int32_t)strlen(opretstr) >> 1; From 873254bbd28e97d84e4f05f9c97dcc9a687e6bec Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 21 Oct 2018 13:23:28 -1100 Subject: [PATCH 3/5] KMDICE freq:2 --- iguana/dpowassets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpowassets b/iguana/dpowassets index 6a8cfa4d5..8f906ed9a 100755 --- a/iguana/dpowassets +++ b/iguana/dpowassets @@ -45,5 +45,5 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MGNX\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"EMC2\",\"freq\":5,\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PGT\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KMDICE\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KMDICE\",\"pubkey\":\"$pubkey\",\"freq\":2}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"DION\",\"pubkey\":\"$pubkey\"}" From aaff962218b4907385fbfa0983eb17c2941dd8e5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 22 Oct 2018 00:46:51 -1100 Subject: [PATCH 4/5] Revert freq 1 for KMDICE --- iguana/dpowassets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpowassets b/iguana/dpowassets index 8f906ed9a..6a8cfa4d5 100755 --- a/iguana/dpowassets +++ b/iguana/dpowassets @@ -45,5 +45,5 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MGNX\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"EMC2\",\"freq\":5,\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PGT\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KMDICE\",\"pubkey\":\"$pubkey\",\"freq\":2}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KMDICE\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"DION\",\"pubkey\":\"$pubkey\"}" From 2555a061c7a15839cd5e26b2b11666c25927d13c Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 26 Oct 2018 19:43:14 -1100 Subject: [PATCH 5/5] -lsodium --- iguana/m_mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/m_mm b/iguana/m_mm index 39df45ee7..6f5d97268 100755 --- a/iguana/m_mm +++ b/iguana/m_mm @@ -11,4 +11,4 @@ if [[ "$OSTYPE" == "darwin"* ]]; then fi rm marketmaker -gcc -g -o marketmaker -DNOTETOMIC -I../crypto777 exchanges/mm.c ../crypto777/cJSON.c mini-gmp.c keccak.c groestl.c segwit_addr.c secp256k1.o ../agents/libcrypto777.a $nanomsg_lib -lcurl -lpthread -lm +gcc -g -o marketmaker -DNOTETOMIC -I../crypto777 exchanges/mm.c ../crypto777/cJSON.c mini-gmp.c keccak.c groestl.c segwit_addr.c secp256k1.o ../agents/libcrypto777.a $nanomsg_lib -lcurl -lpthread -lm -lsodium