- go版本chia签名, 参考python-impl实现部分功能,并非bls的完全实现
-
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 withbig.Int.FillBytes()
- This bug was caused by the wrong use of
- 生成私钥
- 助记词
- seed
- hexString
- bytes
- 签名
- 验签
- 多签
- 多签验证
go get github.com/chuwt/chia-bls-go
- 助记词加载
func KeyGenWithMnemonic(mnemonic, password string) PrivateKey
- hex string加载
func KeyFromHexString(key string) (PrivateKey, error)
- bytes加载
func KeyFromHexString(key string) (PrivateKey, error)
- 生成bytes
func (key PrivateKey) Bytes() []byte
- 生成hex string
func (key PrivateKey) Hex() string
- 派生farmerSk
func (key PrivateKey) FarmerSk() PrivateKey
- 派生poolSk
func (key PrivateKey) PoolSk() PrivateKey
- 派生walletSk
func (key PrivateKey) WalletSk(index int) PrivateKey
- 派生localSk
func (key PrivateKey) LocalSk() PrivateKey
- 生成SyntheticSk
func (key PrivateKey) SyntheticSk(hiddenPuzzleHash []byte) PrivateKey
- 生成公钥
func (key PrivateKey) GetPublicKey() PublicKey
- 生成指纹(fingerprint)
func (key PublicKey) FingerPrint() string
- 生成bytes
func (key PublicKey) Bytes() []byte
- 生成hex string
func (key PublicKey) Hex() string
- 签名
func (asm *AugSchemeMPL) Sign(sk PrivateKey, message []byte)
- 验证
func (asm *AugSchemeMPL) Verify(pk PublicKey, message []byte, sig []byte) bool
- 多签
// 将多个签名联合在一起
func (asm *AugSchemeMPL) Aggregate(signatures ...[]byte) ([]byte, error)
- 多签验证
// 公钥数组,原始信息数组,多签返回的数据
func (asm *AugSchemeMPL) AggregateVerify(pks [][]byte, messages [][]byte, sig []byte) bool
- 前置公钥签名
// 前置公钥签名
SignWithPrependPK(sk PrivateKey, prependPK PublicKey, message []byte)