Skip to main content

Special operations

Special operations are specific types of operations that facilitate various events on the Rell dapp side. These operations are automatically executed at specific points in the blockchain lifecycle and enable automation and integration with external systems.

Available special operations

OperationLocationDescription
__begin_blockon-chainThis operation is executed before any regular transactions are included in the block, allowing for the automation of processes within a dapp.
__end_blockon-chainThis operation is executed after all regular transactions have been processed in the block, enabling the automation of processes within a dapp.
__icmf_messagecross-chainThis operation is used for the Inter-Chain Messaging Framework (ICMF) to manage messages between dapps.
__evm_blockcross-chainThis operation is utilized for the EVM (Ethereum Virtual Machine) Interface (EIF) and is triggered when a block from the EVM network has been received and processed via the EVM Interface (EIF), enabling integration of EVM-side events into the dapp.
__timebon-chainThis operation enforces a temporal condition on transaction validity by requiring that transactions be included in a block only within a specified time window, enhancing control, security, and synchronization of blockchain actions.

Naming conventions

All special operations share a global namespace across the entire blockchain runtime, so name conflicts may occur if different extensions use the same operation names. To prevent this, always use structured dot-notation in @mount names and include the extension/module name in the operation:

// ✅ Preferred: Use dots for mount names
@mount('icmf.message')
operation __icmf_message() {}

@mount('stork.oracle.prices')
operation __stork_oracle_prices() {}

// ❌ Avoid: Using underscores in mount names
// @mount('icmf_message')
// operation __icmf_message() {}
note

Always include the extension name in special operation names to avoid collisions.

Implementation examples

Basic special operations

operation __begin_block(height: integer) {
// Initialize block-level state
print("Block %s started".format(height));
}

operation __end_block(height: integer) {
// Clean up block-level state
print("Block %s completed".format(height));
}

Extension-specific special operations

// ICMF message handling
@mount('icmf.message')
operation __icmf_message() {
// Process incoming ICMF messages
// Implementation details here
}

// Stork oracle price updates
@mount('stork.oracle.prices')
operation __stork_oracle_prices() {
// Update price feeds from Stork oracle
// Implementation details here
}

// Bridge deposit processing
@mount('bridge.deposit')
operation __bridge_deposit() {
// Process pending bridge deposits
// Implementation details here
}