Demo implementation of BLS threshold signatures using BLS12-381 curve with dual verification and support for Ethereum on-chain verification via EIP-2537 precompiles.
- BLS threshold signature scheme using BLS12-381 curve
- Dual verification using Herumi and ConsenSys implementations
- Command-line tools for key generation, signing, and verification
- Prepared for future EIP-2537 integration
Generate key pairs for threshold signing:
go run cmd/util/generate_keys.go \
-threshold 13 \
-total 20 \
-output keys.txt
Sign a message using threshold signatures:
go run cmd/main.go \
-message "Hello, Ethereum!" \
-nodes 1,2,3,4,5,7,8,11,13,16,17,19,20 \
-threshold 13 \
-total 20
Verify a signature independently:
go run cmd/verify/verify.go \
-message "Hello, Ethereum!" \
-signature <hex_signature> \
-pubkey <hex_pubkey>
scheme, err := crypto.NewSignatureScheme(13, 20)
if err != nil {
log.Fatal(err)
}
signature, err := scheme.Sign(message, signingNodes)
if err != nil {
log.Fatal(err)
}
result, err := scheme.VerifySignature(message, signature)
if err != nil {
log.Fatal(err)
}
if result.IsValid {
fmt.Println("Signature is valid!")
}
- This project uses herumi/bls-eth-go-binary which implements interface mentioned in Ethereum 2 phase 0 for signature aggregation and verification.
- Provides verification by both Herumi and ConsenSys implementations
- Hash-to-curve uses
BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_
DST - Uses draft 7 of the BLS signature spec
- Public keys are in G1, signatures in G2 (opposite of standard BLS)
- Hash-to-curve uses
- Add signature aggregation and verification
- On-chain verification with EIP-2537