Quick Start
Get up and running with Edgerun in 5 minutes. This guide will walk you through installing the SDK, compiling a WASM module, and running your first compute job.
Prerequisites
Before you begin, make sure you have the following installed:
- Node.js 18 or later
- A Solana wallet with some SOL for transaction fees
- Basic knowledge of WebAssembly (optional but helpful)
Installation
Install the Edgerun SDK using npm or yarn:
npm install @edgerun/sdkbash
Or with yarn:
yarn add @edgerun/sdkbash
Initialize Your Project
Create a new file called index.js and initialize the Edgerun client:
import { EdgerunClient } from '@edgerun/sdk';
const client = new EdgerunClient({
wallet: 'your-wallet-private-key',
network: 'mainnet-beta'
});
console.log('Edgerun client initialized!');javascript
⚠️
Never commit your wallet private key to version control. Use environment variables instead.
Compile a WASM Module
For this example, we'll use a simple Rust program. First, create a new Rust project:
cargo new --lib hello-wasm
cd hello-wasmbash
Edit src/lib.rs:
#[no_mangle]
pub extern "C" fn add(a: i32, b: i32) -> i32 {
a + b
}rust
Compile to WASM:
cargo build --target wasm32-unknown-unknown --releasebash
Submit Your First Job
Now submit the compiled WASM module to Edgerun:
import fs from 'fs';
const wasmBuffer = fs.readFileSync('./target/wasm32-unknown-unknown/release/hello_wasm.wasm');
const job = await client.submitJob({
name: 'My First Job',
wasm: wasmBuffer,
workerCount: 5
});
console.log('Job submitted:', job.id);javascript
Monitor Job Status
Check the status of your job:
const status = await client.getJobStatus(job.id);
console.log('Status:', status.status);
console.log('Progress:', status.progress);
if (status.status === 'completed') {
console.log('Results:', status.results);
}javascript
✓
Congratulations! You've successfully run your first compute job on Edgerun.
Next Steps
Now that you've run your first job, here are some next steps:
- Learn about Core Concepts like consensus and settlement
- Explore the full API Reference
- Join our Discord community for support
- Check out example projects on GitHub