Utility functions
Crypto API
Crypto API provides a set of cryptographic functions for use within blueprints — blst
is used internally to implement BLS12-381 elliptic-curve operations.
Function: CRYPTO_UTILS_BLS12381_V1_VERIFY
This function verifies a BLS12-381 signature for a single message.
Function: CRYPTO_UTILS_BLS12381_V1_AGGREGATE_VERIFY
This function verifies an aggregate BLS12-381 signature for multiple messages.
Function: CRYPTO_UTILS_BLS12381_V1_FAST_AGGREGATE_VERIFY
This function verifies a BLS12-381 signature for a single message with multiple public keys.
Function: CRYPTO_UTILS_BLS12381_G2_SIGNATURE_AGGREGATE
This function aggregates multiple BLS12-381 signatures into one by adding them together.
Function: CRYPTO_UTILS_KECCAK256_HASH
This function returns the Keccak-256 hash of the input data.
Memory-management API
Function: BUFFER_CONSUME
This function consumes a buffer and copies its contents to the specified destination pointer. The size is not necessary to communicate at this point as the caller holds this information prior to calling this function, as any API returning a buffer also returns the size.
Buffers are used to pass data between the host and the guest code. The system tracks any returned buffers through an index map local to the current VM instance. This approach has the potential to create a memory-exhaustion issue due to the buffer limits being renewed on each stack frame.
System API
Function: SYS_LOG
This function emits a log message with a specified severity level. The message size is constrained by the costing model, so it presents no risks.
Function: SYS_BECH32_ENCODE_ADDRESS
This function encodes a global address into Bech32 format.
Function: SYS_PANIC
This function triggers a system panic with an error message.
Function: SYS_GET_TRANSACTION_HASH
This function retrieves the hash of the current transaction.
Function: SYS_GENERATE_RUID
This function generates a Radix unique identifier (RUID). This is done by combining parts of the transaction hash as well as a block local ID counter.