LNX is an innovative project that introduces a groundbreaking solution for deploying Cartesi-powered Linux decentralized applications (dApps) across all the blockchain ecosystem. This project enables cross-chain communication, allowing computer-demanding dApps to seamlessly function on different blockchains.
LNX's uniqueness is in the ability to deploy Cartesi dApps cross-chaing by leveraging the power of the newly released Chainlink CCIP protocol.
LNX was Developed during ETHGLobal Online Hackathon. To prove in-detailed understanding of LNX, in parallel with the development, we created a dedicated Documentation portal.
LNX harnesses the robust capabilities of Cartesi, a versatile app-specific scaling solution, to enable Linux runtime dApps across different blockchains, taking interoperability to a new level.
User inputs to a Cartesi dApp come through Message Sender Smart Contracts dedicated to each network and running in CCIP. The inpouts are then transferred to LNX's cross-chain relayer that is running on the base layer and further sent to a Cartesi dApp.
-
Blockchain Agnosticism: LNX provides blockchain agnosticism, allowing developers to choose from a range of blockchains for dApp deployment. This flexibility reduces the risk associated with blockchain-specific challenges and limitations.
-
Scalability and Portability: The LNX infrastructure solution enhances dApp scalability by offering the flexibility to deploy on different blockchains. Developers can select the blockchain that best suits their scalability needs, with the added benefit of the option to migrate should their requirements change, ensuring an unmatched level of portability.
-
Interoperability: Cross-chain communication facilitates innovative cross-chain functionality, such as decentralized exchanges operating across multiple blockchains, harnessing the strengths of each network.
-
Diverse User Bases: Accessing multiple blockchains allows developers to tap into a broader range of user communities and ecosystems, fostering credibility, community growth, market expansion, and increasing the potential for widespread adoption.
-
Decentralization and Security: LNX maintains core blockchain principles, ensuring security and decentralization across multiple networks.
-
Risk Mitigation: The ability to deploy on various blockchains reduces dependence on a single network, thereby mitigating risks associated with technical, operational, and governance issues, as well as concerns related to limited user base, low adoption rates, development constraints of the underlying chain, or regulatory alterations.
- Go to frontend directory:
cd frontend/packages/react-app
- Run frontend server (in case this command does not work go to step 2b.)
yarn start
- Go to your preferred browser open `localhost:3000`` and use your desired network to interact with Cartesi Echo dApp.
(2b.) Build the frontend with the command:
yarn build
Go back to step 2.
As the first step of LNX development, we create a simple Ethereum dApp that receives messages from Avalanche and implements CCIP from Chainlink.
- Clone CCIP Starter kit repository.
- Install packages:
forge install
npm install
- Compile contracts:
forge build
- Use infura RPC endpoint to have access to different blockchains.
- Deploy the smart contract to Ethereum Sepolia.
Here we see the deployment of the Relayer in Ethereum. In the example below, we do not have enough funds in Avalance to send to Ethereum:
We first deployed an example Cartesi dApp called Echo Python by using Cartesi's Sunodo framework.
After building the initial locally working application, we’re going to use rollups-examples and clone the Echo dApp from there.
- Clone the cartesi/rollups-examples Github repository, and
cd
into it:
git clone https://github.com/cartesi/rollups-examples.git
cd rollups-examples
- Navigate to the dApp example directory by running the following command:
cd echo-python
- Build the Echo DApp:
docker buildx bake --load
To run the application, we start an environment that includes a local blockchain with the Cartesi smart contracts deployed, as well as a Cartesi layer-2 node executing the DApp's back-end logic.
docker compose -f ../docker-compose.yml -f ./docker-compose.override.yml up
With the infrastructure in place, we can use the frontend-console application to interact with the Echo dApp.
Every Rollups dApp gets an address on the base layer when it's deployed. The following is needed to send inputs to a DApp:
- Gateway URL to the intended chain
- Cartesi Rollups InputBox contract address
- Appropriate account with sufficient funds for submitting transactions to the network
The following steps describe how to send an input to the Echo DApp instance that is running locally:
- Open a separate terminal window
- From the rollups-examples base directory, navigate to the
frontend-console
one:
cd frontend-console
- Build the frontend console application:
yarn
yarn build
- Send an input to the current locally deployed DApp:
yarn start input send --payload "hi there!"
- Verify the outputs (notices) generated by your input:
yarn start notice list
After completing all the steps above, we get a response with the payload of the notice:
"hi there!"
- We run:
DAPP_NAME=echo-dlinn docker compose --env-file ../env.sepolia -f ../deploy-testnet.yml up
- We then run the validator node.
- Once the validator node is running, we interact with it via the Front-end console.
- To interact with the dApp on Sepolia, we need to adjust the Front-end console by switching
localhost
tosepolia
in the.env
files.
:::note We may need to deploy custom graphql for querying information. We try to add input information without crosschain, frontend -> Cartesi dAPP and see if information is queried. :::
- Now we can send an input as follows:
yarn start input send --payload "test 1946" --rpc https://sepolia.infura.io/v3/417f9a026f74429d99b34ab38a96b676 --dapp echo-dlinn
We deploy an Ethereum Smart Contract that implements CCIPReceiver.sol
interface and forwards information to the Cartesi Echo dApp.
In our first deployment, we used the following data:
- Sepolia InputBox
- Sepolia Relayer
- Avax Sender
- Wss for validator
- RPC endpoint
We get an error that might appaer because we don’t have enough balance in Avax sender, or in Sepolia relayer. To solve this, we add funds with avax sender (.1 AVAX) and send the transaction paid with the native coin, not LINK.
In our second deployment we use:
- Relayer deployed at:
0xc690DBb7c8BaeEE9039a2F7c1fb1E881bdcF738C
0x0f34DD596F2EdA21e2cEa551c80e31178ee62Bd0
0x543827f99405cCAf09Bd8993e1f47d6382C0747e
0xD0a5Aa8D099B9B6F5Ac619c9aC363443DFfF13e3
0x501acCDbC057338E5A75aA4b4BaB795830D232de
- New deploy command:
forge script ./script/DeployCrosschainrelayer.s.sol:DeployCrossChainRelayer -vvv --broadcast --rpc-url ethereumSepolia --sig "run(uint8, address, address)" -- 0 0x59b22D57D4f067708AB0c00552767405926dc768 0xe2510c5470FEDD84e6FbFF29c647B0c883dBc496
0x98fcf378FdB37a9615014E91772EF9d921697ED2
- Sender deployed at:
0xCcB0F7F1DCdcD69d9D48094E3114cb3155F67eb8
0x6D1105f424dC488DB39A151CF78bd3296a786b95
0x2F89874C7CdD48DFC56F48a21E255a66804E85Eb
- Sending an input:
cast send 0xCcB0F7F1DCdcD69d9D48094E3114cb3155F67eb8 --rpc-url avalancheFuji --private-key=<> --value 0.1ether
cast send 0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846 "transfer(address,uint256)" 0xCcB0F7F1DCdcD69d9D48094E3114cb3155F67eb8 10000000000000000 --rpc-url avalancheFuji --private-key=<>
- Run a validator node.
For example, for Sepolia:
export WSS_URL=wss://sepolia.infura.io/ws/v3/<<YOUR-KEY>>
Cartesi Server Manager must be built specifying the network used:
docker buildx bake server --load --set “*.args.NETWORK=sepolia”
- Export the RPC URL.
For example, for Sepolia:
export RPC_URL=https://sepolia.infura.io/v3/<<YOUR-KEY>>
export mnemonic=””
- Run the node.
For example, for Sepolia:
DAPP_NAME=echo-dlinn docker compose --env-file ../env.sepolia -f ../docker-compose-testnet.yml -f ./docker-compose.override.yml up
- Send an input from the frontend console:
yarn start input send --payload "test 1946" --rpc https://sepolia.infura.io/v3/<<YOUR-KEY>> --dapp echo-dlinn
In summary, LNX, the Cross-Chain Cartesi-Powered Linux Runtime Rollup, offers dApp developers a versatile and adaptable solution for blockchain deployment. With the flexibility to operate on multiple blockchains, it enables developers to create versatile applications, achieve horizontal scalability, expand their user base, access greater liquidity, and navigate the ever-evolving blockchain landscape with confidence and ease, without being perpetually tied to their initial choice of base layer.