Signature verification cost of committee_size vs dept

This commit is contained in:
mjalalzai 2023-08-28 13:34:49 -07:00
parent 8a023f3b25
commit 95f2931d54
1 changed files with 3 additions and 26 deletions

View File

@ -1,13 +1,12 @@
import time import time
import ecdsa import ed25519
def verify_signatures(committee_size, depth): def verify_signatures(committee_size, depth):
# Simulate verifying depth * committee_size signatures # Simulate verifying depth * committee_size signatures
start_time = time.time() start_time = time.time()
# ECDSA key generation # Generate a single EdDSA key pair for verification
private_key = ecdsa.SigningKey.generate() private_key, public_key = ed25519.create_keypair()
public_key = private_key.get_verifying_key()
# Simulate depth * committee_size signature verifications # Simulate depth * committee_size signature verifications
for _ in range(depth * committee_size): for _ in range(depth * committee_size):
@ -19,25 +18,3 @@ def verify_signatures(committee_size, depth):
elapsed_time = end_time - start_time elapsed_time = end_time - start_time
return elapsed_time return elapsed_time
def aggregate_signatures(committee_size):
# Simulate aggregating 3 * committee_size signatures
start_time = time.time()
# ECDSA key generation
private_keys = [ecdsa.SigningKey.generate() for _ in range(3 * committee_size)]
# public_keys = [private_key.get_verifying_key() for private_key in private_keys]
# Simulate signature aggregation
shared_message = b"Shared message to be signed"
signatures = [private_key.sign(shared_message) for private_key in private_keys]
aggregated_signature = sum(signatures, ecdsa.util.numbertheory.ordercurve.order)
# Verify aggregated signature against the shared message
public_key = ecdsa.VerifyingKey.from_public_point(aggregated_signature, curve=ecdsa.SECP256k1)
assert public_key.verify(aggregated_signature, shared_message)
end_time = time.time()
elapsed_time = end_time - start_time
return elapsed_time