types

package
v1.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2025 License: MIT Imports: 22 Imported by: 23

Documentation

Overview

Package types defines the essential types of the Bigfile blockchain.

Index

Constants

View Source
const (
	// MaxRevisionNumber is used to finalize a FileContract. When a contract's
	// RevisionNumber is set to this value, no further revisions are possible.
	MaxRevisionNumber = math.MaxUint64

	// RenterContractIndex defines the index of the renter's output and public
	// key in a FileContract.
	RenterContractIndex = 0

	// HostContractIndex defines the index of the host's output and public key in
	// a FileContract.
	HostContractIndex = 1

	// UnassignedLeafIndex is a sentinel value used as the LeafIndex of
	// StateElements that have not been added to the accumulator yet. This is
	// necessary for constructing blocks sets where later transactions reference
	// elements created in earlier transactions.
	//
	// Most clients do not need to reference this value directly, and should
	// instead use the EphemeralBigfileElement and EphemeralBigfundElement
	// functions to construct dependent transaction sets.
	UnassignedLeafIndex = 10101010101010101010
)

Variables

View Source
var (
	// ZeroCurrency represents zero base units.
	ZeroCurrency Currency

	// MaxCurrency represents the largest possible value for the Currency type.
	MaxCurrency = NewCurrency(math.MaxUint64, math.MaxUint64)

	// HastingsPerBigfile is the number of hastings (base units) in a bigfile.
	HastingsPerBigfile = NewCurrency(2003764205206896640, 54210) // 10^24
)
View Source
var (
	SpecifierEd25519       = NewSpecifier("ed25519")
	SpecifierBigfileOutput = NewSpecifier("bigfile output")
	SpecifierBigfundOutput = NewSpecifier("bigfund output")
	SpecifierFileContract  = NewSpecifier("file contract")
	SpecifierStorageProof  = NewSpecifier("storage proof")
	SpecifierFoundation    = NewSpecifier("foundation")
	SpecifierEntropy       = NewSpecifier("entropy")
)

Various specifiers.

Functions

func CurrentTimestamp

func CurrentTimestamp() time.Time

CurrentTimestamp returns the current time, rounded to the nearest second. The time zone is set to UTC.

func DecodePtr

func DecodePtr[T any, TP interface {
	*T
	DecoderFrom
}](d *Decoder, v **T)

DecodePtr decodes a pointer to an object that implements DecoderFrom.

func DecodePtrCast

func DecodePtrCast[T interface {
	Cast() V
}, TP interface {
	*T
	DecoderFrom
}, V any](d *Decoder, p **V)

DecodePtrCast decodes a pointer to an object by casting it to V.

func DecodeSlice

func DecodeSlice[T any, DF interface {
	*T
	DecoderFrom
}](d *Decoder, s *[]T)

DecodeSlice decodes a length-prefixed slice of type T, containing values read from the decoder.

func DecodeSliceCast

func DecodeSliceCast[V any, T any, VF interface {
	*V
	Cast() T
	DecoderFrom
}](d *Decoder, s *[]T)

DecodeSliceCast decodes a length-prefixed slice of type T, casting through type V.

func DecodeSliceFn

func DecodeSliceFn[T any](d *Decoder, s *[]T, fn func(*Decoder) T)

DecodeSliceFn decodes a length-prefixed slice of type T, calling an explicit function to decode each element.

func EncodePtr

func EncodePtr[T any, P interface {
	*T
	EncoderTo
}](e *Encoder, p P)

EncodePtr encodes a pointer to an object that implements EncoderTo.

func EncodePtrCast

func EncodePtrCast[V interface {
	Cast() T
	EncoderTo
}, T any](e *Encoder, p *T)

EncodePtrCast encodes a pointer to an object by casting it to V.

func EncodeSlice

func EncodeSlice[T EncoderTo](e *Encoder, s []T)

EncodeSlice encodes a slice of objects that implement EncoderTo.

func EncodeSliceCast

func EncodeSliceCast[V interface {
	Cast() T
	EncoderTo
}, T any](e *Encoder, s []T)

EncodeSliceCast encodes a slice of objects by casting them to V.

func EncodeSliceFn

func EncodeSliceFn[T any](e *Encoder, s []T, fn func(*Encoder, T))

EncodeSliceFn encodes a slice of objects by calling an explicit function to encode each element.

Types

type Address

type Address Hash256

An Address is the hash of a set of UnlockConditions.

var VoidAddress Address

VoidAddress is an address whose signing key does not exist. Sending coins to this address ensures that they will never be recoverable by anyone.

func ParseAddress

func ParseAddress(s string) (a Address, err error)

ParseAddress parses an address from a prefixed hex encoded string.

func StandardAddress

func StandardAddress(pk PublicKey) Address

StandardAddress returns the standard v2 Address derived from pk. It is equivalent to PolicyPublicKey(pk).Address().

func StandardUnlockHash

func StandardUnlockHash(pk PublicKey) Address

StandardUnlockHash returns the standard UnlockHash derived from pk. It is equivalent to SpendPolicy{PolicyUnlockConditions(StandardUnlockConditions(pk))}.Address().

func (*Address) DecodeFrom

func (a *Address) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (Address) EncodeTo

func (a Address) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (Address) MarshalText

func (a Address) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Address) String

func (a Address) String() string

String implements fmt.Stringer.

func (*Address) UnmarshalText

func (a *Address) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type Attestation

type Attestation struct {
	PublicKey PublicKey `json:"publicKey"`
	Key       string    `json:"key"`
	Value     []byte    `json:"value"`
	Signature Signature `json:"signature"`
}

An Attestation associates a key-value pair with an identity. For example, hosts attest to their network address by setting Key to "HostAnnouncement" and Value to their address, thereby allowing renters to discover them. Generally, an attestation for a particular key is considered to overwrite any previous attestations with the same key. (This allows hosts to announce a new network address, for example.)

func (*Attestation) DecodeFrom

func (a *Attestation) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (Attestation) EncodeTo

func (a Attestation) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type AttestationElement

type AttestationElement struct {
	ID           AttestationID `json:"id"`
	StateElement StateElement  `json:"stateElement"`
	Attestation  Attestation   `json:"attestation"`
}

An AttestationElement is a record of an Attestation within the state accumulator.

func (AttestationElement) Copy added in v0.0.2

Copy returns a deep copy of the element. It must be used whenever the element's memory is copied.

func (AttestationElement) Move added in v0.0.2

Move returns a shallow copy of the element. It must only be used when the element's memory is not shared.

func (AttestationElement) Share added in v0.0.2

Share returns a shallow copy of the element. It must be used whenever the element's memory is intentionally aliased.

type AttestationID

type AttestationID Hash256

An AttestationID uniquely identifies an attestation.

func (*AttestationID) DecodeFrom

func (id *AttestationID) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (AttestationID) EncodeTo

func (id AttestationID) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (AttestationID) MarshalText

func (aid AttestationID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (AttestationID) String

func (aid AttestationID) String() string

String implements fmt.Stringer.

func (*AttestationID) UnmarshalText

func (aid *AttestationID) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type BigfileElement added in v1.0.9

type BigfileElement struct {
	ID             BigfileOutputID `json:"id"`
	StateElement   StateElement    `json:"stateElement"`
	BigfileOutput  BigfileOutput   `json:"bigfileOutput"`
	MaturityHeight uint64          `json:"maturityHeight"`
}

A BigfileElement is a record of a BigfileOutput within the state accumulator.

func (BigfileElement) Copy added in v1.0.9

func (bige BigfileElement) Copy() BigfileElement

Copy returns a deep copy of the element. It must be used whenever the element's memory is copied.

func (*BigfileElement) DecodeFrom added in v1.0.9

func (bige *BigfileElement) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (BigfileElement) EncodeTo added in v1.0.9

func (bige BigfileElement) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (BigfileElement) Move added in v1.0.9

func (bige BigfileElement) Move() BigfileElement

Move returns a shallow copy of the element. It must only be used when the element's memory is not shared.

func (BigfileElement) Share added in v1.0.9

func (bige BigfileElement) Share() BigfileElement

Share returns a shallow copy of the element. It must be used whenever the element's memory is intentionally aliased.

type BigfileInput added in v1.0.9

type BigfileInput struct {
	ParentID         BigfileOutputID  `json:"parentID"`
	UnlockConditions UnlockConditions `json:"unlockConditions"`
}

A BigfileInput spends an unspent BigfileOutput in the UTXO set by revealing and satisfying its unlock conditions.

func (*BigfileInput) DecodeFrom added in v1.0.9

func (in *BigfileInput) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (BigfileInput) EncodeTo added in v1.0.9

func (in BigfileInput) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (BigfileInput) MarshalJSON added in v1.0.9

func (si BigfileInput) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

For convenience, the input's address is also calculated and included. This field is ignored during unmarshalling.

type BigfileOutput added in v1.0.9

type BigfileOutput struct {
	Value   Currency `json:"value"`
	Address Address  `json:"address"`
}

A BigfileOutput is the recipient of some of the bigfiles spent in a transaction.

type BigfileOutputID added in v1.0.9

type BigfileOutputID Hash256

A BigfileOutputID uniquely identifies a bigfile output.

func (*BigfileOutputID) DecodeFrom added in v1.0.9

func (id *BigfileOutputID) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (BigfileOutputID) EncodeTo added in v1.0.9

func (id BigfileOutputID) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (BigfileOutputID) MarshalText added in v1.0.9

func (bigoid BigfileOutputID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (BigfileOutputID) String added in v1.0.9

func (bigoid BigfileOutputID) String() string

String implements fmt.Stringer.

func (*BigfileOutputID) UnmarshalText added in v1.0.9

func (bigoid *BigfileOutputID) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type BigfundElement added in v1.0.4

type BigfundElement struct {
	ID            BigfundOutputID `json:"id"`
	StateElement  StateElement    `json:"stateElement"`
	BigfundOutput BigfundOutput   `json:"bigfundOutput"`
	ClaimStart    Currency        `json:"claimStart"` // value of BigfundTaxRevenue when element was created
}

A BigfundElement is a record of a BigfundOutput within the state accumulator.

func (BigfundElement) Copy added in v1.0.4

func (bfe BigfundElement) Copy() BigfundElement

Copy returns a deep copy of the element. It must be used whenever the element's memory is copied.

func (*BigfundElement) DecodeFrom added in v1.0.4

func (bfe *BigfundElement) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (BigfundElement) EncodeTo added in v1.0.4

func (bfe BigfundElement) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (BigfundElement) Move added in v1.0.4

func (bfe BigfundElement) Move() BigfundElement

Move returns a shallow copy of the element. It must only be used when the element's memory is not shared.

func (BigfundElement) Share added in v1.0.4

func (bfe BigfundElement) Share() BigfundElement

Share returns a shallow copy of the element. It must be used whenever the element's memory is intentionally aliased.

type BigfundInput added in v1.0.4

type BigfundInput struct {
	ParentID         BigfundOutputID  `json:"parentID"`
	UnlockConditions UnlockConditions `json:"unlockConditions"`
	ClaimAddress     Address          `json:"claimAddress"`
}

A BigfundInput spends an unspent BigfundOutput in the UTXO set by revealing and satisfying its unlock conditions. BigfundInputs also include a ClaimAddress, specifying the recipient of the bigfiles that were earned by the output.

func (*BigfundInput) DecodeFrom added in v1.0.4

func (in *BigfundInput) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (BigfundInput) EncodeTo added in v1.0.4

func (in BigfundInput) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (BigfundInput) MarshalJSON added in v1.0.9

func (si BigfundInput) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

For convenience, the input's address is also calculated and included. This field is ignored during unmarshalling.

type BigfundOutput added in v1.0.4

type BigfundOutput struct {
	Value   uint64  `json:"value"`
	Address Address `json:"address"`
}

A BigfundOutput is the recipient of some of the bigfilefunds spent in a transaction.

type BigfundOutputID added in v1.0.4

type BigfundOutputID Hash256

A BigfundOutputID uniquely identifies a bigfund output.

func (BigfundOutputID) ClaimOutputID added in v1.0.4

func (bfoid BigfundOutputID) ClaimOutputID() BigfileOutputID

ClaimOutputID returns the ID of the BigfileOutput that is created when the bigfund output is spent.

func (*BigfundOutputID) DecodeFrom added in v1.0.4

func (id *BigfundOutputID) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (BigfundOutputID) EncodeTo added in v1.0.4

func (id BigfundOutputID) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (BigfundOutputID) MarshalText added in v1.0.4

func (bfoid BigfundOutputID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (BigfundOutputID) String added in v1.0.4

func (bfoid BigfundOutputID) String() string

String implements fmt.Stringer.

func (*BigfundOutputID) UnmarshalText added in v1.0.4

func (bfoid *BigfundOutputID) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (BigfundOutputID) V2ClaimOutputID added in v1.0.4

func (bfoid BigfundOutputID) V2ClaimOutputID() BigfileOutputID

V2ClaimOutputID returns the ID of the BigfileOutput that is created when the bigfund output is spent.

type Block

type Block struct {
	ParentID     BlockID         `json:"parentID"`
	Nonce        uint64          `json:"nonce"`
	Timestamp    time.Time       `json:"timestamp"`
	MinerPayouts []BigfileOutput `json:"minerPayouts"`
	Transactions []Transaction   `json:"transactions"`

	V2 *V2BlockData `json:"v2,omitempty"`
}

A Block is a timestamped set of transactions, immutably linked to a previous block, secured by proof-of-work.

func (*Block) Header

func (b *Block) Header() BlockHeader

Header returns the block's header.

func (*Block) ID

func (b *Block) ID() BlockID

ID returns a hash that uniquely identifies a block.

func (*Block) V2Transactions

func (b *Block) V2Transactions() []V2Transaction

V2Transactions returns the block's v2 transactions, if present.

type BlockHeader

type BlockHeader struct {
	ParentID   BlockID   `json:"parentID"`
	Nonce      uint64    `json:"nonce"`
	Timestamp  time.Time `json:"timestamp"`
	Commitment Hash256   `json:"commitment"`
}

A BlockHeader is the preimage of a Block's ID.

func (*BlockHeader) DecodeFrom

func (h *BlockHeader) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (BlockHeader) EncodeTo

func (h BlockHeader) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (BlockHeader) ID

func (bh BlockHeader) ID() BlockID

ID returns the hash of the header data.

type BlockID

type BlockID Hash256

A BlockID uniquely identifies a block.

func (BlockID) CmpWork

func (bid BlockID) CmpWork(t BlockID) int

CmpWork compares the work implied by two BlockIDs.

func (*BlockID) DecodeFrom

func (id *BlockID) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (BlockID) EncodeTo

func (id BlockID) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (BlockID) FoundationOutputID

func (bid BlockID) FoundationOutputID() BigfileOutputID

FoundationOutputID returns the ID of the block's Foundation subsidy.

func (BlockID) MarshalText

func (bid BlockID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (BlockID) MinerOutputID

func (bid BlockID) MinerOutputID(i int) BigfileOutputID

MinerOutputID returns the ID of the block's i'th miner payout.

func (BlockID) String

func (bid BlockID) String() string

String implements fmt.Stringer.

func (*BlockID) UnmarshalText

func (bid *BlockID) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type ChainIndex

type ChainIndex struct {
	Height uint64  `json:"height"`
	ID     BlockID `json:"id"`
}

A ChainIndex pairs a block's height with its ID.

func ParseChainIndex

func ParseChainIndex(s string) (ci ChainIndex, err error)

ParseChainIndex parses a chain index from a string.

func (*ChainIndex) DecodeFrom

func (index *ChainIndex) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (ChainIndex) EncodeTo

func (index ChainIndex) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (ChainIndex) MarshalJSON

func (ci ChainIndex) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (ChainIndex) MarshalText

func (ci ChainIndex) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (ChainIndex) String

func (ci ChainIndex) String() string

String implements fmt.Stringer.

func (*ChainIndex) UnmarshalJSON

func (ci *ChainIndex) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*ChainIndex) UnmarshalText

func (ci *ChainIndex) UnmarshalText(b []byte) (err error)

UnmarshalText implements encoding.TextUnmarshaler.

type ChainIndexElement

type ChainIndexElement struct {
	ID           BlockID      `json:"id"`
	StateElement StateElement `json:"stateElement"`
	ChainIndex   ChainIndex   `json:"chainIndex"`
}

A ChainIndexElement is a record of a ChainIndex within the state accumulator.

func (ChainIndexElement) Copy added in v0.0.2

Copy returns a deep copy of the element. It must be used whenever the element's memory is copied.

func (*ChainIndexElement) DecodeFrom

func (cie *ChainIndexElement) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (ChainIndexElement) EncodeTo

func (cie ChainIndexElement) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (ChainIndexElement) Move added in v0.0.2

Move returns a shallow copy of the element. It must only be used when the element's memory is not shared.

func (ChainIndexElement) Share added in v0.0.2

Share returns a shallow copy of the element. It must be used whenever the element's memory is intentionally aliased.

type CoveredFields

type CoveredFields struct {
	WholeTransaction      bool     `json:"wholeTransaction,omitempty"`
	BigfileInputs         []uint64 `json:"bigfileInputs,omitempty"`
	BigfileOutputs        []uint64 `json:"bigfileOutputs,omitempty"`
	FileContracts         []uint64 `json:"fileContracts,omitempty"`
	FileContractRevisions []uint64 `json:"fileContractRevisions,omitempty"`
	StorageProofs         []uint64 `json:"storageProofs,omitempty"`
	BigfundInputs         []uint64 `json:"bigfundInputs,omitempty"`
	BigfundOutputs        []uint64 `json:"bigfundOutputs,omitempty"`
	MinerFees             []uint64 `json:"minerFees,omitempty"`
	ArbitraryData         []uint64 `json:"arbitraryData,omitempty"`
	Signatures            []uint64 `json:"signatures,omitempty"`
}

CoveredFields indicates which fields of a transaction are covered by a signature.

func (*CoveredFields) DecodeFrom

func (cf *CoveredFields) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (CoveredFields) EncodeTo

func (cf CoveredFields) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type Currency

type Currency struct {
	Lo, Hi uint64
}

Currency represents a quantity of hastings as an unsigned 128-bit number.

func Bigfiles added in v1.0.9

func Bigfiles(n uint32) Currency

Bigfiles returns a Currency value representing n bigfiles.

func NewCurrency

func NewCurrency(lo, hi uint64) Currency

NewCurrency returns the Currency value (lo,hi).

func NewCurrency64

func NewCurrency64(c uint64) Currency

NewCurrency64 converts c to a Currency value.

func ParseCurrency

func ParseCurrency(s string) (Currency, error)

ParseCurrency parses s as a Currency value. The format of s should match one of the representations provided by (Currency).Format.

func (Currency) Add

func (c Currency) Add(v Currency) Currency

Add returns c+v. If the result would overflow, Add panics.

It is safe to use Add in any context where the sum cannot exceed the total supply of Currency (such as when calculating the balance of a wallet). In less-trusted contexts (such as when validating a transaction), AddWithOverflow should be used instead.

func (Currency) AddWithOverflow

func (c Currency) AddWithOverflow(v Currency) (Currency, bool)

AddWithOverflow returns c+v, along with a boolean indicating whether the result overflowed.

func (Currency) Big

func (c Currency) Big() *big.Int

Big returns c as a *big.Int.

func (Currency) Bigfiles added in v1.0.9

func (c Currency) Bigfiles() float64

Bigfiles converts c to a floating-point number of bigfiles. This may result in a loss of precision.

func (Currency) Cmp

func (c Currency) Cmp(v Currency) int

Cmp compares c and v and returns:

-1 if c <  v
 0 if c == v
+1 if c >  v

func (Currency) Div

func (c Currency) Div(v Currency) Currency

Div returns c/v. If v == 0, Div panics.

func (Currency) Div64

func (c Currency) Div64(v uint64) Currency

Div64 returns c/v. If v == 0, Div panics.

func (Currency) Equals

func (c Currency) Equals(v Currency) bool

Equals returns true if c == v.

Currency values can be compared directly with ==, but use of the Equals method is preferred for consistency.

func (Currency) ExactString

func (c Currency) ExactString() string

ExactString returns the base-10 representation of c as a string.

func (Currency) Format

func (c Currency) Format(f fmt.State, v rune)

Format implements fmt.Formatter. It accepts the following formats:

s, v: decimal with unit suffix (equivalent to String())
b, d, o, O, x, X: raw integer, formatted via c.Big().Format

func (Currency) IsZero

func (c Currency) IsZero() bool

IsZero returns true if c == 0.

func (Currency) MarshalText

func (c Currency) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Currency) Mul

func (c Currency) Mul(v Currency) Currency

Mul returns c*v. If the result would overflow, Mul panics.

Note that it is safe to multiply any two Currency values that are below 2^64.

func (Currency) Mul64

func (c Currency) Mul64(v uint64) Currency

Mul64 returns c*v. If the result would overflow, Mul64 panics.

Note that it is safe to multiply any two Currency values that are below 2^64.

func (Currency) Mul64WithOverflow

func (c Currency) Mul64WithOverflow(v uint64) (Currency, bool)

Mul64WithOverflow returns c*v along with a boolean indicating whether the result overflowed.

Note that it is safe to multiply any two Currency values that are below 2^64.

func (Currency) MulWithOverflow

func (c Currency) MulWithOverflow(v Currency) (Currency, bool)

MulWithOverflow returns c*v, along with a boolean indicating whether the result overflowed.

Note that it is safe to multiply any two Currency values that are below 2^64.

func (Currency) String

func (c Currency) String() string

String returns the base-10 representation of c with a unit suffix.

func (Currency) Sub

func (c Currency) Sub(v Currency) Currency

Sub returns c-v. If the result would underflow, Sub panics.

func (Currency) SubWithUnderflow

func (c Currency) SubWithUnderflow(v Currency) (Currency, bool)

SubWithUnderflow returns c-v, along with a boolean indicating whether the result underflowed.

func (*Currency) UnmarshalText

func (c *Currency) UnmarshalText(b []byte) (err error)

UnmarshalText implements encoding.TextUnmarshaler.

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

A Decoder reads values from an underlying stream. Callers MUST check (*Decoder).Err before using any decoded values.

func NewBufDecoder

func NewBufDecoder(buf []byte) *Decoder

NewBufDecoder returns a Decoder for the provided byte slice.

func NewDecoder

func NewDecoder(lr io.LimitedReader) *Decoder

NewDecoder returns a Decoder that wraps the provided stream.

func (*Decoder) Err

func (d *Decoder) Err() error

Err returns the first error encountered during decoding.

func (*Decoder) Read

func (d *Decoder) Read(p []byte) (int, error)

Read implements the io.Reader interface. It always returns an error if fewer than len(p) bytes were read.

func (*Decoder) ReadBool

func (d *Decoder) ReadBool() bool

ReadBool reads a bool value from the underlying stream.

func (*Decoder) ReadBytes

func (d *Decoder) ReadBytes() []byte

ReadBytes reads a length-prefixed []byte from the underlying stream.

func (*Decoder) ReadString

func (d *Decoder) ReadString() string

ReadString reads a length-prefixed string from the underlying stream.

func (*Decoder) ReadTime

func (d *Decoder) ReadTime() time.Time

ReadTime reads a time.Time from the underlying stream.

func (*Decoder) ReadUint8

func (d *Decoder) ReadUint8() uint8

ReadUint8 reads a uint8 value from the underlying stream.

func (*Decoder) ReadUint64

func (d *Decoder) ReadUint64() uint64

ReadUint64 reads a uint64 value from the underlying stream.

func (*Decoder) SetErr

func (d *Decoder) SetErr(err error)

SetErr sets the Decoder's error if it has not already been set. SetErr should only be called from DecodeFrom methods.

type DecoderFrom

type DecoderFrom interface {
	DecodeFrom(d *Decoder)
}

A DecoderFrom can decode itself from a stream via a Decoder.

type DecoderFunc

type DecoderFunc func(*Decoder)

DecoderFunc implements types.DecoderTo with a function.

func (DecoderFunc) DecodeFrom

func (fn DecoderFunc) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderTo.

type ElementID

type ElementID = [32]byte

An ElementID identifies a generic element within the state accumulator. In practice, it may be a BlockID, BigfileOutputID, BigfundOutputID, FileContractID, or AttestationID.

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

An Encoder writes Bigfile objects to an underlying stream.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns an Encoder that wraps the provided stream.

func (*Encoder) Flush

func (e *Encoder) Flush() error

Flush writes any pending data to the underlying stream. It returns the first error encountered by the Encoder.

func (*Encoder) Reset

func (e *Encoder) Reset(w io.Writer)

Reset resets the Encoder to write to w. Any unflushed data, along with any error previously encountered, is discarded.

func (*Encoder) Write

func (e *Encoder) Write(p []byte) (int, error)

Write implements io.Writer.

func (*Encoder) WriteBool

func (e *Encoder) WriteBool(b bool)

WriteBool writes a bool value to the underlying stream.

func (*Encoder) WriteBytes

func (e *Encoder) WriteBytes(b []byte)

WriteBytes writes a length-prefixed []byte to the underlying stream.

func (*Encoder) WriteString

func (e *Encoder) WriteString(s string)

WriteString writes a length-prefixed string to the underlying stream.

func (*Encoder) WriteTime

func (e *Encoder) WriteTime(t time.Time)

WriteTime writes a time.Time value to the underlying stream.

func (*Encoder) WriteUint8

func (e *Encoder) WriteUint8(u uint8)

WriteUint8 writes a uint8 value to the underlying stream.

func (*Encoder) WriteUint64

func (e *Encoder) WriteUint64(u uint64)

WriteUint64 writes a uint64 value to the underlying stream.

type EncoderFunc

type EncoderFunc func(*Encoder)

EncoderFunc implements types.EncoderTo with a function.

func (EncoderFunc) EncodeTo

func (fn EncoderFunc) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type EncoderTo

type EncoderTo interface {
	EncodeTo(e *Encoder)
}

An EncoderTo can encode itself to a stream via an Encoder.

type FileContract

type FileContract struct {
	Filesize           uint64          `json:"filesize"`
	FileMerkleRoot     Hash256         `json:"fileMerkleRoot"`
	WindowStart        uint64          `json:"windowStart"`
	WindowEnd          uint64          `json:"windowEnd"`
	Payout             Currency        `json:"payout"`
	ValidProofOutputs  []BigfileOutput `json:"validProofOutputs"`
	MissedProofOutputs []BigfileOutput `json:"missedProofOutputs"`
	UnlockHash         Address         `json:"unlockHash"`
	RevisionNumber     uint64          `json:"revisionNumber"`
}

A FileContract is a storage agreement between a renter and a host. It contains a bidirectional payment channel that resolves as either "valid" or "missed" depending on whether a valid StorageProof is submitted for the contract.

func (*FileContract) DecodeFrom

func (fc *FileContract) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (FileContract) EncodeTo

func (fc FileContract) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (*FileContract) EndHeight

func (fc *FileContract) EndHeight() uint64

EndHeight returns the height at which the contract's host is no longer obligated to store the contract data.

func (*FileContract) MissedHostOutput

func (fc *FileContract) MissedHostOutput() BigfileOutput

MissedHostOutput returns the output that will be created for the host if the contract resolves missed.

func (*FileContract) MissedHostPayout

func (fc *FileContract) MissedHostPayout() Currency

MissedHostPayout returns the amount of bigfiles that the host will receive if the contract resolves missed.

func (*FileContract) MissedRenterOutput

func (fc *FileContract) MissedRenterOutput() BigfileOutput

MissedRenterOutput returns the output that will be created for the renter if the contract resolves missed.

func (*FileContract) MissedRenterPayout

func (fc *FileContract) MissedRenterPayout() Currency

MissedRenterPayout returns the amount of bigfiles that the renter will receive if the contract resolves missed.

func (*FileContract) ValidHostOutput

func (fc *FileContract) ValidHostOutput() BigfileOutput

ValidHostOutput returns the output that will be created for the host if the contract resolves valid.

func (*FileContract) ValidHostPayout

func (fc *FileContract) ValidHostPayout() Currency

ValidHostPayout returns the amount of bigfiles that the host will receive if the contract resolves valid.

func (*FileContract) ValidRenterOutput

func (fc *FileContract) ValidRenterOutput() BigfileOutput

ValidRenterOutput returns the output that will be created for the renter if the contract resolves valid.

func (*FileContract) ValidRenterPayout

func (fc *FileContract) ValidRenterPayout() Currency

ValidRenterPayout returns the amount of bigfiles that the renter will receive if the contract resolves valid.

type FileContractElement

type FileContractElement struct {
	ID           FileContractID `json:"id"`
	StateElement StateElement   `json:"stateElement"`
	FileContract FileContract   `json:"fileContract"`
}

A FileContractElement is a record of a FileContract within the state accumulator.

func (FileContractElement) Copy added in v0.0.2

Copy returns a deep copy of the element. It must be used whenever the element's memory is copied.

func (*FileContractElement) DecodeFrom

func (fce *FileContractElement) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (FileContractElement) EncodeTo

func (fce FileContractElement) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (FileContractElement) Move added in v0.0.2

Move returns a shallow copy of the element. It must only be used when the element's memory is not shared.

func (FileContractElement) Share added in v0.0.2

Share returns a shallow copy of the element. It must be used whenever the element's memory is intentionally aliased.

type FileContractID

type FileContractID Hash256

A FileContractID uniquely identifies a file contract.

func (*FileContractID) DecodeFrom

func (id *FileContractID) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (FileContractID) EncodeTo

func (id FileContractID) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (FileContractID) MarshalText

func (fcid FileContractID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (FileContractID) MissedOutputID

func (fcid FileContractID) MissedOutputID(i int) BigfileOutputID

MissedOutputID returns the ID of the missed proof output at index i.

func (FileContractID) String

func (fcid FileContractID) String() string

String implements fmt.Stringer.

func (*FileContractID) UnmarshalText

func (fcid *FileContractID) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (FileContractID) V2HostOutputID

func (fcid FileContractID) V2HostOutputID() BigfileOutputID

V2HostOutputID returns the ID of the host output for a v2 contract.

func (FileContractID) V2RenewalID

func (fcid FileContractID) V2RenewalID() FileContractID

V2RenewalID returns the ID of the renewal of a v2 contract.

func (FileContractID) V2RenterOutputID

func (fcid FileContractID) V2RenterOutputID() BigfileOutputID

V2RenterOutputID returns the ID of the renter output for a v2 contract.

func (FileContractID) ValidOutputID

func (fcid FileContractID) ValidOutputID(i int) BigfileOutputID

ValidOutputID returns the ID of the valid proof output at index i.

type FileContractRevision

type FileContractRevision struct {
	ParentID         FileContractID   `json:"parentID"`
	UnlockConditions UnlockConditions `json:"unlockConditions"`
	// NOTE: the Payout field of the contract is not "really" part of a
	// revision. A revision cannot change the total payout, so the original siad
	// code defines FileContractRevision as an entirely separate struct without
	// a Payout field. Here, we instead reuse the FileContract type, which means
	// we must treat its Payout field as invalid. To guard against developer
	// error, we set it to a sentinel value when decoding it.
	FileContract
}

A FileContractRevision updates the state of an existing file contract.

func (*FileContractRevision) DecodeFrom

func (rev *FileContractRevision) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (FileContractRevision) EncodeTo

func (rev FileContractRevision) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (FileContractRevision) MarshalJSON

func (fcr FileContractRevision) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*FileContractRevision) UnmarshalJSON

func (fcr *FileContractRevision) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type FoundationAddressUpdate

type FoundationAddressUpdate struct {
	NewPrimary  Address `json:"newPrimary"`
	NewFailsafe Address `json:"newFailsafe"`
}

A FoundationAddressUpdate updates the primary and failsafe Foundation subsidy addresses.

func (*FoundationAddressUpdate) DecodeFrom

func (fau *FoundationAddressUpdate) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (FoundationAddressUpdate) EncodeTo

func (fau FoundationAddressUpdate) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type Hash256

type Hash256 [32]byte

A Hash256 is a generic 256-bit cryptographic hash.

func HashBytes

func HashBytes(b []byte) Hash256

HashBytes computes the hash of b using Bigfile's hash function.

func (*Hash256) DecodeFrom

func (h *Hash256) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (Hash256) EncodeTo

func (h Hash256) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (Hash256) MarshalText

func (h Hash256) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Hash256) String

func (h Hash256) String() string

String implements fmt.Stringer.

func (*Hash256) UnmarshalText

func (h *Hash256) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type Hasher

type Hasher struct {
	E *Encoder
	// contains filtered or unexported fields
}

A Hasher streams objects into an instance of Bigfile's hash function.

func NewHasher

func NewHasher() *Hasher

NewHasher returns a new Hasher instance.

func (*Hasher) Reset

func (h *Hasher) Reset()

Reset resets the underlying hash and encoder state.

func (*Hasher) Sum

func (h *Hasher) Sum() (sum Hash256)

Sum returns the digest of the objects written to the Hasher.

func (*Hasher) WriteDistinguisher

func (h *Hasher) WriteDistinguisher(p string)

WriteDistinguisher writes a distinguisher prefix to the encoder.

type PolicyTypeAbove

type PolicyTypeAbove uint64

PolicyTypeAbove requires the input to be spent above a given block height.

type PolicyTypeAfter

type PolicyTypeAfter time.Time

PolicyTypeAfter requires the input to be spent after a given timestamp.

type PolicyTypeHash

type PolicyTypeHash Hash256

PolicyTypeHash requires the input to reveal a SHA256 hash preimage.

type PolicyTypeOpaque

type PolicyTypeOpaque Address

PolicyTypeOpaque is the opaque hash of a policy. It is not satisfiable.

type PolicyTypePublicKey

type PolicyTypePublicKey PublicKey

PolicyTypePublicKey requires the input to be signed by a given key.

type PolicyTypeThreshold

type PolicyTypeThreshold struct {
	N  uint8         `json:"n"`
	Of []SpendPolicy `json:"of"`
}

PolicyTypeThreshold requires at least N sub-policies to be satisfied.

type PolicyTypeUnlockConditions

type PolicyTypeUnlockConditions UnlockConditions

PolicyTypeUnlockConditions reproduces the requirements imposed by Bigfile's original "UnlockConditions" type. It exists for compatibility purposes and should not be used to construct new policies.

type PrivateKey

type PrivateKey []byte

A PrivateKey is an Ed25519 private key.

func GeneratePrivateKey

func GeneratePrivateKey() PrivateKey

GeneratePrivateKey creates a new private key from a secure entropy source.

func NewPrivateKeyFromSeed

func NewPrivateKeyFromSeed(seed []byte) PrivateKey

NewPrivateKeyFromSeed calculates a private key from a seed.

func (PrivateKey) PublicKey

func (priv PrivateKey) PublicKey() (pk PublicKey)

PublicKey returns the PublicKey corresponding to priv.

func (PrivateKey) SignHash

func (priv PrivateKey) SignHash(h Hash256) (s Signature)

SignHash signs h with priv, producing a Signature.

type PublicKey

type PublicKey [32]byte

A PublicKey is an Ed25519 public key.

func (*PublicKey) DecodeFrom

func (pk *PublicKey) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (PublicKey) EncodeTo

func (pk PublicKey) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (PublicKey) MarshalText

func (pk PublicKey) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (PublicKey) String

func (pk PublicKey) String() string

String implements fmt.Stringer.

func (PublicKey) UnlockKey

func (pk PublicKey) UnlockKey() UnlockKey

UnlockKey returns pk as an UnlockKey.

func (*PublicKey) UnmarshalText

func (pk *PublicKey) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (PublicKey) VerifyHash

func (pk PublicKey) VerifyHash(h Hash256, s Signature) bool

VerifyHash verifies that s is a valid signature of h by pk.

type SatisfiedPolicy

type SatisfiedPolicy struct {
	Policy     SpendPolicy
	Signatures []Signature
	Preimages  [][32]byte
}

A SatisfiedPolicy pairs a policy with the signatures and preimages that satisfy it.

func (*SatisfiedPolicy) DecodeFrom

func (sp *SatisfiedPolicy) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (SatisfiedPolicy) EncodeTo

func (sp SatisfiedPolicy) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (SatisfiedPolicy) MarshalJSON

func (sp SatisfiedPolicy) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*SatisfiedPolicy) UnmarshalJSON

func (sp *SatisfiedPolicy) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Signature

type Signature [64]byte

A Signature is an Ed25519 signature.

func (*Signature) DecodeFrom

func (s *Signature) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (Signature) EncodeTo

func (s Signature) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (Signature) MarshalText

func (sig Signature) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Signature) String

func (sig Signature) String() string

String implements fmt.Stringer.

func (*Signature) UnmarshalText

func (sig *Signature) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type Specifier

type Specifier [16]byte

A Specifier is a fixed-size, 0-padded identifier.

func NewSpecifier

func NewSpecifier(name string) (s Specifier)

NewSpecifier returns a specifier containing the provided name.

func (*Specifier) DecodeFrom

func (s *Specifier) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (Specifier) EncodeTo

func (s Specifier) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (Specifier) MarshalText

func (s Specifier) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Specifier) String

func (s Specifier) String() string

String implements fmt.Stringer.

func (*Specifier) UnmarshalText

func (s *Specifier) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type SpendPolicy

type SpendPolicy struct {
	Type interface {
		// contains filtered or unexported methods
	}
}

A SpendPolicy describes the conditions under which an input may be spent.

func AnyoneCanSpend

func AnyoneCanSpend() SpendPolicy

AnyoneCanSpend returns a policy that has no requirements.

func ParseSpendPolicy

func ParseSpendPolicy(s string) (SpendPolicy, error)

ParseSpendPolicy parses a spend policy from a string.

func PolicyAbove

func PolicyAbove(height uint64) SpendPolicy

PolicyAbove returns a policy that requires the input to be spent above a given block height.

func PolicyAfter

func PolicyAfter(t time.Time) SpendPolicy

PolicyAfter returns a policy that requires the input to be spent after a given timestamp.

func PolicyHash

func PolicyHash(h Hash256) SpendPolicy

PolicyHash returns a policy that requires the input to reveal a SHA256 hash preimage.

func PolicyOpaque

func PolicyOpaque(p SpendPolicy) SpendPolicy

PolicyOpaque returns a policy with the same address as p, but without its semantics.

func PolicyPublicKey

func PolicyPublicKey(pk PublicKey) SpendPolicy

PolicyPublicKey returns a policy that requires the input to be signed by a given key.

func PolicyThreshold

func PolicyThreshold(n uint8, of []SpendPolicy) SpendPolicy

PolicyThreshold returns a policy that requires at least N sub-policies to be satisfied. When satisfying a threshold policy, all unsatisfied sub-policies must be replaced with PolicyOpaque.

func (SpendPolicy) Address

func (p SpendPolicy) Address() Address

Address computes the opaque address for a given policy.

func (*SpendPolicy) DecodeFrom

func (p *SpendPolicy) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (SpendPolicy) EncodeTo

func (p SpendPolicy) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (SpendPolicy) MarshalJSON

func (p SpendPolicy) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (SpendPolicy) String

func (p SpendPolicy) String() string

String implements fmt.Stringer.

func (*SpendPolicy) UnmarshalJSON

func (p *SpendPolicy) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements json.Unmarshaler.

func (SpendPolicy) Verify

func (p SpendPolicy) Verify(height uint64, medianTimestamp time.Time, sigHash Hash256, sigs []Signature, preimages [][32]byte) error

Verify verifies that p is satisfied by the supplied inputs.

type StateElement

type StateElement struct {
	LeafIndex   uint64    `json:"leafIndex"`
	MerkleProof []Hash256 `json:"merkleProof,omitempty"`
	// contains filtered or unexported fields
}

A StateElement is a generic element within the state accumulator.

func (StateElement) Copy added in v0.0.2

func (se StateElement) Copy() StateElement

Copy returns a deep copy of the element. It must be used whenever the element's memory is copied.

func (*StateElement) DecodeFrom

func (se *StateElement) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (StateElement) EncodeTo

func (se StateElement) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (StateElement) Move added in v0.0.2

func (se StateElement) Move() StateElement

Move returns a shallow copy of the element. It must only be used when the element's memory is not shared.

func (StateElement) Share added in v0.0.2

func (se StateElement) Share() StateElement

Share returns a shallow copy of the element. It must be used whenever the element's memory is intentionally aliased.

type StorageProof

type StorageProof struct {
	ParentID FileContractID
	Leaf     [64]byte
	Proof    []Hash256
}

A StorageProof asserts the presence of a randomly-selected leaf within the Merkle tree of a FileContract's data.

func (*StorageProof) DecodeFrom

func (sp *StorageProof) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (StorageProof) EncodeTo

func (sp StorageProof) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (StorageProof) MarshalJSON

func (sp StorageProof) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*StorageProof) UnmarshalJSON

func (sp *StorageProof) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Transaction

type Transaction struct {
	BigfileInputs         []BigfileInput         `json:"bigfileInputs,omitempty"`
	BigfileOutputs        []BigfileOutput        `json:"bigfileOutputs,omitempty"`
	FileContracts         []FileContract         `json:"fileContracts,omitempty"`
	FileContractRevisions []FileContractRevision `json:"fileContractRevisions,omitempty"`
	StorageProofs         []StorageProof         `json:"storageProofs,omitempty"`
	BigfundInputs         []BigfundInput         `json:"bigfundInputs,omitempty"`
	BigfundOutputs        []BigfundOutput        `json:"bigfundOutputs,omitempty"`
	MinerFees             []Currency             `json:"minerFees,omitempty"`
	ArbitraryData         [][]byte               `json:"arbitraryData,omitempty"`
	Signatures            []TransactionSignature `json:"signatures,omitempty"`
}

A Transaction effects a change of blockchain state.

func (*Transaction) BigfileOutputID added in v1.0.9

func (txn *Transaction) BigfileOutputID(i int) BigfileOutputID

BigfileOutputID returns the ID of the bigfile output at index i.

func (*Transaction) BigfundClaimOutputID added in v1.0.4

func (txn *Transaction) BigfundClaimOutputID(i int) BigfileOutputID

BigfundClaimOutputID returns the ID of the bigfile claim output for the bigfund input at index i.

func (*Transaction) BigfundOutputID added in v1.0.4

func (txn *Transaction) BigfundOutputID(i int) BigfundOutputID

BigfundOutputID returns the ID of the bigfund output at index i.

func (*Transaction) DecodeFrom

func (txn *Transaction) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (Transaction) EncodeTo

func (txn Transaction) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (*Transaction) FileContractID

func (txn *Transaction) FileContractID(i int) FileContractID

FileContractID returns the ID of the file contract at index i.

func (*Transaction) FullHash

func (txn *Transaction) FullHash() Hash256

FullHash returns the hash of the transaction's binary encoding. This hash is only used in specific circumstances; generally, ID should be used instead.

func (*Transaction) ID

func (txn *Transaction) ID() TransactionID

ID returns the "semantic hash" of the transaction, covering all of the transaction's effects, but not incidental data such as signatures. This ensures that the ID will remain stable (i.e. non-malleable).

To hash all of the data in a transaction, use the FullHash method.

func (Transaction) MarshalJSON

func (txn Transaction) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

The transaction and UTXO IDs are calculated and included for convenience. These fields are ignored during unmarshalling.

func (*Transaction) MerkleLeafHash added in v1.0.8

func (txn *Transaction) MerkleLeafHash() Hash256

MerkleLeafHash returns the hash of the transaction as a leaf in a Merkle tree.

func (*Transaction) TotalFees

func (txn *Transaction) TotalFees() Currency

TotalFees returns the sum of the transaction's miner fees. If the sum would overflow, TotalFees returns ZeroCurrency.

type TransactionID

type TransactionID Hash256

A TransactionID uniquely identifies a transaction.

func (*TransactionID) DecodeFrom

func (id *TransactionID) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (TransactionID) EncodeTo

func (id TransactionID) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (TransactionID) MarshalText

func (tid TransactionID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (TransactionID) String

func (tid TransactionID) String() string

String implements fmt.Stringer.

func (*TransactionID) UnmarshalText

func (tid *TransactionID) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type TransactionSignature

type TransactionSignature struct {
	ParentID       Hash256       `json:"parentID"`
	PublicKeyIndex uint64        `json:"publicKeyIndex"`
	Timelock       uint64        `json:"timelock,omitempty"`
	CoveredFields  CoveredFields `json:"coveredFields"`
	Signature      []byte        `json:"signature"`
}

A TransactionSignature signs transaction data.

func (*TransactionSignature) DecodeFrom

func (ts *TransactionSignature) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (TransactionSignature) EncodeTo

func (ts TransactionSignature) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type UnlockConditions

type UnlockConditions struct {
	Timelock           uint64      `json:"timelock"`
	PublicKeys         []UnlockKey `json:"publicKeys"`
	SignaturesRequired uint64      `json:"signaturesRequired"`
}

UnlockConditions specify the conditions for spending an output or revising a file contract.

func StandardUnlockConditions

func StandardUnlockConditions(pk PublicKey) UnlockConditions

StandardUnlockConditions returns the standard unlock conditions for pk.

func (*UnlockConditions) DecodeFrom

func (uc *UnlockConditions) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (UnlockConditions) EncodeTo

func (uc UnlockConditions) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (UnlockConditions) UnlockHash

func (uc UnlockConditions) UnlockHash() Address

UnlockHash computes the hash of a set of UnlockConditions. Such hashes are most commonly used as addresses, but are also used in file contracts.

type UnlockKey

type UnlockKey struct {
	Algorithm Specifier
	Key       []byte
}

An UnlockKey can provide one of the signatures required by a set of UnlockConditions.

func (*UnlockKey) DecodeFrom

func (uk *UnlockKey) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (UnlockKey) EncodeTo

func (uk UnlockKey) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (UnlockKey) MarshalText

func (uk UnlockKey) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*UnlockKey) UnmarshalText

func (uk *UnlockKey) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type V1BigfileOutput added in v1.0.9

type V1BigfileOutput BigfileOutput

V1BigfileOutput provides v1 encoding for BigfileOutput.

func (V1BigfileOutput) Cast added in v1.0.9

func (bigo V1BigfileOutput) Cast() BigfileOutput

Cast provides type safety for DecodeSliceCast.

func (*V1BigfileOutput) DecodeFrom added in v1.0.9

func (bigo *V1BigfileOutput) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V1BigfileOutput) EncodeTo added in v1.0.9

func (bigo V1BigfileOutput) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V1BigfundOutput added in v1.0.4

type V1BigfundOutput BigfundOutput

V1BigfundOutput provides v1 encoding for BigfundOutput.

func (V1BigfundOutput) Cast added in v1.0.4

func (bfo V1BigfundOutput) Cast() BigfundOutput

Cast provides type safety for DecodeSliceCast.

func (*V1BigfundOutput) DecodeFrom added in v1.0.4

func (bfo *V1BigfundOutput) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V1BigfundOutput) EncodeTo added in v1.0.4

func (bfo V1BigfundOutput) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V1Block

type V1Block Block

V1Block provides v1 encoding for Block.

func (V1Block) Cast

func (b V1Block) Cast() Block

Cast provides type safety for DecodeSliceCast.

func (*V1Block) DecodeFrom

func (b *V1Block) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V1Block) EncodeTo

func (b V1Block) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V1Currency

type V1Currency Currency

V1Currency provides v1 encoding for Currency.

func (V1Currency) Cast

func (c V1Currency) Cast() Currency

Cast provides type safety for DecodeSliceCast.

func (*V1Currency) DecodeFrom

func (c *V1Currency) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V1Currency) EncodeTo

func (c V1Currency) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V2BigfileInput added in v1.0.9

type V2BigfileInput struct {
	Parent          BigfileElement  `json:"parent"`
	SatisfiedPolicy SatisfiedPolicy `json:"satisfiedPolicy"`
}

A V2BigfileInput spends an unspent BigfileElement in the state accumulator by revealing its public key and signing the transaction.

func (*V2BigfileInput) DecodeFrom added in v1.0.9

func (in *V2BigfileInput) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2BigfileInput) EncodeTo added in v1.0.9

func (in V2BigfileInput) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V2BigfileOutput added in v1.0.9

type V2BigfileOutput BigfileOutput

V2BigfileOutput provides v2 encoding for BigfileOutput.

func (V2BigfileOutput) Cast added in v1.0.9

func (bigo V2BigfileOutput) Cast() BigfileOutput

Cast provides type safety for DecodeSliceCast.

func (*V2BigfileOutput) DecodeFrom added in v1.0.9

func (bigo *V2BigfileOutput) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2BigfileOutput) EncodeTo added in v1.0.9

func (bigo V2BigfileOutput) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V2BigfundInput added in v1.0.4

type V2BigfundInput struct {
	Parent          BigfundElement  `json:"parent"`
	ClaimAddress    Address         `json:"claimAddress"`
	SatisfiedPolicy SatisfiedPolicy `json:"satisfiedPolicy"`
}

A V2BigfundInput spends an unspent BigfundElement in the state accumulator by revealing its public key and signing the transaction. Inputs also include a ClaimAddress, specifying the recipient of the bigfiles that were earned by the BigfundElement.

func (*V2BigfundInput) DecodeFrom added in v1.0.4

func (in *V2BigfundInput) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2BigfundInput) EncodeTo added in v1.0.4

func (in V2BigfundInput) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V2BigfundOutput added in v1.0.4

type V2BigfundOutput BigfundOutput

V2BigfundOutput provides v2 encoding for BigfundOutput.

func (V2BigfundOutput) Cast added in v1.0.4

func (bfo V2BigfundOutput) Cast() BigfundOutput

Cast provides type safety for DecodeSliceCast.

func (*V2BigfundOutput) DecodeFrom added in v1.0.4

func (bfo *V2BigfundOutput) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2BigfundOutput) EncodeTo added in v1.0.4

func (bfo V2BigfundOutput) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V2Block

type V2Block Block

V2Block provides v2 encoding for Block.

func (V2Block) Cast

func (b V2Block) Cast() Block

Cast provides type safety for DecodeSliceCast.

func (*V2Block) DecodeFrom

func (b *V2Block) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2Block) EncodeTo

func (b V2Block) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V2BlockData

type V2BlockData struct {
	Height       uint64          `json:"height"`
	Commitment   Hash256         `json:"commitment"`
	Transactions []V2Transaction `json:"transactions"`
}

V2BlockData contains additional fields not present in v1 blocks.

func (*V2BlockData) DecodeFrom

func (b *V2BlockData) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2BlockData) EncodeTo

func (b V2BlockData) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V2Currency

type V2Currency Currency

V2Currency provides v2 encoding for Currency.

func (V2Currency) Cast

func (c V2Currency) Cast() Currency

Cast provides type safety for DecodeSliceCast.

func (*V2Currency) DecodeFrom

func (c *V2Currency) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2Currency) EncodeTo

func (c V2Currency) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V2FileContract

type V2FileContract struct {
	Capacity         uint64        `json:"capacity"`
	Filesize         uint64        `json:"filesize"`
	FileMerkleRoot   Hash256       `json:"fileMerkleRoot"`
	ProofHeight      uint64        `json:"proofHeight"`
	ExpirationHeight uint64        `json:"expirationHeight"`
	RenterOutput     BigfileOutput `json:"renterOutput"`
	HostOutput       BigfileOutput `json:"hostOutput"`
	MissedHostValue  Currency      `json:"missedHostValue"`
	TotalCollateral  Currency      `json:"totalCollateral"`
	RenterPublicKey  PublicKey     `json:"renterPublicKey"`
	HostPublicKey    PublicKey     `json:"hostPublicKey"`
	RevisionNumber   uint64        `json:"revisionNumber"`

	// signatures cover above fields
	RenterSignature Signature `json:"renterSignature"`
	HostSignature   Signature `json:"hostSignature"`
}

A V2FileContract is a storage agreement between a renter and a host. It consists of a bidirectional payment channel that resolves as either "valid" or "missed" depending on whether a valid StorageProof is submitted for the contract.

func (*V2FileContract) DecodeFrom

func (fc *V2FileContract) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2FileContract) EncodeTo

func (fc V2FileContract) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (V2FileContract) MissedHostOutput

func (fc V2FileContract) MissedHostOutput() BigfileOutput

MissedHostOutput returns the host output that will be created if the contract resolves missed.

type V2FileContractElement

type V2FileContractElement struct {
	ID             FileContractID `json:"id"`
	StateElement   StateElement   `json:"stateElement"`
	V2FileContract V2FileContract `json:"v2FileContract"`
}

A V2FileContractElement is a record of a V2FileContract within the state accumulator.

func (V2FileContractElement) Copy added in v0.0.2

Copy returns a deep copy of the element. It must be used whenever the element's memory is copied.

func (*V2FileContractElement) DecodeFrom

func (fce *V2FileContractElement) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2FileContractElement) EncodeTo

func (fce V2FileContractElement) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (V2FileContractElement) Move added in v0.0.2

Move returns a shallow copy of the element. It must only be used when the element's memory is not shared.

func (V2FileContractElement) Share added in v0.0.2

Share returns a shallow copy of the element. It must be used whenever the element's memory is intentionally aliased.

type V2FileContractExpiration

type V2FileContractExpiration struct{}

A V2FileContractExpiration resolves an expired contract. A contract is considered expired when its proof window has elapsed. If the contract is not storing any data, it will resolve as valid; otherwise, it resolves as missed.

func (*V2FileContractExpiration) DecodeFrom

func (*V2FileContractExpiration) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2FileContractExpiration) EncodeTo

func (V2FileContractExpiration) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V2FileContractRenewal

type V2FileContractRenewal struct {
	FinalRenterOutput BigfileOutput  `json:"finalRenterOutput"`
	FinalHostOutput   BigfileOutput  `json:"finalHostOutput"`
	RenterRollover    Currency       `json:"renterRollover"`
	HostRollover      Currency       `json:"hostRollover"`
	NewContract       V2FileContract `json:"newContract"`

	// signatures cover above fields
	RenterSignature Signature `json:"renterSignature"`
	HostSignature   Signature `json:"hostSignature"`
}

A V2FileContractRenewal renews a file contract.

func (*V2FileContractRenewal) DecodeFrom

func (ren *V2FileContractRenewal) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2FileContractRenewal) EncodeTo

func (ren V2FileContractRenewal) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V2FileContractResolution

type V2FileContractResolution struct {
	Parent     V2FileContractElement        `json:"parent"`
	Resolution V2FileContractResolutionType `json:"resolution"`
}

A V2FileContractResolution closes a v2 file contract's payment channel. There are three ways a contract can be resolved:

1) The renter and host can jointly renew the contract. The old contract is finalized, and a portion of its funds are "rolled over" into a new contract. Renewals must be submitted prior to the contract's ProofHeight.

2) If the renter is unwilling or unable to sign a renewal, the host can submit a storage proof, asserting that it has faithfully stored the contract data for the agreed-upon duration. Storage proofs must be submitted after the contract's ProofHeight and prior to its ExpirationHeight.

3) Lastly, anyone can submit a contract expiration. An expiration can only be submitted after the contract's ExpirationHeight.

Once a contract has been resolved, it cannot be altered or resolved again. When a contract is resolved, its RenterOutput and HostOutput are created immediately (though they will not be spendable until their timelock expires). However, if the contract is resolved via an expiration, the HostOutput will have value equal to MissedHostValue; in other words, the host forfeits its collateral. This is considered a "missed" resolution; all other resolution types are "valid." As a special case, the expiration of an empty contract is considered valid, reflecting the fact that the host has not failed to perform any duty.

func (*V2FileContractResolution) DecodeFrom

func (res *V2FileContractResolution) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2FileContractResolution) EncodeTo

func (res V2FileContractResolution) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (V2FileContractResolution) MarshalJSON

func (res V2FileContractResolution) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*V2FileContractResolution) UnmarshalJSON

func (res *V2FileContractResolution) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Marshaler.

type V2FileContractResolutionType

type V2FileContractResolutionType interface {
	// contains filtered or unexported methods
}

V2FileContractResolutionType enumerates the types of file contract resolution.

type V2FileContractRevision

type V2FileContractRevision struct {
	Parent   V2FileContractElement `json:"parent"`
	Revision V2FileContract        `json:"revision"`
}

A V2FileContractRevision updates the state of an existing file contract.

func (*V2FileContractRevision) DecodeFrom

func (rev *V2FileContractRevision) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2FileContractRevision) EncodeTo

func (rev V2FileContractRevision) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V2StorageProof

type V2StorageProof struct {
	// Selecting the leaf requires a source of unpredictable entropy; we use the
	// ID of the block at the contract's ProofHeight. The storage proof thus
	// includes a proof that this ID is the correct ancestor.
	//
	// During validation, it is imperative to check that ProofIndex.Height
	// matches the ProofHeight field of the contract's final revision;
	// otherwise, the prover could use any ProofIndex, giving them control over
	// the leaf index.
	ProofIndex ChainIndexElement

	// The leaf is always 64 bytes, extended with zeros if necessary.
	Leaf  [64]byte
	Proof []Hash256
}

A V2StorageProof asserts the presence of a randomly-selected leaf within the Merkle tree of a V2FileContract's data.

func (*V2StorageProof) DecodeFrom

func (sp *V2StorageProof) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2StorageProof) EncodeTo

func (sp V2StorageProof) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (V2StorageProof) MarshalJSON

func (sp V2StorageProof) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*V2StorageProof) UnmarshalJSON

func (sp *V2StorageProof) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type V2Transaction

type V2Transaction struct {
	BigfileInputs           []V2BigfileInput           `json:"bigfileInputs,omitempty"`
	BigfileOutputs          []BigfileOutput            `json:"bigfileOutputs,omitempty"`
	BigfundInputs           []V2BigfundInput           `json:"bigfundInputs,omitempty"`
	BigfundOutputs          []BigfundOutput            `json:"bigfundOutputs,omitempty"`
	FileContracts           []V2FileContract           `json:"fileContracts,omitempty"`
	FileContractRevisions   []V2FileContractRevision   `json:"fileContractRevisions,omitempty"`
	FileContractResolutions []V2FileContractResolution `json:"fileContractResolutions,omitempty"`
	Attestations            []Attestation              `json:"attestations,omitempty"`
	ArbitraryData           []byte                     `json:"arbitraryData,omitempty"`
	NewFoundationAddress    *Address                   `json:"newFoundationAddress,omitempty"`
	MinerFee                Currency                   `json:"minerFee"`
}

A V2Transaction effects a change of blockchain state.

func (*V2Transaction) AttestationID

func (*V2Transaction) AttestationID(txid TransactionID, i int) AttestationID

AttestationID returns the ID for the attestation at index i.

func (*V2Transaction) BigfileOutputID added in v1.0.9

func (*V2Transaction) BigfileOutputID(txid TransactionID, i int) BigfileOutputID

BigfileOutputID returns the ID for the bigfile output at index i.

func (*V2Transaction) BigfundOutputID added in v1.0.4

func (*V2Transaction) BigfundOutputID(txid TransactionID, i int) BigfundOutputID

BigfundOutputID returns the ID for the bigfund output at index i.

func (*V2Transaction) DecodeFrom

func (txn *V2Transaction) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (*V2Transaction) DeepCopy

func (txn *V2Transaction) DeepCopy() V2Transaction

DeepCopy returns a copy of txn that does not alias any of its memory.

func (V2Transaction) EncodeTo

func (txn V2Transaction) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

func (*V2Transaction) EphemeralBigfileOutput added in v1.0.9

func (txn *V2Transaction) EphemeralBigfileOutput(i int) BigfileElement

EphemeralBigfileOutput returns a BigfileElement for the bigfile output at index i.

func (*V2Transaction) EphemeralBigfundOutput added in v1.0.4

func (txn *V2Transaction) EphemeralBigfundOutput(i int) BigfundElement

EphemeralBigfundOutput returns a BigfundElement for the bigfund output at index i.

func (*V2Transaction) FullHash

func (txn *V2Transaction) FullHash() Hash256

FullHash returns the hash of the transaction's binary encoding. This hash is only used in specific circumstances; generally, ID should be used instead.

func (*V2Transaction) ID

func (txn *V2Transaction) ID() TransactionID

ID returns the "semantic hash" of the transaction, covering all of the transaction's effects, but not incidental data such as signatures or Merkle proofs. This ensures that the ID will remain stable (i.e. non-malleable).

To hash all of the data in a transaction, use the FullHash method.

func (V2Transaction) MarshalJSON

func (txn V2Transaction) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

For convenience, the transaction's ID is also calculated and included. This field is ignored during unmarshalling.

func (*V2Transaction) MerkleLeafHash added in v1.0.8

func (txn *V2Transaction) MerkleLeafHash() Hash256

MerkleLeafHash returns the hash of the transaction as a leaf in a Merkle tree.

func (*V2Transaction) V2FileContractID

func (*V2Transaction) V2FileContractID(txid TransactionID, i int) FileContractID

V2FileContractID returns the ID for the v2 file contract at index i.

type V2TransactionSemantics

type V2TransactionSemantics V2Transaction

V2TransactionSemantics is a helper type that provides a "semantic encoding" of a v2 transaction, for use in computing IDs and signature hashes.

func (V2TransactionSemantics) EncodeTo

func (txn V2TransactionSemantics) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

type V2TransactionsMultiproof

type V2TransactionsMultiproof []V2Transaction

V2TransactionsMultiproof is a slice of V2Transactions whose Merkle proofs are encoded as a single multiproof. This can significantly reduce the size of the encoded transactions. However, multiproofs may only be used for transaction sets whose Merkle proofs are all valid for the same consensus state.

func (*V2TransactionsMultiproof) DecodeFrom

func (txns *V2TransactionsMultiproof) DecodeFrom(d *Decoder)

DecodeFrom implements types.DecoderFrom.

func (V2TransactionsMultiproof) EncodeTo

func (txns V2TransactionsMultiproof) EncodeTo(e *Encoder)

EncodeTo implements types.EncoderTo.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL