{"modulePath":"github.com/chainopen/matrixchaincode","version":"v0.0.0-20190924071332-ddf2b42e220f","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package baseinterface\n\nCopyright (c) 2018 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php)\n\nCopyright (c) 2018 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php)\n\nCopyright (c) 2018 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php)\n\n## Constants\n\n```go\nconst (\n\tModuleElection   = \"选举模块\"\n\tDefaultElectPlug = \"layered\"\n)\n```\n\n```go\nconst (\n\tModuleRandom = \"随机数接口服务\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\tDefaultVrfPlug = \"withHash\"\n)\n```\n\n## Functions\n\n```go\nfunc RegElectPlug(name string, value func() ElectionInterface)\n```\n\n```go\nfunc RegRandom(name string, fun func(string, RandomChainSupport) (RandomSubService, error))\n```\n\n```go\nfunc RegVrf(name string, value func() VrfInterface)\n```\n\n## Types\n\n```go\ntype ChainReader interface {\n\t// Config retrieves the blockchain's chain configuration.\n\tConfig() *params.ChainConfig\n\n\t// CurrentHeader retrieves the current header from the local chain.\n\tCurrentHeader() *types.Header\n\n\t// GetHeader retrieves a block header from the database by hash and number.\n\tGetHeader(hash common.Hash, number uint64) *types.Header\n\n\t// GetHeaderByNumber retrieves a block header from the database by number.\n\tGetHeaderByNumber(number uint64) *types.Header\n\n\t// GetHeaderByHash retrieves a block header from the database by its hash.\n\tGetHeaderByHash(hash common.Hash) *types.Header\n\n\tGetBlockByNumber(number uint64) *types.Block\n\tGetAncestorHash(sonHash common.Hash, ancestorNumber uint64) (common.Hash, error)\n\t// GetBlock retrieves a block sfrom the database by hash and number.\n\tGetBlock(hash common.Hash, number uint64) *types.Block\n\tStateAt(root []common.CoinRoot) (*state.StateDBManage, error)\n\tState() (*state.StateDBManage, error)\n\tStateAtNumber(number uint64) (*state.StateDBManage, error)\n\tStateAtBlockHash(hash common.Hash) (*state.StateDBManage, error)\n\tGetSuperBlockNum() (uint64, error)\n\tGetGraphByState(state matrixstate.StateDB) (*mc.TopologyGraph, *mc.ElectGraph, error)\n}\n```\n\n```go\ntype ElectionInterface interface {\n\tMinerTopGen(*mc.MasterMinerReElectionReqMsg) *mc.MasterMinerReElectionRsp\n\tValidatorTopGen(*mc.MasterValidatorReElectionReqMsg, *state.StateDBManage) *mc.MasterValidatorReElectionRsq\n\tToPoUpdate(support.AllNative, *mc.TopologyGraph) []mc.Alternative\n}\n```\n\n```go\nfunc NewElect(ElectPlugs string) ElectionInterface\n```\n\n```go\ntype Random struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewRandom(bc ChainReader) (*Random, error)\n```\n\n```go\nfunc (self *Random) GetRandom(hash common.Hash, Type string) (*big.Int, error)\n```\n\n```go\nfunc (self *Random) Stop()\n```\n\n```go\ntype RandomChain struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (self *RandomChain) BlockChain() ChainReader\n```\n\n```go\ntype RandomChainSupport interface {\n\tBlockChain() ChainReader\n}\n```\n\n```go\ntype RandomSubService interface {\n\tPrepare(uint64, common.Hash) error\n\tCalcData(data common.Hash) (*big.Int, error)\n}\n```\n\n```go\ntype VrfInterface interface {\n\tComputeVrf(*ecdsa.PrivateKey, []byte) ([]byte, []byte, error)\n\tDecodeVrf(header *types.Header, preHeader *types.Header) (common.Address, error)\n\tGetVrfInfoFromHeader([]byte) ([]byte, []byte, []byte)\n\tGetHeaderVrf([]byte, []byte, []byte) []byte\n}\n```\nfunc (self \\*vrfWithHash)verifyVrf(pk \\*ecdsa.PublicKey,  prevVrf, newVrf, proof \\[]byte) error { func(self \\*vrfWithHash) computeVrf(sk \\*ecdsa.PrivateKey,prevVrf \\[]byte) (\\[]byte, \\[]byte, error) {\n\n```go\nfunc NewVrf() VrfInterface\n```\n\n","path":"github.com/chainopen/matrixchaincode/baseinterface","name":"baseinterface","synopsis":"","isRedistributable":true}
