Gully Game SDK

On this page

The Gully Game SDK is the Unity package every Gully Studio game uses to talk to Gully services. It is open source under MIT, so any Unity developer building on Gully Chain can use it too. Source: github.com/gully-labs/gully-game-sdk (opens in a new tab).

Note

v0.1.0, work in progress (released 2026-10-25). APIs may change before 1.0. Pin a tag, never main.

#Install

Unity 6 LTS (6000.0 or newer). In the Package Manager choose Add package from git URL and paste:

Text
https://github.com/gully-labs/gully-game-sdk.git#v0.1.0

Or add the line to Packages/manifest.json:

JSON
{
  "dependencies": {
    "xyz.gullylabs.gamesdk": "https://github.com/gully-labs/gully-game-sdk.git#v0.1.0"
  }
}

The package depends only on two built-in Unity modules (unitywebrequest, jsonserialize). Projects created from the studio template already reference it.

#What is in it

Area Classes What it does
Gully ID GullyIdClient, LoopbackRedirectListener, DeepLinkRedirect, IdToken Sign in with Gully: OIDC authorization code + PKCE, refresh, /v1/me, id_token claims including gully_account
Gully Chain JsonRpcClient, Abi, Keccak256, Erc20, GullyChain JSON-RPC reads, ABI encode and decode, selectors, EIP-55 checksums, ERC-20 reads and transfer calldata
Gully Pay X402Client x402 pay-per-call: parse a 402, pay the Gully Chain option, retry with X-PAYMENT
Gully Arcade GullyArcadeClient, ArcadeAbi run tickets, score attestation, submitScore calldata, season and leaderboard reads
Wallet seam ITransactionSender the one interface you implement with the player's account
Brand GullyStudioTheme GullyStudio colour tokens and sample-scene defaults

Everything lives in the GullyLabs.GameSdk namespace.

#Quick start

C#
using GullyLabs.GameSdk;

// Chain reads: public testnet RPC by default; production games use their Gully RPC key.
var rpc = new JsonRpcClient(GullyChain.GullyRpcUrl("<your-gully-rpc-project>")); // or new JsonRpcClient()
long block = await rpc.BlockNumberAsync();
var weth = await Erc20.BalanceOfAsync(rpc, GullyChain.TestnetWeth, player);

// Arcade: start a run, play from the seed, attest, submit.
var arcade = new GullyArcadeClient(rpc: rpc);
var run = await arcade.StartRunAsync(gameId: 1);
var attestation = await arcade.AttestAsync(run.ticket, new ArcadeRunLog { seed = run.seed, taps = taps }, player, score);
string txHash = await arcade.SubmitScoreAsync(attestation, mySender); // mySender : ITransactionSender
var board = await arcade.LeaderboardAsync(attestation.seasonId);

Each area has its own page: Gully ID, Wallet, Gully Chain, Payments, Gully Quests.

#Samples

Import them from the package's Samples tab in the Package Manager.

Sample What it shows
Arcade Quickstart start a run, attest the score, build the submitScore calldata, read the leaderboard
Sign in with Gully OIDC authorization code + PKCE against id.gullychain.xyz with a loopback redirect (desktop and editor)
Pay per call (x402) fetch a paid resource: parse the 402, pay on Gully Chain, retry with the payment header

#What works today

Working against live services: Gully Chain reads (RPC, ABI, ERC-20), Arcade reads (season, leaderboard, best score), Arcade run tickets and attestation (season 1 of Frog Hop is live on testnet), submitScore calldata, OIDC URL, PKCE, token exchange and claims, x402 requirement parsing and payment-transaction building.

On you, or not built yet:

  • Sending transactions: implement ITransactionSender (see Wallet).
  • id_token signature verification: do it on your server with the JWKS.
  • Gully Pay verification: your resource server calls the Gully Pay API with its API key, never the game.
  • A Gully ID OIDC client for your game: registered by Gully Labs (see Gully ID).

Coming soon

A Gully Quests client and an offerwall client are not in the SDK yet. Until then, read quests with JsonRpcClient and Abi as shown on Gully Quests.

#Design rules

  • No keys, no secrets. The package holds no API keys, signer keys or licence files, and its CI lints for them.
  • No JSON dependency. JsonUtility only; responses map to [Serializable] DTOs.
  • Tested helpers. Hex, Keccak256, Abi, ArcadeAbi, Pkce and Base64Url have no UnityEngine reference and are unit-tested with known vectors.
  • Nothing from the Asset Store. That is why this repo can be public while game repos are private.

#Updating

Change the tag in the git URL (#v0.1.0 to the new tag) and let Unity re-resolve. Read the changelog (opens in a new tab) first; until 1.0, minor versions may break APIs. The developer portal (opens in a new tab) lists the published versions.