Skip to main content

Crate miden

Crate miden 

Source

Re-exports§

pub use miden_field;
pub use miden_field_repr as felt_repr;
pub use wit_bindgen;

Modules§

active_account
active_note
asset
faucet
input_note
intrinsics
native_account
note
output_note
storage
tx

Macros§

felt
Creates a Felt from an integer constant checking that it is within the valid range at compile time.
generate
Generate bindings for an input WIT document.

Structs§

AccountId
Unique identifier for a Miden account, composed of two field elements.
Asset
A fungible or non-fungible asset encoded as separate vault key and value words.
BumpAlloc
A very simple allocator for Miden SDK-based programs.
Digest
A cryptographic digest representing a 256-bit hash value.
Felt
A Felt backed by Plonky3’s Goldilocks field element.
NoteIdx
NoteMetadata
The note metadata returned by *_note::get_metadata procedures.
NoteType
Recipient
A note recipient digest.
SmtGetResponse
Result of smt_get, containing the retrieved value and the (unchanged) root.
SmtSetResponse
Result of smt_set, containing the old_value and the updated new_root.
StorageMap
Typed access to an account storage map.
StorageSlotId
The partial hash of a storage slot name.
StorageValue
Typed access to a single account storage value.
Tag
Word
A unit of data consisting of 4 field elements.
WordAligned
A wrapper type which ensures that the wrapped value is aligned to 32 bytes.

Traits§

FromFeltRepr
Trait for deserialization from felt memory representation.
ToFeltRepr
Trait for serializing a type into its felt memory representation.
WordKey
A type that can be used as a key in a storage map.
WordValue
A type that can be stored in (or loaded from) account storage.

Functions§

adv_load_preimage
Pops an arbitrary number of words from the advice stack and asserts it matches the commitment. Returns a Vec containing the loaded words.
assert
Fails if a != 1.
assert_eq
Fails if a != b.
assertz
Fails if a != 0.
blake3_hash
Computes BLAKE3 1-to-1 hash.
blake3_merge
Computes BLAKE3 2-to-1 hash.
emit_falcon_sig_to_stack
extern_hash_elements
ABI helper for miden::core::crypto::hashes::poseidon2::hash_elements.
extern_hash_words
ABI helper for miden::core::crypto::hashes::poseidon2::hash_words.
felt_from_padded_word
Extracts a scalar felt from a protocol word with zero-padded trailing limbs.
hash_elements
Computes the hash of a sequence of field elements using the Rescue Prime Optimized (RPO) hash function.
hash_words
Computes the hash of a sequence of words using the Rescue Prime Optimized (RPO) hash function.
padded_word_from_felt
Packs a scalar felt into the leading limb of a protocol word.
pipe_double_words_to_memory
Returns an even number of words from the advice stack along with the RPO hash of all read words.
pipe_words_to_memory
Reads an arbitrary number of words num_words from the advice stack and returns them along with sequantial RPO hash of all read words.
rpo_falcon512_verify
sha256_hash
Computes SHA256 1-to-1 hash.
sha256_merge
Computes SHA256 2-to-1 hash.
smt_get
Returns the value associated with key in the sparse Merkle tree rooted at root as tracked by the VM’s advice provider. The returned SmtGetResponse contains the retrieved value and the (unchanged) root returned by the ABI. Fails if the tree with the specified root does not exist in the VM’s advice provider. When no value has previously been inserted under key, the procedure returns the empty word.
smt_set
Inserts value at key in the sparse Merkle tree rooted at root, returning the prior value stored at key along with the new root. The returned SmtSetResponse contains the previous value stored under key and the updated root. Fails if the tree with the specified root does not exist in the VM’s advice provider.

Attribute Macros§

auth_script
Marks a component method as the authentication procedure entrypoint (#[auth_script]).
component
Generates the WIT interface and storage metadata.
export_type
Generates an equvalent type in the WIT interface. Required for every type mentioned in the public methods of an account component.
note
Marks a type/impl as a note script definition.
note_script
Marks a method as the note script entrypoint (#[note_script]).
tx_script
Marks the function as a transaction script

Derive Macros§

FromFeltRepr
Derives FromFeltRepr for miden-field-repr for a struct with named fields, or an enum.
ToFeltRepr
Derives ToFeltRepr trait for a struct with named fields, or an enum.