msgtx.go raw

   1  package wire
   2  
   3  import (
   4  	"next.orly.dev/pkg/nostr/crypto/ec/chainhash"
   5  )
   6  
   7  // OutPoint defines a bitcoin data type that is used to track previous
   8  // transaction outputs.
   9  type OutPoint struct {
  10  	Hash  chainhash.Hash
  11  	Index uint32
  12  }
  13  
  14  // TxWitness defines the witness for a TxIn. A witness is to be interpreted as
  15  // a slice of byte slices, or a stack with one or many elements.
  16  type TxWitness [][]byte
  17  
  18  // TxIn defines a bitcoin transaction input.
  19  type TxIn struct {
  20  	PreviousOutPoint OutPoint
  21  	SignatureScript  []byte
  22  	Witness          TxWitness
  23  	Sequence         uint32
  24  }
  25  
  26  // TxOut defines a bitcoin transaction output.
  27  type TxOut struct {
  28  	Value    int64
  29  	PkScript []byte
  30  }
  31  
  32  // MsgTx implements the Message interface and represents a bitcoin tx message.
  33  // It is used to deliver transaction information in response to a getdata
  34  // message (MsgGetData) for a given transaction.
  35  //
  36  // Use the AddTxIn and AddTxOut functions to build up the list of transaction
  37  // inputs and outputs.
  38  type MsgTx struct {
  39  	Version  int32
  40  	TxIn     []*TxIn
  41  	TxOut    []*TxOut
  42  	LockTime uint32
  43  }
  44