Mobile Integration
Rivellum supports mobile application integration through its standard REST API. There is no platform-specific mobile SDK at this time.
Architecture
Mobile apps interact with Rivellum nodes via HTTP/JSON:
Mobile App (iOS/Android) → HTTPS → Rivellum Node (port 9000)
Integration Approach
REST API
All node functionality is accessible through the JSON REST API. Use your platform's HTTP client:
Swift (iOS):
import Foundation
struct RivellumClient {
let nodeUrl: String
func getBalance(address: String) async throws -> Data {
let url = URL(string: "\(nodeUrl)/v1/balance/\(address)")!
let (data, _) = try await URLSession.shared.data(from: url)
return data
}
func submitIntent(payload: Data) async throws -> Data {
var request = URLRequest(url: URL(string: "\(nodeUrl)/v1/submit")!)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = payload
let (data, _) = try await URLSession.shared.data(for: request)
return data
}
}
Kotlin (Android):
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaType
class RivellumClient(private val nodeUrl: String) {
private val client = OkHttpClient()
private val json = "application/json".toMediaType()
fun getBalance(address: String): String {
val request = Request.Builder()
.url("$nodeUrl/v1/balance/$address")
.build()
return client.newCall(request).execute().body!!.string()
}
fun submitIntent(payload: String): String {
val body = RequestBody.create(json, payload)
val request = Request.Builder()
.url("$nodeUrl/v1/submit")
.post(body)
.build()
return client.newCall(request).execute().body!!.string()
}
}
Key Endpoints
| Endpoint | Use Case |
|---|---|
GET /v1/balance/:address | Wallet balance display |
GET /v1/nonce/:address | Nonce for intent signing |
POST /v1/submit_envelope | Submit signed intents |
POST /v1/faucet/mint | Fund wallets (testnet only) |
GET /events/stream | Real-time event notifications (SSE) |
Considerations
- Signing: Rivellum uses Dilithium3 (post-quantum, 3,309-byte signatures). Mobile clients need a Dilithium signing library, or can delegate signing to a trusted backend.
- Key storage: Use platform secure enclaves (iOS Keychain, Android Keystore) for private key material.
- Network: Always use HTTPS in production. The node itself serves HTTP; place a TLS-terminating reverse proxy in front.
- Offline signing: Build and sign intents offline, then submit when connectivity is available.
TypeScript SDK (React Native)
For React Native apps, use the standard TypeScript SDK:
npm install @rivellum/sdk
import { RivellumClient } from '@rivellum/sdk';
const client = new RivellumClient({ nodeUrl: 'https://node.example.com' });
const balance = await client.getBalance('0x1234...');
See SDK Guide for full SDK documentation.