CIP-0199

Poseidon Permutation Built-in for Plutus

Status
Proposed
Category
Plutus
Created
Updated
License
CC-BY-4.0
Implementors
Discussions

Abstract

This CIP introduces a single new Plutus built-in, bls12_381_poseidonPermutation: the Poseidon permutation over the BLS12-381 scalar field, with an append-only registry of parameter instances (initially two, serving the circom-style R1CS ecosystem and the plonkish/halo2 ecosystem). The built-in deliberately exposes the permutation rather than a hash function: deployed Poseidon implementations agree only at the permutation layer, while the framings that turn permutation calls into a hash — capacity placement and initialization, absorption order, padding and tags, how much output is squeezed — vary across (and even within) ecosystems and keep evolving. A script reconstructs any framing with a few cheap operations around the built-in; in exchange, hash-level security properties are the calling script's responsibility, a trade-off this document makes explicit with normative terminology, misuse warnings, and per-instance framing documentation with test vectors.

Motivation: Why is this CIP necessary?

Many zk applications require the same hash function to be evaluated both in-circuit and onchain. An example of such a use case is a Merkle tree whose root is committed onchain while membership proofs are verified inside a circuit (or vice versa).

Traditional hash functions like SHA-256 or Blake2b are ill-suited for this: they are designed for CPUs, operating on 32- or 64-bit registers with bitwise operations (XOR, AND, rotations) and additions that wrap around at the register size. A zk circuit, however, natively expresses only additions and multiplications in a prime field. To evaluate a bit-oriented hash in-circuit, every register must be emulated: each word is decomposed into individual bits (one field element per bit, each with its own constraint forcing it to be 0 or 1), every bitwise operation costs constraints per bit, and every register addition needs extra constraints to reproduce the 32/64-bit overflow behaviour, since field arithmetic wraps around at the field prime instead. This emulation inflates a single hash evaluation to tens of thousands of constraints, and the constraint count directly determines circuit size and proving time.

This gap is filled by zk-friendly hash functions, which are built from native field additions and multiplications so no bit decomposition or overflow emulation is needed. Of these, Poseidon is the most established.

Poseidon, however, is a family of functions, and deployed ecosystems differ both in their parameters and in the conventions layered on top of the shared core (see Framing conventions); the conventions moreover keep evolving, while the core — the permutation — is fixed forever once its constants are chosen. This CIP therefore proposes a built-in for the Poseidon permutation rather than for any single hash: every deployed or future hash framing then remains expressible as a handful of cheap script-level operations around the built-in, at the price that hash-level security becomes the calling script's explicit responsibility (see Misuse warnings). The initial instance registry contains two entries, chosen to serve the two dominant proving-stack lineages over the BLS12-381 scalar field: the circomlib-style R1CS ecosystem and the plonkish/halo2 ecosystem (midnight-zk).

Specification

Poseidon

Poseidon1 is a family of cryptographic hash functions designed to be efficient inside zero-knowledge proof systems (ZK-SNARKs, STARKs, PLONK, etc.), each built as a framing around a core permutation — the layer this CIP exposes. Unlike "traditional" hashes such as SHA-256 or Blake2b, which operate on bits and are cheap on a CPU but extremely expensive to prove in a circuit, Poseidon operates directly over the elements of a large prime field Fp\mathbb{F}_p, where pp is usually the scalar field prime of the elliptic curve underlying the proof system. Because the operations of which a Poseidon function is comprised are native field additions and multiplications, the number of constraints needed to prove a Poseidon evaluation in-circuit is orders of magnitude smaller than for a bit-oriented hash. This is what makes it "arithmetization-friendly".

Prime fields

A prime field Fp\mathbb{F}_p is the set of integers ‘{0,1,…,p−1}‘`\{0, 1, \dots, p-1\}` for a prime modulus pp, with addition and multiplication performed modulo pp. Because pp is prime, every non-zero element has a multiplicative inverse, so Fp\mathbb{F}_p supports the four basic arithmetic operations: it behaves like ordinary arithmetic that wraps around at pp. An element of such a field is a single number in ‘{0,…,p−1}‘`\{0, \dots, p-1\}`; this is the basic unit of data Poseidon operates on.

Elliptic-curve-based proof systems come with two prime fields: the base field, over which the curve's point coordinates are defined, and the scalar field, whose modulus is the (prime) order of the cryptographic subgroup of the curve. The arithmetic of a circuit — and hence the values a prover commits to — lives in the scalar field, so a hash function that is cheap to prove must operate natively on scalar-field elements.

Plutus exposes exactly one pairing curve via built-ins, BLS12-381, whose scalar field has the 255-bit prime modulus

p = 52435875175126190479447740508185965837690552500527637822603658699938581184513

All Poseidon parameters in this document are instantiated over this field.

Notation: the cryptographic literature — and the parameter-generator invocations quoted later, whose final argument <r> is this modulus — often call this prime rr, being the order of the curve's cryptographic subgroup. This document writes pp for the modulus throughout and reserves rr for the sponge rate introduced below.

Overview of the construction

Like SHA-3, Poseidon is built in two independent layers:

  1. An inner permutation PP: a fixed, invertible function Fpt→Fpt\mathbb{F}_p^t \to \mathbb{F}_p^t that supplies all of the cryptographic mixing. It is not a hash function by itself — it takes no variable-length input and, being invertible, hides nothing on its own. It is constructed by iterating a simple round function (add constants, apply a non-linear S-box, multiply by a mixing matrix) a fixed number of times.
  2. An outer mode of operation, the sponge construction: a thin wrapper that repeatedly invokes PP to obtain the interface of a hash function — variable-length input, fixed-length output, one-wayness. The mode contains no cryptographic hardness of its own; its security reduces to that of the permutation it wraps.

Importantly, there is no canonical, unique "the Poseidon hash function": Poseidon is a family of hash functions. Both layers are parameterized — the permutation by the field, the state width, the S-box exponent, the round counts, and the round constants; the mode by conventions such as how inputs and domain-separation tags are placed into the state — and every combination of choices yields a different function, producing digests incompatible with all others. Two implementations agree only if every single one of these choices matches. For this reason the built-in proposed here does not fix a single canonical instance: it is an interface that is modular over instances, backed by a set of known instances that is append-only — new instances can be added over time, but once added, an instance can never be removed.

The two subsections that follow describe these layers top-down: first the sponge, treating PP as a black box, then the internal round structure of PP itself.

The sponge construction

Recall from the overview that the permutation PP maps exactly tt field elements to tt field elements, and that accepting input of any other length is the job of the mode wrapped around it. This subsection describes that mode: the same sponge construction as used by Keccak/SHA-3, which feeds the message into the state in fixed-size chunks, invoking PP in between. The internal state is a vector of t=r+ct = r + c field elements:

  • rr (the rate): how many field elements of input are absorbed per step, and how many are squeezed out per step (this is where the word sponge comes from).
  • cc (the capacity): reserved elements into which no message input is ever absorbed and from which no output is squeezed (though they may be initialized with a protocol-defined parameter, see below); they carry the security of the construction.

Starting from an initial state I=0r∥0cI = 0^r \Vert 0^c of t=r+ct = r + c field elements — a fixed public constant of all zeros, where a protocol-defined tag (a domain-separation or input-length tag) may take the place of the zeros in the capacity part — hashing proceeds in two phases:

  1. Absorb: the input (padded to a multiple of rr) is split into chunks m1,m2,…m_1, m_2, \dots of rr field elements each. Each chunk mim_i is added into the rate part (the first rr elements) of the state. Then PP is applied to the whole state, capacity included, replacing all tt elements with a new state. The capacity is never written to by the message, but it still changes with every call. Because PP is a bijection, this step can be undone: the old state can be recomputed from the new one (see Misuse warnings).
  2. Squeeze: after all chunks have been absorbed, the first rr elements of the state are read off as the output z1z_1; the cc capacity elements are not part of the output. This truncation is what makes the result a hash, and it concerns what is published as the output, not secrecy: the capacity is not a secret. A commitment must publish only the squeezed output; because PP is invertible, publishing the full final state instead would let anyone run the sponge backwards and recover the committed input (see Misuse warnings). Once the input is revealed (e.g. when a script checks an opening on chain), anyone can recompute every state of the computation, capacity included, but this leaks nothing, since the input is already public. If more output is needed, PP is applied again and further outputs z2,…z_2, \dots are read.

The sponge construction

Message chunks ‘mi‘`m_i` are added into the rate part of the state, interleaved with applications of the permutation ‘P‘`P`; once all input is absorbed, output elements ‘zi‘`z_i` are read from the rate part.

In practice, however, most deployments of Poseidon do not hash arbitrary-length data but use a fixed-arity instance. This is a consequence of how zk circuits work: a circuit is fixed at compile/setup time, meaning its entire structure — every wire, every constraint, and therefore the number of permutation calls — must be known before any input exists. A circuit thus cannot branch on the length of its input; "hash however many chunks arrive" is simply not expressible. Variable-length hashing can only be emulated by building the circuit for a maximum length and padding shorter inputs up to it, paying the worst-case constraint cost on every proof. Consequently, protocols are designed around hashes of a fixed, known arity — which is also what their typical uses need: a Merkle node always hashes exactly two children, a commitment always binds the same number of field elements. The most common instance has width t=3t = 3 (r=2r = 2, c=1c = 1) and acts as a 2-to-1 compression function, e.g. hashing the two children of a Merkle tree node.

Framing conventions

While the permutation of an instance is fully determined by its parameters, the way a fixed-arity hash is framed on top of PP is not. Which state element plays the role of the capacity, what value the capacity is initialized with, in which order the inputs are laid into the rate, and which element of the final state is read off as the digest are all conventions layered on top of the permutation — and none of them is canonical. Real-world implementations disagree on every one of these choices. Two deployed examples over the BLS12-381 scalar field, both cross-validated against the reference implementation accompanying this proposal:

  • circom-style (jmagan/poseidon-bls12381-circom2, following the framing of the widely used circomlib library3): an nn-input hash uses width t=n+1t = n + 1; the capacity element is the first state element and is initialized to zero; the whole hash is a single application of PP to (0,in1,…,inn)(0, \text{in}_1, \dots, \text{in}_n); the digest is the first element of the output state — i.e. it is read from the position the capacity occupied, not from the rate. There is no domain-separation or length tag. (This lineage's extended PoseidonEx template does allow a caller to initialize the capacity element to an arbitrary value, which is how a domain-separation tag can be injected in that ecosystem, but the plain Poseidon template used in practice fixes it to zero.)

  • midnight-zk fixed-arity hash4: the capacity element is the last state element and is initialized to the number of inputs (a length tag); inputs are absorbed in rate-sized chunks with one application of PP per chunk; the digest is the first element of the output state. Concretely, the 3-input hash on the width-3 instance runs:

    1. start from the initial state (0,0,3)(0, 0, 3) — the capacity element (last) holds the length tag;
    2. absorb the chunk (in1,in2)(\text{in}_1, \text{in}_2), giving (in1,in2,3)(\text{in}_1, \text{in}_2, 3), and apply PP to obtain (x,y,z)(x, y, z);
    3. absorb in3\text{in}_3 as the next (partial) chunk, giving (x+in3, y, z)(x + \text{in}_3,\ y,\ z), and apply PP to obtain (x′,y′,z′)(x', y', z');
    4. read the digest x′x' from the rate part — as the diagram shows, squeezing begins with a read, not with another application of PP.

    The same codebase's variable-length transcript mode uses yet a third convention: the capacity is initialized to 2642^{64} and a queue-length padding element is absorbed alongside the message.

All of these framings invoke the same kind of permutation, yet they produce mutually incompatible digests for the same inputs. Because no framing is canonical — a single ecosystem may even use several, over the same constants — this proposal deliberately standardizes only the permutation and leaves the framing to the calling script (see The built-in for the full argument). The framing used by the ecosystem each registered instance originates from is documented alongside the instance — machine-readably, in its constants file — together with known-answer vectors, so that script authors targeting that ecosystem can reproduce it exactly; it is documentation of one use, not a property of the instance.

The permutation (HADES design)

The core of Poseidon is a fixed permutation PP over Fpt\mathbb{F}_p^t, built as a substitution-permutation network following the HADES strategy. It applies a sequence of rounds, each composed of three steps:

  1. AddRoundConstants (ARC): add fixed, round-specific constants cic_i to every state element. This breaks symmetry and acts like a key schedule.
  2. S-box (SubWords): the non-linear layer, raising elements to a fixed power, x↦xαx \mapsto x^\alpha. α\alpha is the smallest integer (commonly α=5\alpha = 5, sometimes 33) such that gcd⁡(α,p−1)=1\gcd(\alpha, p - 1) = 1, which guarantees the map is a bijection.
  3. MixLayer (linear layer): multiply the state vector by a fixed t×tt \times t MDS (Maximum Distance Separable) matrix MM. This diffuses each element across the entire state.

The key HADES insight is mixing two kinds of rounds:

  • Full rounds (RFR_F): the S-box is applied to all tt state elements.
  • Partial rounds (RPR_P): the S-box is applied to only one element; the rest pass through the non-linear layer untouched.

The rounds are arranged as RF/2R_F/2 full rounds, then RPR_P partial rounds, then RF/2R_F/2 full rounds. Full rounds provide strong security against statistical attacks (differential/linear), while the cheaper partial rounds provide algebraic security (against interpolation / Gröbner-basis attacks) at a fraction of the constraint cost. This split is essential to security, not just an optimization. Because all but one lane pass through a partial round linearly, the partial rounds on their own offer little resistance to statistical attacks: that resistance is provided by the full rounds alone, which is why the construction is only secure when enough full rounds — RF/2R_F/2 on each side — surround the partial rounds (at least RF=6R_F = 6 in total, see the notation below). Moving full rounds into the partial block, or placing them all on one side, voids the security argument even if the total number of rounds is unchanged.

Notation: the paper1 uses two symbols for full rounds: RfR_f (lowercase) for the full rounds on one side, and RF=2RfR_F = 2R_f (uppercase) for the total. Throughout this document RFR_F always denotes the total number of full rounds (so RF/2R_F/2 on each side equals the paper's RfR_f). The paper's statistical-security minimum is RF≥6R_F \geq 6; the value RF=8R_F = 8 used below is that minimum plus the paper's recommended safety margin of two additional full rounds1.

The S-box is the most expensive operation in a circuit, so applying it to one element instead of tt for most rounds is where the savings come from. The exact round counts (RF,RP)(R_F, R_P) are derived from pp, tt, and α\alpha to give a target security level (typically 128 bits).

Parameters

A concrete Poseidon instance is fully specified by the numeric parameters:

  • the field pp;
  • the state size tt (and hence rate rr and capacity cc);
  • the S-box exponent α\alpha;
  • the round numbers (RF,RP)(R_F, R_P);
  • the round constants cic_i and the MDS matrix MM, together with the exact procedure that generated them (typically a Grain-LFSR-based script; the precise script and its arguments differ between ecosystems and must be pinned per instance);

and by structural choices that the Poseidon paper leaves open and that implementations in the wild resolve differently:

  • the order of operations within a round — this document defines a round as ARC → S-box → Mix, as above; implementations may internally reorder or pre-compose constants (e.g. the common "shifted" schedule that applies an initial ARC and then folds each round's constants into the end of the previous round) provided the result is observationally identical to the definition;
  • which state element the partial-round S-box applies to (e.g. the circom implementations use the first element; midnight-zk and the reference implementation backing this proposal use the last);
  • the orientation of the MDS multiplication: row-major ‘statei′=∑jMij⋅statej‘`\text{state}'_i = \sum_j M_{ij} \cdot \text{state}_j`, versus multiplying by the transpose;
  • the consumption order of the round-constant list (which constant goes to which round and lane).

These structural choices are not cosmetic. For example, the circom BLS12-381 instance and the reference implementation differ only in the partial-round S-box position, and importing the circom constants requires an exact state-reversal conjugation — ‘Mij′=M(t−1−i)(t−1−j)‘`M'_{ij} = M_{(t-1-i)(t-1-j)}` with each round's constant chunk reversed, inputs fed in reverse order and the digest read from the mirrored lane. Applied blindly, the same numeric constants produce entirely different digests.

(A concrete hash, finally, additionally requires a framing on top of the permutation — see Framing conventions; the built-in exposes the permutation only, so framings are documented per instance rather than baked into its semantics.)

Because all of the above must match exactly on both the prover and verifier side, each instance in the built-in's append-only set must be specified by a single, unambiguous parameter set covering the numeric and the structural choices.

Concrete parameters

Round counts are not universal constants: they are derived from the field pp, the state size tt, the S-box exponent α\alpha, and a chosen security margin, so they are meaningful only relative to a fixed field.

One property is normative for every instance of this built-in, present and future: it is instantiated over the BLS12-381 scalar field introduced above, the only pairing curve exposed by Plutus built-ins and the field the reference implementation's arithmetic is built on.

The other agreements between the instances below are descriptive, not normative: each happens to target 128-bit security with S-box exponent α=5\alpha = 5 and RF=8R_F = 8 full rounds (split as 4 before and 4 after the partial rounds). The recurrence of α=5\alpha = 5 is no coincidence: α\alpha is conventionally chosen as the smallest integer such that gcd⁡(α,p−1)=1\gcd(\alpha, p - 1) = 1, which is what makes x↦xαx \mapsto x^\alpha a bijection. For the BLS12-381 scalar field this smallest choice is 55 — the candidate 33 is ruled out because 33 divides p−1p - 1, so x3x^3 is not a bijection over this field. Nevertheless, none of these values is fixed forever. Instead, a future instance must satisfy the registry's admission criteria: gcd⁡(α,p−1)=1\gcd(\alpha, p - 1) = 1, a declared security level of at least 128 bits, and round counts meeting the Poseidon paper's minima (plus its recommended margin) for the declared (t,α)(t, \alpha) at that level. The deployed BLS12-381 instances that have been cross-validated against the reference implementation backing this proposal are:

Origintt (rate rr / capacity cc)α\alphaRFR_FRPR_PConstant generation
midnight-zk43 (r=2r=2, c=1c=1)5860generate_parameters_grain.sage 1 0 255 3 8 60 <r> (pasta-hadeshash)
circom BLS12-381 port23 (r=2r=2, c=1c=1)5856generate_params_poseidon.sage 1 0 255 3 5 128 <r> (hadeshash)
circom BLS12-381 port24 (r=3r=3, c=1c=1)5856generate_params_poseidon.sage 1 0 255 4 5 128 <r> (hadeshash)

Note that two of these share the same (p,t,α)(p, t, \alpha) yet use different partial-round counts, 60 versus 56: both include a security margin over the paper's minima, but the margin and the derivation script differ. The Poseidon paper's own calc_round_numbers.py can likewise produce slightly different counts depending on the margin and attack assumptions chosen. Neither instance is "wrong" — but they are different hash functions, and their digests are incompatible.

Caveat: for exactly this reason, this specification fixes for each registered instance the exact generator script and its inputs (not merely a round-count table), so that round constants, the MDS matrix, and round counts are reproducible bit-for-bit. Note: Poseidon25 is a newer successor that keeps the same round structure but uses a cheaper linear layer and constant schedule. It is explicitly out of scope for this CIP: this specification standardizes the original, battle-tested Poseidon, which has seen years of deployment and cryptanalysis across the ZK ecosystem.

The built-in

This CIP adds a single built-in function exposing the Poseidon permutation — deliberately not a hash — over the BLS12-381 scalar field:

bls12_381_poseidonPermutation : integer -> list integer -> list integer

(The name carries bls12_381 following the existing family of BLS12-381 built-ins; the final spelling is to be agreed with the Plutus Core team. It deliberately says permutation, not hash — see the terminology box below — and deliberately says Poseidon rather than HADES: HADES6 is the broader design strategy, of which other instantiations exist, whereas this built-in's registry admits specifically the original Poseidon construction — power-map S-box, a single MDS linear layer, the Poseidon paper's round-count minima.)

Its semantics:

  1. The first argument is the variant index, selecting one instance from the append-only instance registry (next section). An index with no registered instance makes evaluation fail.
  2. The second argument is the full input state: a list of exactly tt integers, where tt is the selected instance's width. A list of any other length makes evaluation fail — the input is never padded (see below).
  3. Each input integer is reduced modulo pp into a field element, with exactly the semantics the existing BLS12-381 built-ins use when converting an integer to a scalar: the representative is n mod pn \bmod p, so inputs ≥p\geq p wrap around and negative inputs land in [0,p)[0, p) (e.g. −1-1 becomes p−1p - 1). The reduction is total; callers for whom an out-of-range input is an error must check the range themselves before calling.
  4. The instance's permutation PP is applied to the state, and the full output state — tt integers, each a canonical representative in [0,p)[0, p) — is returned.

For a fixed variant index the function is a pure, constant-cost map from tt field elements to tt field elements; it has no other failure modes and no dependence on chain state. One call computes one complete permutation — all RF+RPR_F + R_P rounds run inside the implementation; the caller never iterates rounds.

Time and space complexity. For a fixed instance the time is constant: one call executes exactly RF+RPR_F + R_P rounds, each dominated by the O(t2)O(t^2) field multiplications of the MDS matrix product plus at most tt S-box exponentiations, with no input-dependent control flow. The only input-size-dependent work is the initial reduction of each input integer modulo pp, linear in the size of that integer (and negligible for canonical inputs — see Cost model and initial benchmarks). Space is constant per instance: the state is tt field elements throughout, and the result is tt integers in [0,p)[0, p).

Important

Terminology, used normatively throughout this document. The permutation is what this built-in computes: a public bijection on Fpt\mathbb{F}_p^t with no security properties of its own. A hash is a construction: a specific framing of permutation calls (initial capacity value, absorption schedule, digest lane), chosen by the calling script — never by the registry, which identifies permutations only. "Poseidon hash" in this document always means permutation plus framing, never a bare built-in call — and the output of a single built-in call is a state, never a digest. Conflating the two is the root of every attack in Misuse warnings below.

Reference implementation

The permutation core referenced throughout this document is the C Poseidon implementation in Nomadic Labs' ocaml-bls12-381-hash library7 (src/poseidon), MIT-licensed, which operates on the same blst field arithmetic as the existing BLS12-381 built-ins. Its permutation context is parameterized over the width, round counts and constants, so each registry entry instantiates the same core with its own constants file (index 1 additionally needs either a generalized partial-S-box lane or the shipped conjugated_form — see Implementation Plan). This core, integrated into cardano-base and Plutus, is what produced the benchmark results in Cost model and initial benchmarks; that integration is preliminary work demonstrating onchain feasibility, not a production implementation, and the C core has not yet been independently audited (see Trustworthiness and Path to Active).

Why the permutation and not a hash

As the Framing conventions section shows, deployed Poseidon hashes disagree on everything above the permutation: capacity position and initialization, input order, chunking, tags and digest lane. The permutation is the lowest layer that can be pinned down bit-for-bit: implementations still differ in which permutation they run (see Parameters), but each choice, once its constants are fixed, is a single immutable function that a registry index can identify forever — and it is the layer that carries all of the cryptographic cost. A script reproduces any framing with a handful of cheap operations around the built-in: list construction, integer additions, and reading elements of the result.

The deeper reason is that the two layers evolve on different timescales. The permutation is the unchangeable core of every Poseidon deployment: once its constants are fixed, it never changes — which is exactly the shape of commitment a permanent built-in interface can safely make. How the permutation is operated, by contrast, is never fixed and cannot be predicted: what value the capacity is initialized with, in which order inputs are absorbed, how message boundaries are encoded — and, on the output side, how much is read. The framings deployed today happen to squeeze a single element, but the sponge naturally produces more: a future application may squeeze the full rate per call, or squeeze repeatedly (with interleaved permutations, z1,z2,…z_1, z_2, \dots as in the sponge diagram) to derive several field elements from one absorbed message — multi-element commitments, transcript randomness, key derivation, duplex-style authenticated constructions. None of these need anything from the chain that the permutation built-in does not already provide — and, because an index identifies a permutation and not a way of operating it, none of them needs a new registry entry either: the same index serves every framing over its constants. A hash-shaped built-in, by fixing "absorb everything, squeeze one designated lane" into protocol law, would make each of them wait for a protocol upgrade instead.

A hash-level alternative was seriously considered: a built-in taking the raw message and an index that pins the constants and a framing, absorbing internally. It has real merits — a script author cannot misapply a framing, an index alone identifies a complete hash function, it mirrors the hash-level interface circuit libraries expose (in midnight-zk a circuit calls std_lib.poseidon(layouter, &message) and never touches PP), and it saves per-built-in-call overhead on multi-chunk hashes. It was nevertheless rejected, because built-in interfaces are permanent and the hash-level semantics does not stay uniform across entries: each entry would carry its own accepted arities, absorption schedule and cost shape (the midnight framing hashes three inputs with two internal permutations, the circom framing with one), and every future mode — midnight's variable-length transcript framing, a duplex construction, a framing not yet invented — would require a new registry entry to become expressible at all. The permutation-level built-in has one uniform signature, one constant cost per index, and leaves every present and future framing expressible in script today. The misuse concern is addressed instead by documentation and data: each registry entry ships its ecosystem's framing in machine-readable form together with known-answer vectors (see test-vectors.json), from which audited script-level wrappers can be built and checked.

Why no implicit padding

Zero-padding an under-length input inside the built-in would not be injective: the states (a,0,0)(a, 0, 0) obtained from input [a][a] and from input [a,0][a, 0] would be identical, making the two inputs collide by construction — the same ambiguity class exploited by known second-preimage attacks on Merkle trees. Padding and domain separation are security-relevant decisions that must remain the script author's explicit, auditable choice.

Why the rate/capacity split is not an argument

The signature contains tt but says nothing about the split t=r+ct = r + c, and deliberately so: the split is not a property of the permutation. PP is a bijection on Fpt\mathbb{F}_p^t with no distinguished lanes — the reference C context accordingly stores only the width, round counts and constants. "Rate" and "capacity" only come into existence in a mode: the rate is the set of lanes a mode chooses to add message into, and the capacity is the set of lanes it promises never to touch. Since the built-in never absorbs, there is nothing for it to be ambiguous about: how an arity-6 hash splits its inputs — three chunks of two on a width-3 instance, or a single chunk on a width-7 instance — is written out explicitly in the calling script, one permutation call per chunk, and different splits are simply different (individually well-defined) hash functions. The split does matter for security: the sponge indifferentiability argument8 applies only to scripts that leave the instance's cc designated capacity lanes untouched by input and output. Each registry entry therefore documents its ecosystem's rate/capacity split and lane positions — as the contract a script must follow to inherit the instance's security analysis, not as behaviour the built-in enforces.

Why the full state is returned

Returning the full output state is maximally general: callers can build sponges, fixed-arity compression functions, or duplex-style constructions, and can squeeze whichever elements their framing designates. Note that the sponge security arguments cover squeezing only the rate portion of the state; which elements those are is part of the framing a script chooses, and at least one deployed framing (circom-style) reads the lane that held the capacity. This generality has sharp edges, spelled out next.

Misuse warnings: what the built-in does not provide

Warning

The permutation is invertible — a call to this built-in is not a hash. PP is a public bijection: anyone can compute P−1P^{-1} just as cheaply as PP. Every hash-like property a script obtains — one-wayness, compression, binding — comes exclusively from the framing it builds around the built-in, never from the built-in itself. A script that deviates from a documented, analyzed framing forfeits that framing's security argument, usually silently: the digests still look random.

In particular:

  • The full output state is never a commitment. Given all tt output elements, the entire input state is recoverable exactly by running PP backwards. More generally, revealing (or absorbing into) all tt lanes leaves no hidden state: an attacker who learns the full state after any permutation call can run the sponge backwards to recover everything absorbed and forwards to compute digests of arbitrary extensions. Preimage resistance exists only because the cc capacity lanes of the final state are withheld — a digest must be a truncation of the output (the sponge construction bounds security by c⋅log⁡2(p)/2c \cdot \log_2(p) / 2 bits8, about 127 bits for a width-3, c=1c = 1 instance). Consequently: publish only the framing's designated digest lane(s); never absorb message elements into the capacity lane; never build keyed constructions (MAC-like uses) that expose more of the state than the framing's digest.

  • Prefix and extension attacks on home-made framings. A framing without a length tag, padding rule, or fixed arity does not fix message boundaries, and distinct messages then collide or extend each other by construction: zero-extension collisions — [a][a] and [a,0][a, 0] absorb to identical states (as in Why no implicit padding), and in general any message collides with itself extended by zeros up to the next chunk boundary, at every chunk boundary; and length-extension-style forgeries whenever intermediate states leak. Tree constructions need domain separation on top: a Merkle tree whose leaves and internal nodes are hashed identically admits second preimages by reinterpreting an internal node as a leaf — the classic Merkle-tree second-preimage attack, which standard designs prevent by tagging leaves and internal nodes differently (as in RFC 6962's 0x00/0x01 prefixes). The deployed framings avoid these pitfalls by construction — midnight's capacity length tag pins the arity, circom's fixed width pins it structurally — which is precisely why scripts should reproduce a documented framing (its machine-readable description and known-answer vectors ship with each instance) rather than invent one.

  • The integer reduction is not injective. Inputs nn and n+pn + p are the same field element and produce identical outputs. A script hashing data that can numerically exceed [0,p)[0, p) (e.g. values parsed from 32-byte strings, which range up to 2256>p2^{256} > p) must range-check before calling, or two distinct pieces of data collide trivially.

Non-normative examples

The two framings documented in Framing conventions, exactly as their ecosystems compute them (each reproducible against test-vectors.json):

midnight-zk's 3-input hash (variant 0). The width-3 instance has rate 2, so three inputs are absorbed in two chunks — one permutation call per chunk, as in the sponge diagram above — with the capacity lane (last) initialized to the input count:

hash3 in1 in2 in3 =
  let [x, y, z]    = bls12_381_poseidonPermutation 0 [in1, in2, 3]   -- absorb the first chunk (rate = 2 elements)
      [x', y', z'] = bls12_381_poseidonPermutation 0 [x + in3, y, z] -- absorb the second chunk
  in x'                                                              -- digest = first lane

The circom BLS12-381 port's 2-input hash (variant 1). This framing sizes the width to the arity — an nn-input hash uses a width-‘(n+1)‘`(n{+}1)` instance, so all inputs fit into the rate of a single chunk and one call suffices, with the capacity lane (first) fixed to zero:

hash2 in1 in2 = head (bls12_381_poseidonPermutation 1 [0, in1, in2]) -- digest = first lane

Instance registry

The built-in's first argument selects an instance from the registry specified here. The registry contract:

  • indices are append-only: new instances can be added, none can ever be removed;
  • the meaning of an index, once assigned, is never changed or reused — onchain scripts depend on it;
  • a faster but observably identical implementation of an existing index is not a new instance;
  • an index identifies a permutation, never a hash: framings are not part of an entry, and operating an existing index with a different framing — a different capacity tag, another absorption order, squeezing more output elements — never requires (and never receives) a new index.

What a registry entry specifies

Each entry must pin, bit-for-bit, everything the Parameters section identifies — numerically and structurally:

FieldMeaning
width tt, α\alpha, (RF,RP)(R_F, R_P)the shape of the permutation (the field is always the BLS12-381 scalar field — the one normative constant of this built-in)
MDS matrix, round constantsfull values, in a machine-readable constants file; MDS orientation and constant consumption order declared in the same file
partial-round S-box lanethe state element the partial rounds apply the S-box to
round-operation orderARC → S-box → Mix, as defined in The permutation; equivalent schedules permitted if observationally identical
provenancethe exact generation procedure: script, version and arguments
test vectorsat least one normative permutation vector (input state → full output state) in test-vectors.json

Alongside the normative fields, each entry's constants file also records — non-normatively, as provenance documentation — the framing used by the ecosystem the constants originate from (rate/capacity split and lane positions, capacity initialization, absorption schedule, accepted arities, digest lane), together with secondary hash vectors, so that script authors targeting that ecosystem can reproduce its hash exactly instead of inventing a framing (see Misuse warnings). This documentation describes one use of the entry, not a property of it: the entry is the permutation alone, and any framing may operate it.

Registered instances

The two initial entries are chosen to cover the two dominant proving-stack lineages over the BLS12-381 scalar field: the plonkish/halo2 ecosystem (index 0) and the circomlib-style R1CS ecosystem (index 1).

IndexInstancettα\alphaRFR_FRPR_PPartial S-box laneConstants
0midnight-zk435860lastmidnight-poseidon-constants.json
1circom BLS12-381 port2, 2-input35856firstcircom-bls-t3-poseidon-constants.json

Index 0 — midnight-zk (plonkish/halo2 ecosystem). The instance behind midnight-zk's Poseidon chip: width 3, RF=8R_F = 8, RP=60R_P = 60, S-box x5x^5, partial-round S-box on the last lane, row-major MDS (‘statei′=∑jMij statej‘`\text{state}'_i = \sum_j M_{ij}\,\text{state}_j`), constants consumed in ARC → S-box → Mix order. Provenance: generate_parameters_grain.sage 1 0 255 3 8 60 <r> (the pasta-hadeshash generator); source of truth circuits/src/hash/poseidon/constants/blstrs.rs in midnight-zk4 (Fq::from_raw little-endian limbs, canonical form), converted to the decimal integers in the constants file and cross-validated against midnight's own Rust implementation. The ecosystem it originates from operates it as: capacity lane last, initialized to the input count; digest = first lane (an example use, documented non-normatively in the constants file and demonstrated in Non-normative examples).

Index 1 — circom BLS12-381 port, 2-input (R1CS ecosystem). The width-3 instance of the circom port2, serving the circomlib-style R1CS ecosystem: width 3, RF=8R_F = 8, RP=56R_P = 56, S-box x5x^5, partial-round S-box on the first lane, row-major MDS, constants consumed in ARC → S-box → Mix order. Provenance: generate_params_poseidon.sage 1 0 255 3 5 128 <r> (the hadeshash generator); source of truth circuits/poseidon255_constants.circom in the circom port2, cross-validated against the circom tooling on the compiled circuit. The entry is defined by this upstream form; an implementation whose permutation core fixes the S-box on the last lane may realize it through the exact state-reversal conjugation shipped as conjugated_form in the constants file — observationally identical, hence not a distinct variant under the registry contract. The ecosystem it originates from operates it as: a single permutation of (0,in1,in2)(0, \text{in}_1, \text{in}_2) — capacity lane first, fixed to zero, exactly two inputs; digest = first lane (an example use, documented non-normatively in the constants file). This lineage also covers other toolchains that follow circomlib's conventions: Noir's Poseidon library9, for instance, uses exactly this recipe (Grain/hadeshash constants, width t=n+1t = n + 1, capacity first and zero, partial-round S-box and digest on the first lane) — today only over the BN254 field and hence out of scope, but a future Noir proving backend over the BLS12-381 scalar field adopting the same recipe would be served by this instance family rather than needing a new one.

Candidate instances

The following instance is fully validated against its upstream implementation and its constants, framing and vectors ship with this CIP, but it is not registered: it will be assigned an index by amendment once a user demonstrates a need for it.

Instancettα\alphaRFR_FRPR_PPartial S-box laneConstants
circom BLS12-381 port2, 3-input45856firstcircom-bls-t4-poseidon-constants.json

Provenance: generate_params_poseidon.sage 1 0 255 4 5 128 <r> (the hadeshash generator); the same first-lane S-box and conjugation remarks as index 1 apply.

Admission criteria for future instances

A proposed instance is added by amending this CIP with a complete registry entry. Beyond completeness, the entry must satisfy:

  1. Field: the BLS12-381 scalar field — this built-in never hosts another field. Ecosystems native to a different field — the canonical BN254 deployments of circomlib, or Noir with its Barretenberg backend (BN254) — are permanently out of scope: their digests cannot be reproduced over this field at any layer.
  2. S-box: gcd⁡(α,p−1)=1\gcd(\alpha, p - 1) = 1, so x↦xαx \mapsto x^\alpha is a bijection.
  3. Security level: a declared level of at least 128 bits, with (RF,RP)(R_F, R_P) meeting the Poseidon paper's minima plus its recommended margin for the declared (t,α)(t, \alpha)1.
  4. Constant properties: all constants canonical in [0,p)[0, p); round constants pairwise distinct and nonzero; the matrix genuinely MDS (every square minor nonzero, see footnote 7 of the Poseidon paper1, hence invertible); and no infinitely long subspace trail keeping the partial-round S-box inactive — the only MM-invariant subspace contained in ‘{x:xS-box lane=0}‘`\{x : x_{\text{S-box lane}} = 0\}` is the trivial one, checked as full rank of the matrix with rows elMje_l M^j, j=0,…,t−1j = 0, \dots, t-1 (Poseidon paper1, §2.3; see also10). (The stronger condition that no power MiM^i has any eigenvalue in Fp\mathbb{F}_p is sufficient but not necessary — both registered width-3 instances have such eigenvalues yet satisfy the criterion above; the width-4 circom candidate happens to have none.)
  5. Cross-validation: test vectors reproduced against the upstream implementation the instance claims compatibility with, plus the normative permutation vector.
  6. Demonstrated demand: a concrete user or protocol that needs this instance.

Criteria 2 and 4 (and the re-derivation of every shipped vector) are mechanically checkable: check-constants.py in this CIP's directory implements them for all shipped constants with a dependency-free python3 check-constants.py, and must pass for any amended entry.

Known-answer test vectors

test-vectors.json accompanies this CIP. For each instance it contains a normative permutation vector — one call of the built-in, input state to full output state — which is what conformance means for bls12_381_poseidonPermutation; for index 0:

bls12_381_poseidonPermutation 0 [1, 2, 3] =
  [ 0x5e7d844fc6e217cb53a21928cdd831c73fe626f0b62fe012e9e3883a05b88b1a
  , 0x6727d5f45b85a106452257dab75c34fab4edec2544ba49a4c7b73edef7a7f5da
  , 0x339d99829dc3bb8b18fcc17a2dc7cda7628f2fcdc6c7f71f83c3f5e5466e2c4a ]
 
bls12_381_poseidonPermutation 1 [0, 1, 2] =
  [ 0x3fb8310b0e962b75bffec5f9cfcbf3f965a7b1d2dcac8d95ccb13d434e08e5fa
  , 0x43fe5dfa886bfae59d015ed8b2a8c9328230f299203c89b9c78d8b40ccdc7dda
  , 0x05153d5d7d0f9122550ecc902c0f5248d8ddcacfa1b911699c982099efc48aa7 ]

and, per instance, secondary hash vectors that demonstrate the correct construction of the origin ecosystem's hash out of permutation calls — each vector carries the full trace (every permutation call's input and output state, following the framing documented in the instance's constants file) ending in the digest, so a script-level hash implementation can be checked call by call, not just against the final digest. These are worked examples of one use, not registered modes: a script operating the same index with a different framing — a different tag, or squeezing more elements — is equally legitimate (subject to Misuse warnings) and needs no new registry entry. For index 0:

midnight_poseidon_hash [1, 2]    -- one call:  P([1, 2, 2]); note the capacity tag is the arity, 2
  = 0x4ad818f39d91567d105c5bea1ec4b5ac201dc45b784e39a2beef781790bf5177
midnight_poseidon_hash [1, 2, 3] -- two calls: P([1, 2, 3]), then P over the updated state
  = 0x2416a898714a84833f3690e09279c3b175418c956399a8c8928b8d1d4150ab7b

The pair illustrates the terminology split above and the role of the length tag: hash [1, 2] is not any element of the permutation [1, 2, 3] vector — the 2-input hash absorbs into initial state (0,0,2)(0, 0, \mathbf{2}), while P([1,2,3])P([1,2,3]) is merely the first call inside hash [1, 2, 3] (capacity tag 33), whose output state is an intermediate value, not a digest. For index 1, the circom 2-input hash of [1,2][1, 2] is a single call and its digest is the first element of the permutation vector above — the upstream repository's own shipped test vector.

Digest provenance: the midnight 3-input hash, the midnight permutation vector, and both circom digests were produced by the upstream implementations themselves (midnight-zk's Rust; the circom tooling on the compiled circuits); the midnight 2-input hash vector is derived from the framing exactly as upstream's fixed-length code path computes it (init(Some(2)), no padding). All vectors are independently re-derived from the shipped constants files by check-constants.py.

Rationale: How does this CIP achieve its goals?

The Poseidon permutation could in principle be implemented in Plutus itself on top of the existing integer or BLS12-381 built-ins, but each evaluation requires on the order of 60+ rounds of field exponentiations and an MDS matrix multiplication, which is prohibitively expensive within current script budgets. Exposing the permutation as a native built-in — costed as a constant per variant index, since the built-in never absorbs variable-length input — makes onchain verification of Poseidon-based commitments practical and closes the gap between what zk provers produce and what Plutus scripts can verify.

Trustworthiness of the implementation

Per CIP-35, a proposed built-in must argue that its implementation can be trusted. For the reference implementation (see Reference implementation):

  • Provenance and review. The C core comes from Nomadic Labs' MIT-licensed ocaml-bls12-381-hash library7, built on the same blst arithmetic as the existing BLS12-381 built-ins. It has been reviewed by the authors of this proposal, and every registered instance is cross-validated against its upstream ecosystem implementation through the shipped test vectors (test-vectors.json, re-derivable via check-constants.py). It has not yet been independently audited; an audit is a precondition for a production release and appears in the acceptance criteria below.
  • Termination. Every call executes exactly RF+RPR_F + R_P rounds of straight-line field arithmetic; there is no input-dependent control flow, so the function always terminates.
  • No exceptions. The function is total apart from its two specified failure modes — an unregistered variant index and a wrong-length input list — both of which are ordinary, costed built-in evaluation failure, not exceptions. The arithmetic itself is total: the modular reduction accepts any integer (negative included) and no division is performed.
  • Predictable behaviour. The cost is constant per instance up to the input-size-linear modular reduction; the benchmarks below show a flat curve (under 10% variation over a 31× input-size range), and the proposed linear guard term covers inputs beyond the benchmarked range. There is no data-dependent worst case.

Cost model and initial benchmarks

An initial implementation of the built-in was benchmarked on the Plutus cost model benchmarking machine (CI run; raw data in results.csv) to establish how the built-in should be costed and that it is affordable on chain.

What determines the cost

The interface gives the costing function little to depend on, by design:

  • the variant index is a bounded small integer (one word for every registry entry), selecting a fixed permutation;
  • the input list has exactly tt integers; each is reduced modulo pp on entry, after which all work — the RF+RPR_F + R_P rounds — is fixed-size field arithmetic independent of the arguments.

The only argument-size-dependent work is therefore the initial modular reduction. This splits the cost into a realistic-usage cost — inputs that are already canonical field elements of at most 255 bits (4 words), which is what every framing produces — and a worst case for oversized integers, whose reduction the built-in must still charge for. The benchmarks measure both by varying the size of the input integers from 1 to 31 machine words (64 to ~2000 bits), for both registered variants:

VariantTotal rounds (RF+RPR_F + R_P)1-word inputsrealistic usage (255-bit inputs)measured worst case (31-word inputs)
0 (midnight-zk)6821.8 µs~23.6 µs24.1 µs
1 (circom port)6420.7 µs~22.2 µs23.1 µs

Two observations:

  • The cost is essentially constant in the input size. Growing every input from 1 to 31 words moves the cost by under 10%: the reduction is negligible against the round function, and the realistic-usage cost sits within a few percent of the measured worst case.
  • The cost is proportional to the round count. Variant 1 is ~5% cheaper than variant 0, matching its round-count ratio (64/68≈0.9464/68 \approx 0.94). The permutation cost is thus dominated by the rounds, and the cost of any future instance is predictable from its tt and (RF,RP)(R_F, R_P) before it is implemented.

Proposed costing

  • CPU: a constant per instance, set to that instance's measured worst case — about 24 µs for index 0 and 23 µs for index 1 on the benchmarking machine, i.e. on the order of 2.4×1072.4 \times 10^7 ExCPU. Because the size curve is so flat, this conservative constant overcharges realistic usage (255-bit inputs) by only a few percent. For inputs beyond the benchmarked range the modular reduction keeps scaling, so the constant should be accompanied by a small linear term in the total size of the list elements (mirroring how modInteger is costed today) to keep adversarially large integers safely costed.
  • Memory: a constant per call: the output is tt canonical field elements of at most 4 words each (12 words of integers for the width-3 instances, plus list overhead).

One nuance: Plutus costing functions usually depend on argument sizes rather than values, but Plutus already provides newtype wrappers that change an argument's size measure, used in the builtin's denotation and its budgeting benchmark alike. IntegerCostedLiterally, for example, makes an integer's size its absolute value; this is how dropList (whose cost depends on the number of elements dropped) and shiftByteString/rotateByteString are costed. Wrapping the variant index the same way lets the costing function depend on which instance is selected, so each instance is charged its own cost rather than the worst case over all of them. This also keeps the registry extensible: a future instance with a materially larger width or round count can be costed on its own without raising the cost of existing ones. The exact shape — whether an existing costing-function form suffices, or a dedicated size measure mapping each index to its cost is needed — is to be agreed with the Plutus Core team.

Comparison with other built-ins

Against the same benchmarking suite run on master (CI run of 2026-08-10; raw data in results-master.csv, covering equalsByteString and equalsString): those built-ins run at 1.1–2.3 µs across argument sizes up to ~20 kB, so one Poseidon permutation costs roughly 10–20 such calls — squarely in the range of ordinary built-in work, orders of magnitude below the budget-dominating BLS12-381 pairing operations already on mainnet.

The instructive comparison is with the traditional hash built-ins, which are the other way to build a Merkle tree on chain. Per the current mainnet cost model, hashing one 64-byte Merkle node (two 32-byte children) costs about 0.27 µs with blake2b_256 and about 0.45 µs with sha2_256; the corresponding Poseidon 2-to-1 compression is one permutation call at ~23 µs. On chain, a Poseidon Merkle node is therefore roughly 90× more expensive than a blake2b_256 node (roughly 50× a sha2_256 node). That factor is the price of arithmetization-friendliness, and it buys back far more on the proving side: in-circuit, a bit-oriented hash costs tens of thousands of constraints per evaluation against a few hundred for Poseidon (see Motivation) — a ~100× saving exactly where the budget is scarce.

In protocol terms (ExCPU is calibrated as ~1 ps on the reference machine), one permutation call is ~‘2.4×107‘`2.4 \times 10^7` ExCPU, i.e. ~0.24% of the mainnet per-transaction CPU budget of 101010^{10}. A single transaction could afford over 400 permutation calls on CPU cost alone.

What this buys: a Merkle tree on chain

The motivating workload is Merkle verification. In both registered framings a 2-to-1 compression — hashing a node's left and right child — is a single permutation call (circom: digest of P(0,l,r)P(0, l, r); midnight: digest of ‘P(l,r,2)‘`P(l, r, 2)`), so verifying a Merkle membership proof of depth dd costs dd calls plus cheap glue (list construction, selecting the left/right position per level):

Tree depth (leaves)Permutation callsBuilt-in CPU costShare of tx budgetSame proof with blake2b_256
20 (10610^6)20~0.48 ms~4.8%~5.4 µs (~0.05%)
32 (4×1094 \times 10^9)32~0.77 ms~7.7%~8.6 µs (~0.09%)

A Poseidon membership proof is thus ~90× the cost of its blake2b_256 counterpart, yet a proof over a tree with four billion leaves still consumes under a tenth of one transaction's CPU budget — the construction the Motivation section opens with is comfortably practical on chain, which is what this initial experiment set out to show.

Path to Active

Acceptance Criteria

  • The exact parameter set of each registered instance (the BLS12-381 scalar field, tt, α\alpha, round counts, constant generation, structural choices) is fixed in this specification.
  • The constants files shipped with this CIP are independently validated as the correct, usable parameter sets: regenerated bit-for-bit from each instance's pinned generator script and cross-checked against its upstream source of truth, and confirmed to satisfy the constant properties of the admission criteria (check-constants.py passes).
  • The built-in is implemented in Plutus with a benchmarked costing function, validated against reference implementation test vectors.
  • The C permutation core and its integration (cardano-base bindings and the Plutus built-in) have passed an independent security audit — the existing implementation and benchmarks are preliminary feasibility work, not a production implementation.
  • The ledger is updated with new protocol parameters controlling the costing of the built-in.
  • The built-in is released on mainnet in a hard-fork protocol upgrade (adding a built-in changes the binary format and therefore requires a hard fork; per CIP-35 it does not require a new Plutus Core language version).

Implementation Plan

  • Agree on the parameter sets with the Plutus Core team and community.
  • Validate the shipped constants files: re-run the pinned generator scripts and diff against the upstream sources of truth (blstrs.rs for index 0, poseidon255_constants.circom for index 1), and verify the admission criteria's constant properties via check-constants.py.
  • Implement the primitive (e.g. in cardano-base/plutus) with test vectors cross-checked against the upstream implementation of each registered instance. The existing cardano-base/plutus integration that produced the benchmarks in this document is preliminary work — its purpose was to demonstrate that the built-in can run on chain, not to be the final production implementation.
  • Commission an independent audit of the C permutation core7 and its bindings.
  • Align the cardano-base variant registry with the table in this CIP. The preliminary implementation registers a different width-3 instance at index 0 — the Nomadic Labs ocaml-bls12-381-hash7 instance (RP=56R_P = 56, different constants and provenance); the registry becomes append-only upon ratification of this CIP, so that entry must be replaced by the table above before release (the Nomadic instance can still be registered later under the admission criteria if a user demonstrates demand). Index 1 needs either a generalized partial-S-box lane in the C core or the shipped conjugated_form, and the constant test suite asserts the eigenvalue-freeness condition that the criteria above deliberately relax to the subspace-trail criterion.
  • Benchmark and propose costing parameters (initial benchmarks and a proposed costing shape in Cost model and initial benchmarks).

This CIP is licensed under CC-BY-4.0.

Footnotes

  1. L. Grassi, D. Khovratovich, C. Rechberger, A. Roy, M. Schofnegger. Poseidon: A New Hash Function for Zero-Knowledge Proof Systems. USENIX Security 2021. IACR ePrint 2019/458. ↩ ↩2 ↩3 ↩4 ↩5 ↩6

  2. J. Magán. poseidon-bls12381-circom, a circom Poseidon implementation over the BLS12-381 scalar field. github.com/jmagan/poseidon-bls12381-circom. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7

  3. iden3. circomlib. Reference Poseidon circuit: circuits/poseidon.circom. ↩

  4. Midnight Network. midnight-zk, the zero-knowledge library of the Midnight blockchain; Poseidon instance and constants under circuits/src/hash/poseidon. github.com/midnightntwrk/midnight-zk. ↩ ↩2 ↩3 ↩4

  5. L. Grassi, D. Khovratovich, M. Schofnegger. Poseidon2: A Faster Version of the Poseidon Hash Function. AFRICACRYPT 2023. IACR ePrint 2023/323. Reference parameters: HorizenLabs/poseidon2. ↩

  6. L. Grassi, R. Lüftenegger, C. Rechberger, D. Rotaru, M. Schofnegger. On a Generalization of Substitution-Permutation Networks: The HADES Design Strategy. EUROCRYPT 2020. IACR ePrint 2019/1107. ↩

  7. Nomadic Labs. ocaml-bls12-381-hash, MIT-licensed C implementations (with OCaml bindings) of arithmetization-friendly hash primitives over the BLS12-381 scalar field; the Poseidon permutation core referenced by this proposal lives under src/poseidon. gitlab.com/nomadic-labs/cryptography/ocaml-bls12-381-hash. ↩ ↩2 ↩3 ↩4

  8. G. Bertoni, J. Daemen, M. Peeters, G. Van Assche. Cryptographic Sponge Functions / On the Indifferentiability of the Sponge Construction, EUROCRYPT 2008. keccak.team/sponge_duplex.html. ↩ ↩2

  9. noir-lang. poseidon, the Poseidon library of the Noir language (formerly in the Noir standard library); circomlib-consistent instantiations over BN254. github.com/noir-lang/poseidon. ↩

  10. L. Grassi, C. Rechberger, M. Schofnegger. Proving Resistance Against Infinitely Long Subspace Trails: How to Choose the Linear Layer. IACR ToSC 2021(2). IACR ePrint 2020/500. ↩