Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Implement Secp256k1 #36

Closed
2 of 4 tasks
Pratyush opened this issue Jan 11, 2021 · 7 comments · Fixed by #122
Closed
2 of 4 tasks

Implement Secp256k1 #36

Pratyush opened this issue Jan 11, 2021 · 7 comments · Fixed by #122
Labels
D-easy Difficulty: easy T-feature Type: new features

Comments

@Pratyush
Copy link
Member

Pratyush commented Jan 11, 2021

Summary

Implement the Bitcoin curve.

Possible issue: the existing field infrastructure in ark-ff does not support "full-wdith" moduli. For example, a 255-bit modulus is fine, but a 256-bit one might not be.

Proposal

The implementation can hopefully follow the existing curve implementations. Another option would be to wrap existing fast arithmetic from other libraries/implementations (though there are not many fast pure-Rust libraries).


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@Pratyush Pratyush added T-feature Type: new features D-easy Difficulty: easy help wanted labels Jan 11, 2021
@ValarDragon
Copy link
Member

I'm in favor of wrapping k256 (https://github.com/RustCrypto/elliptic-curves/tree/master/k256). See Tony's blog post on it: https://iqlusion.blog/k256-crate-pure-rust-projective-secp256k1-library.

@Pratyush
Copy link
Member Author

I think it would make sense to only wrap their field code, and use our existing Short Weierstrass Jacobian type for curve arithmetic. This is so that we can easily reuse the existing gadget infrastructure in the future (which works only with our existing Twisted Edwards and Short Weierstrass structs).

@burdges
Copy link

burdges commented Jan 12, 2021

Would Ed25519 make sense? Ristretto maybe less so

@weikengchen
Copy link
Member

We can just move this one? https://github.com/FindoraNetwork/ark-bulletproofs-secq256k1/tree/main/src/curve/secp256k1

With the recent algebra library upgrade, this should be pretty easy. I just need a yes or no.

@Pratyush
Copy link
Member Author

I think with the new infrastructure we can avoid the extra limb; I would be in favour of that.

@weikengchen
Copy link
Member

Let me double check---I suspect that 256 can fit curve25519 but not secp256k1.

@Pratyush
Copy link
Member Author

By "new infrastructure" I mean the new trait design, not the existing arithmetic routines. We would need to introduce a separate impl of montgomery reductions and multiplication to avoid the extra limb.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
D-easy Difficulty: easy T-feature Type: new features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants