Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Staizita on December 04, 2018, 09:15:23 AM



Title: How much BTC does it cost to build a transaction that only contains OP_RETURN?
Post by: Staizita on December 04, 2018, 09:15:23 AM
  How much BTC(at least) does it cost to build a transaction that only contains OP_RETURN(OUTPUT)?

  Is there any information about this?


Title: Re: How much BTC does it cost to build a transaction that only contains OP_RETURN?
Post by: Coding Enthusiast on December 04, 2018, 10:40:59 AM
Nearly the same as when you make a payment to a legacy address!

TX Size =
4 byte version
1 byte txInCount
  TxIn:
  36 byte outpoint
  1 byte scriptLength
  72 byte script
  33 byte public key
  4 byte sequence
1 byte txOutCount
  txOut:
  8 byte amount
  1 byte size of script
  1 byte OP_Return + 1 byte size of the data + (0 to 40 bytes)
4 byte locktime

Min size=167 bytes
Multiply that with fee in satoshi/byte unit and you will get how much it can cost.
If you use SegWit then you have to calculate virtual size which is 89 vbytes so it an cost even less.