coinspark / python-op_return Goto Github PK
View Code? Open in Web Editor NEWSimple Python commands and library for using bitcoin OP_RETURNs
Simple Python commands and library for using bitcoin OP_RETURNs
(Before I put myself on developing something useless...)
Is it possible to leverage an SPV client (e.g.: picocoin), instead of the full node Bitcoin-Core?
In other words, do you think I can modify the lib to make use of a lightweight client?
Hi, i been testing this lib and i louve it, i found two things that can be improved:
one is to change the OP_RETURN_MAX_BYTES=40 to 80 as the field is now bigger
the other is that i found sometimes a problem with rounding the change amount. It sometimes goes to more than 8 decimal and this is a problem.
I added this small modification to prevent it from happening on the OP_RETURN_send function :
# Calculate amounts and choose inputs
send_amount = round(send_amount,8)
output_amount=round(send_amount+OP_RETURN_BTC_FEE,8)
inputs_spend=OP_RETURN_select_inputs(output_amount, testnet)
if 'error' in inputs_spend:
return {'error': inputs_spend['error']}
change_amount=round(inputs_spend['total']-output_amount,8)
Regards
Carlos
Hi
I'm trying to use this lib, and understand where should the funds needed to use the lib should be store, and as fas as i can understand, the lib uses the bitcoin core commands using rpc, so i assume i need the funds in the wallet of the bitcoin core client, thats correct?
Maybe it will be useful to add this information into the readme
I really enjoy this but I'm looking for a version who doesn't need the bitcoin client, did you know of any of those?
I did a quick test of the cli tools. I stored some data:
$ python store-OP_RETURN.py "Test kk message!" 1
TxIDs: b4c9efa9e53c586b4ead18a802b98c647c3774900e3dea62d676db11e5f4cca4
Ref: 1064270-051636
...and then tried to retrieve using the reference but I got the following error:
$ python retrieve-OP_RETURN.py 1064270-051636 1
Traceback (most recent call last):
File "retrieve-OP_RETURN.py", line 43, in
results=OP_RETURN_retrieve(ref, 1, testnet)
File "/home/user/scripts/python/python-OP_RETURN/OP_RETURN.py", line 211, in OP_RETURN_retrieve
txns=OP_RETURN_get_block_txns(height, testnet) # if block, get all fully unpacked
File "/home/user/scripts/python/python-OP_RETURN/OP_RETURN.py", line 401, in OP_RETURN_get_block_txns
block=OP_RETURN_unpack_block(raw_block['block'])
File "/home/user/scripts/python/python-OP_RETURN/OP_RETURN.py", line 623, in OP_RETURN_unpack_block
transaction=OP_RETURN_unpack_txn_buffer(buffer)
File "/home/user/scripts/python/python-OP_RETURN/OP_RETURN.py", line 663, in OP_RETURN_unpack_txn_buffer
input['sequence']=buffer.shift_unpack(4, '<L')
File "/home/user/scripts/python/python-OP_RETURN/OP_RETURN.py", line 785, in shift_unpack
unpack=struct.unpack(format, self.shift(chars))
struct.error: unpack requires a bytes object of length 4
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.