Skip to content

sirdeggen/brc-100-payments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BRC-100 Payments Demo

This application demonstrates BRC-100 wallet payment methods using the BSV SDK.

Features

The app includes examples of:

  • Identity-based payments: Send and receive payments using identity keys via MessageBox
  • Address-based payments: Generate addresses and internalize transactions
  • Payment verification: Fetch, verify, and internalize transactions from the blockchain

Usage

First, install dependencies:

npm i

Note: This project requires tsx to be installed globally. If you don't have it installed, run:

npm install -g tsx

Then run the development server:

npm run dev

Step-by-Step Guide

The application includes 4 demo steps you can run sequentially:

Step 1: Generate a BRC-100 Wallet Address

tsx index.ts 1

This generates a wallet address associated with your BRC-100 wallet.

Step 2: Internalize an Address-Based Transaction

tsx index.ts 2 <txid>

Example:

tsx index.ts 2 cafebabecafebabecafebabecafebabecafebabecafebabecafebabecafebabe

This fetches a transaction by ID, verifies it, and internalizes it as a payment.

Step 3: Create Identity-Based Payment

The email address must be registered on the identity overlay using Social Cert for the example to work.

tsx index.ts 3 <email> <satoshis>

Example:

tsx index.ts 3 test@deggen.com 1000

This creates and sends an identity-based payment to a recipient via MessageBox.

Step 4: Accept Identity-Based Payment

tsx index.ts 4

Note: Switch to the receiving side before running this last step. This retrieves and accepts incoming identity-based payments from MessageBox if you are running the wallet with the keys associated with the email used in step 3.

Key Functions

  • getAddress() - Generate a BRC-100 wallet address
  • createOutboundTxToIdentity() - Create identity-based payment to a recipient
  • acceptIdentityBasedPayment() - Accept incoming identity-based payments from MessageBox
  • internalizeATransaction() - Internalize and verify address-based payments

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors