pybitcash/bitcash

message option (OP_RETURN) not working

Closed this issue · 4 comments

So I tried to send a transaction with optional message field, but without an address and/or with 0 value, there is an error, if I put an address and a value > 0 it goes on but the final transaction has not a OP_RETURN (obviously(?)). Thanks for helping.

I tried to send a transaction with optional message field, but without an address and/or with 0 value

You cannot send a transaction without output or with 0 value.

if I put an address and a value > 0 it goes on but the final transaction has not a OP_RETURN

Could you provide a minimal reproducible example?

Here is a code snippet that works as expected:

from bitcash import Key


key = Key()
print(key.to_wif())
print(key.address)

# you need to fund the wallet before executing the code below

key.get_balance()
key.send(
    [],
    leftover="bitcoincash:qrjluzvef02tz5czm5u90jkdalte8qldyqc7afjlsd",
    message="This was sent with BitCash"
)

Oh ok, thank you for that snippet, that's all I needed, I didn't know how to exactly put the parameters for an OP_RETURN transaction, maybe put this example in the docs?

Yea, but those
...
in
key.send(..., message='Simplicity level is over 9000!!!')
were not explicit enough for me.