Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/debugging/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ You will need to disable Smart Transactions in MetaMask:

After this, your transactions will go through the regular route and should work correctly.

[More on Smart Transactions →](https://support.metamask.io/manage-crypto/transactions/smart-transactions/)
[More on MetaMask's Smart Transactions →](https://support.metamask.io/manage-crypto/transactions/smart-transactions/)
Binary file added docs/docs/img/reactive-contracts.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/docs/img/reactive-smart-contracts.jpg
Binary file not shown.
8 changes: 5 additions & 3 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
sidebar_position: 1
title: Getting Started
description: Explore Reactive Network, an EVM-compatible layer for advanced dApps. Learn about Reactive Smart Contracts that use data flows from multiple blockchains. Get started with setup, development and testing, and our unique architecture.
description: Explore Reactive Network, an EVM-compatible layer for advanced dApps. Learn about Reactive Contracts that use data flows from multiple blockchains. Get started with setup, development and testing, and our unique architecture.
slug: /
hide_title: true
---

![Reactive Network Docs Image](./img/reactive-docs.jpg)
![Reactive Docs Image](./img/reactive-docs.jpg)

## Overview

Expand All @@ -20,7 +20,7 @@ Reactive contracts receive event logs from various chains, executing Solidity lo

[Hyperlane →](./hyperlane.mdx) Explore an alternative transport system for callbacks like Hyperlane.

[Reactive Contracts →](./reactive-smart-contracts.md) Understand the core concept of reactive contracts.
[Reactive Contracts →](./reactive-contracts.md) Understand the core concept of reactive contracts.

[ReactVM →](./reactvm.md) Learn about ReactVM and its purpose.

Expand Down Expand Up @@ -52,5 +52,7 @@ Reactive contracts receive event logs from various chains, executing Solidity lo

[FAQ →](./faq.md) Find answers to common questions.

[Debugging →](../debugging/index.md) Debug errors and issues related to Reactive and beyond.

[Contacts →](../contacts/index.md) Reach out via socials for technical or trading inquiries.

Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
---
title: Reactive Smart Contracts
title: Reactive Contracts
sidebar_position: 4
description: Explore Reactive Smart Contracts, which enable event-driven interactions and transaction creation. Learn their setup, processing, and applications through clear examples.
slug: /reactive-smart-contracts
description: Explore Reactive Contracts, which enable event-driven interactions and transaction creation. Learn their setup, processing, and applications through clear examples.
slug: /reactive-contracts
hide_title: true
---

![Reactive Smart Contracts Image](./img/reactive-smart-contracts.jpg)
![Reactive Contracts Image](./img/reactive-contracts.jpg)

## Overview

Reactive smart contracts (RSCs) operate on a standard Ethereum Virtual Machine (EVM) and can be written in any EVM-compatible language, with Application Binary Interfaces (ABIs) particularly customized for Solidity. Their unique capabilities stem from reactive nodes and a specialized pre-deployed system contract.
Reactive Contracts (RCs) operate on a standard Ethereum Virtual Machine (EVM) and can be written in any EVM-compatible language, with Application Binary Interfaces (ABIs) particularly customized for Solidity. Their unique capabilities stem from Reactive nodes and a specialized pre-deployed system contract.

## Key Features

Reactive Smart Contracts (RSCs) monitor blockchains for specific events and respond automatically, unlike traditional contracts that rely on EOAs to trigger actions. This reactivity and their use of Inversion of Control (IoC) — where contracts decide when to act — set them apart.
Reactive Contracts monitor blockchains for specific events and respond automatically, unlike traditional contracts that rely on EOAs to trigger actions. This reactivity and their use of Inversion of Control (IoC) — where contracts decide when to act — set them apart.

RSCs define which blockchains, contracts, and events to watch. When a relevant event occurs, they execute logic, update state, and perform trustless transactions within the Reactive Network.
RCs define which blockchains, contracts, and events to watch. When a relevant event occurs, they execute logic, update state, and perform trustless transactions within the Reactive Network.

### Deployment

RSCs deploy to both the main Reactive Network and a private [ReactVM](./reactvm.md). The main copy interacts with EOAs and manages subscriptions via the system contract. The ReactVM copy handles event processing but is not accessible to EOAs.
RCs deploy to both the main Reactive Network and a private [ReactVM](./reactvm.md). The main copy interacts with EOAs and manages subscriptions via the system contract. The ReactVM copy handles event processing but is not accessible to EOAs.

### State and Separation

The two copies are isolated and don’t share state. Since they use the same bytecode, use constructor flags or checks to distinguish the environment. You can detect if a contract is on ReactVM by calling the system contract — calls will revert outside ReactVMs. See [examples](./demos.md) for details.

### ReactVM Limitations

In [ReactVM](./reactvm.md), RSCs can’t access external systems directly. They receive logs from the Reactive Network and can call destination chain contracts but nothing else.
In [ReactVM](./reactvm.md), RCs can’t access external systems directly. They receive logs from the Reactive Network and can call destination chain contracts but nothing else.

## Contract Verification

Expand Down Expand Up @@ -126,4 +126,4 @@ Compiler: 0.8.28

The source code will be publicly viewable, with full syntax highlighting and structure, helping others understand and trust the contract logic.

[More on Reactive Smart Contracts →](../education/module-1/reactive-smart-contracts.md)
[More on Reactive Contracts →](../education/module-1/reactive-contracts)
42 changes: 5 additions & 37 deletions docs/docs/reactvm.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: ReactVM
sidebar_position: 5
description: Explore ReactVM, a dedicated EVM within the Reactive Network for executing Reactive Smart Contracts. It enables random transactions while maintaining order, serving as a sandbox for contract deployment.
description: Explore ReactVM, a dedicated EVM within the Reactive Network for executing Reactive Contracts. It enables random transactions while maintaining order, serving as a sandbox for contract deployment.
slug: /reactvm
hide_title: true
---
Expand All @@ -10,13 +10,13 @@ hide_title: true

## Overview

The ReactVM is a specialized Ethereum Virtual Machine (EVM) within the Reactive Network, designed to execute [Reactive Smart Contracts](./reactive-smart-contracts.md) (RSCs). It allows transactions to occur in random order across multiple threads while maintaining order within each ReactVM.
The ReactVM is a specialized Ethereum Virtual Machine (EVM) within the Reactive Network, designed to execute [Reactive Contracts](./reactive-contracts) (RCs). It allows transactions to occur in random order across multiple threads while maintaining order within each ReactVM.

Technically, ReactVM is an isolated execution environment that activates when an event matches an RSC's subscription. Although this approach introduces some overhead, we've optimized the process by separating the EVM from Geth, reducing ReactVm's boot time to approximately 100 microseconds. This overhead is insignificant relative to the network's processing capabilities.
Technically, ReactVM is an isolated execution environment that activates when an event matches an RC's subscription. Although this approach introduces some overhead, we've optimized the process by separating the EVM from Geth, reducing ReactVm's boot time to approximately 100 microseconds. This overhead is insignificant relative to the network's processing capabilities.

## My ReactVM

When you deploy a Reactive Smart Contract, it is assigned to a ReactVM. The ReactVM's address will match the Externally Owned Account (EOA) address used for the deployment. All smart contracts deployed to the Reactive Network will ultimately reside within your personal ReactVM, enabling shared state and interaction among contracts. Although multiple RSCs can be deployed within a single ReactVM, this practice is generally discouraged.
When you deploy a Reactive Contract, it is assigned to a ReactVM. The ReactVM's address will match the Externally Owned Account (EOA) address used for the deployment. All smart contracts deployed to the Reactive Network will ultimately reside within your personal ReactVM, enabling shared state and interaction among contracts. Although multiple RCs can be deployed within a single ReactVM, this practice is generally discouraged.

### Calling subscribe()

Expand All @@ -30,7 +30,7 @@ The Reactive Network's state is determined by the collective states of individua

The Reactive Network operates within a dual-state environment that supports parallel transaction execution. While the EVM processes commands sequentially in a single-threaded manner, ReactVMs can operate independently and in parallel across different cores or threads. This architecture facilitates the management of various operations, including fund flows and token management, with each contract copy having its own state and execution context.

Each [Reactive Smart Contract](./reactive-smart-contracts.md) has two instances with different states, both initialized in the constructor:
Each [Reactive Contract](./reactive-contracts) has two instances with different states, both initialized in the constructor:

     **ReactVM State**: Updates when an event occurs.

Expand All @@ -44,36 +44,4 @@ The following diagram illustrates a process involving the interaction between an

![Reactive Network Lifecycle](./img/global-processing-flow.png)

### Step-by-step Description

**New Block in Origin Chain**: The process starts when a new block is created on the Origin Chain. This block contains multiple transactions.

**Catch Block in Reactive Network**: The Reactive Network catches the newly created block from the Origin Chain.

**Iterate Transactions**: The system iterates through all the transactions in the newly caught block.

**Extract Transaction Logs**: Transaction logs are extracted from each transaction.

**Find Transactions at System SC**: The system identifies specific transactions that need to be processed by the System Smart Contract (System SC).

**Prepare Transaction and Publish to RVM**: The identified transactions are prepared and published to the ReactVM for further processing.

**ReactVM Processing**:

       **ReactVM Exists?**: The system checks if a ReactVM already exists.

       **No**: If no ReactVM exists, the system sets up a new ReactVM.

       **Run ReactVM**: The ReactVM is run to process the transaction.

       **Execute Transaction**: The transaction is executed within the ReactVM.

       **Stop ReactVM**: After executing the transaction, the ReactVM is stopped.

**Transaction Receipt**: After the ReactVM completes processing the transaction, a transaction receipt is generated.

**Prepare Transaction for Destination Chain**: Based on the transaction receipt, a new transaction is prepared for the Destination Chain.

**Transaction at Mem. Pool in Destination Chain**: The prepared transaction is placed in the memory pool of the Destination Chain, ready to be included in a new block on that chain.

[More on ReactVM →](../education/module-1/react-vm.md)
4 changes: 2 additions & 2 deletions docs/docs/rnk-rpc-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ Retrieves the bytecode of a deployed contract at a specific transaction or block
#### Parameters

1. **rvmId**: `DATA`, 20 bytes — The unique identifier of the RVM.
2. **contract** `DATA`, 20 bytes — The address of the smart contract.
2. **contract** `DATA`, 20 bytes — The Reactive contract address.
3. **txNumberOrHash** `HEX | TAG` — Specifies the state at which the contract code is retrieved. Accepts either a block number (`HEX`) or a tag (`"latest"`, `"earliest"`, `"pending"`).

#### cURL
Expand Down Expand Up @@ -703,7 +703,7 @@ Returns the storage value:

## rnk_call

Performs a read-only simulation of a smart contract function call on a given RVM, without creating a transaction.
Performs a read-only simulation of a Reactive contract function call on a given RVM, without creating a transaction.

#### Parameters

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/subscriptions.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Subscriptions
sidebar_position: 10
description: Explore how to subscribe to events via Reactive Smart Contracts, allowing for event-driven interactions and transaction creation.
description: Explore how to subscribe to events via Reactive Contracts, allowing for event-driven interactions and transaction creation.
slug: /subscriptions
hide_title: true
---
Expand Down
Loading
Loading