Coder Social home page Coder Social logo

chia-bls-go's Introduction

chia-bls-go

  • go版本chia签名, 参考python-impl实现部分功能,并非bls的完全实现

Bug fix

  • 2024/01/18 Thanks for the code from coolaj86, a bug for checking length of pks on coreAggregateVerify was fixed!

  • 2023/07/08 Thanks for the report from goomario, a bug was fixed!

    • This bug was caused by the wrong use of big.Int.Bytes(), it should be replaced with big.Int.FillBytes()

主要功能

  • 生成私钥
    • 助记词
    • seed
    • hexString
    • bytes
  • 签名
  • 验签
  • 多签
  • 多签验证

安装说明

go get github.com/chuwt/chia-bls-go

使用说明

加载私钥

  1. 助记词加载
func KeyGenWithMnemonic(mnemonic, password string) PrivateKey
  1. hex string加载
func KeyFromHexString(key string) (PrivateKey, error)
  1. bytes加载
func KeyFromHexString(key string) (PrivateKey, error)

私钥

  1. 生成bytes
func (key PrivateKey) Bytes() []byte
  1. 生成hex string
func (key PrivateKey) Hex() string
  1. 派生farmerSk
func (key PrivateKey) FarmerSk() PrivateKey
  1. 派生poolSk
func (key PrivateKey) PoolSk() PrivateKey 
  1. 派生walletSk
func (key PrivateKey) WalletSk(index int) PrivateKey
  1. 派生localSk
func (key PrivateKey) LocalSk() PrivateKey
  1. 生成SyntheticSk
func (key PrivateKey) SyntheticSk(hiddenPuzzleHash []byte) PrivateKey
  1. 生成公钥
func (key PrivateKey) GetPublicKey() PublicKey

公钥

  1. 生成指纹(fingerprint)
func (key PublicKey) FingerPrint() string
  1. 生成bytes
func (key PublicKey) Bytes() []byte
  1. 生成hex string
func (key PublicKey) Hex() string

签名

  1. 签名
func (asm *AugSchemeMPL) Sign(sk PrivateKey, message []byte)
  1. 验证
func (asm *AugSchemeMPL) Verify(pk PublicKey, message []byte, sig []byte) bool
  1. 多签
// 将多个签名联合在一起
func (asm *AugSchemeMPL) Aggregate(signatures ...[]byte) ([]byte, error)
  1. 多签验证
// 公钥数组,原始信息数组,多签返回的数据
func (asm *AugSchemeMPL) AggregateVerify(pks [][]byte, messages [][]byte, sig []byte) bool
  1. 前置公钥签名
// 前置公钥签名
SignWithPrependPK(sk PrivateKey, prependPK PublicKey, message []byte)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.