Rivellum

Rivellum Portal

Download Wallet (Chrome)
Checking...
mainnet

Unity & Game Integration

Rivellum provides integration pathways for Unity game engines through its TypeScript SDK and REST API.

Architecture

Game clients interact with Rivellum through the standard RPC API. There is no Unity-specific SDK at this time — integration uses HTTP requests to the node's REST endpoints.

Unity Game Client → HTTP/REST → Rivellum Node (port 9000)

Integration Approach

1. REST API (Recommended)

Use Unity's UnityWebRequest to call Rivellum's JSON API directly:

using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class RivellumClient : MonoBehaviour
{
    private string nodeUrl = "https://rpc.rivellum.network";

    public IEnumerator GetBalance(string address)
    {
        string url = $"{nodeUrl}/v1/balance/{address}";
        using (UnityWebRequest req = UnityWebRequest.Get(url))
        {
            yield return req.SendWebRequest();
            if (req.result == UnityWebRequest.Result.Success)
            {
                Debug.Log($"Balance: {req.downloadHandler.text}");
            }
        }
    }

    public IEnumerator SubmitIntent(string intentJson)
    {
        string url = $"{nodeUrl}/v1/submit";
        byte[] body = System.Text.Encoding.UTF8.GetBytes(intentJson);
        using (UnityWebRequest req = new UnityWebRequest(url, "POST"))
        {
            req.uploadHandler = new UploadHandlerRaw(body);
            req.downloadHandler = new DownloadHandlerBuffer();
            req.SetRequestHeader("Content-Type", "application/json");
            yield return req.SendWebRequest();
        }
    }
}

2. Key Endpoints for Games

EndpointUse Case
GET /v1/balance/:addressPlayer wallet balance
POST /v1/submit_envelopeSubmit game actions as intents
GET /v1/nonce/:addressGet current nonce for signing
POST /v1/faucet/mintFund player wallets (testnet)
GET /events/streamSSE stream for real-time game events

3. NFT Integration

Games can use Rivellum's native NFT operations for in-game items:

  • Create Collection: Register a game's item collection
  • Mint NFT: Award items to players with custom attributes
  • Transfer NFT: Enable player-to-player trading
  • Query owned NFTs: Display player inventory

See NFT Standard for full details.

Considerations

  • Signing: Rivellum uses Dilithium3 (post-quantum). You'll need a signing library compatible with CRYSTALS-Dilithium for the client side, or use a server-side signing proxy.
  • Real-time events: Use the SSE endpoint (/events/stream) for live game state updates.
  • Testnet first: Always develop against a local testnet before mainnet deployment.