Starknet is built on advanced cryptographic primitives that enable scalable, trustless computation using STARK proofs. These include a custom prime field and elliptic curve and multiple hash functions optimized for zero-knowledge performance.
The curve’s order is 3618502788666131213697322783095070105526743751716087489154079457884512865583, and the generator point G in the Elliptic Curve Digital Signature Algorithm (ECDSA) implementation that is used in Cairo with respect to it is defined by:
Let h denote the pedersen hash function, then given an array a1,...,an of n field elements we define h(a1,...,an) to be:h(...h(h(0,a1),a2),...,an),n)
Poseidon is a family of hash functions designed to be very efficient as algebraic circuits. As such, they can be very useful in ZK-proving systems such as STARKs.
Starknet’s version of the Poseidon hash function is based on a three-element state Hades permutation and defined of up to 2 elements by:poseidon(x):=([hadespermutation(x,0,1)])0poseidon(x,y):=([hadespermutation(x,y,2)])0Where [⋅]j denotes taking the j‘th coordinate of a tuple.
Let hades:FP3→FP3 denote the Hades permutation with Starknet’s parameters, then given an array a1,...,an of n field elements we define poseidon(a1,...,an) to be the first coordinate of H(a1,...,an;0,0,0), where:H(a1,…,an;s1,s2,s3)=⎩⎨⎧H(a3,…,an;hades(s1+a1,s2+a2,s3))hades(s1+a1,s2+1,s3)hades(s1+1,s2,s3)if n≥2if n=1if n=0