Skip to content
Open
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ ark-bn254 = { version = "0.5" }
ark-ec = { version = "0.5", features = ["parallel"] }
ark-ff = { version = "0.5", features = ["parallel", "asm"] }
ark-poly = { version = "0.5", features = ["parallel"] }
ark-secp256k1 = { version = "0.5.0", features = ["std"] }
ark-serialize = "0.5"
ark-std = { version = "0.5", features = ["parallel"] }
ark-test-curves = { version = "0.5", features = ["parallel", "asm"] }
Expand Down
2 changes: 2 additions & 0 deletions curves/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ asm = []
ark-bn254.workspace = true
ark-ec.workspace = true
ark-ff.workspace = true
ark-secp256k1.workspace = true
ark-std.workspace = true
num-bigint.workspace = true

Expand All @@ -27,3 +28,4 @@ rand.workspace = true
ark-test-curves.workspace = true
ark-algebra-test-templates.workspace = true
ark-serialize.workspace = true
proptest.workspace = true
1 change: 1 addition & 0 deletions curves/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod named;
pub mod pasta;
pub mod secp256k1;
4 changes: 4 additions & 0 deletions curves/src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ impl NamedCurve for Affine<LegacyPallasParameters> {
impl NamedCurve for Affine<ark_bn254::g1::Config> {
const NAME: &'static str = "bn254";
}

impl NamedCurve for Affine<ark_secp256k1::Config> {
const NAME: &'static str = "secp256k1";
}
40 changes: 40 additions & 0 deletions curves/src/secp256k1/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//! secp256k1 curve implementation using ark-secp256k1.
//!
//! This module re-exports types from the ark-secp256k1 crate for use in Mina.
//! secp256k1 is the elliptic curve used in Bitcoin and Ethereum (ECDSA signatures).
//!
//! Curve equation: y^2 = x^3 + 7
//!
//! # Field parameters
//! - Base field modulus (p): 2^256 - 2^32 - 977
//! - Scalar field order (n): 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
//!
//! # Usage
//! ```
//! use mina_curves::secp256k1::{Affine, Fq, Fr, Projective, G_GENERATOR_X, G_GENERATOR_Y};
//! use ark_ec::AffineRepr;
//!
//! // Get the generator point
//! let g = Affine::generator();
//! assert!(g.is_on_curve());
//!
//! // Generator coordinates are also available as constants
//! let g_manual = Affine::new_unchecked(G_GENERATOR_X, G_GENERATOR_Y);
//! assert_eq!(g, g_manual);
//! ```

// Re-export all types from ark-secp256k1
pub use ark_secp256k1::{Config, Fq, FqConfig, Fr, FrConfig};

// Re-export curve point types
pub use ark_secp256k1::{Affine, Projective};

/// G_GENERATOR_X =
/// 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
/// = 55066263022277343669578718895168534326250603453777594175500187360389116729240
pub use ark_secp256k1::G_GENERATOR_X;

/// G_GENERATOR_Y =
/// 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8
/// = 32670510020758816978083085130507043184471273380659243275938904335757337482424
pub use ark_secp256k1::G_GENERATOR_Y;
Loading
Loading