TELA Beginner Guide
Complete beginner's guide to TELA development - from setup to your first deployed application.
Goal: By the end of this guide, you'll have a working TELA application deployed on the DERO blockchain!
What You'll Learn
- What TELA is and why it's revolutionary
- Setting up your development environment
- Creating your first TELA application
- Deploying to the DERO blockchain
- Testing your deployed application
What is TELA?
TELA is a platform for building truly private web3 applications that run on the DERO blockchain.
Key Differences from Traditional Web Development
| Traditional Web | TELA Applications |
|---|---|
| Hosted on servers | Stored on blockchain |
| Centralized | Decentralized |
| Privacy concerns | Complete privacy |
| Server dependencies | No external dependencies |
| Can be censored | Censorship resistant |
Why TELA Matters
- π Complete Privacy: Built on DERO's homomorphic encryption
- π True Decentralization: No servers, no single points of failure
- β‘ Local Performance: Apps run locally for maximum speed
- π‘οΈ Censorship Resistant: Cannot be taken down or blocked
- π° Cost Effective: Pay once to deploy, run forever
Development Environment Setup
Prerequisites
-
DERO Wallet (Engram recommended for beginners)
- Download from DERO releases (opens in a new tab)
- Create wallet and sync to network
- Ensure XSWD is enabled (default in Engram)
-
TELA-CLI (for deployment)
- Download from TELA releases (opens in a new tab)
- Extract and add to your PATH
-
Code Editor (VS Code, Sublime, etc.)
- Any text editor will work
- Syntax highlighting for JavaScript/HTML/CSS helpful
-
Web Browser (Chrome, Firefox, Safari, Edge)
- For testing your applications
- Developer tools for debugging
Verify Setup
# Check TELA-CLI installation
tela-cli --version
# Check DERO wallet is running
# Engram: Look for XSWD status in wallet
# CLI: Should show "RPC server started" messageYour First TELA Application
Let's create a simple "Hello TELA" application that displays DERO network information.
Step 1: Create HTML File
Create hello-tela.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello TELA</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
color: #ffffff;
margin: 0;
padding: 20px;
min-height: 100vh;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.card {
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 12px;
padding: 20px;
margin-bottom: 20px;
}
.status {
padding: 8px 16px;
border-radius: 6px;
font-weight: 500;
margin-bottom: 10px;
}
.status.connected { background: #28a745; }
.status.connecting { background: #ffc107; color: #000; }
.status.error { background: #dc3545; }
.btn {
background: #52c8db;
color: #000;
border: none;
padding: 10px 20px;
border-radius: 6px;
cursor: pointer;
font-weight: 600;
margin: 5px;
}
.btn:hover { background: #45a8b8; }
</style>
</head>
<body>
<div class="container">
<h1>π Hello TELA!</h1>
<p>Your first TELA application running on DERO blockchain</p>
<div class="card">
<h2>Connection Status</h2>
<div id="connection-status" class="status connecting">Connecting...</div>
<button class="btn" onclick="connectToXSWD()">Connect to DERO</button>
</div>
<div class="card">
<h2>DERO Network Information</h2>
<div id="network-info">
<p>Connect to DERO to see network information</p>
</div>
<button class="btn" onclick="loadNetworkInfo()">Refresh Data</button>
</div>
<div class="card">
<h2>Your Wallet</h2>
<div id="wallet-info">
<p>Connect to see your wallet information</p>
</div>
<button class="btn" onclick="loadWalletInfo()">Load Wallet Data</button>
</div>
</div>
<script src="hello-tela.js"></script>
</body>
</html>Step 2: Create JavaScript File
Create hello-tela.js:
// Hello TELA - Your first TELA application
({
name: 'hello-tela',
version: '1.0.0',
// Connection state
socket: null,
connected: false,
// Initialize the application
init: function() {
console.log('π Hello TELA initializing...');
this.updateStatus('connecting', 'Initializing...');
},
// Connect to XSWD
connectXSWD: function() {
var self = this;
try {
self.updateStatus('connecting', 'Connecting to DERO...');
// Application identification
var appData = {
"id": "hello-tela-app-v1",
"name": "Hello TELA",
"description": "My first TELA application",
"url": window.location.origin
};
// Create WebSocket connection
self.socket = new WebSocket("ws://127.0.0.1:44326/xswd");
self.socket.onopen = function() {
console.log('π WebSocket opened, sending handshake...');
self.socket.send(JSON.stringify(appData));
};
self.socket.onmessage = function(event) {
var response = JSON.parse(event.data);
if (response.accepted) {
self.connected = true;
self.updateStatus('connected', 'Connected to DERO!');
console.log('β
XSWD connection accepted');
// Automatically load initial data
self.loadNetworkInfo();
} else if (response.jsonrpc) {
self.handleAPIResponse(response);
}
};
self.socket.onclose = function() {
self.connected = false;
self.updateStatus('error', 'Connection closed');
console.log('π XSWD connection closed');
};
self.socket.onerror = function(error) {
self.updateStatus('error', 'Connection failed');
console.error('π¨ XSWD connection error:', error);
};
} catch (error) {
self.updateStatus('error', 'Connection error: ' + error.message);
console.error('Failed to connect:', error);
}
},
// Handle API responses
handleAPIResponse: function(response) {
// This is where we'll handle API call responses
console.log('π₯ API Response:', response);
},
// Update connection status display
updateStatus: function(status, message) {
var statusEl = document.getElementById('connection-status');
if (statusEl) {
statusEl.className = 'status ' + status;
statusEl.textContent = message;
}
},
// Make API calls
call: function(method, params) {
var self = this;
if (!self.connected) {
throw new Error('Not connected to XSWD');
}
return new Promise(function(resolve, reject) {
var id = Math.random().toString(36);
var request = {
"jsonrpc": "2.0",
"method": method,
"id": id,
"params": params || {}
};
// Store request for response handling
self.pendingRequests = self.pendingRequests || {};
self.pendingRequests[id] = { resolve: resolve, reject: reject };
// Send request
self.socket.send(JSON.stringify(request));
// Timeout after 30 seconds
setTimeout(function() {
if (self.pendingRequests[id]) {
delete self.pendingRequests[id];
reject(new Error('Request timeout'));
}
}, 30000);
});
},
// Load network information
loadNetworkInfo: function() {
var self = this;
if (!self.connected) {
alert('Please connect to DERO first');
return;
}
console.log('π Loading network information...');
self.call('DERO.GetInfo').then(function(info) {
self.displayNetworkInfo(info);
}).catch(function(error) {
console.error('Failed to load network info:', error);
alert('Failed to load network information: ' + error.message);
});
},
// Display network information
displayNetworkInfo: function(info) {
var html = '<h3>π Network Statistics</h3>';
html += '<p><strong>Block Height:</strong> ' + info.height.toLocaleString() + '</p>';
html += '<p><strong>Difficulty:</strong> ' + info.difficulty.toLocaleString() + '</p>';
html += '<p><strong>Hash Rate:</strong> ' + (info.hashrate / 1000000).toFixed(2) + ' MH/s</p>';
html += '<p><strong>Connected Peers:</strong> ' + info.peer_count + '</p>';
html += '<p><strong>Pending Transactions:</strong> ' + info.tx_pool_size + '</p>';
html += '<p><strong>Network Version:</strong> ' + info.version + '</p>';
var container = document.getElementById('network-info');
if (container) {
container.innerHTML = html;
}
},
// Load wallet information
loadWalletInfo: function() {
var self = this;
if (!self.connected) {
alert('Please connect to DERO first');
return;
}
console.log('π° Loading wallet information...');
// Get wallet address
self.call('GetAddress').then(function(addressResult) {
// Get wallet balance
return self.call('GetBalance').then(function(balanceResult) {
self.displayWalletInfo(addressResult.address, balanceResult);
});
}).catch(function(error) {
console.error('Failed to load wallet info:', error);
alert('Failed to load wallet information: ' + error.message);
});
},
// Display wallet information
displayWalletInfo: function(address, balance) {
var html = '<h3>π° Your Wallet</h3>';
html += '<p><strong>Address:</strong> ' + address.substring(0, 20) + '...</p>';
html += '<p><strong>Balance:</strong> ' + (balance.unlocked_balance / 100000).toFixed(5) + ' DERO</p>';
html += '<p><strong>Locked Balance:</strong> ' + ((balance.balance - balance.unlocked_balance) / 100000).toFixed(5) + ' DERO</p>';
var container = document.getElementById('wallet-info');
if (container) {
container.innerHTML = html;
}
}
});
// Global functions for HTML onclick handlers
window.connectToXSWD = function() {
if (window.HelloTELA) {
window.HelloTELA.connectXSWD();
}
};
window.loadNetworkInfo = function() {
if (window.HelloTELA) {
window.HelloTELA.loadNetworkInfo();
}
};
window.loadWalletInfo = function() {
if (window.HelloTELA) {
window.HelloTELA.loadWalletInfo();
}
};
// Initialize when page loads
window.addEventListener('load', function() {
// Make module available globally
window.HelloTELA = window.HelloTELA || arguments[0];
if (window.HelloTELA) {
window.HelloTELA.init();
}
});π Step-by-Step Deployment
Step 1: Test Locally
-
Start a local web server:
# In your project directory python3 -m http.server 8080 # Or use any local web server -
Open in browser:
http://localhost:8080/hello-tela.html -
Test functionality:
- Click "Connect to DERO"
- Approve connection in wallet
- Click "Refresh Data" to load network info
- Click "Load Wallet Data" to see your balance
Step 2: Deploy to DERO Blockchain
-
Deploy the HTML file:
tela-cli install-doc # Enter file path: ./hello-tela.html # Enter name: Hello TELA App # Enter description: My first TELA application # Enter dURL: hello-tela-app # Note the SCID (e.g., abc123...) -
Deploy the JavaScript file:
tela-cli install-doc # Enter file path: ./hello-tela.js # Enter name: Hello TELA Logic # Enter description: Application logic for Hello TELA # Enter dURL: hello-tela-logic # Note the SCID (e.g., def456...) -
Create application index:
tela-cli install-index # Enter name: Hello TELA Application # Enter description: Complete Hello TELA application # Enter dURL: hello-tela # DOC1: abc123... (HTML SCID) # DOC2: def456... (JS SCID) # Note the INDEX SCID (e.g., ghi789...)
Step 3: Test Deployed Application
-
Serve the application:
tela-cli serve ghi789... # Application will be available at http://localhost:8082 -
Test in browser: Open
http://localhost:8082 -
Verify functionality: Same as local testing
Congratulations! You've just deployed your first TELA application to the DERO blockchain!
Understanding the Code
Object Literal Pattern
// β
TELA uses this pattern for all modules
({
name: 'my-app',
version: '1.0.0',
// Properties and methods go here
myMethod: function() {
// Function logic
}
});Why this pattern?
- β Deployment Success: 100% success rate with DERO blockchain
- β Self-Contained: All functionality in one object
- β No External Dependencies: Everything needed is included
XSWD Integration
// XSWD connection flow
connectXSWD: function() {
// 1. Create WebSocket connection
this.socket = new WebSocket("ws://127.0.0.1:44326/xswd");
// 2. Send application identification
this.socket.onopen = function() {
this.socket.send(JSON.stringify(appData));
};
// 3. Handle wallet approval
this.socket.onmessage = function(event) {
var response = JSON.parse(event.data);
if (response.accepted) {
// Connection approved!
}
};
}API Calls
// Making blockchain API calls
call: function(method, params) {
return new Promise(function(resolve, reject) {
var request = {
"jsonrpc": "2.0",
"method": method,
"id": "unique-id",
"params": params
};
// Send request and handle response
this.socket.send(JSON.stringify(request));
});
}Next Steps
Enhance Your Application
-
Add More Features:
// Add mining capability startMining: function() { return this.call('AttemptEPOCH', { hashes: 1000 }); }, // Add transaction history loadTransactions: function() { return this.call('GetTransfers', { in: true, out: true }); } -
Improve the UI:
- Add loading indicators
- Better error handling
- Responsive design
- Dark/light theme toggle
-
Add Smart Contract Integration:
// Interact with smart contracts loadContract: function(scid) { return this.call('DERO.GetSC', { scid: scid, variables: true }); }
Explore Advanced Features
- TELA Libraries - Use reusable code components
- Design System - Professional UI patterns
- EPOCH Mining - Add mining functionality
- Advanced API - Explore all available methods
π¨ Common Beginner Mistakes
Mistake 1: Using Modern JavaScript
// β DON'T USE - ES6+ syntax not supported
const myFunction = () => {};
async function getData() {}
let variable = 'value';
// β
USE INSTEAD - Traditional JavaScript
var myFunction = function() {};
function getData() { return promise; }
var variable = 'value';Mistake 2: External Dependencies
<!-- β DON'T USE - External resources -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter" rel="stylesheet">
<!-- β
USE INSTEAD - Local resources only -->
<script src="my-chart-lib.js"></script>
<style>
body { font-family: system-ui, sans-serif; }
</style>Mistake 3: File Size Violations
# β File too large
$ wc -c hello-tela.js
25000 hello-tela.js # 25KB - too large!
# β
Optimize file size
$ wc -c hello-tela.js
15000 hello-tela.js # 15KB - perfect!Mistake 4: Improper Error Handling
// β Poor error handling
function loadData() {
xswd.call('DERO.GetInfo'); // No error handling
}
// β
Proper error handling
function loadData() {
xswd.call('DERO.GetInfo')
.then(function(info) {
// Handle success
})
.catch(function(error) {
console.error('API call failed:', error);
// Show user-friendly error
});
}π Learning Resources
Essential Reading
- TELA-CLI Guide - Command-line interface
- API Reference - All available methods
- Compliance Rules - Deployment requirements
Video Tutorials
- DERO community YouTube channel
- TELA development streams
- Blockchain development basics
Example Applications
- Block Explorer - Browse DERO blockchain
- Mining Dashboard - EPOCH mining interface
- Wallet Interface - Balance and transaction management
- Smart Contract Browser - Explore deployed contracts
Learning Path: Start with this beginner guide, then explore the Complete API Guide, and finally dive into Advanced TELA Features when you're ready to build more complex applications.
Your TELA Journey
- β Complete this tutorial - Deploy your first app
- π Study the API docs - Learn all available methods
- π¨ Apply design patterns - Make it look professional
- π Build something amazing - Create your unique application
- π Share with community - Help others learn TELA
Welcome to TELA development! You're now part of building the future of private, decentralized web applications on the DERO blockchain.