Decentralized Application Tutorial
Step 1: Initialize Project
$ epsilon new my-dapp
Scaffold a new decentralized application. Choose the TypeScript & React template for web-based DApps.
Step 2: Add Smart Contract
epsilon add contract --language rust
Add an on-chain component using our Rust/WASM framework. This creates a ./contracts directory with boilerplate contract code.
Step 3: Configure DApp
// src/dapp.ts
import { DAppKit } from 'epsilon-sdk'
const dapp = new DAppKit({
contractAddress: 'epsilon1q9t5gqj77890z0k5l6j07n858fjzv2qk639q5n2xw5k800lq36y76m',
network: 'calibration'
})
Connect to the εЬLΛB1 network using our SDK. Replace with your actual contract address from the calibration network.
Step 4: Build Interface
import React, { useState } from 'react'
export default function ContractUI() {
const [input, setInput] = useState('')
const handleSubmit = async (e) => {
e.preventDefault()
await dapp.write.setData(input)
}
return (
<form onSubmit={handleSubmit} className="space-y-4">
<input
type="text"
value={input}
onChange={(e) => setInput(e.target.value)}
className="w-full p-3 rounded text-black"
/>
<button
type="submit"
className="px-6 py-3 bg-gradient-to-r from-blue-500 to-purple-600 rounded-lg shadow-lg hover:shadow-xl transition-all"
>
Store Data
</button>
</form>
)
}
Create a simple form interface using React. This demonstrates writing to the contract using your DApp.
Deployment
Ready to Deploy?
When you're ready to launch your DApp, use our deployment toolkit to publish to the εЬLΛB1 mainnet.
Deploy to Mainnet