Appendix B: Compiler Intrinsics

The Pint compiler supports a list of intrinsics that perform various low level operations that are mostly useful for building libraries. Intrinsics are generally target-specific. They give library authors access to VM-specific instructions while preserving type safety. Below is a list of all available compiler intrinsics for the Essential VM:


__this_address() -> b256

Description: Returns the content hash of this predicate.


__this_contract_address() -> b256

Description: Returns the content hash of the contract that this predicate belongs to.


__this_pathway() -> int

Description: Returns the "pathway" of this predicate. The pathway of a predicate is the index of the solution data currently being used to check the predicate.


__predicate_at(pathway: int) -> { b256, b256 }

Description: Returns the full address of predicate at pathway <pathway>. The pathway of a predicate is the index of the solution data currently being used to check the predicate. The full address contains both the content hash of the contract to which the predicate belongs and the content hash of the predicate itself


__address_of(name: string) -> b256

Description: Returns the content hash of predicate named name in the same contract. The name must be the full absolute path to the predicate, such as ::Foo, and cannot be the name of the predicate it's used in.


__sha256(data: _) -> b256

Description: Returns a SHA 256 hash from the specified data.


__state_len(data: _) -> int

Description: Returns the length of a state variable. the argument data must be a state variable or a "next state" expression but can have any type.


__vec_len(vec: _[]) -> int

Description: Returns the length of a storage vector.


__verify_ed25519(data: _, sig: { b256, b256 }, pub_key: b256) -> bool

Description: Validate an Ed25519 signature against a public key.


__recover_secp256k1(data_hash: b256, sig: { b256, b256, int }) -> { b256, int }

Description: Recover the public key from a secp256k1 signature.