bc

package
v0.0.0-...-4e9b90d Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package bc is a generated protocol buffer package.

It is generated from these files:

bc.proto

It has these top-level messages:

Hash
Program
AssetID
AssetAmount
AssetDefinition
ValueSource
ValueDestination
BlockHeader
TxHeader
Mux
Nonce
Output
Retirement
TimeRange
Issuance
Spend

Package bc provides the fundamental blockchain data structures used in the Chain Protocol.

This package is in transition from a set of "old" data structures (TxData, TxInput, TxOutput, etc.) to a new data model based on "entries," each with a specific type (such as spend, issuance, output, etc.), and each with its own distinct hash. The hash of a designated "header" entry serves as the hash of the entire transaction. The rationale for this change is that it is considerably more extensible, and it allows future scripting tools to traverse and access transaction data by making all components hash-addressable.

Hashing and validation (of the old types) are redefined to mean "convert to the new data structures and hash/validate that."

Soon the old structures will be retired entirely.

These changes will be made in a compatible way; in particular, block and transaction hashes will not change.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEntryType    = errors.New("invalid entry type")
	ErrMissingEntry = errors.New("missing entry")
)
View Source
var EmptyStringHash = NewHash(sha3.Sum256(nil))

Functions

func DurationMillis

func DurationMillis(d time.Duration) uint64

DurationMillis converts a time.Duration to a number of milliseconds.

func Millis

func Millis(t time.Time) uint64

Millis converts a time.Time to a number of milliseconds since 1970.

func MillisDuration

func MillisDuration(m uint64) time.Duration

MillisDuration coverts milliseconds to a time.Duration.

Types

type AssetAmount

type AssetAmount struct {
	AssetId *AssetID `protobuf:"bytes,1,opt,name=asset_id,json=assetId" json:"asset_id,omitempty"`
	Amount  uint64   `protobuf:"varint,2,opt,name=amount" json:"amount,omitempty"`
}

func (*AssetAmount) Descriptor

func (*AssetAmount) Descriptor() ([]byte, []int)

func (*AssetAmount) Equal

func (a *AssetAmount) Equal(other *AssetAmount) (eq bool, err error)

func (*AssetAmount) GetAmount

func (m *AssetAmount) GetAmount() uint64

func (*AssetAmount) GetAssetId

func (m *AssetAmount) GetAssetId() *AssetID

func (*AssetAmount) ProtoMessage

func (*AssetAmount) ProtoMessage()

func (*AssetAmount) ReadFrom

func (a *AssetAmount) ReadFrom(r *blockchain.Reader) error

func (*AssetAmount) Reset

func (m *AssetAmount) Reset()

func (*AssetAmount) String

func (m *AssetAmount) String() string

func (AssetAmount) WriteTo

func (a AssetAmount) WriteTo(w io.Writer) (int64, error)

type AssetDefinition

type AssetDefinition struct {
	InitialBlockId  *Hash    `protobuf:"bytes,1,opt,name=initial_block_id,json=initialBlockId" json:"initial_block_id,omitempty"`
	IssuanceProgram *Program `protobuf:"bytes,2,opt,name=issuance_program,json=issuanceProgram" json:"issuance_program,omitempty"`
	Data            *Hash    `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"`
}

func (*AssetDefinition) ComputeAssetID

func (ad *AssetDefinition) ComputeAssetID() (assetID AssetID)

func (*AssetDefinition) Descriptor

func (*AssetDefinition) Descriptor() ([]byte, []int)

func (*AssetDefinition) GetData

func (m *AssetDefinition) GetData() *Hash

func (*AssetDefinition) GetInitialBlockId

func (m *AssetDefinition) GetInitialBlockId() *Hash

func (*AssetDefinition) GetIssuanceProgram

func (m *AssetDefinition) GetIssuanceProgram() *Program

func (*AssetDefinition) ProtoMessage

func (*AssetDefinition) ProtoMessage()

func (*AssetDefinition) Reset

func (m *AssetDefinition) Reset()

func (*AssetDefinition) String

func (m *AssetDefinition) String() string

type AssetID

type AssetID struct {
	V0 uint64 `protobuf:"fixed64,1,opt,name=v0" json:"v0,omitempty"`
	V1 uint64 `protobuf:"fixed64,2,opt,name=v1" json:"v1,omitempty"`
	V2 uint64 `protobuf:"fixed64,3,opt,name=v2" json:"v2,omitempty"`
	V3 uint64 `protobuf:"fixed64,4,opt,name=v3" json:"v3,omitempty"`
}

This message type duplicates Hash, above. One alternative is to embed a Hash inside an AssetID. But it's useful for AssetID to be plain old data (without pointers). Another alternative is use Hash in any protobuf types where an AssetID is called for, but it's preferable to have type safety.

func ComputeAssetID

func ComputeAssetID(prog []byte, initialBlockID *Hash, vmVersion uint64, data *Hash) AssetID

func NewAssetID

func NewAssetID(b [32]byte) (a AssetID)

func (AssetID) Byte32

func (a AssetID) Byte32() (b32 [32]byte)

func (AssetID) Bytes

func (a AssetID) Bytes() []byte

func (*AssetID) Descriptor

func (*AssetID) Descriptor() ([]byte, []int)

func (*AssetID) GetV0

func (m *AssetID) GetV0() uint64

func (*AssetID) GetV1

func (m *AssetID) GetV1() uint64

func (*AssetID) GetV2

func (m *AssetID) GetV2() uint64

func (*AssetID) GetV3

func (m *AssetID) GetV3() uint64

func (*AssetID) IsZero

func (a *AssetID) IsZero() bool

func (AssetID) MarshalText

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

func (*AssetID) ProtoMessage

func (*AssetID) ProtoMessage()

func (*AssetID) ReadFrom

func (a *AssetID) ReadFrom(r io.Reader) (int64, error)

func (*AssetID) Reset

func (m *AssetID) Reset()

func (*AssetID) Scan

func (a *AssetID) Scan(val interface{}) error

func (*AssetID) String

func (m *AssetID) String() string

func (*AssetID) UnmarshalJSON

func (a *AssetID) UnmarshalJSON(b []byte) error

func (*AssetID) UnmarshalText

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

func (AssetID) Value

func (a AssetID) Value() (driver.Value, error)

func (AssetID) WriteTo

func (a AssetID) WriteTo(w io.Writer) (int64, error)

type Block

type Block struct {
	*BlockHeader
	ID           Hash
	Transactions []*Tx
}

type BlockHeader

type BlockHeader struct {
	Version              uint64   `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
	Height               uint64   `protobuf:"varint,2,opt,name=height" json:"height,omitempty"`
	PreviousBlockId      *Hash    `protobuf:"bytes,3,opt,name=previous_block_id,json=previousBlockId" json:"previous_block_id,omitempty"`
	TimestampMs          uint64   `protobuf:"varint,4,opt,name=timestamp_ms,json=timestampMs" json:"timestamp_ms,omitempty"`
	TransactionsRoot     *Hash    `protobuf:"bytes,5,opt,name=transactions_root,json=transactionsRoot" json:"transactions_root,omitempty"`
	AssetsRoot           *Hash    `protobuf:"bytes,6,opt,name=assets_root,json=assetsRoot" json:"assets_root,omitempty"`
	NextConsensusProgram []byte   `protobuf:"bytes,7,opt,name=next_consensus_program,json=nextConsensusProgram,proto3" json:"next_consensus_program,omitempty"`
	ExtHash              *Hash    `protobuf:"bytes,8,opt,name=ext_hash,json=extHash" json:"ext_hash,omitempty"`
	WitnessArguments     [][]byte `protobuf:"bytes,9,rep,name=witness_arguments,json=witnessArguments,proto3" json:"witness_arguments,omitempty"`
}

func NewBlockHeader

func NewBlockHeader(version, height uint64, previousBlockID *Hash, timestampMS uint64, transactionsRoot, assetsRoot *Hash, nextConsensusProgram []byte) *BlockHeader

NewBlockHeader creates a new BlockHeader and populates its body.

func (*BlockHeader) Descriptor

func (*BlockHeader) Descriptor() ([]byte, []int)

func (*BlockHeader) GetAssetsRoot

func (m *BlockHeader) GetAssetsRoot() *Hash

func (*BlockHeader) GetExtHash

func (m *BlockHeader) GetExtHash() *Hash

func (*BlockHeader) GetHeight

func (m *BlockHeader) GetHeight() uint64

func (*BlockHeader) GetNextConsensusProgram

func (m *BlockHeader) GetNextConsensusProgram() []byte

func (*BlockHeader) GetPreviousBlockId

func (m *BlockHeader) GetPreviousBlockId() *Hash

func (*BlockHeader) GetTimestampMs

func (m *BlockHeader) GetTimestampMs() uint64

func (*BlockHeader) GetTransactionsRoot

func (m *BlockHeader) GetTransactionsRoot() *Hash

func (*BlockHeader) GetVersion

func (m *BlockHeader) GetVersion() uint64

func (*BlockHeader) GetWitnessArguments

func (m *BlockHeader) GetWitnessArguments() [][]byte

func (*BlockHeader) ProtoMessage

func (*BlockHeader) ProtoMessage()

func (*BlockHeader) Reset

func (m *BlockHeader) Reset()

func (*BlockHeader) String

func (m *BlockHeader) String() string

type Entry

type Entry interface {
	proto.Message
	// contains filtered or unexported methods
}

Entry is the interface implemented by each addressable unit in a blockchain: transaction components such as spends, issuances, outputs, and retirements (among others), plus blockheaders.

type Hash

type Hash struct {
	V0 uint64 `protobuf:"fixed64,1,opt,name=v0" json:"v0,omitempty"`
	V1 uint64 `protobuf:"fixed64,2,opt,name=v1" json:"v1,omitempty"`
	V2 uint64 `protobuf:"fixed64,3,opt,name=v2" json:"v2,omitempty"`
	V3 uint64 `protobuf:"fixed64,4,opt,name=v3" json:"v3,omitempty"`
}

func EntryID

func EntryID(e Entry) (hash Hash)

EntryID computes the identifier of an entry, as the hash of its body plus some metadata.

func MerkleRoot

func MerkleRoot(transactions []*Tx) (root Hash, err error)

MerkleRoot creates a merkle tree from a slice of transactions and returns the root hash of the tree.

func NewHash

func NewHash(b32 [32]byte) (h Hash)

func (Hash) Byte32

func (h Hash) Byte32() (b32 [32]byte)

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (*Hash) Descriptor

func (*Hash) Descriptor() ([]byte, []int)

func (*Hash) GetV0

func (m *Hash) GetV0() uint64

func (*Hash) GetV1

func (m *Hash) GetV1() uint64

func (*Hash) GetV2

func (m *Hash) GetV2() uint64

func (*Hash) GetV3

func (m *Hash) GetV3() uint64

func (*Hash) IsZero

func (h *Hash) IsZero() bool

IsZero tells whether a Hash pointer is nil or points to an all-zero hash.

func (Hash) MarshalText

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

MarshalText satisfies the TextMarshaler interface. It returns the bytes of h encoded in hex, for formats that can't hold arbitrary binary data. It never returns an error.

func (*Hash) ProtoMessage

func (*Hash) ProtoMessage()

func (*Hash) ReadFrom

func (h *Hash) ReadFrom(r io.Reader) (int64, error)

ReadFrom satisfies the io.ReaderFrom interface.

func (*Hash) Reset

func (m *Hash) Reset()

func (*Hash) Scan

func (h *Hash) Scan(v interface{}) error

Scan satisfies the driver.Scanner interface

func (*Hash) String

func (m *Hash) String() string

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(b []byte) error

UnmarshalJSON satisfies the json.Unmarshaler interface. If b is a JSON-encoded null, it copies the zero-value into h. Othwerwise, it decodes hex data from b into h.

func (*Hash) UnmarshalText

func (h *Hash) UnmarshalText(v []byte) error

UnmarshalText satisfies the TextUnmarshaler interface. It decodes hex data from b into h.

func (Hash) Value

func (h Hash) Value() (driver.Value, error)

Value satisfies the driver.Valuer interface

func (Hash) WriteTo

func (h Hash) WriteTo(w io.Writer) (int64, error)

WriteTo satisfies the io.WriterTo interface.

type Issuance

type Issuance struct {
	AnchorId               *Hash             `protobuf:"bytes,1,opt,name=anchor_id,json=anchorId" json:"anchor_id,omitempty"`
	Value                  *AssetAmount      `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
	Data                   *Hash             `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"`
	ExtHash                *Hash             `protobuf:"bytes,4,opt,name=ext_hash,json=extHash" json:"ext_hash,omitempty"`
	WitnessDestination     *ValueDestination `protobuf:"bytes,5,opt,name=witness_destination,json=witnessDestination" json:"witness_destination,omitempty"`
	WitnessAssetDefinition *AssetDefinition  `protobuf:"bytes,6,opt,name=witness_asset_definition,json=witnessAssetDefinition" json:"witness_asset_definition,omitempty"`
	WitnessArguments       [][]byte          `protobuf:"bytes,7,rep,name=witness_arguments,json=witnessArguments,proto3" json:"witness_arguments,omitempty"`
	WitnessAnchoredId      *Hash             `protobuf:"bytes,8,opt,name=witness_anchored_id,json=witnessAnchoredId" json:"witness_anchored_id,omitempty"`
	Ordinal                uint64            `protobuf:"varint,9,opt,name=ordinal" json:"ordinal,omitempty"`
}

func NewIssuance

func NewIssuance(anchorID *Hash, value *AssetAmount, data *Hash, ordinal uint64) *Issuance

NewIssuance creates a new Issuance.

func (*Issuance) Descriptor

func (*Issuance) Descriptor() ([]byte, []int)

func (*Issuance) GetAnchorId

func (m *Issuance) GetAnchorId() *Hash

func (*Issuance) GetData

func (m *Issuance) GetData() *Hash

func (*Issuance) GetExtHash

func (m *Issuance) GetExtHash() *Hash

func (*Issuance) GetOrdinal

func (m *Issuance) GetOrdinal() uint64

func (*Issuance) GetValue

func (m *Issuance) GetValue() *AssetAmount

func (*Issuance) GetWitnessAnchoredId

func (m *Issuance) GetWitnessAnchoredId() *Hash

func (*Issuance) GetWitnessArguments

func (m *Issuance) GetWitnessArguments() [][]byte

func (*Issuance) GetWitnessAssetDefinition

func (m *Issuance) GetWitnessAssetDefinition() *AssetDefinition

func (*Issuance) GetWitnessDestination

func (m *Issuance) GetWitnessDestination() *ValueDestination

func (*Issuance) ProtoMessage

func (*Issuance) ProtoMessage()

func (*Issuance) Reset

func (m *Issuance) Reset()

func (*Issuance) SetDestination

func (iss *Issuance) SetDestination(id *Hash, val *AssetAmount, pos uint64)

func (*Issuance) String

func (m *Issuance) String() string

type Mux

type Mux struct {
	Sources             []*ValueSource      `protobuf:"bytes,1,rep,name=sources" json:"sources,omitempty"`
	Program             *Program            `protobuf:"bytes,2,opt,name=program" json:"program,omitempty"`
	ExtHash             *Hash               `protobuf:"bytes,3,opt,name=ext_hash,json=extHash" json:"ext_hash,omitempty"`
	WitnessDestinations []*ValueDestination `protobuf:"bytes,4,rep,name=witness_destinations,json=witnessDestinations" json:"witness_destinations,omitempty"`
	WitnessArguments    [][]byte            `protobuf:"bytes,5,rep,name=witness_arguments,json=witnessArguments,proto3" json:"witness_arguments,omitempty"`
}

func NewMux

func NewMux(sources []*ValueSource, program *Program) *Mux

NewMux creates a new Mux.

func (*Mux) Descriptor

func (*Mux) Descriptor() ([]byte, []int)

func (*Mux) GetExtHash

func (m *Mux) GetExtHash() *Hash

func (*Mux) GetProgram

func (m *Mux) GetProgram() *Program

func (*Mux) GetSources

func (m *Mux) GetSources() []*ValueSource

func (*Mux) GetWitnessArguments

func (m *Mux) GetWitnessArguments() [][]byte

func (*Mux) GetWitnessDestinations

func (m *Mux) GetWitnessDestinations() []*ValueDestination

func (*Mux) ProtoMessage

func (*Mux) ProtoMessage()

func (*Mux) Reset

func (m *Mux) Reset()

func (*Mux) String

func (m *Mux) String() string

type Nonce

type Nonce struct {
	Program           *Program `protobuf:"bytes,1,opt,name=program" json:"program,omitempty"`
	TimeRangeId       *Hash    `protobuf:"bytes,2,opt,name=time_range_id,json=timeRangeId" json:"time_range_id,omitempty"`
	ExtHash           *Hash    `protobuf:"bytes,3,opt,name=ext_hash,json=extHash" json:"ext_hash,omitempty"`
	WitnessArguments  [][]byte `protobuf:"bytes,4,rep,name=witness_arguments,json=witnessArguments,proto3" json:"witness_arguments,omitempty"`
	WitnessAnchoredId *Hash    `protobuf:"bytes,5,opt,name=witness_anchored_id,json=witnessAnchoredId" json:"witness_anchored_id,omitempty"`
}

func NewNonce

func NewNonce(p *Program, trID *Hash) *Nonce

NewNonce creates a new Nonce.

func (*Nonce) Descriptor

func (*Nonce) Descriptor() ([]byte, []int)

func (*Nonce) GetExtHash

func (m *Nonce) GetExtHash() *Hash

func (*Nonce) GetProgram

func (m *Nonce) GetProgram() *Program

func (*Nonce) GetTimeRangeId

func (m *Nonce) GetTimeRangeId() *Hash

func (*Nonce) GetWitnessAnchoredId

func (m *Nonce) GetWitnessAnchoredId() *Hash

func (*Nonce) GetWitnessArguments

func (m *Nonce) GetWitnessArguments() [][]byte

func (*Nonce) ProtoMessage

func (*Nonce) ProtoMessage()

func (*Nonce) Reset

func (m *Nonce) Reset()

func (*Nonce) SetAnchored

func (n *Nonce) SetAnchored(id *Hash)

func (*Nonce) String

func (m *Nonce) String() string

type Output

type Output struct {
	Source         *ValueSource `protobuf:"bytes,1,opt,name=source" json:"source,omitempty"`
	ControlProgram *Program     `protobuf:"bytes,2,opt,name=control_program,json=controlProgram" json:"control_program,omitempty"`
	Data           *Hash        `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"`
	ExtHash        *Hash        `protobuf:"bytes,4,opt,name=ext_hash,json=extHash" json:"ext_hash,omitempty"`
	Ordinal        uint64       `protobuf:"varint,5,opt,name=ordinal" json:"ordinal,omitempty"`
}

func NewOutput

func NewOutput(source *ValueSource, controlProgram *Program, data *Hash, ordinal uint64) *Output

NewOutput creates a new Output.

func (*Output) Descriptor

func (*Output) Descriptor() ([]byte, []int)

func (*Output) GetControlProgram

func (m *Output) GetControlProgram() *Program

func (*Output) GetData

func (m *Output) GetData() *Hash

func (*Output) GetExtHash

func (m *Output) GetExtHash() *Hash

func (*Output) GetOrdinal

func (m *Output) GetOrdinal() uint64

func (*Output) GetSource

func (m *Output) GetSource() *ValueSource

func (*Output) ProtoMessage

func (*Output) ProtoMessage()

func (*Output) Reset

func (m *Output) Reset()

func (*Output) String

func (m *Output) String() string

type Program

type Program struct {
	VmVersion uint64 `protobuf:"varint,1,opt,name=vm_version,json=vmVersion" json:"vm_version,omitempty"`
	Code      []byte `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
}

func (*Program) Descriptor

func (*Program) Descriptor() ([]byte, []int)

func (*Program) GetCode

func (m *Program) GetCode() []byte

func (*Program) GetVmVersion

func (m *Program) GetVmVersion() uint64

func (*Program) ProtoMessage

func (*Program) ProtoMessage()

func (*Program) Reset

func (m *Program) Reset()

func (*Program) String

func (m *Program) String() string

type Retirement

type Retirement struct {
	Source  *ValueSource `protobuf:"bytes,1,opt,name=source" json:"source,omitempty"`
	Data    *Hash        `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
	ExtHash *Hash        `protobuf:"bytes,3,opt,name=ext_hash,json=extHash" json:"ext_hash,omitempty"`
	Ordinal uint64       `protobuf:"varint,4,opt,name=ordinal" json:"ordinal,omitempty"`
}

func NewRetirement

func NewRetirement(source *ValueSource, data *Hash, ordinal uint64) *Retirement

NewRetirement creates a new Retirement.

func (*Retirement) Descriptor

func (*Retirement) Descriptor() ([]byte, []int)

func (*Retirement) GetData

func (m *Retirement) GetData() *Hash

func (*Retirement) GetExtHash

func (m *Retirement) GetExtHash() *Hash

func (*Retirement) GetOrdinal

func (m *Retirement) GetOrdinal() uint64

func (*Retirement) GetSource

func (m *Retirement) GetSource() *ValueSource

func (*Retirement) ProtoMessage

func (*Retirement) ProtoMessage()

func (*Retirement) Reset

func (m *Retirement) Reset()

func (*Retirement) String

func (m *Retirement) String() string

type Spend

type Spend struct {
	SpentOutputId      *Hash             `protobuf:"bytes,1,opt,name=spent_output_id,json=spentOutputId" json:"spent_output_id,omitempty"`
	Data               *Hash             `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
	ExtHash            *Hash             `protobuf:"bytes,3,opt,name=ext_hash,json=extHash" json:"ext_hash,omitempty"`
	WitnessDestination *ValueDestination `protobuf:"bytes,4,opt,name=witness_destination,json=witnessDestination" json:"witness_destination,omitempty"`
	WitnessArguments   [][]byte          `protobuf:"bytes,5,rep,name=witness_arguments,json=witnessArguments,proto3" json:"witness_arguments,omitempty"`
	WitnessAnchoredId  *Hash             `protobuf:"bytes,6,opt,name=witness_anchored_id,json=witnessAnchoredId" json:"witness_anchored_id,omitempty"`
	Ordinal            uint64            `protobuf:"varint,7,opt,name=ordinal" json:"ordinal,omitempty"`
}

func NewSpend

func NewSpend(spentOutputID *Hash, data *Hash, ordinal uint64) *Spend

NewSpend creates a new Spend.

func (*Spend) Descriptor

func (*Spend) Descriptor() ([]byte, []int)

func (*Spend) GetData

func (m *Spend) GetData() *Hash

func (*Spend) GetExtHash

func (m *Spend) GetExtHash() *Hash

func (*Spend) GetOrdinal

func (m *Spend) GetOrdinal() uint64

func (*Spend) GetSpentOutputId

func (m *Spend) GetSpentOutputId() *Hash

func (*Spend) GetWitnessAnchoredId

func (m *Spend) GetWitnessAnchoredId() *Hash

func (*Spend) GetWitnessArguments

func (m *Spend) GetWitnessArguments() [][]byte

func (*Spend) GetWitnessDestination

func (m *Spend) GetWitnessDestination() *ValueDestination

func (*Spend) ProtoMessage

func (*Spend) ProtoMessage()

func (*Spend) Reset

func (m *Spend) Reset()

func (*Spend) SetAnchored

func (s *Spend) SetAnchored(id *Hash)

func (*Spend) SetDestination

func (s *Spend) SetDestination(id *Hash, val *AssetAmount, pos uint64)

func (*Spend) String

func (m *Spend) String() string

type TimeRange

type TimeRange struct {
	MinTimeMs uint64 `protobuf:"varint,1,opt,name=min_time_ms,json=minTimeMs" json:"min_time_ms,omitempty"`
	MaxTimeMs uint64 `protobuf:"varint,2,opt,name=max_time_ms,json=maxTimeMs" json:"max_time_ms,omitempty"`
	ExtHash   *Hash  `protobuf:"bytes,3,opt,name=ext_hash,json=extHash" json:"ext_hash,omitempty"`
}

func NewTimeRange

func NewTimeRange(minTimeMS, maxTimeMS uint64) *TimeRange

NewTimeRange creates a new TimeRange.

func (*TimeRange) Descriptor

func (*TimeRange) Descriptor() ([]byte, []int)

func (*TimeRange) GetExtHash

func (m *TimeRange) GetExtHash() *Hash

func (*TimeRange) GetMaxTimeMs

func (m *TimeRange) GetMaxTimeMs() uint64

func (*TimeRange) GetMinTimeMs

func (m *TimeRange) GetMinTimeMs() uint64

func (*TimeRange) ProtoMessage

func (*TimeRange) ProtoMessage()

func (*TimeRange) Reset

func (m *TimeRange) Reset()

func (*TimeRange) String

func (m *TimeRange) String() string

type Tx

type Tx struct {
	*TxHeader
	ID       Hash
	Entries  map[Hash]Entry
	InputIDs []Hash // 1:1 correspondence with TxData.Inputs

	// IDs of reachable entries of various kinds
	NonceIDs       []Hash
	SpentOutputIDs []Hash
}

Tx is a wrapper for the entries-based representation of a transaction.

func (*Tx) Issuance

func (tx *Tx) Issuance(id Hash) (*Issuance, error)

func (*Tx) Nonce

func (tx *Tx) Nonce(id Hash) (*Nonce, error)

func (*Tx) Output

func (tx *Tx) Output(id Hash) (*Output, error)

func (*Tx) SigHash

func (tx *Tx) SigHash(n uint32) (hash Hash)

func (*Tx) Spend

func (tx *Tx) Spend(id Hash) (*Spend, error)

func (*Tx) TimeRange

func (tx *Tx) TimeRange(id Hash) (*TimeRange, error)

type TxHeader

type TxHeader struct {
	Version   uint64  `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
	ResultIds []*Hash `protobuf:"bytes,2,rep,name=result_ids,json=resultIds" json:"result_ids,omitempty"`
	Data      *Hash   `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"`
	MinTimeMs uint64  `protobuf:"varint,4,opt,name=min_time_ms,json=minTimeMs" json:"min_time_ms,omitempty"`
	MaxTimeMs uint64  `protobuf:"varint,5,opt,name=max_time_ms,json=maxTimeMs" json:"max_time_ms,omitempty"`
	ExtHash   *Hash   `protobuf:"bytes,6,opt,name=ext_hash,json=extHash" json:"ext_hash,omitempty"`
}

func NewTxHeader

func NewTxHeader(version uint64, resultIDs []*Hash, data *Hash, minTimeMS, maxTimeMS uint64) *TxHeader

NewTxHeader creates an new TxHeader.

func (*TxHeader) Descriptor

func (*TxHeader) Descriptor() ([]byte, []int)

func (*TxHeader) GetData

func (m *TxHeader) GetData() *Hash

func (*TxHeader) GetExtHash

func (m *TxHeader) GetExtHash() *Hash

func (*TxHeader) GetMaxTimeMs

func (m *TxHeader) GetMaxTimeMs() uint64

func (*TxHeader) GetMinTimeMs

func (m *TxHeader) GetMinTimeMs() uint64

func (*TxHeader) GetResultIds

func (m *TxHeader) GetResultIds() []*Hash

func (*TxHeader) GetVersion

func (m *TxHeader) GetVersion() uint64

func (*TxHeader) ProtoMessage

func (*TxHeader) ProtoMessage()

func (*TxHeader) Reset

func (m *TxHeader) Reset()

func (*TxHeader) String

func (m *TxHeader) String() string

type ValueDestination

type ValueDestination struct {
	Ref      *Hash        `protobuf:"bytes,1,opt,name=ref" json:"ref,omitempty"`
	Value    *AssetAmount `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
	Position uint64       `protobuf:"varint,3,opt,name=position" json:"position,omitempty"`
}

func (*ValueDestination) Descriptor

func (*ValueDestination) Descriptor() ([]byte, []int)

func (*ValueDestination) GetPosition

func (m *ValueDestination) GetPosition() uint64

func (*ValueDestination) GetRef

func (m *ValueDestination) GetRef() *Hash

func (*ValueDestination) GetValue

func (m *ValueDestination) GetValue() *AssetAmount

func (*ValueDestination) ProtoMessage

func (*ValueDestination) ProtoMessage()

func (*ValueDestination) Reset

func (m *ValueDestination) Reset()

func (*ValueDestination) String

func (m *ValueDestination) String() string

type ValueSource

type ValueSource struct {
	Ref      *Hash        `protobuf:"bytes,1,opt,name=ref" json:"ref,omitempty"`
	Value    *AssetAmount `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
	Position uint64       `protobuf:"varint,3,opt,name=position" json:"position,omitempty"`
}

func (*ValueSource) Descriptor

func (*ValueSource) Descriptor() ([]byte, []int)

func (*ValueSource) GetPosition

func (m *ValueSource) GetPosition() uint64

func (*ValueSource) GetRef

func (m *ValueSource) GetRef() *Hash

func (*ValueSource) GetValue

func (m *ValueSource) GetValue() *AssetAmount

func (*ValueSource) ProtoMessage

func (*ValueSource) ProtoMessage()

func (*ValueSource) Reset

func (m *ValueSource) Reset()

func (*ValueSource) String

func (m *ValueSource) String() string

Directories

Path Synopsis
Package bctest provides utilities for constructing blockchain data structures.
Package bctest provides utilities for constructing blockchain data structures.

Jump to

Keyboard shortcuts

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