dsrvlabs / czg-keremony

JavaScript-based client to participate in Ethereum KZG Ceremony
https://dsrv.com
MIT License
13 stars 4 forks source link

Add signature #18

Open kim201212 opened 1 year ago

kim201212 commented 1 year ago

Spec.

Signing the contributions

The signing of contributions with Ethereum ECDSA keys and BLS signing the user's identity is RECOMMENDED.

def sign_identity(contribution: Contribution, x: int, identity: str) -> Contribution:
    encoded_identity = b''
    if identity[:2] == '0x':
        # Identity is a Ethereum address
        encoded_identity = eth_address_to_identity(identity).encode()
    else:
        # Identity is an GitHub ID
        encoded_identity = github_handle_to_identity(identity).encode()
    signature = bls.Sign(x, encoded_identity)
    contribution.bls_signature = signature
def sign_contribution(batch_contribution: BatchContribution, ethereum_address: Optional[str]) -> BatchContribution:
    typed_data = contribution_to_typed_data_str(batch_contribution)  # function defined in contributionSigning.md
    batch_contribution.ecdsa_signature = web3.eth.sign_typed_data(ethereum_address, json.loads(typed_data))
    return batch_contribution
kim201212 commented 1 year ago

identity is required to sign. There is no way we can get identity with cli. It looks good to add a web interface after we add it. I think this is why it's optional. @rootwarp What do you think?

rootwarp commented 1 year ago

identity is required to sign. There is no way we can get identity with cli. It looks good to add a web interface after we add it. I think this is why it's optional. @rootwarp What do you think?

@kim201212 Make sense. This issue may be handled as optional if we have the plan to support web interface.