nsb

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: LGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NSBVersion version.Protocol = 0x1
)

Variables

View Source
var (
	ContractNameNotEqual = errors.New("the name of contract to call is mismatch with providing name")
)
View Source
var (
	MethodMissing = errors.New("no corresponding function")
)

Functions

func MakeValSetChangeTx

func MakeValSetChangeTx(pubkey types.PubKey, power int64) []byte

func MustUnmarshal

func MustUnmarshal(data []byte, load interface{})

Types

type AccountInfo

type AccountInfo struct {
	Balance     *math.Uint256 `json:"balance"`
	CodeHash    []byte        `json:"code_hash"`
	StorageRoot []byte        `json:"storage_root"`
	Name        []byte        `json:"name"`
}

func (*AccountInfo) String

func (accInfo *AccountInfo) String() string

type ArgsAddAction

type ArgsAddAction struct {
	ISCAddress []byte `json:"1"`
	Tid        uint64 `json:"2"`
	Aid        uint64 `json:"3"`
	Type       uint8  `json:"4"`
	Content    []byte `json:"5"`
	Signature  []byte `json:"6"`
}

type ArgsAddActions added in v0.7.4

type ArgsAddActions struct {
	Args []ArgsAddAction `json:"1"`
}

type ArgsAddBlockCheck added in v0.7.1

type ArgsAddBlockCheck struct {
	ChainID  uint64 `json:"1"`
	BlockID  []byte `json:"2"`
	RtType   uint8  `json:"3"`
	RootHash []byte `json:"4"`
}

type ArgsGetAction

type ArgsGetAction struct {
	ISCAddress []byte `json:"1"`
	// hexbytes
	Tid uint64 `json:"2"`
	// hexbytes
	Aid uint64 `json:"3"`
}

type ArgsGetMerkleProof added in v0.7.1

type ArgsGetMerkleProof struct {
	Type     uint16 `json:"1"`
	RootHash []byte `json:"2"`
	Key      []byte `json:"3"`
	// Value    []byte `json:"4"`
	// Proof    []byte `json:"5"`
	ChainID uint64 `json:"4"`
	BlockID []byte `json:"5"`
	RtType  uint8  `json:"6"`
}

type ArgsGetStorageAt

type ArgsGetStorageAt struct {
	Address []byte `json:"1"`
	Key     []byte `json:"2"`
}

type ArgsSetBalance

type ArgsSetBalance struct {
	Value *math.Uint256 `json:"1"`
}

* storage := actionMap

type ArgsTransfer

type ArgsTransfer struct {
	Value *math.Uint256 `json:"1"`
}

type ArgsValidateMerkleProof added in v0.7.3

type ArgsValidateMerkleProof struct {
	Type     uint16 `json:"1"`
	RootHash []byte `json:"2"`
	Key      []byte `json:"3"`
	Value    []byte `json:"4"`
	Proof    []byte `json:"5"`
}

type FAPair

type FAPair struct {
	FuncName string `json:"function_name"`
	Args     []byte `json:"args"`
}

type MPTMerkleProof added in v0.7.1

type MPTMerkleProof struct {
	RootHash  []byte   `json:"r"`
	HashChain [][]byte `json:"h"`
}

type NSBApplication

type NSBApplication struct {
	types.BaseApplication

	ValUpdates []types.ValidatorUpdate
	// contains filtered or unexported fields
}

func NewNSBApplication

func NewNSBApplication(dbDir string) (*NSBApplication, error)

func (*NSBApplication) ActionRigisteredMethod

func (nsb *NSBApplication) ActionRigisteredMethod(
	env *cmn.TransactionHeader,
	frInfo *AccountInfo,
	toInfo *AccountInfo,
	funcName string,
	args []byte,
) *types.ResponseDeliverTx

func (*NSBApplication) BeginBlock

Track the block hash and header information

func (*NSBApplication) CheckTx

func (*NSBApplication) Commit

func (nsb *NSBApplication) Commit() types.ResponseCommit

func (*NSBApplication) DeliverTx

func (*NSBApplication) EndBlock

Update the validator set

func (*NSBApplication) Info

func (*NSBApplication) InitChain

Save the validators in the merkle tree

func (*NSBApplication) MerkleProofRigisteredMethod added in v0.7.1

func (nsb *NSBApplication) MerkleProofRigisteredMethod(
	env *cmn.TransactionHeader,
	frInfo *AccountInfo,
	toInfo *AccountInfo,
	funcName string,
	args []byte,
) *types.ResponseDeliverTx

func (*NSBApplication) Query

func (nsb *NSBApplication) Query(req types.RequestQuery) (ret types.ResponseQuery)
type RequestQuery struct {
    Data                 []byte   `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
    Path                 string   `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
    Height               int64    `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
    Prove                bool     `protobuf:"varint,4,opt,name=prove,proto3" json:"prove,omitempty"`
}
type ResponseQuery struct {
    Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
    // bytes data = 2; // use "value" instead.
    Log                  string        `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
    Info                 string        `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"`
    Index                int64         `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"`
    Key                  []byte        `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"`
    Value                []byte        `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"`
    Proof                *merkle.Proof `protobuf:"bytes,8,opt,name=proof" json:"proof,omitempty"`
    Height               int64         `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"`
    Codespace            string        `protobuf:"bytes,10,opt,name=codespace,proto3" json:"codespace,omitempty"`
}
type Proof struct {
    Ops                  []ProofOp `protobuf:"bytes,1,rep,name=ops" json:"ops"`
}

func (*NSBApplication) QueryIndex

func (nsb *NSBApplication) QueryIndex(req *types.RequestQuery) string

func (*NSBApplication) Revert

func (nsb *NSBApplication) Revert() error

func (*NSBApplication) SetLogger

func (nsb *NSBApplication) SetLogger(l log.Logger)

func (*NSBApplication) Stop

func (nsb *NSBApplication) Stop() (err1 error, err2 error)

func (*NSBApplication) TokenRigisteredMethod

func (nsb *NSBApplication) TokenRigisteredMethod(
	env *cmn.TransactionHeader,
	frInfo *AccountInfo,
	toInfo *AccountInfo,
	funcName string,
	args []byte,
) *types.ResponseDeliverTx

func (*NSBApplication) Validators

func (nsb *NSBApplication) Validators() (validators []types.ValidatorUpdate)

type NSBState

type NSBState struct {
	StateRoot []byte `json:"action_root"`
	Height    int64  `json:"height"`
	// contains filtered or unexported fields
}

func (*NSBState) Close

func (st *NSBState) Close() error

func (*NSBState) String

func (st *NSBState) String() string

type SimpleMerkleProof added in v0.7.1

type SimpleMerkleProof struct {
	HashChain [][]byte `json:"h"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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