chaincode

package
v0.0.0-...-169a2f2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallContext

type CallContext interface {
	Sender() []byte
	BlockHash() []byte
	BlockHeight() uint64
	Input() []byte

	GetState(key []byte) []byte
	SetState(key, value []byte)
}

type Chaincode

type Chaincode interface {
	// called when chaincode is deployed
	Init(ctx CallContext) error

	Invoke(ctx CallContext) error

	Query(ctx CallContext) ([]byte, error)
}

all chaincodes implements Chaincode interface

type MockCallContext

type MockCallContext struct {
	MockSender      []byte
	MockBlockHeight uint64
	MockBlockHash   []byte
	MockInput       []byte
	*MockState
}

func (*MockCallContext) BlockHash

func (wc *MockCallContext) BlockHash() []byte

func (*MockCallContext) BlockHeight

func (wc *MockCallContext) BlockHeight() uint64

func (*MockCallContext) Input

func (wc *MockCallContext) Input() []byte

func (*MockCallContext) Sender

func (wc *MockCallContext) Sender() []byte

type MockState

type MockState struct {
	StateMap    map[string][]byte
	VerifyError error
}

func NewMockState

func NewMockState() *MockState

func (*MockState) GetState

func (ms *MockState) GetState(key []byte) []byte

func (*MockState) SetState

func (ms *MockState) SetState(key, value []byte)

func (*MockState) VerifyState

func (ms *MockState) VerifyState(key []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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