Bitcoin Forum
November 01, 2024, 12:15:50 AM *
News: Bitcoin Pumpkin Carving Contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Embedding metadata on-chain  (Read 127 times)
moonie (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 13


View Profile WWW
February 07, 2023, 05:00:52 AM
Merited by ABCbits (1), paid2 (1)
 #1

Hi there.

I want to put a bit of extra data (a file’s hash) in a Bitcoin transaction so it can be included in a time stamped block and potentially used as reference later. I hear theres been a lot of talk about taproot lately.
I was wondering What (if any) would be the benefits of using taproot scripts for this purpose vs OP_RETURN? Would it be cheaper per byte? Would my data be stored on chain directly with taproot or?

Also lastly I’d just like to say obviously I don’t understand taproot very much, other than it having something to do with segregated witness.

Thanks Everyone
pooya87
Legendary
*
Offline Offline

Activity: 3626
Merit: 10993


Crypto Swap Exchange


View Profile
February 07, 2023, 05:10:15 AM
Merited by LoyceV (4), ABCbits (2)
 #2

The best way and the most correct way of inserting an arbitrary data into bitcoin blockchain is using an OP_RETURN output. The transaction size depends mainly on the number of inputs you are going to have and their type. For example if you are spending a simple single P2WPKH output and creating a new P2WPKH output with a single OP_RETURN output you would need to pay less than 200 satoshi fee which is about $0.04 with today's price.

The benefit of this is that it doesn't put a burden on full nodes for having to keep the output in their UTXO database but if you use Taproot, they will have to keep it in there and load it in memory when verifying blocks.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
moonie (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 13


View Profile WWW
February 07, 2023, 05:37:28 AM
 #3

The best way and the most correct way of inserting an arbitrary data into bitcoin blockchain is using an OP_RETURN output. The transaction size depends mainly on the number of inputs you are going to have and their type. For example if you are spending a simple single P2WPKH output and creating a new P2WPKH output with a single OP_RETURN output you would need to pay less than 200 satoshi fee which is about $0.04 with today's price.

The benefit of this is that it doesn't put a burden on full nodes for having to keep the output in their UTXO database but if you use Taproot, they will have to keep it in there and load it in memory when verifying blocks.

I see, thank you for the response and consideration. I want to make sure my full node has this arbitrary transaction data in storage permanently. Accepting that I may pay more per kB, I assume I must use P2PKH?
ABCbits
Legendary
*
Offline Offline

Activity: 3052
Merit: 8018


Crypto Swap Exchange


View Profile
February 07, 2023, 12:12:09 PM
Merited by pooya87 (2)
 #4

I want to make sure my full node has this arbitrary transaction data in storage permanently.

Both Taproot and P2PKH ensure your data is stored permanently on all Bitcoin full node.

Accepting that I may pay more per kB, I assume I must use P2PKH?

Could you rephrase your question? I have hard time trying to understand your question. If you wanted to ask about storing more than 80 bytes (soft limitation of OP_RETURN) of arbitrary data, Taproot (through Ordinal wallet) probably is better option.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
moonie (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 13


View Profile WWW
February 07, 2023, 11:24:41 PM
Merited by vapourminer (1)
 #5

Yes, my apologies for being unclear. 80bytes would be more than enough. I was asking if the P2WPKH method would result in my OP_RETURN data eventually being pruned, since pooya mentioned that nodes would not be required to retain the output in their database. Just sayin' I would pay the extra sats and use P2PKH, if that were in fact an issue. Sorry again I'm a bit dense
ABCbits
Legendary
*
Offline Offline

Activity: 3052
Merit: 8018


Crypto Swap Exchange


View Profile
February 08, 2023, 09:36:04 AM
Merited by pooya87 (2)
 #6

I was asking if the P2WPKH method would result in my OP_RETURN data eventually being pruned, since pooya mentioned that nodes would not be required to retain the output in their database.

He was talking about UTXO database, not blockchain database. All data on Bitcoin blockchain is immutable. FYI, full node software have UTXO database in order to verify validity of input of any transaction quickly.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
moonie (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 13


View Profile WWW
February 09, 2023, 12:31:25 AM
 #7

I was asking if the P2WPKH method would result in my OP_RETURN data eventually being pruned, since pooya mentioned that nodes would not be required to retain the output in their database.

He was talking about UTXO database, not blockchain database. All data on Bitcoin blockchain is immutable. FYI, full node software have UTXO database in order to verify validity of input of any transaction quickly.

Okay, cool. Thank you everyone
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!