privval

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPoP

func BuildPoP(valPrivKey tmcrypto.PrivKey, blsPrivkey bls12381.PrivateKey) (*types.ProofOfPossession, error)

BuildPoP builds a proof-of-possession by PoP=sign(key = BLS_sk, data = sign(key = Ed25519_sk, data = BLS_pk)) where valPrivKey is Ed25519_sk and blsPrivkey is BLS_sk

Types

type ValidatorKeys

type ValidatorKeys struct {
	ValPubkey tmcrypto.PubKey
	BlsPubkey bls12381.PublicKey
	PoP       *types.ProofOfPossession
	// contains filtered or unexported fields
}

func NewValidatorKeys

func NewValidatorKeys(valPrivkey tmcrypto.PrivKey, blsPrivKey bls12381.PrivateKey) (*ValidatorKeys, error)

type WrappedFilePV

type WrappedFilePV struct {
	Key           WrappedFilePVKey
	LastSignState privval.FilePVLastSignState
}

WrappedFilePV wraps FilePV with WrappedFilePVKey.

func GenWrappedFilePV

func GenWrappedFilePV(keyFilePath, stateFilePath string) *WrappedFilePV

GenWrappedFilePV generates a new validator with randomly generated private key and sets the filePaths, but does not call Save().

func LoadOrGenWrappedFilePV

func LoadOrGenWrappedFilePV(keyFilePath, stateFilePath string) *WrappedFilePV

LoadOrGenWrappedFilePV loads a FilePV from the given filePaths or else generates a new one and saves it to the filePaths.

func LoadWrappedFilePV

func LoadWrappedFilePV(keyFilePath, stateFilePath string) *WrappedFilePV

LoadWrappedFilePV loads a FilePV from the filePaths. The FilePV handles double signing prevention by persisting data to the stateFilePath. If either file path does not exist, the program will exit.

func LoadWrappedFilePVEmptyState

func LoadWrappedFilePVEmptyState(keyFilePath, stateFilePath string) *WrappedFilePV

LoadWrappedFilePVEmptyState loads a FilePV from the given keyFilePath, with an empty LastSignState. If the keyFilePath does not exist, the program will exit.

func NewWrappedFilePV

func NewWrappedFilePV(privKey tmcrypto.PrivKey, blsPrivKey bls12381.PrivateKey, keyFilePath, stateFilePath string) *WrappedFilePV

NewWrappedFilePV wraps FilePV

func (*WrappedFilePV) Clean

func (pv *WrappedFilePV) Clean(keyFilePath, stateFilePath string)

Clean removes PVKey file and PVState file

func (*WrappedFilePV) ExportGenBls

func (pv *WrappedFilePV) ExportGenBls(filePath string) (outputFileName string, err error)

ExportGenBls writes a {address, bls_pub_key, pop, and pub_key} into a json file

func (*WrappedFilePV) GetAddress

func (pv *WrappedFilePV) GetAddress() sdk.ValAddress

GetAddress returns the delegator address of the validator. Implements PrivValidator.

func (*WrappedFilePV) GetBlsPrivKey

func (pv *WrappedFilePV) GetBlsPrivKey() bls12381.PrivateKey

func (*WrappedFilePV) GetBlsPubkey

func (pv *WrappedFilePV) GetBlsPubkey() (bls12381.PublicKey, error)

func (*WrappedFilePV) GetPubKey

func (pv *WrappedFilePV) GetPubKey() (tmcrypto.PubKey, error)

GetPubKey returns the public key of the validator. Implements PrivValidator.

func (*WrappedFilePV) GetValPrivKey

func (pv *WrappedFilePV) GetValPrivKey() tmcrypto.PrivKey

func (*WrappedFilePV) Reset

func (pv *WrappedFilePV) Reset()

Reset resets all fields in the FilePV. NOTE: Unsafe!

func (*WrappedFilePV) Save

func (pv *WrappedFilePV) Save()

Save persists the FilePV to disk.

func (*WrappedFilePV) SetAccAddress

func (pv *WrappedFilePV) SetAccAddress(addr sdk.AccAddress)

func (*WrappedFilePV) SignMsgWithBls

func (pv *WrappedFilePV) SignMsgWithBls(msg []byte) (bls12381.Signature, error)

func (*WrappedFilePV) String

func (pv *WrappedFilePV) String() string

String returns a string representation of the FilePV.

type WrappedFilePVKey

type WrappedFilePVKey struct {
	DelegatorAddress string              `json:"acc_address"`
	Address          types.Address       `json:"address"`
	PubKey           tmcrypto.PubKey     `json:"pub_key"`
	PrivKey          tmcrypto.PrivKey    `json:"priv_key"`
	BlsPubKey        bls12381.PublicKey  `json:"bls_pub_key"`
	BlsPrivKey       bls12381.PrivateKey `json:"bls_priv_key"`
	// contains filtered or unexported fields
}

WrappedFilePVKey wraps FilePVKey with BLS keys.

func (WrappedFilePVKey) Save

func (pvKey WrappedFilePVKey) Save()

Save persists the FilePVKey to its filePath.

Jump to

Keyboard shortcuts

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