Documentation ¶
Index ¶
- func Blake224Hash(b []byte) ([]byte, error)
- func GetBytesFromCBORHex(cborHex string) ([]byte, error)
- func GetCBORHexFromBytes(data []byte) (string, error)
- func GetCBOR_DecMode() cbor.DecMode
- func GetCBOR_EncMode() cbor.EncMode
- func GetVerificationKeyFromSigningKey(signingKey []byte) []byte
- func SignMessage(signingKey, verificationKey, message []byte) (result []byte, err error)
- type AddrKeyHash
- type AuxiliaryData
- type BootstrapWitness
- type Hash28
- type Metadata
- type MetadataElement
- type NativeScript
- type NativeScriptType
- type ScriptHashNamespace
- type Tx
- func (t *Tx) AddInputs(inputs ...*TxInput) error
- func (t *Tx) AddOutputs(outputs ...*TxOutput) error
- func (t *Tx) Bytes() ([]byte, error)
- func (t *Tx) CalculateAuxiliaryDataHash() error
- func (t *Tx) Fee(lfee *fees.LinearFee) (uint, error)
- func (t *Tx) Hash() ([32]byte, error)
- func (t *Tx) Hex() (string, error)
- func (t *Tx) SetFee(fee uint)
- type TxBody
- type TxBuilder
- func (tb *TxBuilder) AddChangeIfNeeded(addr address.Address)
- func (tb *TxBuilder) AddInputs(inputs ...*TxInput)
- func (tb *TxBuilder) AddOutputs(outputs ...*TxOutput)
- func (tb *TxBuilder) Build() (tx Tx, err error)
- func (tb TxBuilder) GetTotalInputOutputs() (inputs, outputs uint)
- func (tb TxBuilder) MinFee() (fee uint)
- func (tb *TxBuilder) SetTTL(ttl uint32)
- func (tb *TxBuilder) Sign(xprv bip32.XPrv)
- func (tb *TxBuilder) Tx() (tx *Tx)
- type TxInput
- type TxOutput
- type VKeyWitness
- type WitnessSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Blake224Hash ¶
func GetBytesFromCBORHex ¶
func GetCBORHexFromBytes ¶
func GetCBOR_DecMode ¶
func GetCBOR_EncMode ¶
func GetVerificationKeyFromSigningKey ¶
GetVerificationKeyFromSigningKey retrieves verification/public key from signing/private key
func SignMessage ¶
Types ¶
type AddrKeyHash ¶
type AddrKeyHash = Hash28
type AuxiliaryData ¶
type AuxiliaryData struct { Metadata Metadata `cbor:"0,keyasint,omitempty"` NativeScripts interface{} `cbor:"1,keyasint,omitempty"` PlutusScripts interface{} `cbor:"2,keyasint,omitempty"` PreferAlonzoFormat bool `cbor:"2,keyasint,omitempty"` }
AuxiliaryData is the auxiliary data in the transaction.
func NewAuxiliaryData ¶
func NewAuxiliaryData() *AuxiliaryData
func (*AuxiliaryData) AddMetadataElement ¶
func (d *AuxiliaryData) AddMetadataElement(key string, value MetadataElement)
func (*AuxiliaryData) AddMetadataTransaction ¶
func (d *AuxiliaryData) AddMetadataTransaction(address string, amount uint)
func (*AuxiliaryData) MarshalCBOR ¶
func (d *AuxiliaryData) MarshalCBOR() ([]byte, error)
MarshalCBOR implements cbor.Marshaler
func (*AuxiliaryData) UnmarshalCBOR ¶
func (d *AuxiliaryData) UnmarshalCBOR(data []byte) error
UnmarshalCBOR implements cbor.Unmarshaler
type BootstrapWitness ¶
type BootstrapWitness struct { VKey []byte Signature []byte ChainCode []byte Attributes []byte // contains filtered or unexported fields }
BootstrapWitness for use with Byron/Legacy based transactions
type Metadata ¶
type Metadata map[uint]map[string]MetadataElement
Metadata represents the transaction metadata.
type MetadataElement ¶
type MetadataElement interface{}
type NativeScript ¶
type NativeScript struct { Type NativeScriptType KeyHash AddrKeyHash N uint64 Scripts []NativeScript IntervalValue uint64 }
NativeScript is a Cardano Native Script.
func NewScriptPubKey ¶
func NewScriptPubKey(keyHash []byte) (NativeScript, error)
NewScriptPubKey returns a new Script PubKey. keyHash = PubKey.Hash()
func (*NativeScript) Bytes ¶
func (ns *NativeScript) Bytes() ([]byte, error)
Bytes returns the CBOR encoding of the script as bytes.
func (*NativeScript) Hash ¶
func (ns *NativeScript) Hash() (Hash28, error)
Hash returns the script hash using blake2b224.
func (*NativeScript) MarshalCBOR ¶
func (ns *NativeScript) MarshalCBOR() ([]byte, error)
MarshalCBOR implements cbor.Marshaler.
func (*NativeScript) UnmarshalCBOR ¶
func (ns *NativeScript) UnmarshalCBOR(data []byte) error
UnmarshalCBOR implements cbor.Unmarshaler.
type NativeScriptType ¶
type NativeScriptType uint64
const ( ScriptPubKey NativeScriptType = iota ScriptAll ScriptAny ScriptNofK ScriptInvalidBefore ScriptInvalidAfter )
type ScriptHashNamespace ¶
type ScriptHashNamespace uint8
const ( NativeScriptNamespace ScriptHashNamespace = iota PlutusScriptNamespace )
type Tx ¶
type Tx struct { Body *TxBody WitnessSet *WitnessSet Valid bool AuxiliaryData *AuxiliaryData // or null // contains filtered or unexported fields }
func (*Tx) AddOutputs ¶
AddOutputs adds the outputs to the transaction body
func (*Tx) CalculateAuxiliaryDataHash ¶
func (*Tx) Fee ¶
Fee returns the fee(in lovelaces) required by the transaction from the linear formula fee = txFeeFixed + txFeePerByte*tx_len_in_bytes
func (*Tx) Hash ¶
Hash performs a blake2b hash of the transaction body and returns a slice of [32]byte
type TxBody ¶
type TxBody struct { Inputs []*TxInput `cbor:"0,keyasint"` Outputs []*TxOutput `cbor:"1,keyasint"` Fee uint64 `cbor:"2,keyasint"` TTL uint32 `cbor:"3,keyasint,omitempty"` AuxiliaryDataHash []byte `cbor:"7,keyasint,omitempty"` }
TxBody contains the inputs, outputs, fee and titme to live for the transaction.
type TxBuilder ¶
type TxBuilder struct {
// contains filtered or unexported fields
}
TxBuilder - used to create, validate and sign transactions.
func NewTxBuilder ¶
NewTxBuilder returns pointer to a new TxBuilder.
func (*TxBuilder) AddChangeIfNeeded ¶
AddChangeIfNeeded calculates the excess change from UTXO inputs - outputs and adds it to the transaction body.
func (*TxBuilder) AddOutputs ¶
AddOutputs add outputs to the transaction body
func (*TxBuilder) Build ¶
Build creates hash of transaction, signs the hash using supplied witnesses and adds them to the transaction.
func (TxBuilder) GetTotalInputOutputs ¶
type TxInput ¶
func NewTxInput ¶
NewTxInput creates and returns a *TxInput from Transaction Hash(Hex Encoded), Transaction Index and Amount.
func (*TxInput) MarshalCBOR ¶
type TxOutput ¶
type VKeyWitness ¶
VKeyWitness - Witness for use with Shelley based transactions
func NewVKeyWitness ¶
func NewVKeyWitness(vkey, signature []byte) VKeyWitness
NewVKeyWitness creates a Witness for Shelley Based transactions from a verification key and transaction signature.
type WitnessSet ¶
type WitnessSet struct { Witnesses []VKeyWitness `cbor:"0,keyasint,omitempty"` Scripts []NativeScript `cbor:"1,keyasint,omitempty"` }
func NewTXWitnessSet ¶
func NewTXWitnessSet(scripts []NativeScript, witnesses []VKeyWitness) *WitnessSet
NewTXWitness returns a pointer to a Witness created from VKeyWitnesses.