Rivellum

Rivellum Portal

Download Wallet (Chrome)
Checking...
testnet

Unity & Game Integration

Rivellum includes a dedicated Unity SDK in this repository.

Architecture

Unity clients use the C# SDK in sdk/unity/ and call node RPC endpoints through its transport layer.

Unity Game Client -> sdk/unity -> Rivellum Node RPC

Integration Approach

1. Unity SDK (Primary)

Use RivellumClient from sdk/unity/src/ with UnityWebRequest or HttpClient transport.

Key surfaces exposed by the SDK include:

  • balance queries
  • intent simulation and submission
  • fluent intent builder
  • event subscriptions

2. Direct REST API (Optional)

For custom integrations, Unity's UnityWebRequest can call Rivellum 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 SubmitEnvelope(string envelopeJson)
    {
        string url = $"{nodeUrl}/v1/submit_envelope";
        byte[] body = System.Text.Encoding.UTF8.GetBytes(envelopeJson);
        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 encrypted envelopes
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.

Related References

  • /docs/dev/sdk-surface
  • /docs/dev/godot-integration
  • /docs/dev/mobile-integration
  • /docs/dev/sdk-guide