Documentation
¶
Index ¶
- Constants
- func BigPow(a, b int64) *big.Int
- func Bytes2PublicKey(pub []byte) *ecdsa.PublicKey
- func CalculatorInitialization(pp *big.Int, order *big.Int, t int64)
- func DecodePrivateKeyFromHexString(hexString string) (*ecdsa.PrivateKey, error)
- func GenerateGenesisParams() (*common.GenesisParams, error)
- func GenerateParams() (*big.Int, *big.Int, error)
- func PublicKey2Bytes(pub *ecdsa.PublicKey) []byte
- func PublicKeyBytes2Address(pubBytes [33]byte) [20]byte
- func VRFCalculate(curve elliptic.Curve, msg []byte) ([]byte, *big.Int, *big.Int, error)
- func VRFCheckLocalConsensus(vdfOutput []byte) (bool, error)
- func VRFCheckOutputConsensus(randomOutput []byte, local bool) bool
- func VRFCheckRemoteConsensus(key *ecdsa.PublicKey, vdfMsg []byte, s *big.Int, t *big.Int, value []byte) (bool, error)
- func VRFVerify(curve elliptic.Curve, key *ecdsa.PublicKey, msg []byte, s *big.Int, t *big.Int, ...) (bool, error)
- type Calculator
Constants ¶
View Source
const ( // todo: 作为参数写入到创世区块 ConsensusFloor = 0.0 // 共识要求的最低概率 )
Variables ¶
This section is empty.
Functions ¶
func Bytes2PublicKey ¶
func DecodePrivateKeyFromHexString ¶
func DecodePrivateKeyFromHexString(hexString string) (*ecdsa.PrivateKey, error)
func GenerateGenesisParams ¶
func GenerateGenesisParams() (*common.GenesisParams, error)
GenerateGenesisParams 打包 VDF 计算参数
func GenerateParams ¶
GenerateParams 用于生成计算参数,返回 order(n), proof_param
func PublicKey2Bytes ¶
func PublicKeyBytes2Address ¶
func VRFCalculate ¶
func VRFCheckLocalConsensus ¶
VRFCheckLocalConsensus 检查当前节点是否是一个共识节点
func VRFCheckOutputConsensus ¶
VRFCheckOutputConsensus 检查一个 VRF 的输出是否满足共识
Types ¶
type Calculator ¶
type Calculator struct {
// contains filtered or unexported fields
}
func GetCalculatorInstance ¶
func GetCalculatorInstance() *Calculator
GetCalculatorInstance 所有的对 VDF 计算类的操作必须从这里获取实例
func (*Calculator) AppendNewSeed ¶
func (c *Calculator) AppendNewSeed(seed *big.Int, proof *big.Int)
AppendNewSeed 在计算运行时修改此时的运行参数
func (*Calculator) GetSeedParams ¶
GetSeedParams 读取计算信息,如果channel中有数据则优先获取
func (*Calculator) Verify ¶
Verify 验证 VDF 计算结果 result == pi^l * seed^s 具体细节见论文 - Simple Verifiable Delay Functions
func (*Calculator) VerifyBlockVDF ¶
Click to show internal directories.
Click to hide internal directories.