Reactive Network Developer Documentation

website·Indexed 34 days ago

https://dev.reactive.network

Developer resources for the Reactive Network, featuring guides on Reactive Contracts, the Reactive Library, and ReactVM. Includes technical documentation for RNK RPC methods, event processing, callbacks, subscriptions, and integration with Hyperlane mailboxes.

Tokens
20K
Snippets
100
Records
133
Agent score
63%

What's inside Reactive Network

  1. Introduction to Reactive Network EVM Automation

    Reactive Network is an EVM automation layer that enables 'if-this-then-that' on-chain automation via reactive contracts. These are event-driven smart contracts that subscribe to event logs across various EVM chains and automatically execute Solidity logic when matching events occur. The network runs on CometBFT consensus, offering roughly 1-second block times and instant finality while remaining fully EVM compatible. This architecture removes the need for manual user triggers or off-chain bots to initiate cross-chain callback transactions.
  2. Understand Reactive Network core system contracts

    Reactive Network operations are managed by three primary contracts:

    1. System Contract: Handles payments for Reactive Contracts, manages access control (whitelisting/blacklisting), and emits cron events for periodic triggers.
    2. Callback Proxy: Delivers callback transactions to destination contracts, manages deposits/reserves/debts, restricts callbacks to authorized contracts, and calculates gas costs and kickbacks.
    3. AbstractSubscriptionService: Manages event subscriptions with support for filtering by chain, contract, and topics, including wildcard matching via REACTIVE_IGNORE.
  3. Understand Reactive Contracts for cross-chain automation

    Reactive contracts are event-driven smart contracts designed for cross-chain, on-chain automation. They function by subscribing to event logs across EVM chains; when a matching event occurs, they execute Solidity logic and can trigger cross-chain callback transactions. Once deployed to the Reactive Network, the system contract delivers event logs to the contract's react() function and processes callback requests.
  4. Use Hyperlane mailboxes for cross-chain callbacks

    Reactive contracts typically send cross-chain callback transactions via callback proxies. Hyperlane mailboxes serve as an alternative transport mechanism, acting as the entry and exit points for cross-chain messages on supported chains. This is particularly useful when a callback proxy is not yet deployed on a specific chain. Reactive contracts continue to listen to event logs and trigger actions normally; only the underlying transport layer changes.
  5. Understand Reactive Contracts (RCs) architecture

    Reactive Contracts (RCs) are event-driven smart contracts designed for cross-chain, on-chain automation. Unlike traditional contracts that rely on user transactions or bots, RCs operate autonomously by monitoring event logs across EVM chains. When a subscribed event occurs, the RC executes Solidity logic and can trigger cross-chain callback transactions.
  6. Understand Reactive Network and Reactive Contracts

    Reactive Network is an EVM-compatible blockchain that enables on-chain, cross-chain automation through Reactive Contracts (RCs). Unlike standard smart contracts that require a user or bot to trigger a transaction, Reactive Contracts monitor event logs across EVM chains and automatically execute Solidity logic when specific conditions are met. This allows for 'if-this-then-that' automation, such as automated stop-loss/take-profit orders, liquidation protection, portfolio rebalancing, and yield optimization.
  7. Understand Reactive Contract event processing and ReactVMs

    Reactive Contracts process on-chain events and trigger transactions on destination chains via callbacks. These contracts execute within isolated environments called ReactVMs, which are associated with the deployer's address. Contracts within one ReactVM cannot interact directly with contracts deployed by other users.
  8. Get specific ReactVM information using rnk_getVm

    The rnk_getVm method retrieves detailed information about a specific ReactVM. It requires the rvmId (20 bytes of data) as a parameter. The response includes the rvmId, the lastTxNumber (hex-encoded), and the count of contracts created by that RVM.
    curl --location 'https://lasna-rpc.rnk.dev/' \
    --header 'Content-Type: application/json' \
    --data '{
      "jsonrpc": "2.0",
      "method": "rnk_getVm",
      "params": ["0xA7D9AA89cbcd216900a04Cdc13eB5789D643176a"],
      "id": 1
    }' | jq
  9. Understand ReactVM execution environment

    ReactVM is a private execution environment within the Reactive Network. It is where Reactive Contracts process events and execute Solidity logic. Each contract runs in a dedicated ReactVM that activates upon subscribed events. ReactVMs operate independently and in parallel, ensuring deterministic execution. Event logs are delivered to the ReactVM, which then determines if callback transactions should be sent to destination chains.
  10. Understand Reactive Contract Origins and Destinations

    Reactive Contracts (RCs) operate by listening to event logs on one chain and triggering actions on another.

    • Origin: The event source chain where events occur and logs are read.
    • Destination: The chain where the Reactive Network delivers a callback transaction, resulting in state changes.

    Key capabilities include:

    • Cross-chain flow: Origins and destinations can be different chains.
    • Multi-chain subscription: A single RC can subscribe to events from multiple origin chains.
    • Multi-chain delivery: An RC can send callbacks to one or more destination chains.
    • Conditional logic: Solidity logic can be used to determine the destination chain dynamically.
  11. Understand Reactive Contract event subscriptions

    Reactive Contracts (RCs) listen to events by subscribing through the system contract. A subscription is defined by the origin chain ID, the contract address, and event topics. When an event matching these criteria is detected, the contract's react() function is triggered. Subscriptions can be configured during deployment (in the constructor) or dynamically via callbacks.
  12. Manage Reactive Contract deployment environments

    Reactive Contracts are deployed in two distinct environments using identical bytecode, but they operate independently and do not share state:

    1. Reactive Network (RNK): The public chain where Externally Owned Accounts (EOAs) interact with the contract and manage subscriptions.
    2. ReactVM (RVM): A private execution environment where event processing takes place.

    To distinguish between these environments, developers can use constructor flags or runtime checks. A contract can detect if it is executing inside ReactVM by calling the system contract; these calls will revert if executed outside of ReactVM.