Categorygithub.com/cnc-project/cnc-bls
modulepackage
1.0.3
Repository: https://github.com/cnc-project/cnc-bls.git
Documentation: pkg.go.dev

# 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

  1. mnemonic loading
func KeyGenWithMnemonic(mnemonic, password string) PrivateKey
  1. load hex string
func KeyFromHexString(key string) (PrivateKey, error)
  1. load bytes
func KeyFromHexString(key string) (PrivateKey, error)

PrivateKey

  1. generate bytes
func (key PrivateKey) Bytes() []byte
  1. generate hex string
func (key PrivateKey) Hex() string
  1. derive farmerSk
func (key PrivateKey) FarmerSk() PrivateKey
  1. derive poolSk
func (key PrivateKey) PoolSk() PrivateKey 
  1. derive walletSk
func (key PrivateKey) WalletSk(index int) PrivateKey
  1. derive localSk
func (key PrivateKey) LocalSk() PrivateKey
  1. generate SyntheticSk
func (key PrivateKey) SyntheticSk(hiddenPuzzleHash []byte) PrivateKey
  1. generate public key
func (key PrivateKey) GetPublicKey() PublicKey

PublicKey

  1. generate fingerprint
func (key PublicKey) FingerPrint() string
  1. generate bytes
func (key PublicKey) Bytes() []byte
  1. generate hex string
func (key PublicKey) Hex() string

Signature

  1. sign
func (asm *AugSchemeMPL) Sign(sk PrivateKey, message []byte)
  1. verify
func (asm *AugSchemeMPL) Verify(pk PublicKey, message []byte, sig []byte) bool
  1. multiple sign
// Combine multiple signatures together
func (asm *AugSchemeMPL) Aggregate(signatures ...[]byte) ([]byte, error)
  1. 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

# Packages

No description provided by the author

# Functions

CalculatePlotFilterInput return [32]byte.
CalculatePlotIdPh return [32]byte.
CalculatePlotIdPk return [32]byte.
CalculatePosChallenge return [32]byte.
No description provided by the author
CreateZeroSign creates a zero signature, used as placeholder in filecoin.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author