Documentation ¶
Overview ¶
Package util is a generated protocol buffer package.
It is generated from these files:
dah.proto
It has these top-level messages:
TX
Index ¶
- func ReadVarInt(buffer *bytes.Buffer) uint64
- type ExecResult
- type InMemoryStore
- func (ims *InMemoryStore) DelState(key Key) error
- func (ims *InMemoryStore) GetState(key Key) (*TX_TXOUT, bool, error)
- func (ims *InMemoryStore) GetTran(key string) ([]byte, bool, error)
- func (ims *InMemoryStore) PutState(key Key, value *TX_TXOUT) error
- func (ims *InMemoryStore) PutTran(key string, value []byte) error
- type Key
- type Store
- type TX
- func (*TX) Descriptor() ([]byte, []int)
- func (m *TX) GetBlocks() [][]byte
- func (m *TX) GetFee() uint64
- func (m *TX) GetLockTime() uint32
- func (m *TX) GetTxin() []*TX_TXIN
- func (m *TX) GetTxout() []*TX_TXOUT
- func (m *TX) GetVersion() uint32
- func (*TX) ProtoMessage()
- func (m *TX) Reset()
- func (m *TX) String() string
- type TX_TXIN
- type TX_TXOUT
- type UTXO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExecResult ¶
ExecResult is the result of processing a transaction
type InMemoryStore ¶
InMemoryStore used for unit testing
func (*InMemoryStore) DelState ¶
func (ims *InMemoryStore) DelState(key Key) error
DelState deletes the given key and corresponding transactions
func (*InMemoryStore) GetState ¶
func (ims *InMemoryStore) GetState(key Key) (*TX_TXOUT, bool, error)
GetState returns the transaction for the given key
func (*InMemoryStore) GetTran ¶
func (ims *InMemoryStore) GetTran(key string) ([]byte, bool, error)
GetTran returns the transaction for the given hash
func (*InMemoryStore) PutState ¶
func (ims *InMemoryStore) PutState(key Key, value *TX_TXOUT) error
PutState saves the key and transaction in memory
func (*InMemoryStore) PutTran ¶
func (ims *InMemoryStore) PutTran(key string, value []byte) error
PutTran saves the hash and transaction in memory
type Key ¶
Key represents the key for a transaction in storage. It has both a hash and index
type Store ¶
type Store interface { GetState(Key) (*TX_TXOUT, bool, error) PutState(Key, *TX_TXOUT) error DelState(Key) error GetTran(string) ([]byte, bool, error) PutTran(string, []byte) error }
Store interface describes the storage used by this chaincode. The interface was created so either the state database store can be used or a in memory store can be used for unit testing.
type TX ¶
type TX struct { Version uint32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` LockTime uint32 `protobuf:"varint,2,opt,name=lockTime" json:"lockTime,omitempty"` Txin []*TX_TXIN `protobuf:"bytes,3,rep,name=txin" json:"txin,omitempty"` Txout []*TX_TXOUT `protobuf:"bytes,4,rep,name=txout" json:"txout,omitempty"` Blocks [][]byte `protobuf:"bytes,5,rep,name=blocks,proto3" json:"blocks,omitempty"` Fee uint64 `protobuf:"varint,6,opt,name=fee" json:"fee,omitempty"` }
func ParseUTXOBytes ¶
ParseUTXOBytes parses a bitcoin style transaction
type TX_TXIN ¶
type TX_TXIN struct { Ix uint32 `protobuf:"varint,1,opt,name=ix" json:"ix,omitempty"` SourceHash []byte `protobuf:"bytes,2,opt,name=sourceHash,proto3" json:"sourceHash,omitempty"` Script []byte `protobuf:"bytes,3,opt,name=script,proto3" json:"script,omitempty"` Sequence uint32 `protobuf:"varint,4,opt,name=sequence" json:"sequence,omitempty"` }
type TX_TXOUT ¶
type TX_TXOUT struct { Value uint64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` Script []byte `protobuf:"bytes,2,opt,name=script,proto3" json:"script,omitempty"` Color []byte `protobuf:"bytes,3,opt,name=color,proto3" json:"color,omitempty"` Quantity uint64 `protobuf:"varint,4,opt,name=quantity" json:"quantity,omitempty"` }
type UTXO ¶
type UTXO struct {
Store Store
}
UTXO includes the storage for the chaincode API or an in memory store for testing
func MakeUTXO ¶
MakeUTXO constructs a new UTXO with the given store
func (*UTXO) Execute ¶
func (u *UTXO) Execute(txData []byte) (*ExecResult, error)
Execute processes the given transaction and outputs a result
func (*UTXO) GetTransactionHash ¶
GetTransactionHash returns the Bitcoin hash (double sha256) of the given transaction
func (*UTXO) IsCoinbase ¶
IsCoinbase returns true if this is a coinbase transaction, false otherwise