Closed wdcs-amitkumar closed 2 years ago
from py_ecc.bls import G2ProofOfPossession as bls_pop
from py_ecc.bls.g2_primitives import signature_to_G2, pubkey_to_G1
signature = "85b95df4656df8ef8d9a7d463073cd3829f0e17fc44c6f1fc65587536fcb5307e35a3dcc4916f42d747426c3ca47bfe90ce1fa2fddb19b7f31985ef6ecc1bb897d3d2b25d7aa6b26b5dbe8b82cdccfa3bae56ae467c898e587fbb8ae40a40c6c"
public_key = "b4788b55a14a67f9a44657f86583118b335693e5bed02038e9b886608657b60cfd53125343a543fe0aa8d9e6c826c2dfab749a6747438d945160f81cc3253ee8f10fabb860234d195c008ad7762e9c01456fc694112374684ceaf0668b423fb4a29e7b6e922d204ab83dc517ab5da26f7eef17a3052b0936921659f36af77c0346a2df3dac9e0c0732b5921162e5ecc68a14562777d3b0941d4a09cb5a975c078698571e8e34280c28310c74fca1944b2ddcc552358d891b1b38ba722e45503d"
g1 = pubkey_to_G1(bytes.fromhex(public_key))
g2 = signature_to_G2(bytes.fromhex(signature))
print(g1)
print("*******************************8")
print(g2)
G1
and G2
refer to the groups defined as part of the BLS cryptosystem which have canonical representations that are different lengths -- in fact G2 points are double the length of G1 points for the setting we use in the consensus layer today.
based on your code sample, it looks like you have signature
and public_key
swapped which would be the first thing to fix -- can you link the full code sample you are trying to run?
I didn't expected so prompt response :)
https://github.com/maidsafe/bls_dkg/blob/master/src/key_gen/tests.rs
Smart Contract : https://gist.github.com/BjornvdLaan/ca6dd4e3993e1ef392f363ec27fe74c4#file-blsexample-sol
if you click around it may be that your signature is using a different ciphersuite than the one you called upon (with G2ProofOfPosession
)
https://github.com/maidsafe/blsttc/blob/master/src/lib.rs#L73
try w/ G2Basic
? if that doesn't work, it is possible that somewhere in the stack you are trying to use there is an incompatibility with what this library produces or even intends to support.
and as this issue does not pertain to this repo in particular, i am going to close it... if you think you have found a bug w/ py_ecc
in particular, please feel free to re-open the issue.
i am not exactly sure where to send you for further support.... perhaps try the Maidsafe discord?
So I tried to verify signature and public output from Line 273 : threshold_sig ::
But G1 and G2 points I received were of length 115 not 77( see first link)
So I was unable to verify Signature
Used Functions