Gelios Documentation
Welcome to the Gelios developer documentation. Gelios is an AI-native Layer 1 blockchain that combines sub-400ms finality, 100,000+ TPS, and native AI inference capabilities. This guide covers everything from basic setup to deploying autonomous AI agents on-chain.
New to Gelios? Start with the Quick Start guide to deploy your first smart contract in under 5 minutes.
Quick Start
Get up and running with Gelios in three steps:
Step 1: Install the Gelios CLI
npm install -g @gelios/cli
# Or via cargo
cargo install gelios-cli
# Verify installation
gelios --version
# gelios-cli v2.4.0
Step 2: Create a New Project
cd my-first-dapp
gelios build
Step 3: Deploy to Testnet
gelios faucet --network testnet
# Deploy your contract
gelios deploy --network testnet
# ✓ Contract deployed at: 0x1a2b...3c4d
Installation
System Requirements
- Node.js v18.0 or higher
- Rust 1.70+ (for native contract development)
- Python 3.10+ (for AI SDK)
- 8GB RAM minimum (16GB recommended for AI workloads)
Package Installation
npm install @gelios/sdk @gelios/ai-sdk
// For Python developers
pip install gelios-sdk gelios-ai
Your First Smart Contract
Here's a simple token contract on Gelios:
#[contract]
pub struct MyToken {
name: String,
symbol: String,
total_supply: u128,
balances: Storage<Address, u128>,
}
#[contract_impl]
impl MyToken {
pub fn new(name: String, symbol: String, supply: u128) -> Self {
Self { name, symbol, total_supply: supply, balances: Storage::new() }
}
pub fn transfer(&mut self, to: Address, amount: u128) -> Result<()> {
let sender = msg::sender();
let balance = self.balances.get(&sender).unwrap_or(0);
require!(balance >= amount, "Insufficient balance");
self.balances.set(&sender, balance - amount);
let to_balance = self.balances.get(&to).unwrap_or(0);
self.balances.set(&to, to_balance + amount);
Ok(())
}
}
Accounts & Wallets
Gelios uses a unified account model supporting both externally owned accounts (EOAs) and smart contract accounts. Each account has:
- Address — 32-byte unique identifier
- Balance — Native GOS token balance
- Nonce — Transaction counter for replay protection
- Code — Optional smart contract bytecode
- AI State — Optional AI agent state and model references
// Create a new wallet
const wallet = Wallet.create();
console.log('Address:', wallet.address);
console.log('Public Key:', wallet.publicKey);
// Import existing wallet
const imported = Wallet.fromPrivateKey('0xYOUR_PRIVATE_KEY');
Transactions
Gelios transactions support standard transfers, contract calls, and AI inference calls. All transactions achieve finality in under 400ms.
const client = new GeliosClient('https://rpc.gelios.network');
// Send a transaction
const tx = await client.sendTransaction({
to: '0xRecipientAddress',
value: parseGOS('10.0'),
gasLimit: 21000,
});
console.log('TX Hash:', tx.hash);
console.log('Finality:', tx.finalityMs, 'ms');
Smart Contracts
Gelios smart contracts can be written in Rust (recommended) or Solidity (compatibility mode). The Gelios VM extends standard smart contract capabilities with native AI primitives.
Contract Lifecycle
- Write — Write contract code in Rust or Solidity
- Compile —
gelios buildcompiles to Gelios bytecode - Test —
gelios testruns unit tests locally - Deploy —
gelios deploydeploys to testnet or mainnet - Verify —
gelios verifypublishes source for verification
Gas & Fees
Gelios uses an AI-optimized gas model that dynamically adjusts prices based on network demand. Average fees are $0.001 per transaction.
| Operation | Gas Cost | USD Equivalent |
|---|---|---|
| Simple Transfer | 21,000 | ~$0.0005 |
| Contract Call | 50,000 - 500,000 | ~$0.001 - $0.01 |
| AI Inference (Small) | 100,000 | ~$0.01 |
| AI Inference (Large) | 1,000,000+ | ~$0.10 - $0.50 |
| Contract Deployment | 500,000 - 5,000,000 | ~$0.05 - $0.50 |
AI SDK Overview
Gelios AI SDK — Build autonomous AI agents that live on-chain. Available for TypeScript/JavaScript and Python.
The Gelios AI SDK provides everything you need to deploy, manage, and interact with AI agents and models on the Gelios blockchain. Key features:
- AI Agent Framework — Deploy autonomous agents with wallets
- Model Deployment — Upload and execute ML models on-chain
- Verifiable Inference — Cryptographic proofs of correct computation
- Agent Composition — Chain multiple agents into workflows
- Event Listeners — Agents react to on-chain events in real-time
Installation
npm install @gelios/ai-sdk
# Python
pip install gelios-ai
Quick Example
// Initialize the AI SDK
const ai = new GeliosAI({
network: 'mainnet',
apiKey: 'YOUR_API_KEY',
});
// Deploy an autonomous trading agent
const agent = await ai.createAgent({
name: 'TradingBot-001',
model: 'gelios-7b',
capabilities: ['trade', 'analyze', 'interact'],
wallet: 'auto',
verify: true,
});
// Deploy and start the agent
await agent.deploy({ network: 'mainnet' });
console.log(`Agent live at: ${agent.address}`);
Creating AI Agents
AI Agents on Gelios are autonomous on-chain entities. Each agent has its own wallet, can execute transactions, and runs an ML model for decision-making.
Agent Configuration
| Parameter | Type | Description |
|---|---|---|
name | string | Human-readable agent identifier |
model | string | AI model to use (gelios-7b, gelios-13b, or custom) |
capabilities | string[] | Allowed actions: trade, analyze, interact, govern |
wallet | string | "auto" for new wallet, or existing address |
verify | boolean | Enable verifiable inference proofs |
maxGasPerAction | number | Gas limit per agent action (safety limit) |
eventTriggers | object[] | On-chain events that wake the agent |
Agent Lifecycle
const defiAgent = await ai.createAgent({
name: 'DeFi-Monitor',
model: 'gelios-7b',
capabilities: ['analyze', 'interact'],
wallet: 'auto',
verify: true,
eventTriggers: [{
contract: '0xAgentSwapPool',
event: 'Swap',
filter: { minAmount: parseGOS('1000') },
}],
});
// Listen to agent actions
defiAgent.on('action', (action) => {
console.log('Agent action:', action.type, action.details);
});
// Fund and start the agent
await defiAgent.fund(parseGOS('50'));
await defiAgent.start();
On-Chain Models
Deploy custom ML models to the Gelios Model Registry and use them across smart contracts and agents.
Supported Formats
- ONNX — Recommended for most models
- TensorFlow Lite — For lightweight inference
- Gelios Model Format (GMF) — Optimized for on-chain execution
client = GeliosClient("https://rpc.gelios.network")
registry = ModelRegistry(client)
# Upload a model
model_id = await registry.upload(
path="./my_model.onnx",
name="PricePredictor-v1",
description="Predicts GOS/USDC price movement",
access="public", # or "private"
fee_per_inference=0.01, # GOS per call
)
# Run inference
result = await registry.infer(
model_id=model_id,
input_data={"prices": [1.23, 1.25, 1.21, 1.28]},
verify=True,
)
print(f"Prediction: {result.output}")
print(f"Proof: {result.proof_hash}")
Verifiable Inference
Every AI inference on Gelios can produce a Verifiable Inference Proof (VIP) — a cryptographic attestation that the model output was correctly computed. This is critical for DeFi applications where AI decisions affect user funds.
How It Works
- Input Commitment — Input data is hashed and committed on-chain
- Execution — The model runs on a validator node with TEE (Trusted Execution Environment)
- Proof Generation — A zkML proof is generated alongside the output
- Verification — Any node can verify the proof in O(log n) time
const isValid = await client.verifyInference({
modelId: '0xModelAddress',
inputHash: result.inputHash,
output: result.output,
proof: result.proof,
});
console.log('Inference valid:', isValid); // true
JSON-RPC API
Gelios provides a standard JSON-RPC interface compatible with common tooling. Endpoint: https://rpc.gelios.network
Core Methods
AI-Specific Methods
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "gos_getBalance",
"params": ["0xYourAddress", "latest"],
"id": 1
}'
REST API
For convenience, Gelios also provides a RESTful API at https://api.gelios.network/v1
WebSocket API
Subscribe to real-time events via WebSocket at wss://ws.gelios.network
const ws = new GeliosWS('wss://ws.gelios.network');
// Subscribe to new blocks
ws.subscribe('newBlocks', (block) => {
console.log('New block:', block.number);
});
// Subscribe to AI agent events
ws.subscribe('agentActions', {
agentId: '0xAgentAddress',
}, (action) => {
console.log('Agent acted:', action);
});
// Subscribe to contract events
ws.subscribe('contractEvents', {
address: '0xContractAddress',
event: 'Transfer',
}, (event) => {
console.log('Transfer:', event.from, '->', event.to, event.amount);
});