Eclipse SVM Development

This guide explains everything you need to know to use Eclipse Devnet.

Introduction to SVM Deployment

Eclipse Mainnet runs the SVM, so you can deploy smart contracts on it just like you would on Solana.
Here's a simple step-by-step tutorial on deploying a "Hello World" contract to Eclipse Devnet.
This guide works right out of the box on Linux and macOS. We recommend using the Windows Subsystem for Linux (WSL) if you're using Windows. Check the official Microsoft documentation for setting it up.

Prerequisites

You'll have to do a few things before you can deploy your smart contract to the SVM chain.

Install Dependencies

Install Rust, and its package manager—Cargo.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
You can check if the installation was successful by running the following commands:
rustc --version
cargo --version
ii. We'll also have to install Node.js and npm using, which will be used later in this guide.
Visit the official Node.js download page and download the installation binary for your system. Versions recommended are 14.0 and above.
NOTE
npm is bundled with the Node.js installation, so you don't have to install it separately.
iii. Now let's install the Solana CLI. This allows you to interact with Solana clusters—our SVM chain on Eclipse in this case.
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
iv. Instead of setting your Solana CLI to a local cluster, set it to the SVM chain with the following command:
solana config set --url https://staging-rpc.dev.eclipsenetwork.xyz
v. If this is your first time using the Solana CLI, you will need to generate a new keypair:
solana-keygen new
This will generate a new key pair and save it to your local machine. You will need this key pair to sign transactions to deploy your smart contract to the SVM chain.

Acquiring testnet tokens​​

We need to claim testnet tokens to pay for transaction fees to deploy your smart contract to the testnet.
Run the following commands to get 10 testnet tokens in your local wallet
  1. 1.
    solana config set --url https://staging-rpc.dev.eclipsenetwork.xyz
  2. 2.
    solana airdrop 10
These testnet tokens are only valid on the testnet and are meant for testing purposes only. Eclipse will never charge you for testnet tokens. Please be wary of scams. Report any suspicious activity to us on our Discord server.

Deploying the smart contract​​

Now that we've set up our environment, we can deploy our smart contract to the Eclipse Devnet. Let's start by running a local Solana cluster.
solana-test-validator
NOTE
Incase the validator fails to start, restart your computer and run the following command:
sudo $(command -v solana-sys-tuner) --user $(whoami) > sys-tuner.log 2>&1 &
sudo $(command -v solana-sys-tuner) --user $(whoami) > sys-tuner.log 2>&1 &
Now we'll clone the Solana Hello World repository and install the dependencies.
git clone https://github.com/solana-labs/example-helloworld
cd example-helloworld
npm install
Next, we will build the smart contract.
npm run build:program-rust
Finally, we can deploy the smart contract to the SVM chain.
solana program deploy dist/program/helloworld.so
We can run the JavaScript client and confirm whether the smart contract was deployed successfully.
npm run start
The output should be something like this:
Let's say hello to a Solana account...
Connection to cluster established: http://127.0.0.1:8899 { 'feature-set': 2045430982, 'solana-core': '1.7.8' }
Using account AiT1QgeYaK86Lf9kudqKthQPCWwpG8vFA1bAAioBoF4X containing 0.00141872 SOL to pay for fees
Using program Dro9uk45fxMcKWGb1eWALujbTssh6DW8mb4x8x3Eq5h6
Creating account 8MBmHtJvxpKdYhdw6yPpedp6X6y2U9dCpdYaZJdmwV3A to say hello to
Saying hello to 8MBmHtJvxpKdYhdw6yPpedp6X6y2U9dCpdYaZJdmwV3A
8MBmHtJvxpKdYhdw6yPpedp6X6y2U9dCpdYaZJdmwV3A has been greeted 1 times
Success
Not seeing the expected output?
  • Make sure you've run all the commands in the previous steps.
  • Inspect the program logs by running solana logs to see why the program failed.
An example of what you might find is given below.
Signature: 4pya5iyvNfAZj9sVWHzByrxdKB84uA5sCxLceBwr9UyuETX2QwnKg56MgBKWSM4breVRzHmpb1EZQXFPPmJnEtsJ
Status: Error processing Instruction 0: Program failed to complete
Log Messages:
Program G5bbS1ipWzqQhekkiCLn6u7Y1jJdnGK85ceSYLx2kKbA invoke [1]
Program log: Hello World Rust program entrypoint
Program G5bbS1ipWzqQhekkiCLn6u7Y1jJdnGK85ceSYLx2kKbA consumed 200000 of 200000 compute units
Program failed to complete: exceeded maximum number of instructions allowed (200000) at instruction #334
Program G5bbS1ipWzqQhekkiCLn6u7Y1jJdnGK85ceSYLx2kKbA failed: Program failed to complete

Integration Instructions

Do you need additional assistance integrating something special like a wallet, bridge, or something else? Feel free to reach out via Discord.