Module: BSV::Wallet::Interface::ProofStore

Defined in:
lib/bsv/wallet/interface/proof_store.rb

Overview

Merkle proof storage and retrieval for SPV validation (BRC-67).

Proofs confirm that a transaction is included in a block. They arrive via three routes:

1. Broadcast response (ARC returns MINED with merklePath)
2. ARC SSE events or polling
3. Incoming BEEF data (internaliseAction)

Backed by the tx_proofs table. Proofs are independent of whether a wallet action references them — ancestor proofs exist for BEEF construction.

Instance Method Summary collapse

Instance Method Details

#find_proof(wtxid:) ⇒ Hash?

Retrieve a proof by wtxid.

Parameters:

  • wtxid (String)

    32-byte binary wtxid (wire byte order)

Returns:

  • (Hash, nil)

    proof data, or nil if not stored

Raises:

  • (NotImplementedError)


34
35
36
# File 'lib/bsv/wallet/interface/proof_store.rb', line 34

def find_proof(wtxid:)
  raise NotImplementedError
end

#proof_exists?(wtxid:) ⇒ Boolean

Check whether a proof exists for a transaction. Used by the trustSelf mechanism — “wtxids known to this wallet.”

Parameters:

  • wtxid (String)

    32-byte binary wtxid (wire byte order)

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


43
44
45
# File 'lib/bsv/wallet/interface/proof_store.rb', line 43

def proof_exists?(wtxid:)
  raise NotImplementedError
end

#save_proof(wtxid:, proof:) ⇒ Integer

Store a merkle proof for a transaction.

Upserts — if a proof already exists for this wtxid, updates it.

Parameters:

  • wtxid (String)

    32-byte binary wtxid (wire byte order)

  • proof (Hash)

    :height, :block_index, :merkle_path (binary), :raw_tx (binary), :block_hash (binary), :merkle_root (binary)

Returns:

  • (Integer)

    the tx_proof ID

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/bsv/wallet/interface/proof_store.rb', line 26

def save_proof(wtxid:, proof:)
  raise NotImplementedError
end