Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: ECDSA deep dive #562

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions docs/zkapps/o1js/ecdsa.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
title: ECDSA
hide_title: true
description: The ECDSA signature scheme (need context value statement here)
keywords:
- o1js
- ecdsa
- cryptographic primities
- hashing functions
- signature scheme
- signature protocol
- ethereum
---

# ECDSA and SHA3 in o1js

You can use the SHA3 and ECDSA primitives in o1js to interact with Ethereum.

:::experimental

Using ECDSA and SHA3 in o1js is experimental. To learn more, see [Experimental Features](/zkapps/experimental).

:::

In o1js, you can do ?? with the ECDSA signature scheme and the SHA3 hash function family ??

from: https://app.zenhub.com/workspaces/zkapps-product-eng-6130fedb3b0fc600123d8796/issues/gh/o1-labs/o1js/970

ECDSA is the signature protocol used by Bitcoin, Ethereum and most blockchain
systems [27, 7], due to both Schnorr's copyright and ECDSA's relatively smaller key
size, especially when compared to RSA. Most RSA keys are 2,048 bits, but the much
shorter 256-bit ECDSA key provides roughly equal security to a 3,248 bit RSA key
[30].
ECDSA uses the [secp256k1](/glossary#secp256k1) curve.

Most existing blockchain and public key infrastructure uses this curve
for non-deterministic signatures


## ECDSA

talk about ECDSA in a general way
o1js does not use ECDSA natively because it is inefficient.

from: https://www.notion.so/minaprotocol/ECDSA-ver-gadget-PoC-PRD-9458c38adf204d6b922deb8eed1ac193
The ability to verify EVM-compatible ECDSA signatures in-circuit is an important primitive in enabling compatibility with Ethereum and other EVM-compatible chains.

## SHA3 and Keccak

talk about SHA3 in a general way

SHA3 algorithm is different than Keccak (talk about different parameters)


In o1js, you have access to multiple flavors of SHA3 combined under the shared namespace `Hash`.

You can use these functions by calling `Hash.[hash_name].hash(xs)`.


primitives = key building block that you can use to build your zkApp
natively for signature verification we are using Schnorr (add to glossary and o1js FAQ)
natively for hashing we use Poseidon (add to glossary and o1js FAQ)

are widely used outside of Mina. For example, Ethereum uses ECDSA over secp256k1 for signatures - in order to "communicate" with the outside world and other blockchains, o1js (and, therefore Mina) needs to support these primitives as well. This RFC describes how we will leverage the custom gates implemented by the crypto team and expose them to o1js, making them accessible to smart contract developers.

You can leverage ECDSA and SHA3/Keccak to build applications that integrate with Ethereum and other use cases that require the use of said cryptographic primitives.

## How to interact with Ethereum

example

## API Overview

Florian and Martin wrote the implementation
link to src/examples/zkapps/hashing/hash.ts

https://github.com/o1-labs/o1js/pull/999

## Example: Using SHA3 in a smart contract

describe example

https://github.com/o1-labs/o1js/pull/999/files#diff-7074aa210dfcf0c8288f1e8d55838577de49e78e87fed595c35b0366759f7b2a
Loading