Abstract

The py-sdk provides fundamental functionalities for developers to build Simplified Payment Verification (SPV) wallets. While additional development is required, such as implementing a Paymail server using the TypeScript Paymail library or connecting to a pre-built SPV wallet Go server, py-sdk addresses the most challenging aspects of SPV development. This report examines the process of creating an SPV wallet using py-sdk and explores various implementation options.

Introduction to SPV

SPV, or Simplified Payment Verification, offers an elegant solution to scaling issues through a peer-to-peer payment scheme. In this model, the sender transmits transactions directly to the receiver, who then verifies the transaction and broadcasts it to the network. This approach significantly reduces network queries, as wallets directly receive their transactions, eliminating the need to constantly poll the network for updates.

Furthermore, receivers perform simple verification on incoming transactions using SPV checks, which include source transactions and Merkle paths. This process reduces the propagation of malformed transactions across the network, serving as a first line of defense – analogous to frontend sanitization in general IT development.

For more information on SPV, visit: SPV Documentation

Key Concepts in SPV

1. SPV Transaction Format (BEEF)

BEEF (Background Evaluation Extended Format) is the transaction format for SPV. It allows wallets to perform simplified verification of receiving transactions before broadcasting them to the network, providing a certain level of confidence in the transaction's validity.

BEEF consists of:

Py-sdk has the capability to build and verify BEEF transactions.

For more information on BEEF, visit: BEEF Documentation

2. SPV Check (Source Transaction, Merkle Path)

SPV checks involve verifying that source transactions (inputs of the receiving transaction) are already confirmed in blocks. This ensures that the receiving transaction stems from legitimate transactions. Merkle paths are used to prove that source transactions were already included in a block. Py-sdk has the capability to calculate Merkle paths and verify against block headers. Internal or external block-headers-service can be used to receive the newest block headers from the network.

It's important to note that SPV is not a full validation. Full validation requires checking the UTXO set on the network, but SPV might be sufficient for small and micro transactions.

3. Broadcasting (ARC)