Go PSBT library with:
- full BIP-174 (PSBTv0) support
- full BIP-370 (PSBTv2) support
- BIP-375 field transport (silent payment ECDH shares, DLEQ proofs, SP output info)
The silent payment workflow (sp/) and DLEQ proof math (sp/dleq/) have been extracted to:
dleq374— standalone BIP-374 DLEQ proof packagebip375-examples/go/sp— BIP-352/BIP-375 workflow
go get github.com/otaliptus/psbt-v2This library handles BIP-375 field transport — parsing, serializing, and validating the six silent payment PSBT fields. It does not perform ECDH or DLEQ math itself.
PSBTv0 freezes the unsigned transaction as a single global blob at creation time. Once you call New(), the inputs and outputs are fixed. That makes incremental multi-party construction awkward.
PSBTv2 decomposes the transaction into first-class per-input and per-output fields:
- per-input prevout and sequence fields instead of a monolithic
UnsignedTx - per-output amount and script fields
TxModifiableflags for controlled mutation- per-input locktime requirements with deterministic locktime resolution
That makes packet mutation, conversion, and higher-level workflows much cleaner.
About 60% non-slop.
There is obviously AI assistance in here. I still try to keep it grounded in the BIPs, btcd's original psbt package, and real test vectors instead of letting it freestyle nonsense. If something looks off, open an issue.
modifiable := uint8(0x03) // inputs + outputs modifiable
pkt, _ := psbt.NewV2(2, inputs, outputs, &locktime, &modifiable)
ctor, _ := psbt.NewConstructor(pkt)
ctor.AddInput(newTxID, newIndex)
ctor.AddOutput(amount, script)ctor, _ := psbt.NewConstructor(pkt)
ctor.AddSilentPaymentOutput(amount, scanKey, spendKey, nil)For the full signing/materialization/extraction workflow, see bip375-examples/go/sp.
| Area | Status |
|---|---|
| PSBTv0 parse / serialize / roles | Done |
| PSBTv2 parse / serialize / roles | Done |
| v0 <-> v2 conversion | Done |
| BIP-375 field transport | Done |
- single
Packettype with version-aware validation - tested v0 <-> v2 conversion helpers
- BIP-375 output/input/global field support
- BIP-375 test vector coverage for field parsing and round-trip
go test -v ./...
golangci-lint run -v --timeout=5mThis project is derived from btcd's psbt package by the btcsuite developers. The original v0 implementation and most of the role-based structure started there.