Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingInputs = fmt.Errorf("missing inputs") ErrMissingData = fmt.Errorf("missing data") ErrMissingWitnessUtxo = fmt.Errorf("missing witness utxo") ErrIncompletePSBT = fmt.Errorf("incomplete psbt, missing signatures on inputs") ErrInvalidTxNumberOfInputs = fmt.Errorf("invalid tx, expected at least 2 inputs") ErrInvalidTxNumberOfOutputs = fmt.Errorf("invalid tx, expected at least 1 output") ErrInvalidTxWrongTxHash = fmt.Errorf("invalid tx, wrong tx hash in first input") ErrInvalidTxWrongOutputIndex = fmt.Errorf("invalid tx, wrong output index in first input") ErrPrevoutNotFound = fmt.Errorf("prevout not found") ErrMissingArkFields = fmt.Errorf("expected at least 1 ark field, revealed taptree is required") )
Functions ¶
Types ¶
type BaseMessage ¶
type BaseMessage struct {
Type IntentMessageType `json:"type"`
}
type DeleteMessage ¶
type DeleteMessage struct {
BaseMessage
// ExpireAt is the timestamp (in seconds) at which the proof should be considered invalid
// if set to 0, the proof will be considered valid indefinitely
ExpireAt int64 `json:"expire_at"`
}
func (*DeleteMessage) Decode ¶
func (m *DeleteMessage) Decode(data string) error
func (DeleteMessage) Encode ¶
func (m DeleteMessage) Encode() (string, error)
type IntentMessageType ¶
type IntentMessageType string
const ( IntentMessageTypeRegister IntentMessageType = "register" IntentMessageTypeDelete IntentMessageType = "delete" )
type Proof ¶
an intent proof is a special psbt containing the inputs to prove ownership, embeds a message and may include optional outputs to register in ark batches.
func New ¶
New creates the proof psbt from the message, inputs and (optional) outputs list the psbt creation is greatly inspired by BIP322 (https://bips.xyz/322) it is composed of 2 transactions: toSpend and toSign * toSpend embeds the message and make the proof "invalid" from the chain point of view * toSign is the regular transaction that will be signed to prove ownership of the inputs and may include the specified outputs toSign spends toSpend input as first input, making the tx unusable onchain
func (Proof) ContainsOutputs ¶
ContainsOutputs returns true if the proof specifies outputs to register in ark batches
func (Proof) GetOutpoints ¶
GetOutpoints returns the list of inputs proving ownership of coins the first input is the toSpend tx, we ignore it
type RegisterMessage ¶
type RegisterMessage struct {
BaseMessage
// OnchainOutputIndexes specifies what are the outputs in the proof tx
// that should be considered as onchain by the Ark operator
OnchainOutputIndexes []int `json:"onchain_output_indexes"`
// ValidAt is the timestamp (in seconds) at which the proof should be considered valid
// if set to 0, the proof will be considered valid indefinitely or until ExpireAt is reached
ValidAt int64 `json:"valid_at"`
// ExpireAt is the timestamp (in seconds) at which the proof should be considered invalid
// if set to 0, the proof will be considered valid indefinitely
ExpireAt int64 `json:"expire_at"`
// CosignersPublicKeys contains the public keys of the cosigners
// if the outputs are not registered in the proof or all the outputs are onchain, this field is not required
// it is required only if one of the outputs is offchain
CosignersPublicKeys []string `json:"cosigners_public_keys"`
}
func (*RegisterMessage) Decode ¶
func (m *RegisterMessage) Decode(data string) error
func (RegisterMessage) Encode ¶
func (m RegisterMessage) Encode() (string, error)