9 / 9
Payments
Your first testnet payment
Everything so far was signatures: free, and nothing on the blockchain. A payment is a transaction: your wallet builds it, the user approves it, and it's broadcast to the network. This lesson uses testnet, where coins are free and worthless.
The tutorial wallet can't do this: it has no coins and never broadcasts. You need a real one.
Before you start#
- Install BSV Browser (opens in a new tab) and switch it to testnet.
- Get test coins from the BSV Faucet (opens in a new tab): sign in, paste a testnet receive address from your wallet, and request some. Up to 10 million satoshis a day.
- Under the preview, switch the wallet to Your wallet. The preview now talks to your real wallet, exactly as a scaffolded app on your machine would.
Your task#
In client/src/pay.ts, ask the wallet to create the transaction:
ts
const { txid } = await wallet.createAction({
description: 'Tip the author',
outputs: [{
lockingScript: new P2PKH().lock(address).toHex(),
satoshis,
outputDescription: 'Tip for the author'
}]
})
return txidThen connect, paste a testnet address (a second address of your own is fine) and Pay. Approve it in your wallet. The app shows the transaction ID, linked to a block explorer.
Your task
- Send a testnet payment and get a transaction ID back