Documentation
¶
Index ¶
- Constants
- Variables
- func EncodeTaprootSignature(sig []byte, sigHashType txscript.SigHashType) []byte
- func EvaluateScriptToBool(script []byte, witness wire.TxWitness) (bool, error)
- func FinalizeVtxoScript(ptx *psbt.Packet, inputIndex int) error
- func IsSubDustScript(script []byte) bool
- func P2TRScript(taprootKey *btcec.PublicKey) ([]byte, error)
- func ParseTaprootSignature(rawSig []byte) (*schnorr.Signature, txscript.SigHashType, error)
- func SubDustScript(taprootKey *btcec.PublicKey) ([]byte, error)
- func UnspendableKey() *btcec.PublicKey
- type CLTVMultisigClosure
- type CSVMultisigClosure
- type Closure
- type ConditionCSVMultisigClosure
- type ConditionMultisigClosure
- type MultisigClosure
- type MultisigType
- type TapscriptsVtxoScript
- func (v *TapscriptsVtxoScript) Decode(scripts []string) error
- func (v *TapscriptsVtxoScript) Encode() ([]string, error)
- func (v *TapscriptsVtxoScript) ExitClosures() []Closure
- func (v *TapscriptsVtxoScript) ForfeitClosures() []Closure
- func (v *TapscriptsVtxoScript) SmallestExitDelay() (*arklib.RelativeLocktime, error)
- func (v *TapscriptsVtxoScript) TapTree() (*btcec.PublicKey, taprootTree, error)
- func (v *TapscriptsVtxoScript) Validate(signer *btcec.PublicKey, minLocktime arklib.RelativeLocktime, ...) error
- type VtxoScript
Constants ¶
const ( OP_INSPECTOUTPUTSCRIPTPUBKEY = 0xd1 OP_INSPECTOUTPUTVALUE = 0xcf OP_PUSHCURRENTINPUTINDEX = 0xcd OP_INSPECTINPUTVALUE = 0xc9 OP_SUB64 = 0xd8 )
Variables ¶
var ConditionWitnessKey = "condition"
var ErrNoExitLeaf = fmt.Errorf("no exit leaf")
Functions ¶
func EncodeTaprootSignature ¶ added in v0.7.1
func EncodeTaprootSignature(sig []byte, sigHashType txscript.SigHashType) []byte
func EvaluateScriptToBool ¶
EvaluateScriptToBool executes the script with the provided witness as argument and returns a boolean result that can be evaluated by OP_IF / OP_NOIF opcodes.
func FinalizeVtxoScript ¶ added in v0.8.0
FinalizeVtxoScript finalizes the given input as vtxo script IF the witness utxo is a decodable vtxo script closure.
func IsSubDustScript ¶
func ParseTaprootSignature ¶ added in v0.7.1
func UnspendableKey ¶
Types ¶
type CLTVMultisigClosure ¶
type CLTVMultisigClosure struct {
MultisigClosure
Locktime arklib.AbsoluteLocktime
}
CLTVMultisigClosure is a closure that contains a list of public keys and a CHECKLOCKTIMEVERIFY. The witness size is 64 bytes per key, admitting the sighash type is SIGHASH_DEFAULT.
func (*CLTVMultisigClosure) Decode ¶
func (d *CLTVMultisigClosure) Decode(script []byte) (bool, error)
func (*CLTVMultisigClosure) Script ¶
func (d *CLTVMultisigClosure) Script() ([]byte, error)
type CSVMultisigClosure ¶
type CSVMultisigClosure struct {
MultisigClosure
Locktime arklib.RelativeLocktime
}
CSVMultisigClosure is a closure that contains a list of public keys and a CHECKSEQUENCEVERIFY. The witness size is 64 bytes per key, admitting the sighash type is SIGHASH_DEFAULT.
func (*CSVMultisigClosure) Decode ¶
func (d *CSVMultisigClosure) Decode(script []byte) (bool, error)
func (*CSVMultisigClosure) Script ¶
func (d *CSVMultisigClosure) Script() ([]byte, error)
type Closure ¶
type Closure interface {
Script() ([]byte, error)
Decode(script []byte) (bool, error)
Witness(controlBlock []byte, opts map[string][]byte) (wire.TxWitness, error)
}
func DecodeClosure ¶
type ConditionCSVMultisigClosure ¶
type ConditionCSVMultisigClosure struct {
CSVMultisigClosure
Condition []byte
}
ConditionCSVMultisigClosure is a closure that contains a condition and a CSV multisig closure. The condition is a boolean script that is executed with the multisig witness.
func (*ConditionCSVMultisigClosure) Decode ¶
func (f *ConditionCSVMultisigClosure) Decode(script []byte) (bool, error)
func (*ConditionCSVMultisigClosure) Script ¶
func (f *ConditionCSVMultisigClosure) Script() ([]byte, error)
type ConditionMultisigClosure ¶
type ConditionMultisigClosure struct {
MultisigClosure
Condition []byte
}
ConditionMultisigClosure is a closure that contains a condition and a multisig closure. The condition is a boolean script that is executed with the multisig witness.
func (*ConditionMultisigClosure) Decode ¶
func (f *ConditionMultisigClosure) Decode(script []byte) (bool, error)
func (*ConditionMultisigClosure) Script ¶
func (f *ConditionMultisigClosure) Script() ([]byte, error)
type MultisigClosure ¶
type MultisigClosure struct {
PubKeys []*btcec.PublicKey
Type MultisigType
}
MultisigClosure is a closure that contains a list of public keys and a CHECKSIG for each key. The witness size is 64 bytes per key, admitting the sighash type is SIGHASH_DEFAULT.
func (*MultisigClosure) Script ¶
func (f *MultisigClosure) Script() ([]byte, error)
type MultisigType ¶
type MultisigType int
const ( MultisigTypeChecksig MultisigType = iota MultisigTypeChecksigAdd )
type TapscriptsVtxoScript ¶
type TapscriptsVtxoScript struct {
Closures []Closure
}
func NewDefaultVtxoScript ¶
func NewDefaultVtxoScript( owner, signer *btcec.PublicKey, exitDelay arklib.RelativeLocktime, ) *TapscriptsVtxoScript
NewDefaultVtxoScript returns the common VTXO script: A + S | A after T with: - A: the owner of the VTXO. - S: the pubkey of the signer who provided the liquidity for the VTXO. - T: exit delay that must be waited by alice to spend the VTXO once unrolled onchain.
func (*TapscriptsVtxoScript) Decode ¶
func (v *TapscriptsVtxoScript) Decode(scripts []string) error
func (*TapscriptsVtxoScript) Encode ¶
func (v *TapscriptsVtxoScript) Encode() ([]string, error)
func (*TapscriptsVtxoScript) ExitClosures ¶
func (v *TapscriptsVtxoScript) ExitClosures() []Closure
func (*TapscriptsVtxoScript) ForfeitClosures ¶
func (v *TapscriptsVtxoScript) ForfeitClosures() []Closure
func (*TapscriptsVtxoScript) SmallestExitDelay ¶
func (v *TapscriptsVtxoScript) SmallestExitDelay() (*arklib.RelativeLocktime, error)
func (*TapscriptsVtxoScript) TapTree ¶
func (v *TapscriptsVtxoScript) TapTree() (*btcec.PublicKey, taprootTree, error)
func (*TapscriptsVtxoScript) Validate ¶
func (v *TapscriptsVtxoScript) Validate( signer *btcec.PublicKey, minLocktime arklib.RelativeLocktime, blockTypeAllowed bool, ) error
type VtxoScript ¶
type VtxoScript arklib.VtxoScript[taprootTree, Closure]
func ParseVtxoScript ¶
func ParseVtxoScript(scripts []string) (VtxoScript, error)