
Overview
This section explains how reactive contracts pay for execution and cross-chain callbacks, including REACT funding, transaction fees, and callback pricing. Contracts must maintain sufficient balances to remain active.
Reactive Transactions
Reactive transaction fees are charged synchronously when the system contract executes the react() call. The fee is calculated as:
Where:
BaseFee— base fee per gas unit in the current blockGasUsed— gas consumed during execution
The maximum gas limit for reactive transactions is 900,000 units.
Direct Transfers
Reactive contracts must be funded in REACT before executing reactive transactions.
Fund a contract:
cast send $CONTRACT_ADDR \
--rpc-url $REACTIVE_RPC \
--private-key $REACTIVE_PRIVATE_KEY \
--value 0.1ether
Then settle outstanding debt:
cast send \
--rpc-url $REACTIVE_RPC \
--private-key $REACTIVE_PRIVATE_KEY \
$CONTRACT_ADDR "coverDebt()"
Contract status is available on Reactscan.
active— contract executes normallyinactive— outstanding debt must be settled
System Contract Deposits
Contracts can be funded through the system contract using depositTo(). The sender pays the transaction fee, and any outstanding debt is settled automatically.
cast send \
--rpc-url $REACTIVE_RPC \
--private-key $REACTIVE_PRIVATE_KEY \
$SYSTEM_CONTRACT_ADDR "depositTo(address)" \
$CONTRACT_ADDR \
--value 0.1ether
Callback Pricing
Callback costs depend on the destination network and current base fees. The callback price is calculated as:
Where:
- — base gas price (
tx.gaspriceorblock.basefee) - — destination-network pricing coefficient
- — callback gas usage
- — fixed gas surcharge
Callback Payment
Callbacks use the same payment model as reactive transactions. Contracts without sufficient funds are blocklisted and can't execute transactions or callbacks.
Reactive Network enforces a minimum callback gas limit of 100,000 gas. Callback requests below this threshold are ignored, as this minimum ensures sufficient gas for internal audits and computations required to process the callback.
Direct Transfers
Fund a callback contract:
cast send $CALLBACK_ADDR \
--rpc-url $DESTINATION_RPC \
--private-key $DESTINATION_PRIVATE_KEY \
--value 0.1ether
Then settle outstanding debt:
cast send \
--rpc-url $DESTINATION_RPC \
--private-key $DESTINATION_PRIVATE_KEY \
$CALLBACK_ADDR "coverDebt()"
Callback Proxy Deposits
Callback contracts can be funded through the callback proxy using depositTo(). Debt is settled automatically.
cast send \
--rpc-url $DESTINATION_RPC \
--private-key $DESTINATION_PRIVATE_KEY \
$CALLBACK_PROXY_ADDR "depositTo(address)" \
$CALLBACK_ADDR \
--value 0.1ether
Implementing pay() or inheriting from AbstractPayer enables automatic settlement. The callback proxy calls pay() when a callback creates debt. The standard implementation verifies the caller, checks balances, and settles the debt.
Callback Contract Balance
Balance
Retrieve the balance of a callback contract:
cast balance $CONTRACT_ADDR --rpc-url $DESTINATION_RPC
Debt
Query the debt recorded by the callback proxy:
cast call $CALLBACK_PROXY_ADDR "debts(address)" $CONTRACT_ADDR --rpc-url $DESTINATION_RPC | cast to-dec
Reserves
Retrieve reserves held by the callback proxy:
cast call $CALLBACK_PROXY_ADDR "reserves(address)" $CONTRACT_ADDR --rpc-url $DESTINATION_RPC | cast to-dec
Reactive Contract Balance
Balance
Retrieve the REACT balance of a reactive contract:
cast balance $CONTRACT_ADDR --rpc-url $REACTIVE_RPC
Debt
Query the debt recorded by the system contract:
cast call $SYSTEM_CONTRACT_ADDR "debts(address)" $CONTRACT_ADDR --rpc-url $REACTIVE_RPC | cast to-dec
Reserves
Retrieve reserves held by the system contract:
cast call $SYSTEM_CONTRACT_ADDR "reserves(address)" $CONTRACT_ADDR --rpc-url $REACTIVE_RPC | cast to-dec