MCPcopy Create free account
hub / github.com/canopy-network/canopy / sign_bls

Function sign_bls

plugin/python/tutorial/rpc_test.py:151–165  ·  view source on GitHub ↗

Sign with BLS12-381 using G2 signatures. This matches the Go implementation using kyber's bdn.Scheme. Uses BasicSchemeMPL which uses DST: BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_

(private_key_hex: str, message: bytes)

Source from the content-addressed store, hash-verified

149
150
151def sign_bls(private_key_hex: str, message: bytes) -> bytes:
152 """
153 Sign with BLS12-381 using G2 signatures.
154 This matches the Go implementation using kyber's bdn.Scheme.
155 Uses BasicSchemeMPL which uses DST: BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_
156 """
157 private_key_bytes = hex_to_bytes(private_key_hex)
158
159 # Create private key from bytes
160 sk = PrivateKey.from_bytes(private_key_bytes)
161
162 # Sign using BasicSchemeMPL (standard BLS without public key augmentation)
163 signature = BasicSchemeMPL.sign(sk, message)
164
165 return bytes(signature)
166
167
168def get_sign_bytes(

Callers 1

build_sign_and_send_txFunction · 0.85

Calls 1

hex_to_bytesFunction · 0.85

Tested by

no test coverage detected