cln/plugins/bwatch/bwatch_wire.csv
Sangbida Chaudhuri 02e0df876a bwatch: add wire format
This wire file primarily contains datastructures that is used to serialize data for storing in the datastore. We have 2 types of datastores for bwatch.
The block history datastore and the watch datastore. For block history we store height, the hash and the hash of the previous block.
For watches we have 4 types of watches - utxo, scriptpubkey, scid and blockdepth watches, each of these have their unique info stored in the datastore. The common info for all watches includes the start block and the list of owners interested in watching.
2026-05-11 15:51:05 +09:30

1.3 KiB

1#include <bitcoin/block.h>
2#include <bitcoin/tx.h>
3# Block record: complete serializable structure
4subtype,block_record_wire
5subtypedata,block_record_wire,height,u32,
6subtypedata,block_record_wire,hash,bitcoin_blkid,
7subtypedata,block_record_wire,prev_hash,bitcoin_blkid,
8# Watch: complete serializable structure
9# Type is stored to enable reconstruction of watch key from wire data
10subtype,watch_wire
11subtypedata,watch_wire,type,u32,
12# Scriptpubkey key (for WATCH_SCRIPTPUBKEY)
13subtypedata,watch_wire,scriptpubkey_len,u32,
14subtypedata,watch_wire,scriptpubkey,u8,scriptpubkey_len
15# Outpoint key (for WATCH_OUTPOINT)
16subtypedata,watch_wire,outpoint,bitcoin_outpoint,
17# SCID key (for WATCH_SCID)
18subtypedata,watch_wire,scid_blockheight,u32,
19subtypedata,watch_wire,scid_txindex,u32,
20subtypedata,watch_wire,scid_outnum,u32,
21# Blockdepth key (for WATCH_BLOCKDEPTH): block where the tx confirmed
22subtypedata,watch_wire,blockdepth,u32,
23# Common fields
24subtypedata,watch_wire,start_block,u32,
25subtypedata,watch_wire,num_owners,u16,
26subtypedata,watch_wire,owners,wirestring,num_owners
27# Messages for datastore persistence - use these to serialize/deserialize
28# Each message wraps a single item for storage
29msgtype,bwatch_block,1
30msgdata,bwatch_block,block,block_record_wire,
31msgtype,bwatch_watch,2
32msgdata,bwatch_watch,watch,watch_wire,