### Deploying Reactive Smart Contracts with Remix Source: https://dev.reactive.network/education/use-cases A guide on deploying Reactive Smart Contracts using the Remix Development Environment. It covers the setup and deployment process for users. ```English The Deploying Reactive Smart Contracts with Remix article is a guide for deploying a Reactive Smart Contract using the Remix Development Environment. ``` -------------------------------- ### Install Reactive Library Source: https://dev.reactive.network/reactive-library Command to install the Reactive Library using Forge, a Solidity build tool. ```bash forge install Reactive-Network/reactive-lib ``` -------------------------------- ### Reactive Smart Contract Demos on GitHub Source: https://dev.reactive.network/education/introduction This snippet links to a GitHub repository containing various demonstrations and examples of Reactive Smart Contracts. These examples are intended to provide practical insights into implementing RSCs. ```GitHub https://github.com/Reactive-Network/reactive-smart-contract-demos/tree/main/src/demos ``` -------------------------------- ### Solidity Subscription Example in Constructor Source: https://dev.reactive.network/subscriptions Demonstrates how to initiate a subscription to an event within the constructor of a reactive contract. It shows the use of system contract interaction and filtering parameters. ```solidity uint256public originChainId; uint256public destinationChainId; uint64privateconstant GAS_LIMIT =1000000; addressprivate callback; constructor( address _service, uint256 _originChainId, uint256 _destinationChainId, address _contract, uint256 _topic_0, address _callback )payable{ service =ISystemContract(payable(_service)); originChainId = _originChainId; destinationChainId = _destinationChainId; callback = _callback; if(!vm){ service.subscribe( originChainId, _contract, _topic_0, REACTIVE_IGNORE, REACTIVE_IGNORE, REACTIVE_IGNORE ); } } ``` -------------------------------- ### Constructor Subscription Example Source: https://dev.reactive.network/education/module-1/how-subscriptions-work Demonstrates how to set up event subscriptions within a contract's constructor using the service.subscribe method. It includes state variables for callback and counter. ```solidity // State specific to reactive network instance of the contract addressprivate _callback; // State specific to ReactVM instance of the contract uint256public counter; constructor( address _service, address _contract, uint256 topic_0, address callback )payable{ service =ISystemContract(payable(_service)); if(!vm){ service.subscribe( CHAIN_ID, _contract, topic_0, REACTIVE_IGNORE, REACTIVE_IGNORE, REACTIVE_IGNORE ); } _callback = callback; } ``` -------------------------------- ### Ethereum Wallet and Test ETH Setup Source: https://dev.reactive.network/education/introduction/prerequisites Setting up an Ethereum wallet and obtaining test ETH on the Sepolia testnet is vital for deploying and interacting with smart contracts. ```APIDOC Ethereum Wallet and Test ETH: Purpose: To interact with Ethereum networks, deploy, and test smart contracts. Requirements: - An Ethereum wallet (e.g., MetaMask). - Test ETH on the Sepolia testnet. Obtaining Sepolia ETH: - Visit the Sepolia Faucet: https://www.alchemy.com/faucets/ethereum-sepolia Usage: - Use test ETH for transaction fees (gas) when deploying or interacting with contracts on the Sepolia testnet. ``` -------------------------------- ### Git and Command Line Usage Source: https://dev.reactive.network/education/introduction/prerequisites Basic Git commands and command line usage are essential for working with code examples. Familiarity with an IDE like VS Code is also recommended. ```Git # Example Git commands git clone git add . git commit -m "Initial commit" git push origin main ``` ```Command Line # Example command line operations ls -la cd my_project node index.js ``` -------------------------------- ### Forge Create with Broadcast and Verification Source: https://dev.reactive.network/reactive-smart-contracts An example of verifying on deployment using the --broadcast flag, including RPC URL, private key, chain ID, value, and constructor arguments. ```bash forge create \ --broadcast --rpc-url $REACTIVE_RPC_URL\ --private-key $REACTIVE_PRIVATE_KEY\ --chain-id $REACTIVE_CHAIN_ID\ --value0.01ether\ --verify\ --verifier sourcify\ --verifier-url https://sourcify.rnk.dev/\ src/.../MyContract.sol:MyContract\ --constructor-args\ $ARGUMENT_1\ $ARGUMENT_2\ $ARGUMENT_3\ # ...add more as needed ``` -------------------------------- ### Example Response for rnk_getFilters Source: https://dev.reactive.network/rnk-rpc-methods An example JSON response for the rnk_getFilters RPC method, illustrating the structure and data types of the filter objects. ```json { "jsonrpc":"2.0", "id":1, "result":[ { "Uid":"4603da7efc5d1b77f7fa5b0bfd949d6c", "ChainId":11155111, "Contract":"0x1e8db093a0cc38302f5822a451809bfd692ff695", "Topics":[ "0x8cabf31d2b1b11ba52dbb302817a3c9c83e4b2a5194d35121ab1354d69f6a4cb", null, null, null ], "Configs":[ { "Contract":"0xac9163487ca9c5189766706595cbef9b75c1c8e9", "RvmId":"0xc1d48a9173212567bd358e40c50bfe131a9fabf1", "Active":true } ] }, { "Uid":"b91cf2f05464d578896164d4e6c0c854", "ChainId":11155111, "Contract":"0x5e3eeda090eea783af9ee8d81147d9417bb97b38", "Topics":[ "0x8cabf31d2b1b11ba52dbb302817a3c9c83e4b2a5194d35121ab1354d69f6a4cb", null, null, null ], "Configs":[ { "Contract":"0xe3cf3d848557974d3abf8e7c15c3a534187f1c6f", "RvmId":"0xc1d48a9173212567bd358e40c50bfe131a9fabf1", "Active":true } ] }, { "Uid":"0fce746e0305e2fc2e425735ea71a52f", "ChainId":11155111, "Contract":"0x0102e0a1792b8805f16b6ec27978f6898b865475", "Topics":[ "0x9bffe4738606691ddfa5e5d28208b6ef74537676b39ddb9854b7854a62df0692", null, null, null ], "Configs":[ { "Contract":"0xe4d4b0c2f8502a98e68c6f0ef2483214c106fd82", "RvmId":"0x941b727ad8acf020558ce58cd7cb65b48b958db1", "Active":true } ] } ] } ``` -------------------------------- ### Example Transaction Response (JSON) Source: https://dev.reactive.network/rnk-rpc-methods An example of a JSON response received when calling an RPC method to get transaction details. It includes fields like hash, number, time, root, gas usage, sender, receiver, and data. ```JSON { "jsonrpc":"2.0", "id":1, "result":{ "hash":"0xe32b9f60321f7a83ef9dda5daf8cf5b2f5cd523156ee484f417d62d84d1e3044", "number":"0x9", "time":1753427529, "root":"0x8df166bb5c9843696457dbdc5ab20ca1ab9acdd8703b6f1fd1f51766f34fad7d", "limit":900000, "used":47429, "type":2, "status":1, "from":"0xa7d9aa89cbcd216900a04cdc13eb5789d643176a", "to":"0x6ba34385d9018cfa3341db62b68b5a55839fe71f", "createContract":false, "sessionId":109252, "refChainId":11155111, "refTx":"0x52daf0ff44c50da56024f02530ba70fcf653ad11dadb1788b24b20fc824520f5", "refEventIndex":328, "data":"0x0d152c2c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000aa36a7000000000000000000000000c156ad2846d093e0ce4d31cf6d780357e9675dce8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925000000000000000000000000a7d9aa89cbcd216900a04cdc13eb5789d643176a00000000000000000000000065a9b8b03a2ef50356104cb594ba2c91223973de000000000000000000000000000000000000000000000000000000000000000034570ac2a3bbfa2809982e69218a745aa83e1bff79b54e2a2ce10e5d6d4c5c00a52daf0ff44c50da56024f02530ba70fcf653ad11dadb1788b24b20fc824520f50000000000000000000000000000000000000000000000000000000000000148000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003e8", "rData":"0x" } } ``` -------------------------------- ### Multiple Independent Subscriptions in Constructor Source: https://dev.reactive.network/subscriptions This Solidity constructor example shows how to set up multiple, independent event subscriptions by calling the `subscribe()` method multiple times. ```solidity uint256public originChainId; uint256public destinationChainId; uint64privateconstant GAS_LIMIT =1000000; addressprivate callback; constructor( address _service, uint256 _originChainId, uint256 _destinationChainId, address _contract1, uint256 _topic0, address _contract2, uint256 _topic1, address _callback )payable{ service =ISystemContract(payable(_service)); originChainId = _originChainId; destinationChainId = _destinationChainId; callback = _callback; if(!vm){ // First subscription service.subscribe( originChainId, _contract1, _topic0, REACTIVE_IGNORE, REACTIVE_IGNORE, REACTIVE_IGNORE ); // Second subscription service.subscribe( originChainId, _contract2, REACTIVE_IGNORE, _topic1, REACTIVE_IGNORE, REACTIVE_IGNORE ); } } ``` -------------------------------- ### Example Transaction Response Source: https://dev.reactive.network/rnk-rpc-methods An example JSON payload representing a transaction response, showcasing the structure and typical values for each field. ```JSON { "jsonrpc":"2.0", "id":1, "result":{ "hash":"0xe32b9f60321f7a83ef9dda5daf8cf5b2f5cd523156ee484f417d62d84d1e3044", "number":"0x9", "time":1753427529, "root":"0x8df166bb5c9843696457dbdc5ab20ca1ab9acdd8703b6f1fd1f51766f34fad7d", "limit":900000, "used":47429, "type":2, "status":1, "from":"0xa7d9aa89cbcd216900a04cdc13eb5789d643176a", "to":"0x6ba34385d9018cfa3341db62b68b5a55839fe71f", "createContract":false, "sessionId":109252, "refChainId":11155111, "refTx":"0x52daf0ff44c50da56024f02530ba70fcf653ad11dadb1788b24b20fc824520f5", "refEventIndex":328, "data":"0x0d152c2c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000aa36a7000000000000000000000000c156ad2846d093e0ce4d31cf6d780357e9675dce8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925000000000000000000000000a7d9aa89cbcd216900a04cdc13eb5789d643176a00000000000000000000000065a9b8b03a2ef50356104cb594ba2c91223973de000000000000000000000000000000000000000000000000000000000000000034570ac2a3bbfa2809982e69218a745aa83e1bff79b54e2a2ce10e5d6d4c5c00a52daf0ff44c50da56024f02530ba70fcf653ad11dadb1788b24b20fc824520f50000000000000000000000000000000000000000000000000000000000000148000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003e8", "rData":"0x" } } ``` -------------------------------- ### rnk_getRnkAddressMapping RPC Response Example Source: https://dev.reactive.network/rnk-rpc-methods An example JSON response for the rnk_getRnkAddressMapping RPC method, showing the RVM ID for a given contract address. ```JSON { "jsonrpc": "2.0", "id": 1, "result": { "rvmId": "0xa7d9aa89cbcd216900a04cdc13eb5789d643176a" } } ``` -------------------------------- ### Reactive Network Transaction Response Example Source: https://dev.reactive.network/rnk-rpc-methods An example JSON response for a transaction in the Reactive Network, illustrating the structure and typical values for transaction details. ```JSON { "jsonrpc": "2.0", "id": 1, "result": [ { "hash": "0xe32b9f60321f7a83ef9dda5daf8cf5b2f5cd523156ee484f417d62d84d1e3044", "number": "0x9", "time": 1753427529, "root": "0x8df166bb5c9843696457dbdc5ab20ca1ab9acdd8703b6f1fd1f51766f34fad7d", "limit": 900000, "used": 47429, "type": 2, "status": 1, "from": "0xa7d9aa89cbcd216900a04cdc13eb5789d643176a", "to": "0x6ba34385d9018cfa3341db62b68b5a55839fe71f", "createContract": false, "sessionId": 109252, "refChainId": 11155111, "refTx": "0x52daf0ff44c50da56024f02530ba70fcf653ad11dadb1788b24b20fc824520f5", "refEventIndex": 328, "data": "0x0d152c2c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000aa36a7000000000000000000000000c156ad2846d093e0ce4d31cf6d780357e9675dce8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925000000000000000000000000a7d9aa89cbcd216900a04cdc13eb5789d643176a00000000000000000000000065a9b8b03a2ef50356104cb594ba2c91223973de000000000000000000000000000000000000000000000000000000000000000034570ac2a3bbfa2809982e69218a745aa83e1bff79b54e2a2ce10e5d6d4c5c00a52daf0ff44c50da56024f02530ba70fcf653ad11dadb1788b24b20fc824520f50000000000000000000000000000000000000000000000000000000000000148000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003e8", "rData": "0x" } ] } ``` -------------------------------- ### Get Active Log Filters using cURL Source: https://dev.reactive.network/rnk-rpc-methods Shows how to fetch all active log filters on the Reactive Network using a cURL request. This example includes the RPC endpoint, content type, and a JSON-RPC payload for the `rnk_getFilters` method. ```bash curl --location 'https://lasna-rpc.rnk.dev/' \ --header 'Content-Type: application/json' \ --data '{ \ "jsonrpc": "2.0", \ "method": "rnk_getFilters", \ "params": [], \ "id": 1 \ }' | jq ``` -------------------------------- ### rnk_getTransactionLogs cURL Example Source: https://dev.reactive.network/rnk-rpc-methods Example of how to call the `rnk_getTransactionLogs` method using cURL, specifying the ReactVM ID and transaction number. ```bash curl --location 'https://lasna-rpc.rnk.dev/' \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "method": "rnk_getTransactionLogs", "params": [ "0xA7D9AA89cbcd216900a04Cdc13eB5789D643176a", "0x9" ], "id": 1 }' | jq ``` -------------------------------- ### Encoding and Emitting Callback Event Example Source: https://dev.reactive.network/education/module-1/how-events-work Demonstrates how to encode transaction details into the payload using abi.encodeWithSignature and emit the Callback event to initiate actions on a destination chain. ```Solidity bytes memory payload = abi.encodeWithSignature( "stop(address,address,address,bool,uint256,uint256)", address(0), // The ReactVM address pair, // The Uniswap pair address involved in the transaction client, // The address of the client initiating the stop order token0, // The address of the first token in the pair coefficient, // A coefficient determining the sale price threshold // The price threshold at which the sale should occur ); emit Callback(chain_id, stop_order, CALLBACK_GAS_LIMIT, payload); ``` -------------------------------- ### Uniswap V2 Swap Function Example Source: https://dev.reactive.network/education/module-2/how-uniswap-works This code snippet demonstrates a simplified version of the swap function in a Uniswap V2 smart contract. It illustrates how token amounts are exchanged based on the constant product formula (x * y = k) and how liquidity is managed. ```solidity pragma solidity ^0.8.0; interface IUniswapV2Pair { function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external returns (uint amount0In, uint amount1In); function sync() external; function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); } contract UniswapExample { address public factory; address public tokenA; address public tokenB; constructor(address _factory, address _tokenA, address _tokenB) { factory = _factory; tokenA = _tokenA; tokenB = _tokenB; } function swapTokens(uint amountIn, uint amountOutMin, address tokenIn, address tokenOut, address to) public { // Get the pair address address pair = IUniswapV2Factory(factory).getPair(tokenA, tokenB); // Determine which token is tokenA and tokenB for the pair (address reserveTokenA, address reserveTokenB) = (tokenA, tokenB); uint amountAIn = 0; uint amountBIn = 0; if (tokenIn == reserveTokenA) { amountAIn = amountIn; } else if (tokenIn == reserveTokenB) { amountBIn = amountIn; } else { revert("Invalid token in"); } // Transfer tokens to the pair contract // (Assuming ERC20 token transfers are handled elsewhere or implicitly) // Call the swap function on the pair contract IUniswapV2Pair(pair).swap( tokenOut == reserveTokenA ? amountOutMin : 0, // amount0Out tokenOut == reserveTokenB ? amountOutMin : 0, // amount1Out to, // to '' // data (can be used for callback) ); // Note: Actual implementation would involve checking reserves, calculating amounts, and handling approvals. } // Example of adding liquidity (simplified) function addLiquidity(uint amountA, uint amountB, address to) public { address pair = IUniswapV2Factory(factory).getPair(tokenA, tokenB); // Transfer tokens to pair contract and mint liquidity tokens IUniswapV2Pair(pair).mint(to); } // Example of removing liquidity (simplified) function removeLiquidity(uint liquidity, address toA, address toB) public { address pair = IUniswapV2Factory(factory).getPair(tokenA, tokenB); // Burn liquidity tokens and transfer reserves to user (uint amountA, uint amountB) = IUniswapV2Pair(pair).burn(toA); // Note: The actual burn function in Uniswap V2 returns amounts of tokenA and tokenB. // The 'toB' parameter in this example is illustrative and might not be directly used by burn. } } ``` -------------------------------- ### Uniswap V2 Swap Function Example Source: https://dev.reactive.network/education/module-2/how-uniswap-works A simplified Solidity function demonstrating a swap operation in Uniswap V2. It handles input/output amounts, reserve checks, fee calculations, and event emission. ```Solidity functionswap(uint amount0Out,uint amount1Out,address to,bytescalldata data)external{ require(amount0Out >0|| amount1Out >0,"UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT"); (uint112 reserve0,uint112 reserve1,)=getReserves();// fetches reserves of the pool require(amount0Out < reserve0 && amount1Out < reserve1,"UniswapV2: INSUFFICIENT_LIQUIDITY"); uint balance0; uint balance1; { uint amount0In = reserve0 -(balance0 = reserve0 - amount0Out); uint amount1In = reserve1 -(balance1 = reserve1 - amount1Out); require(amount0In >0|| amount1In >0,"UniswapV2: INSUFFICIENT_INPUT_AMOUNT"); uint balanceAdjusted0 = balance0 *1000- amount0In *3; uint balanceAdjusted1 = balance1 *1000- amount1In *3; require(balanceAdjusted0 * balanceAdjusted1 >=uint(reserve0)*uint(reserve1)*(1000**2),"UniswapV2: K"); emitSwap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } _update(balance0, balance1, reserve0, reserve1); if(amount0Out >0)_safeTransfer(token0, to, amount0Out); if(amount1Out >0)_safeTransfer(token1, to, amount1Out); if(data.length >0){ IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); } } ``` -------------------------------- ### ReactVM State Management Source: https://dev.reactive.network/reactvm Explains the dual-state environment of the Reactive Network, differentiating between ReactVM state and Reactive Network state. It clarifies how each state is updated and provides an example of their usage in a governance contract. ```APIDOC ReactVM State Management: Environment: Dual-state environment supporting parallel transaction execution. EVM Processing: Commands processed sequentially in a single-threaded manner. ReactVM Parallelism: ReactVMs operate independently and in parallel across different cores/threads. Contract State Instances: Each Reactive Smart Contract has two instances with different states: - ReactVM State: Updates when an event occurs. Primary logic resides here. - Reactive Network State: Updates when functions are manually called. Example (Governance Contract): - Vote counts: Maintained in ReactVM state. - Operational commands (e.g., pause()): Part of Reactive Network state. ``` -------------------------------- ### rnk_getTransactions RPC Method Source: https://dev.reactive.network/rnk-rpc-methods Fetches a range of transactions from a specified transaction number within a ReactVM. Requires ReactVM ID, starting transaction number, and a limit. ```APIDOC rnk_getTransactions: Parameters: rvmId (DATA, 20 Bytes): The ReactVM ID for which transactions are being retrieved. from (HEX): The starting transaction number. limit (HEX): The maximum number of transactions to retrieve. Response: result (array of Response objects): An array of transaction objects. ``` ```json { "jsonrpc": "2.0", "id": 1, "result": [ { "txHash": "0xe32b9f60321f7a83ef9dda5daf8cf5b2f5cd523156ee484f417d62d84d1e3044", "address": "0x6ba34385d9018cfa3341db62b68b5a55839fe71f", "topics": [ "0x8dd725fa9d6cd150017ab9e60318d40616439424e2fade9c1c58854950917dfc", "0x0000000000000000000000000000000000000000000000000000000000aa36a7", "0x000000000000000000000000fc2236a0d3421473676c4c422046fbc4f1afdffe", "0x00000000000000000000000000000000000000000000000000000000000f4240" ], "data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a42f90252d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000065a9b8b03a2ef50356104cb594ba2c91223973de000000000000000000000000a7d9aa89cbcd216900a04cdc13eb5789d643176a000000000000000000000000c156ad2846d093e0ce4d31cf6d780357e9675dce00000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000" } ] } ``` ```bash curl --location 'https://lasna-rpc.rnk.dev/' \ --header 'Content-Type: application/json' \ --data '{ \ "jsonrpc": "2.0", \ "method": "rnk_getTransactions", \ "params": [ \ "0xA7D9AA89cbcd216900a04Cdc13eB5789D643176a", \ "0x9", \ "0x1" \ ], \ "id": 1 \ }' | jq ``` -------------------------------- ### rnk_getVms - Get Information on All RVMs Source: https://dev.reactive.network/rnk-rpc-methods Retrieves information about all RVMs, including their IDs, last transaction numbers, and associated contract counts. This method requires no parameters. ```bash curl --location 'https://lasna-rpc.rnk.dev/' \ --header 'Content-Type: application/json' \ --data '{ \ "jsonrpc": "2.0", \ "method": "rnk_getVms", \ "params": [], \ "id": 1 \ }' | jq ``` ```json { "jsonrpc": "2.0", "id": 1, "result": [ { "rvmId": "0xa7d9aa89cbcd216900a04cdc13eb5789d643176a", "lastTxNumber": "0x9", "contracts": 4 }, { "rvmId": "0xfe5a45db052489cbc16d882404bcfa4f6223a55e", "lastTxNumber": "0x2", "contracts": 1 }, { "rvmId": "0x49abe186a9b24f73e34ccae3d179299440c352ac", "lastTxNumber": "0x2d6", "contracts": 1 }, { "rvmId": "0x941b727ad8acf020558ce58cd7cb65b48b958db1", "lastTxNumber": "0x7", "contracts": 3 }, { "rvmId": "0xc1d48a9173212567bd358e40c50bfe131a9fabf1", "lastTxNumber": "0x3c", "contracts": 28 } ] } ``` -------------------------------- ### rnk_getSubscribers - Get Contracts Subscribed to RVM Events Source: https://dev.reactive.network/rnk-rpc-methods Returns a list of contracts subscribed to events from a specified RVM, including their filter topics. Requires the RVM's unique identifier. ```APIDOC rnk_getSubscribers(rvmId: DATA) Parameters: rvmId (DATA, 20 Bytes): The unique identifier of the RVM for which subscriber information is requested. Response: Returns a list of contracts subscribed to events from a specified RVM, along with their filter topics. ``` ```bash curl --location 'https://lasna-rpc.rnk.dev/' \ --header 'Content-Type: application/json' \ --data '{ \ "jsonrpc": "2.0", \ "method": "rnk_getSubscribers", \ "params": ["0xA7D9AA89cbcd216900a04Cdc13eB5789D643176a"], \ "id": 1 \ }' | jq ``` -------------------------------- ### Subscribe to a Specific Event Topic (Uniswap V2 Sync) Source: https://dev.reactive.network/education/module-1/how-subscriptions-work Example of subscribing to events with a specific topic hash, such as the Uniswap V2 Sync event. It filters by topic_0 and uses REACTIVE_IGNORE for other topics. ```javascript service.subscribe(CHAIN_ID,0,0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1, REACTIVE_IGNORE, REACTIVE_IGNORE, REACTIVE_IGNORE) ``` -------------------------------- ### Reactive Network Smart Contract Bytecode Source: https://dev.reactive.network/rnk-rpc-methods This snippet contains the compiled EVM bytecode for the Reactive Network smart contract. This bytecode is what gets deployed to the blockchain and executed by the Ethereum Virtual Machine. ```evm 0x608060405234801561001057600080fd5b50600080546001600160a01b815416905550600080546001600160a01b8154169055506040516001600160a01b8154169055506040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161007a90610112565b60405180910390fd5b61009a81610087565b82525050565b6040518060c001604052805f81526020015f73ffffffffffffffffffffffffffffffffffffffff1681526020015f81526020015f81526020015f81526020015f81525090565b5f819050919050565b6100ca816100b7565b82525050565b5f6020820190506100e35f8301846100c1565b92915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f6100f8828403121561011b5761011a6100fe565b5b81905092915050565b5f60208284031215610139576101386100fe565b5b5f82013567ffffffffffffffff811115610155576101546100fe565b5b610161848285016100fe565b91505092915050565b610173816100b7565b811461017d575f5ffd5b50565b5f8135905061018e8161016a565b92915050565b5f602082840312156101a9576101a86100fe565b5b5f6101b68482850161019a565b91505092915050565b5f82825260208201905092915050565b7f5265616374697665204e6574776f726b206f6e6c7900000000000000000000005f82015250565b5f61020d60158361019a565b9150610218826101aa565b602082019050919050565b5f6020820190508181035f83015261023a81610201565b9050919050565b7f556e617574686f72697a656400000000000000000000000000000000000000005f82015250565b5f610267600c8361019a565b91506102728261023d565b602082019050919050565b5f6020820190508181035f8301526102948161025b565b9050919050565b7f4e6f7420706175736564000000000000000000000000000000000000000000005f82015250565b5f6102f1600a8361019a565b91506102fc82610297565b602082019050919050565b5f6020820190508181035f83015261031e816102f1565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61037e8261035c565b9050919050565b61038e81610383565b82525050565b5f60c0820190506103a15f8301896100c1565b6103ae6020830188610396565b6103bb60408301876100c1565b6103c860608301866100c1565b6103d560808301856100c1565b6103e260a08301846100c1565b979650505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61042f826100b7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610441576104406103f6565b5b600182019050919050565b7f564d206f6e6c79000000000000000000000000000000000000000000000000005f82015250565b5f61047a60078361019a565b91506104858261046c565b602082019050919050565b5f6020820190508181035f8301526104a78161048e565b9050919050565b5f81905092915050565b5f6104c282610112565b6104cc81856104c4565b93506104dc818560208601610498565b6104e5816104a7565b840191505092915050565b5f6020820190508181035f83015261050781846104b7565b905092915050565b5f60208201905061051c5f830184610396565b92915050565b5f815190506105308161016a565b92915050565b5f6020828403121561054b5761054a6100fe565b5b5f6105588482850161053c565b91505092915050565b7f416c7265616479207061757365640000000000000000000000000000000000005f82015250565b5f6105a9600e8361019a565b91506105b48261059b565b602082019050919050565b5f6020820190508181035f8301526105d6816105be565b9050919050565b7f417574686f72697a65642073656e646572206f6e6c7900000000000000000000000000000000000000005f82015250565b5f61063360168361019a565b915061063e8261062a565b602082019050919050565b5f6020820190508181035f8301526106608161064c565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f496e73756666696369656e742066756e647300000000000000000000000000005f82015250565b5f6106f160128361019a565b91506106fc826106e3565b602082019050919050565b5f6020820190508181035f83015261071e81610706565b9050919050565b5f81905092915050565b5f61073982610112565b610743818561073b565b9350610753818560208601610706565b61075c8161071e565b84019150509291505 ``` -------------------------------- ### rnk_getTransactionByNumber API Call Source: https://dev.reactive.network/rnk-rpc-methods Demonstrates how to retrieve transaction details using the rnk_getTransactionByNumber RPC method. It specifies the required parameters: rvmId and txNumber, and provides a cURL example for making the request. ```APIDOC rnk_getTransactionByNumber: Description: Returns the details of a transaction based on its sequence number within the specified ReactVM. Parameters: rvmId (DATA, 20 Bytes): The ReactVM ID associated with the transaction. txNumber (HEX): The sequence number of the transaction to retrieve. ``` ```Shell curl --location 'https://lasna-rpc.rnk.dev/' \ --header 'Content-Type: application/json' \ --data '{ \ "jsonrpc": "2.0", \ "method": "rnk_getTransactionByNumber", \ "params": [ \ "0xa7d9aa89cbcd216900a04cdc13eb5789d643176a", \ "0x9" \ ], \ "id": 1 \ }' | jq ``` -------------------------------- ### rnk_getVm - Get Details for a Specific RVM Source: https://dev.reactive.network/rnk-rpc-methods Retrieves detailed information for a specific RVM, identified by its `rvmId`. Returns the RVM's ID, last transaction number, and contract count. ```APIDOC rnk_getVm(rvmId: DATA) Parameters: rvmId (DATA, 20 Bytes): The unique identifier of the RVM for which information is requested. Response: rvmId (string): The unique identifier of the RVM. lastTxNumber (string): The last transaction number executed by this RVM (hex-encoded). contracts (uint32): The number of contracts created by this RVM. ``` ```bash curl --location 'https://lasna-rpc.rnk.dev/' \ --header 'Content-Type: application/json' \ --data '{ \ "jsonrpc": "2.0", \ "method": "rnk_getVm", \ "params": ["0xA7D9AA89cbcd216900a04Cdc13eB5789D643176a"], \ "id": 1 \ }' | jq ``` ```json { "jsonrpc": "2.0", "id": 1, "result": { "rvmId": "0xa7d9aa89cbcd216900a04cdc13eb5789d643176a", "lastTxNumber": "0x9", "contracts": 4 } } ```