Bitcoin Forum
May 05, 2024, 04:49:29 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to add arbitrary 40 byte data per transaction.  (Read 1275 times)
drawingthesun (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1015


View Profile
April 24, 2014, 03:38:50 PM
 #1

How do you add 40 bytes of data into the blockchain?
1714884569
Hero Member
*
Offline Offline

Posts: 1714884569

View Profile Personal Message (Offline)

Ignore
1714884569
Reply with quote  #2

1714884569
Report to moderator
1714884569
Hero Member
*
Offline Offline

Posts: 1714884569

View Profile Personal Message (Offline)

Ignore
1714884569
Reply with quote  #2

1714884569
Report to moderator
The forum strives to allow free discussion of any ideas. All policies are built around this principle. This doesn't mean you can post garbage, though: posts should actually contain ideas, and these ideas should be argued reasonably.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714884569
Hero Member
*
Offline Offline

Posts: 1714884569

View Profile Personal Message (Offline)

Ignore
1714884569
Reply with quote  #2

1714884569
Report to moderator
1714884569
Hero Member
*
Offline Offline

Posts: 1714884569

View Profile Personal Message (Offline)

Ignore
1714884569
Reply with quote  #2

1714884569
Report to moderator
TierNolan
Legendary
*
Offline Offline

Activity: 1232
Merit: 1083


View Profile
April 24, 2014, 03:45:31 PM
 #2

How do you add 40 bytes of data into the blockchain?

You can use the OP_RETURN opcode.  

An output that has a spending script of "OP_RETURN <up to 40 bytes>" will be accepted by miners.

It is not spendable though, since OP_RETURN just means mark output as invalid.

There are other ways to do it, but using OP_RETURN means you aren't "polluting" the chain.  Since the output is known not to be spendable, it doesn't have to be remembered in RAM.  It is still remembered on disk though.

1LxbG5cKXzTwZg9mjL3gaRE835uNQEteWF
drawingthesun (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1015


View Profile
April 24, 2014, 04:02:25 PM
 #3

How do you add 40 bytes of data into the blockchain?

You can use the OP_RETURN opcode.  

An output that has a spending script of "OP_RETURN <up to 40 bytes>" will be accepted by miners.

It is not spendable though, since OP_RETURN just means mark output as invalid.

There are other ways to do it, but using OP_RETURN means you aren't "polluting" the chain.  Since the output is known not to be spendable, it doesn't have to be remembered in RAM.  It is still remembered on disk though.

Thanks Smiley
Realpra
Hero Member
*****
Offline Offline

Activity: 815
Merit: 1000


View Profile
July 15, 2014, 06:44:30 AM
 #4

Won't the sent amount just all go towards miners fees or is the "correct way" of putting data really to create unspendable dust?

Cheap and sexy Bitcoin card/hardware wallet, buy here:
http://BlochsTech.com
TimS
Sr. Member
****
Offline Offline

Activity: 250
Merit: 253


View Profile WWW
July 15, 2014, 12:20:45 PM
 #5

Won't the sent amount just all go towards miners fees or is the "correct way" of putting data really to create unspendable dust?
The OP_RETURN output can be 0 value. If your input(s) are larger than the fee you need to pay, you can put the rest of the money into an ordinary output, as change. Or if you have an input that's just the right size, you can include just the one output, e.g. as done in this transaction https://blockchain.info/tx/064c3364055cc2d862f9320279e486b95a169806aac315333bb035a5ee684891

I wouldn't call it "dust" since it's 0 value and known-pruneable. It can't be spent, but it's 0 value so it didn't destroy any bitcoins in the process of creating it.
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
July 15, 2014, 09:13:16 PM
 #6

Won't the sent amount just all go towards miners fees or is the "correct way" of putting data really to create unspendable dust?

The most common method is to create an otherwise normal txn (with any amount of fees you desire) and then ADD a zero value OP_RETURN output.  They can be pruned because the only outputs which are needed to validate future outputs are spendable outputs.  Normal outputs are pruned once they are spent as a spent output is no longer spendable.  OP_RETURN outputs are by definition never spendable so they can be pruned immediately.

To validate transactions requires maintaining a copy of the UTXO.  This is a more critical resources than the raw blockchain.  Your node doesn't use raw blocks locally for anything other than building the UTXO.  The UTXO is used to validate all future txns and blocks.  OP_RETURN can be excluded from the UTXO as are outputs once they are spent.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!