In python bit (https://github.com/ofek/bit/), when sending a message, it is properly 80 bytes or less (https://developer.bitcoin.org/devguide/transactions.html) fee is If it is a 4-byte character string, it is about 0.03 $ / 140 = 21428 satoshi (https://mempool.space/ja/testnet), but it is often 80,000 or more. Why is the source_code fee calculation result always higher than the actual testnet?

I thought about the cause as follows. 1: There is a possibility that the calculation method of source_code is wrong. (Target + min_change + estimated_fee is the calculation method of fee, but I don't understand why the limit(default 80) is multiplied in the next code part. )

output_size = [len(address_to_scriptpubkey(o[0])) + 9 for o in outputs]
    output_size.append(len(messages) * (MESSAGE_LIMIT + 9))
    output_size.append(len(address_to_scriptpubkey(leftover)) + 9)
    sum_outputs = sum(out[1] for out in outputs)
  (by transaction.py) ```

How can I send a transaction to testnet with the fee properly set below 80000?

1 Answer 1


OP_RETURN doesn't have any special fee rules. This looks like a result of the specific implementation in this library.

It looks like the library always pads out messages to 80 bytes. So when it does the fee calculation, it always uses the 80 byte maximum because that is how large the output will be when it is serialized.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.