Skip to main content
Version: 11.x

Function: poseidonCreate()

poseidonCreate(opts, mdsAttempt?): PoseidonFn

Defined in: node_modules/@scure/starknet/index.d.ts:302

Creates a Starknet-compatible Poseidon permutation from parameters and an MDS attempt index.

Parameters​

opts​

PoseidonOpts

Poseidon permutation parameters. See PoseidonOpts.

mdsAttempt?​

number

attempt index used to derive the MDS matrix

Returns​

PoseidonFn

Poseidon permutation with Starknet metadata.

Throws​

If the derived Poseidon MDS matrix is invalid. Error

Throws​

On wrong Poseidon option or attempt types. TypeError

Throws​

On invalid Poseidon option or attempt ranges. RangeError

Example​

Create the default Starknet-compatible Poseidon permutation from parameters alone.

import { Fp251, poseidonCreate } from '@scure/starknet';
poseidonCreate({ Fp: Fp251, rate: 2, capacity: 1, roundsFull: 8, roundsPartial: 83 });