utils

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrgName  = "sedaprotocol"
	RepoName = "seda-networks"
)
View Source
const VRFKeyFileName = "vrf_key.json"

Variables

This section is empty.

Functions

func DisplayInfo

func DisplayInfo(info PrintInfo) error

func DownloadGitFiles

func DownloadGitFiles(path, downloadPath string) error

func InitializeVRFKey

func InitializeVRFKey(config *cfg.Config) (vrfPubKey sdkcrypto.PubKey, err error)

func PrivValidatorKeyFileToVRFKeyFile

func PrivValidatorKeyFileToVRFKeyFile(pvFile string) string

PrivValidatorKeyFileToVRFKeyFile returns the path to the VRF key file given a path to the private validator key file. The two files should be placed in the same directory.

Types

type GitFile

type GitFile struct {
	Name string `json:"name"`
	Path string `json:"path"`
	URL  string `json:"download_url"`
	Type string `json:"type"`
}

type PrintInfo added in v0.0.6

type PrintInfo struct {
	Moniker string `json:"moniker" yaml:"moniker"`
	ChainID string `json:"chain_id" yaml:"chain_id"`
	NodeID  string `json:"node_id" yaml:"node_id"`
	Seeds   string `json:"seeds" yaml:"seeds"`
}

func NewPrintInfo

func NewPrintInfo(moniker, chainID, nodeID, seeds string) PrintInfo

type VRFKey

type VRFKey struct {
	Address types.Address    `json:"address"`
	PubKey  sdkcrypto.PubKey `json:"pub_key"`
	PrivKey crypto.PrivKey   `json:"priv_key"`
	// contains filtered or unexported fields
}

func LoadOrGenVRFKey

func LoadOrGenVRFKey(keyFilePath string) (*VRFKey, error)

LoadOrGenVRFKey loads a VRFKey from the given file path or else generates a new one and saves it to the file path.

func LoadVRFKey

func LoadVRFKey(keyFilePath string) (*VRFKey, error)

func NewVRFKey

func NewVRFKey(privKey crypto.PrivKey, keyFilePath string) (*VRFKey, error)

NewVRFKey generates a new VRFKey from the given key and key file path.

func (*VRFKey) IsNil

func (v *VRFKey) IsNil() bool

func (VRFKey) Save

func (v VRFKey) Save() error

Save persists the VRFKey to its filePath.

func (*VRFKey) SignTransaction

func (v *VRFKey) SignTransaction(
	ctx sdk.Context, txBuilder client.TxBuilder, txConfig client.TxConfig,
	signMode txsigning.SignMode, account sdk.AccountI,
) (txsigning.SignatureV2, error)

SignTransaction signs a given transaction with the VRF key and returns the resulting signature. The given account must belong to the VRF key.

func (*VRFKey) VRFProve

func (v *VRFKey) VRFProve(alpha []byte) (pi, beta []byte, err error)

VRFProve uses the VRF key to compute the VRF hash output (beta) and the proof that it was computed correctly (pi).

func (*VRFKey) VRFVerify

func (v *VRFKey) VRFVerify(publicKey, alpha, pi []byte) (beta []byte, err error)

VRFVerify verifies that beta is the correct VRF hash of the alpha under private key associated with the given public key. It also outputs the hash output beta.

Jump to

Keyboard shortcuts

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