Documentation ¶
Index ¶
- Constants
- Variables
- type AmperKernel
- type ChainRegister
- type DeployMethod
- type GetMethod
- type KContext
- type Kernel
- func (k *Kernel) CreateBlockChain(name string, data []byte) error
- func (k *Kernel) Finalize(blockid []byte) error
- func (k *Kernel) GetCryptoType(data []byte) (string, error)
- func (k *Kernel) GetKVEngineType(data []byte) (string, error)
- func (k *Kernel) GetVATWhiteList() map[string]bool
- func (k *Kernel) GetVerifiableAutogenTx(blockHeight int64, maxCount int, timestamp int64) ([]*pb.Transaction, error)
- func (k *Kernel) Init(path string, log log.Logger, register ChainRegister, bcName string)
- func (k *Kernel) ReadOutput(desc *contract.TxDesc) (contract.ContractOutputInterface, error)
- func (k *Kernel) RemoveBlockChainData(name string) error
- func (k *Kernel) Rollback(desc *contract.TxDesc) error
- func (k *Kernel) Run(desc *contract.TxDesc) error
- func (k *Kernel) SetContext(context *contract.TxContext) error
- func (k *Kernel) SetMinNewChainAmount(amount string)
- func (k *Kernel) SetNewChainWhiteList(whiteList map[string]bool)
- func (k *Kernel) Stop()
- type Method
- type NewAccountMethod
- type SetAccountACLMethod
- type SetMethod
- type SetMethodACLMethod
Constants ¶
const ModuleName = "xkernel"
ModuleName moudle name
Variables ¶
var ( // ErrBlockChainExist is returned when create an existed block chain ErrBlockChainExist = errors.New("BlockChain Exist") // ErrCreateBlockChain is returned when create block chain error ErrCreateBlockChain = errors.New("Create BlockChain error") // ErrMethodNotImplemented is returned when calling a nonexisted kernel method ErrMethodNotImplemented = errors.New("Method not implemented") // ErrNoEnoughUTXO is returned when has no enough money to create new chain ErrNoEnoughUTXO = errors.New("No enough money to create new chain") // ErrAddrNotInWhiteList is returned when address not in whitelist ErrAddrNotInWhiteList = errors.New("Address not in white list") // ErrPermissionDenied is returned when has no permission to call contract ErrPermissionDenied = errors.New("Permission denied to call this contract") // ErrInvalidChainName is returned when chain name is invalid ErrInvalidChainName = errors.New("Invalid Chain name") )
Functions ¶
This section is empty.
Types ¶
type AmperKernel ¶
type AmperKernel struct {
// contains filtered or unexported fields
}
AmperKernel define kernel contract method type
func NewKernel ¶
func NewKernel(vmm *wasm.VMManager) (*AmperKernel, error)
NewKernel new an instance of AmperKernel, initialized with kernel contract method
func (*AmperKernel) NewContext ¶
func (xk *AmperKernel) NewContext(ctxCfg *contract.ContextConfig) (contract.Context, error)
NewContext new a context, initialized with KernelContext
type ChainRegister ¶
type ChainRegister interface { RegisterBlockChain(name string) error UnloadBlockChain(name string) error }
ChainRegister register blockchains
type DeployMethod ¶
type DeployMethod struct {
// contains filtered or unexported fields
}
DeployMethod define Deploy type
type KContext ¶
type KContext struct { ResourceLimit contract.Limits ModelCache *xmodel.XMCache Initiator string AuthRequire []string ContextConfig *contract.ContextConfig // contains filtered or unexported fields }
KContext define kernel contract context type
func (*KContext) AddResourceUsed ¶
func (*KContext) AddXFeeUsed ¶
AddGasUsed set gas used when invoking kernel contract method
func (*KContext) ResourceUsed ¶
type Kernel ¶
type Kernel struct {
// contains filtered or unexported fields
}
Kernel is the kernel contract
func (*Kernel) CreateBlockChain ¶
CreateBlockChain create a new block chain from amper.json
func (*Kernel) GetCryptoType ¶
GetCryptoType get crypto type from amper.json
func (*Kernel) GetKVEngineType ¶
GetKVEngineType get kv engine type from amper.json
func (*Kernel) GetVATWhiteList ¶
GetVATWhiteList 实现VAT接口
func (*Kernel) GetVerifiableAutogenTx ¶
func (k *Kernel) GetVerifiableAutogenTx(blockHeight int64, maxCount int, timestamp int64) ([]*pb.Transaction, error)
GetVerifiableAutogenTx 实现VAT接口
func (*Kernel) ReadOutput ¶
ReadOutput implements ContractInterface
func (*Kernel) RemoveBlockChainData ¶
RemoveBlockChainData remove all the data associate to the named blockchain
func (*Kernel) SetContext ¶
SetContext implements ContractInterface
func (*Kernel) SetMinNewChainAmount ¶
SetMinNewChainAmount set the minimum amount of token to create a block chain
func (*Kernel) SetNewChainWhiteList ¶
SetNewChainWhiteList set the whitelit of address who can create new block chain
type NewAccountMethod ¶
type NewAccountMethod struct { }
NewAccountMethod define NewAccountMethod type
type SetAccountACLMethod ¶
type SetAccountACLMethod struct { }
SetAccountACLMethod define SetAccountACLMethod type
type SetMethodACLMethod ¶
type SetMethodACLMethod struct { }
SetMethodACLMethod define SetMethodACLMethod type