DERO dApps: Private Decentralized Applications

Decentralized Applications (dApps) are applications that run on blockchain technology rather than centralized servers. They operate on distributed networks where no single authority can control, censor, or shut them down.
DERO's Unique Advantage: The world's first blockchain with private smart contracts using homomorphic encryption. Your dApp code is public and auditable, but all balances, amounts, and financial data remain encrypted on-chain.
What Makes DERO dApps Special?
| Feature | Traditional Blockchains | DERO |
|---|---|---|
| Smart Contracts | โ Public | โ Private |
| Balances | โ Visible | โ Encrypted (Homomorphic) |
| Transaction Amounts | โ Public | โ Hidden (Bulletproofs) |
| Contract State | โ All visible | โ Financial data encrypted |
| Speed | ~15-60 seconds | โก ~16 seconds |
DERO dApp Categories
๐ฆ DeFi (Decentralized Finance)
Build financial applications with complete privacy:
- Private DEXs - Swap tokens without revealing amounts
- Anonymous Escrow - Trustless transactions with hidden balances
- Private Lending - Collateralized loans with encrypted positions
- Yield Vaults - Staking rewards without exposing holdings
Example: Private token swap where neither party knows the other's total balance.
๐ฎ Gaming & Entertainment
Privacy-enhanced gaming experiences:
- Provably Fair Gambling - Lottery, poker, baccarat with on-chain randomness
- Play-to-Earn - Hidden inventory and earnings
- Virtual Assets - Private ownership of in-game items
- Tournament Platforms - Anonymous competitive gaming
Example: Poker game where hand values and bet amounts remain hidden until reveal.
๐ฌ Social & Communication
Censorship-resistant platforms:
- Anonymous Forums - Decentralized message boards (DEchan)
- Private Messaging - On-chain encrypted communication
- Content Platforms - Creator monetization without intermediaries
- Voting Systems - Anonymous governance with verifiable results
๐ Marketplaces & Commerce
Private peer-to-peer commerce:
- Anonymous Marketplaces - Buy/sell without exposing wallet balances
- Digital Goods - NFTs with private metadata
- Service Platforms - Freelance work with encrypted payments
- Supply Chain - Track goods with selective disclosure
๐ง Infrastructure
Decentralized services:
- Name Service - Human-readable addresses (like ENS)
- Storage Pointers - Decentralized file references
- Oracle Services - Private data feeds
- Identity Solutions - Anonymous authentication
Building Your First DERO dApp
1. Write Smart Contract in DVM-BASIC
DVM-BASIC is a BASIC-like language designed for the DERO Virtual Machine:
/* Simple Lottery Smart Contract */
Function Initialize() Uint64
10 STORE("owner", SIGNER())
20 STORE("deposit_count", 0)
30 STORE("deposit_total", 0)
40 RETURN 0
End Function
Function Lottery() Uint64
10 dim deposit_count, winner as Uint64
20 LET deposit_count = LOAD("deposit_count") + 1
// Check if deposit is valid
25 IF DEROVALUE() == 0 THEN GOTO 110
// Store depositor
30 STORE("depositor_address" + (deposit_count-1), SIGNER())
40 STORE("deposit_total", LOAD("deposit_total") + DEROVALUE())
50 STORE("deposit_count", deposit_count)
// Wait for 2 players
60 IF 2 > deposit_count THEN GOTO 110
// Pick winner using on-chain randomness
70 LET winner = RANDOM() % deposit_count
80 SEND_DERO_TO_ADDRESS(LOAD("depositor_address" + winner), LOAD("deposit_total"))
// Reset for next round
90 STORE("deposit_count", 0)
100 STORE("deposit_total", 0)
110 RETURN 0
End FunctionKey DVM-BASIC Features:
- โ
STORE()/LOAD()- Persistent encrypted storage - โ
SIGNER()- Get transaction sender - โ
DEROVALUE()- Amount sent with transaction - โ
RANDOM()- Deterministic on-chain randomness - โ
SEND_DERO_TO_ADDRESS()- Send funds programmatically
2. Deploy via Wallet RPC
Method 1: Using Wallet RPC Endpoint
# Deploy smart contract
curl --request POST \
--data-binary @lottery.bas \
http://127.0.0.1:10103/install_sc
# Returns: { "txid": "abc123...", "scid": "def456..." }Method 2: Using Wallet RPC JSON-RPC
# Install smart contract via scinvoke
curl -X POST http://127.0.0.1:10103/json_rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "1",
"method": "transfer",
"params": {
"scid": "",
"sc_rpc": [
{"name": "SC_ACTION", "datatype": "U", "value": 0},
{"name": "SC_CODE", "datatype": "S", "value": "<base64_encoded_contract>"}
],
"ringsize": 16
}
}'3. Interact with Contract
Call smart contract function:
# Call Lottery() function with 5 DERO deposit
curl http://127.0.0.1:10103/json_rpc -d '{
"jsonrpc": "2.0",
"id": "1",
"method": "scinvoke",
"params": {
"scid": "YOUR_SCID_HERE",
"sc_dero_deposit": 500000,
"ringsize": 16,
"sc_rpc": [
{"name": "entrypoint", "datatype": "S", "value": "Lottery"}
]
}
}' -H 'Content-Type: application/json'4. Query Contract State
Get contract balance and variables:
# Query smart contract
curl http://127.0.0.1:10102/json_rpc -d '{
"jsonrpc": "2.0",
"id": "1",
"method": "getsc",
"params": {
"scid": "YOUR_SCID_HERE",
"code": true,
"variables": true
}
}' -H 'Content-Type: application/json'Response:
{
"result": {
"balance": 1000000,
"code": "...",
"balances": {
"deposit_count": 5,
"deposit_total": 1000000,
"owner": "deto1qy..."
}
}
}Building a Web Front-End
Option 1: Direct JSON-RPC (No Dependencies)
// Simple JavaScript RPC client
async function callSmartContract(scid, entrypoint, deroDeposit = 0) {
const response = await fetch('http://127.0.0.1:10103/json_rpc', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
id: '1',
method: 'scinvoke',
params: {
scid: scid,
sc_dero_deposit: deroDeposit,
ringsize: 16,
sc_rpc: [
{ name: 'entrypoint', datatype: 'S', value: entrypoint }
]
}
})
});
return await response.json();
}
// Get contract state
async function getContractState(scid) {
const response = await fetch('http://127.0.0.1:10102/json_rpc', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
id: '1',
method: 'getsc',
params: {
scid: scid,
code: false,
variables: true
}
})
});
return await response.json();
}
// Usage
const txid = await callSmartContract(
'YOUR_SCID',
'Lottery',
500000 // 5 DERO
);
console.log('Transaction:', txid);
const state = await getContractState('YOUR_SCID');
console.log('Contract state:', state.result.balances);Option 2: XSWD Wallet Integration (Recommended)
For production dApps that need wallet connection:
// Using XSWD for wallet integration
import { xswd } from './xswd-client.js';
// Connect to user's wallet
await xswd.initialize();
// Request wallet connection
const walletInfo = await xswd.wallet.GetAddress();
console.log('Connected wallet:', walletInfo.address);
// Call smart contract through user's wallet
const result = await xswd.wallet.scinvoke({
scid: 'YOUR_SCID',
sc_dero_deposit: 500000,
ringsize: 16,
sc_rpc: [
{ name: 'entrypoint', datatype: 'S', value: 'Lottery' }
]
});
console.log('TXID:', result.txid);See full XSWD guide: XSWD Integration
Development Tools
dSlate - Visual Smart Contract Builder
dSlate (opens in a new tab) is a GUI tool for building and testing DERO smart contracts without command-line knowledge.
Features:
- ๐ Code editor with syntax highlighting
- ๐งช Built-in testing environment
- ๐ One-click deployment
- ๐ Contract state visualization
- ๐พ Template library
Local Development Environment
1. Run simulator node:
# Start local test blockchain
./derod-linux-amd64 --simulator2. Create test wallet:
# Create wallet for testing
./dero-wallet-cli-linux-amd64 --wallet-file test.db3. Deploy and test:
# Deploy contract
curl --request POST --data-binary @contract.bas \
http://127.0.0.1:30000/install_sc
# Test interaction
curl http://127.0.0.1:30000/json_rpc -d '{
"method": "scinvoke",
"params": {
"scid": "YOUR_TEST_SCID",
"sc_rpc": [...]
}
}'Production Deployment Checklist
Before deploying to mainnet, ensure you've completed all testing!
Pre-Launch
- Test extensively on simulator node
- Deploy to testnet and run for 1+ weeks
- Security audit - Have community review code
- Gas optimization - Minimize transaction costs
- Documentation - Write clear user guide
- Front-end testing - Test all user flows
- Emergency functions - Add pause/upgrade mechanisms
Launch
- Deploy to mainnet with appropriate ring size (16+)
- Publish SCID - Share smart contract ID
- Open-source code - GitHub repository
- Community announcement - DERO Discord/Forum
- Monitor usage - Track contract calls and state
- Bug bounty - Incentivize security research
Post-Launch
- User support - Answer questions, fix issues
- Updates - Release improvements via update function
- Analytics - Track adoption and usage metrics
- Marketing - Promote to DERO community
Smart Contract Security
Common Pitfalls
โ Don't:
- Store sensitive data in plaintext (even encrypted blockchain leaks some info)
- Use predictable randomness (always use RANDOM() function)
- Skip input validation
- Allow reentrancy attacks
- Forget to check SIGNER() authorization
โ Do:
- Use STORE() for all persistent data
- Validate all inputs and amounts
- Check SIGNER() for owner-only functions
- Use LOAD() safely (check for existence)
- Add emergency pause mechanisms
- Include UpdateCode() function for bug fixes
Example: Secure Owner Pattern
Function Initialize() Uint64
10 STORE("owner", SIGNER())
20 RETURN 0
End Function
Function TransferOwnership(newowner String) Uint64
// Check caller is current owner
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1 // Unauthorized
// Store new owner
30 STORE("tmpowner", ADDRESS_RAW(newowner))
40 RETURN 0
End Function
Function ClaimOwnership() Uint64
// New owner must claim
10 IF LOAD("tmpowner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 STORE("owner", SIGNER())
40 RETURN 0
End Function
Function UpdateCode(code String) Uint64
// Only owner can update
10 IF LOAD("owner") == SIGNER() THEN GOTO 30
20 RETURN 1
30 UPDATE_SC_CODE(code)
40 RETURN 0
End FunctionLearning Resources
Official Documentation
- ๐ DERO Documentation (opens in a new tab) - Complete developer docs
- ๐ DVM-BASIC Guide - Smart contract language reference
- ๐ RPC API Reference - Wallet and daemon APIs
- ๐ XSWD Protocol - Wallet integration guide
Community Resources
- ๐ฌ DERO Discord (opens in a new tab) - Live developer chat
- ๐ DERO Wiki (opens in a new tab) - Community knowledge base
- ๐ GitHub (opens in a new tab) - Source code & issues
- ๐ฃ๏ธ DERO Forum (opens in a new tab) - Long-form discussions
Example Projects
Browse working smart contracts in the DERO GitHub (opens in a new tab):
- Name Service - Address registration system
- Lottery - Provably fair gaming
- Token Standards - Asset creation templates
Why Build on DERO?
| Advantage | Impact |
|---|---|
| ๐ Privacy by Default | Users transact without exposing balances |
| โก Fast Finality | 16-second blocks, ~1 minute confirmation |
| ๐ช Homomorphic Encryption | Compute on encrypted data |
| ๐ฏ Small Contracts | Fixed ~2.5KB transactions regardless of complexity |
| ๐ Battle-Tested | Running since 2017, proven security |
| ๐ No Gas Wars | Predictable, fair transaction fees |
| ๐ฅ Active Community | Supportive developers and users |
Get Started
Ready to build the next private dApp?
- Download DERO - Set up local node
- Learn DVM-BASIC - Master smart contracts
- Join Discord (opens in a new tab) - Connect with builders
- Explore Examples (opens in a new tab) - Study working code
Need help? The DERO community is active and welcoming. Don't hesitate to ask questions in Discord or the forum!
Further Reading
Core Concepts:
APIs & Integration:
Advanced Topics: