Expand description

Revault transactions

Typesafe routines to create Revault-specific Bitcoin transactions.

We use PSBTs as defined in bip-0174 for data structure as well as roles distribution.

Structs

The transaction “revaulting” a spend attempt, i.e. spending the unvaulting transaction back to a deposit txo.

A set of Cancel transactions signed at fixed feerates.

The transaction spending the Unvault and Spend transactions’ CPFP output in order to bump their fees.

The funding transaction, we don’t create nor sign it.

The transaction spending a deposit output to The Emergency Script.

The transaction spending the unvaulting transaction, paying to one or multiple externally-controlled addresses, and possibly to a new deposit txo for the change.

The transaction spending an unvault output to The Emergency Script.

The unvaulting transaction, spending a deposit and being eventually spent by a spend transaction (if not revaulted).

Constants

The minimum value of a deposit UTxO created by a Cancel transaction.

The min value for which we’ll create a change in a CpfpTransaction. In other words: if the sum of the inputs minus the fees is less than CPFP_MIN_CHANGE, we’ll throw everything in fees.

The minimum value of a deposit UTxO for creating a transaction chain from it.

The feerate, in sat / WU, to create the Emergency transactions with.

We can’t safely error for insane fees on revaulting transactions, but we can for the unvault and the spend. This is 0.2BTC, or 3k€ currently.

Maximum weight of a transaction to be relayed.

The default nLockTime used. Note we can’t set it to prevent fee sniping for pre-signed transactions.

This enables CSV and is easier to apply to all transactions anyways.

The value of the CPFP output in the Unvault transaction. See practical-revault.

The feerate, in sat / WU, to create the unvaulting transactions with.

Traits

A transaction that can be CPFPed

A Revault transaction which is signed in advance and whose signatures are exchanged by the participants. Contains a single transaction input.

A Revault transaction.

Functions

Get a spend transaction out of a list of deposits and derivation indexes. The derivation index used for the Spend CPFP is the highest of the deposits one.

Get the entire chain of pre-signed transactions for this derivation index out of a deposit.

Get the chain of pre-signed transactions out of a deposit available for a manager.