Bitcoin Forum
June 05, 2024, 11:26:37 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to only get transactions with OP_RETURN outputs?  (Read 1137 times)
doge94 (OP)
Sr. Member
****
Offline Offline

Activity: 349
Merit: 250


View Profile
October 19, 2014, 05:51:32 PM
 #1

Is there an easy way using the bitcoin p2p protocol to only get transactions with OP_RETURN outputs? Would bloom filters work for this?
Dare
Hero Member
*****
Offline Offline

Activity: 508
Merit: 500


Techwolf on #bitcoin and Reddit


View Profile WWW
October 20, 2014, 06:22:26 AM
 #2

You could retrieve every block and the discard all transactions without OP_RETURN outputs, but as each block is invalid without the transactions hashed into it, and blocks cannot be verified without retaining the previous block, you'd still need a full node to do so properly. However, you could maintain a buffer of only the last 144 blocks (approximately one day) and verify based on those (equivalent to updating a Bitcoin-Qt checkpoint every hour), which should be sufficient unless you're afraid of a longer temporary fork.

BTC: 1M8oUcBnkRDEhWWgV8ZXLTB6p1mgnejVbX
How Forum Activity Works
Bitcointalk Forum Rules
|
|
|
Firstbits (lucky vanitygen): 1WoLfRUGDx1
How Forum Trust Works
Bitcoin Source Code
doge94 (OP)
Sr. Member
****
Offline Offline

Activity: 349
Merit: 250


View Profile
October 20, 2014, 01:24:11 PM
 #3

You could retrieve every block and the discard all transactions without OP_RETURN outputs, but as each block is invalid without the transactions hashed into it, and blocks cannot be verified without retaining the previous block, you'd still need a full node to do so properly. However, you could maintain a buffer of only the last 144 blocks (approximately one day) and verify based on those (equivalent to updating a Bitcoin-Qt checkpoint every hour), which should be sufficient unless you're afraid of a longer temporary fork.

This uses quite a lot of bandwidth as you have to download every block. Is there not a better way to do it?
Dare
Hero Member
*****
Offline Offline

Activity: 508
Merit: 500


Techwolf on #bitcoin and Reddit


View Profile WWW
October 20, 2014, 10:29:40 PM
 #4

You could retrieve every block and the discard all transactions without OP_RETURN outputs, but as each block is invalid without the transactions hashed into it, and blocks cannot be verified without retaining the previous block, you'd still need a full node to do so properly. However, you could maintain a buffer of only the last 144 blocks (approximately one day) and verify based on those (equivalent to updating a Bitcoin-Qt checkpoint every hour), which should be sufficient unless you're afraid of a longer temporary fork.

This uses quite a lot of bandwidth as you have to download every block. Is there not a better way to do it?

Not really, unless you use a third-party service that sorts out the transactions for you; there's no way to know if a transaction contains an OP_RETURN output without checking it, so you'd need to receive every transaction (and thus, every block) regardless. However, you don't necessarily need to save the transactions without OP_RETURN, which would let you save considerably on disk space at the (potential) cost of verification.

BTC: 1M8oUcBnkRDEhWWgV8ZXLTB6p1mgnejVbX
How Forum Activity Works
Bitcointalk Forum Rules
|
|
|
Firstbits (lucky vanitygen): 1WoLfRUGDx1
How Forum Trust Works
Bitcoin Source Code
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!