bitcoin-hs-0.0.1: Partial implementation of the Bitcoin protocol (as of 2013)

Safe HaskellNone




The secp256k1 Elliptic Curve.

At the moment somewhat slow :(




data ECPoint Source #

A point on the elliptic curve secp256k1


ECPoint !Fp !Fp

a "regular" element of the elliptic curve


the point at infinity is the unit element

secp256k1 curve parameters.

secp256k1_p :: Integer Source #

Parameters of the secp256k1 elliptic curve.

  • p is the order of the prime field we are working over
  • a and b are the parameters in the curve equation y^2 = x^3 + a*x + b (but a=0 here)
  • G is the generator of the subgroup in the curve
  • n is the order of G, equivalently the size of the subgroup
  • H is the cofactor (size of the curve divided by the size of the subgroup)


secp256k1_G :: ECPoint Source #

G is the base point, that is the generator; E = { G^i | iin Z } = { G^i | i<-[1..n] }

Operations on the secp256k1 curve

addEC :: ECPoint -> ECPoint -> ECPoint Source #

Addition in the elliptic curve (or multiplication if you prefer to think it as a multiplicative group)

dblEC :: ECPoint -> ECPoint Source #

Doubling a point in the elliptic curve (multiplication by the integer 2)

invEC :: ECPoint -> ECPoint Source #

Inverse (negation) in the elliptic curve

mulEC :: ECPoint -> Integer -> ECPoint Source #

Multiplication by a positive integer (or exponentiation, if you think multiplicatively). This is slow, use the projective version instead!

Num instance