repositorypackage
1.0.3
Repository: https://github.com/cnc-project/cnc-bls.git
Documentation: pkg.go.dev
# Packages
No description provided by the author
# README
cnc-bls
bls lib for golang
Feature
- generate private key
- mnemonic
- seed
- hexString
- bytes
- sign
- sign verify
- multiple sign
- multiple sign verify
install
go get github.com/cnc-project/cnc-bls
instructions for use
Example
package main
import (
"fmt"
cb "github.com/cnc-project/cnc-bls"
)
func main(){
// Generate a mnemonic for memorization or user-friendly seeds
entropy, _ := cb.NewEntropy()
mnemonic, _ := cb.NewMnemonic(entropy)
// Generate a Bip32 HD wallet for the mnemonic and a user supplied password
seed := cb.NewSeed(mnemonic, "Secret Passphrase")
priKey := cb.KeyGen(seed)
publicKey := priKey.GetPublicKey()
// Display mnemonic and keys
fmt.Println("Mnemonic: ", mnemonic)
fmt.Println("Master private key: ", priKey)
fmt.Println("Master public key: ", publicKey)
fmt.Println("Master generate fingerprint", publicKey.FingerPrint())
}
load private key
- mnemonic loading
func KeyGenWithMnemonic(mnemonic, password string) PrivateKey
- load hex string
func KeyFromHexString(key string) (PrivateKey, error)
- load bytes
func KeyFromHexString(key string) (PrivateKey, error)
PrivateKey
- generate bytes
func (key PrivateKey) Bytes() []byte
- generate hex string
func (key PrivateKey) Hex() string
- derive farmerSk
func (key PrivateKey) FarmerSk() PrivateKey
- derive poolSk
func (key PrivateKey) PoolSk() PrivateKey
- derive walletSk
func (key PrivateKey) WalletSk(index int) PrivateKey
- derive localSk
func (key PrivateKey) LocalSk() PrivateKey
- generate SyntheticSk
func (key PrivateKey) SyntheticSk(hiddenPuzzleHash []byte) PrivateKey
- generate public key
func (key PrivateKey) GetPublicKey() PublicKey
PublicKey
- generate fingerprint
func (key PublicKey) FingerPrint() string
- generate bytes
func (key PublicKey) Bytes() []byte
- generate hex string
func (key PublicKey) Hex() string
Signature
- sign
func (asm *AugSchemeMPL) Sign(sk PrivateKey, message []byte)
- verify
func (asm *AugSchemeMPL) Verify(pk PublicKey, message []byte, sig []byte) bool
- multiple sign
// Combine multiple signatures together
func (asm *AugSchemeMPL) Aggregate(signatures ...[]byte) ([]byte, error)
- multiple sign verify
// Public key array, original information array, data returned by multi-signature
func (asm *AugSchemeMPL) AggregateVerify(pks [][]byte, messages [][]byte, sig []byte) bool