Skip to content

Latest commit

 

History

History
138 lines (102 loc) · 3.75 KB

File metadata and controls

138 lines (102 loc) · 3.75 KB

🚀 TEST_OPI USER GUIDE

📋 ANSWER TO YOUR QUESTION

Where is the PSBT?

The PSBT is displayed in the console after executing a scenario. It's a complete hexadecimal string that represents the unsigned Bitcoin transaction.

What happens at the end?

After PSBT generation, the process stops because the following steps are missing:

  1. Signing the PSBT with your private key
  2. Broadcasting the signed transaction to the Bitcoin network

🔧 AVAILABLE COMMANDS

1. PSBT Generation

# Simple scenario (OP_RETURN only)
npm run start execute single-op-return TEST_OPI 100

# Two outputs scenario
npm run start execute two-outputs TEST_OPI 42 1010

# External address scenario
npm run start execute external-address TEST_OPI 50 2000 --external-address bc1q...

# Three outputs scenario
npm run start execute three-outputs TEST_OPI 25 1500 --external-address bc1q...

2. Signing and Broadcasting

# Sign and broadcast (with your WIF key)
npm run start sign-and-broadcast "PSBT_HEX" -w YOUR_PRIVATE_WIF

# Test signing (without broadcast)
npm run start sign-and-broadcast "PSBT_HEX" -w YOUR_PRIVATE_WIF --dry-run

3. Demonstrations

# Basic demonstration
npm run demo

# Complete demonstration with analysis
npm run demo:complete

📊 COMPLETE EXAMPLE

Step 1: Generate a PSBT

npm run start execute two-outputs TEST_OPI 42 1010

Result:

📊 Scenario Results:
Scenario: two-outputs
Outputs: 2
OP_RETURN Message: {"p":"brc-20","op":"test_opi","tick":"TEST_OPI","amt":"42"}
PSBT: 70736274ff01007b02000000000200000000000000003d6a3b7b2270223a226272632d3230222c226f70223a22746573745f6f7069222c227469636b223a22544553545f4f5049222c22616d74223a223432227df2030000000000002251205074d7844eb8a887f1ef5676fe4a2f8df77b5e2804153beae6e38af1bac245270000000000000000

✅ PSBT ready for signing and broadcasting

Step 2: Sign and broadcast

npm run start sign-and-broadcast "70736274ff01007b02000000000200000000000000003d6a3b7b2270223a226272632d3230222c226f70223a22746573745f6f7069222c227469636b223a22544553545f4f5049222c22616d74223a223432227df2030000000000002251205074d7844eb8a887f1ef5676fe4a2f8df77b5e2804153beae6e38af1bac245270000000000000000" -w YOUR_PRIVATE_WIF

Result:

✔ Transaction broadcasted successfully!

📊 Transaction Details:
Transaction ID: abc123def456...
Explorer: https://blockstream.info/tx/abc123def456...

🔍 ANALYSE DU PSBT

Le PSBT contient :

  • Version : 2 (PSBT v2)
  • Inputs : 0 (transaction without inputs for now)
  • Outputs : 2
    • Sortie 0 : OP_RETURN avec le message BRC-20
    • Sortie 1 : P2TR vers l'adresse de test (1010 sats)

⚙️ CONFIGURATION REQUISE

Fichier .env

# Bitcoin RPC
BITCOIN_RPC_HOST=127.0.0.1
BITCOIN_RPC_PORT=8332
BITCOIN_RPC_USER=bitcoin
BITCOIN_RPC_PASSWORD=votre_mot_de_passe

# Adresse de test
ADDRESS_OPI_TEST=bc1p2p6d0pzwhz5g0u002em0uj303hmhkh3gqs2nh6hxuw90rwkzg5nsatsphn

# Private key (for signing)
WIF_PRIVATE_KEY=votre_wif_privee

🚨 IMPORTANT

  1. Security : Never share your private WIF key
  2. Test : Use --dry-run to test without broadcasting
  3. Network : The project is configured for mainnet
  4. Fees : Fees are calculated automatically

📚 COMMANDES UTILES

# Check configuration
npm run start validate-config

# Test Bitcoin connection
npm run start test-connection

# Interactive mode
npm run start interactive

# List scenarios
npm run start list-scenarios

🎯 NEXT STEPS

  1. Configure your .env file with your real keys
  2. Test with --dry-run first
  3. Sign and broadcast your transactions
  4. Monitor on Bitcoin explorer

The PSBT is there, you just need to sign and broadcast it! 🚀