You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to create OP_RETURN transactions for storing hashes in the blockchain. These types of transactions should not need a a destination address for the ScriptPubKey, nor should they require any amount.
When trying to leave out the address we get this:
>>> id = key.send([("", 0.00, "btc")], message="hash")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/wlmr/.local/lib/python3.9/site-packages/bit/wallet.py", line 772, in send
tx_hex = self.create_transaction(
File "/home/wlmr/.local/lib/python3.9/site-packages/bit/wallet.py", line 708, in create_transaction
unspents, outputs = sanitize_tx_data(
File "/home/wlmr/.local/lib/python3.9/site-packages/bit/transaction.py", line 421, in sanitize_tx_data
output_size = [len(address_to_scriptpubkey(o[0])) + 9 for o in outputs]
File "/home/wlmr/.local/lib/python3.9/site-packages/bit/transaction.py", line 421, in <listcomp>
output_size = [len(address_to_scriptpubkey(o[0])) + 9 for o in outputs]
File "/home/wlmr/.local/lib/python3.9/site-packages/bit/transaction.py", line 458, in address_to_scriptpubkey
get_version(address)
File "/home/wlmr/.local/lib/python3.9/site-packages/bit/format.py", line 48, in get_version
version = b58decode_check(address)[:1]
File "/home/wlmr/.local/lib/python3.9/site-packages/bit/base58.py", line 74, in b58decode_check
raise ValueError(
ValueError: Decoded checksum b'\x00' derived from "" is not equal to hash checksum b']\xf6\xe0\xe2'.
When trying to use the address of the sender:
>>> id = key.send([(key.address, 0.00, "btc")], message="hash")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/wlmr/.local/lib/python3.9/site-packages/bit/wallet.py", line 772, in send
tx_hex = self.create_transaction(
File "/home/wlmr/.local/lib/python3.9/site-packages/bit/wallet.py", line 721, in create_transaction
return create_new_transaction(self, unspents, outputs)
File "/home/wlmr/.local/lib/python3.9/site-packages/bit/transaction.py", line 721, in create_new_transaction
outputs = construct_outputs(outputs)
File "/home/wlmr/.local/lib/python3.9/site-packages/bit/transaction.py", line 485, in construct_outputs
script_pubkey = OP_RETURN + len(dest).to_bytes(1, byteorder='little') + dest
TypeError: can't concat str to bytes
As soon as we change the amount to something bigger than 0, with the address pointing to the senders address, it goes through, however.
Is it possible to create a proper OP_RETURN transaction in some other way?
The text was updated successfully, but these errors were encountered:
Hi there. I just started learning the bit library with the poster's exact use case in mind, to store hashes on the blockchain.
"
BTW I don't remember if we talked about this, but the other day some
people were mentioning secure timestamping. You want to be able to
prove that a certain document existed at a certain time in the past.
Seems to me that bitcoin's stack of blocks would be perfect for this.
Indeed, Bitcoin is a distributed secure timestamp server for
transactions. A few lines of code could create a transaction with
an extra hash in it of anything that needs to be timestamped.
I should add a command to timestamp a file that way.
"
~ Satoshi https://mmalmi.github.io/satoshi/
This is an early Satoshi quote, but this interaction is now possible with the implementation of OP_RETURN transactions. Notably, they are done with zero value btc output and require no receiver. It would be really useful to leverage this implementation programmatically through your python library!
Hi,
We are trying to create OP_RETURN transactions for storing hashes in the blockchain. These types of transactions should not need a a destination address for the ScriptPubKey, nor should they require any amount.
When trying to leave out the address we get this:
When trying to use the address of the sender:
As soon as we change the amount to something bigger than 0, with the address pointing to the senders address, it goes through, however.
Is it possible to create a proper OP_RETURN transaction in some other way?
The text was updated successfully, but these errors were encountered: