Bitcoin
This section summarizes PSBT data handling for offline signing with animated UR codes.
Data types
Request/response UR type:
crypto-psbtSee also: Basic API (UR primitives and structures)
Flow
Build an unsigned PSBT with your wallet backend.
Encode PSBT โ UR (
crypto-psbt) and display as animated QR.Device scans โ returns signed PSBT as
crypto-psbt.Finalize and broadcast.
Tip: Keep PSBT size within practical QR limits; split across frames as needed.
Examples
Decode animated QR โ signed PSBT
import { URDecoder } from '@ngraveio/bc-ur';
import { CryptoPSBT } from '@keystonehq/bc-ur-registry-btc';
const dec = new URDecoder();
// For each scanned frame string from camera:
// dec.receivePart(frameString)
if (dec.isComplete()) {
const ur = dec.resultUR(); // ur.type should be 'crypto-psbt'
const psbt = CryptoPSBT.fromCBOR(ur.cbor);
const signedPsbt = psbt.getPSBT(); // Buffer of PSBT (signed or partially signed)
// finalize & broadcast using your backend
}Encode unsigned PSBT โ animated QR
Last updated
Was this helpful?