QUARK Developers
Sign inRegister

Integration reference · Setup guide · Rules · Terms

Setup guide: from sign-up to your first QRK reward

This guide takes you through every step in order. Plan about one hour if your game already has a server, and about half a day if you also have to create one. You do not need to change the QUARK app, and you do not add any QUARK code to your game app. Only your own game server talks to QUARK.

Your game must be online: the level a player reached has to be stored on a server you control. If the level exists only inside the app on the phone, a player could edit it, so such rewards are not allowed (see the rules).

Part A. In this portal

01  Register and verify your e-mail

Open Register, enter your details, choose a password (at least 10 characters) and accept the Terms. We e-mail you a code; enter it on the verify page. Check spam if it does not arrive within a few minutes, or write to developer@qrknetwork.site.

02  Wait for approval

Every developer is reviewed by the QUARK team. You can sign in only after approval, and we e-mail you the result. If you are rejected the e-mail says why.

03  Add your app

Go to Apps, New app. Enter the app name, the Android package name (for example com.studio.mygame; it cannot be changed later), your Google Play link and a short description. Submit it for review.

04  Pay the one-time registration fee

Each app has a one-time fee (shown on the app page, currently 25 USDT). It is not refundable. Open your app in the portal, follow the payment instructions, then e-mail developer@qrknetwork.site with the app name and the transaction hash. Our team confirms it by hand and the app shows FEE PAID.

05  Get your App ID and secret

Once the app is approved and the fee is confirmed, open the app page and enter your password to reveal the App ID and the secret. Copy both to a safe place. The secret is like a bank PIN: it goes only on your server and never into the game app, a repository or a chat. If it may have leaked, press Rotate; the old one stops working immediately.

06  Buy QRK to fund your rewards

Open Wallet, choose a network, enter the USDT amount (the portal shows the price and the limits), and write down the wallet address you will pay from. Send the USDT from exactly that address to the address shown, then paste the transaction hash. QRK is credited after the payment is verified on the blockchain and approved by our team. Only pay from a wallet you control, never from an exchange account that does not show you the sending address.

07  Create a campaign

Go to Campaigns, New campaign. Choose the app, give the campaign a title players will see, then add tiers: the level a player must reach and the QRK reward for it. Tiers add up: level 5 = 1 QRK, level 10 = 2 QRK and level 15 = 3 QRK pays 6 QRK to a player who reaches level 15. Set the number of players. The portal shows the most one player can earn and the total budget. You can choose whether progress made before a player joined also counts. Confirm with your password: the whole budget is reserved from your wallet. An app can have one open campaign at a time. You can pause, resume or close it. When you close it, everything not owed to players returns to your wallet.

Part B. On your game server

Only your server needs code, and it is two calls: one when a player connects their QUARK account, one when a player's level goes up. Every request is signed with your secret; the signing function is below in four languages. Pick yours. The details of the signature are in the integration reference.

08  Put the three values on your server

Set them as environment variables of your server (Render, Railway, Vercel, Firebase, a VPS: all have a settings page for this). Do not write them into source code or commit them to Git.

QUARK_API=https://quarknetwork-org.onrender.com QUARK_APP_ID=<your App ID from the portal> QUARK_APP_SECRET=<your secret from the portal>

09  Add the signing helper

Copy one of these into your server project.

Node.js

// quark.js (Node 18+) const crypto = require('crypto'); const { QUARK_API, QUARK_APP_ID, QUARK_APP_SECRET } = process.env; // eventId: pass the SAME value when you retry the same event. async function quark(method, path, payload, eventId = crypto.randomUUID()) { const body = payload ? JSON.stringify({ eventId, ...payload }) : ''; const ts = String(Math.floor(Date.now() / 1000)); const bodyHash = crypto.createHash('sha256').update(body).digest('hex'); const sig = crypto.createHmac('sha256', QUARK_APP_SECRET).update(ts + '.' + method + '.' + path + '.' + bodyHash).digest('hex'); const res = await fetch(QUARK_API + path, { method, headers: { 'Content-Type': 'application/json', 'X-Quark-App': QUARK_APP_ID, 'X-Quark-Timestamp': ts, 'X-Quark-Signature': sig }, body: body || undefined, }); return { status: res.status, data: await res.json().catch(() => ({})) }; } module.exports = { quark };

Python

# quark.py import hmac, hashlib, time, json, uuid, os, requests API, APP_ID, SECRET = os.environ['QUARK_API'], os.environ['QUARK_APP_ID'], os.environ['QUARK_APP_SECRET'] def quark(method, path, payload=None, event_id=None): body = json.dumps({'eventId': event_id or str(uuid.uuid4()), **payload}).encode() if payload else b'' ts = str(int(time.time())) msg = f"{ts}.{method}.{path}.{hashlib.sha256(body).hexdigest()}" headers = {'Content-Type': 'application/json', 'X-Quark-App': APP_ID, 'X-Quark-Timestamp': ts, 'X-Quark-Signature': hmac.new(SECRET.encode(), msg.encode(), hashlib.sha256).hexdigest()} r = requests.request(method, API + path, data=body or None, headers=headers, timeout=15) return r.status_code, r.json() # status, data = quark('POST', '/partner/v1/progress', {'playerId': 'player-123', 'level': 12})

C# (server side)

// Quark.cs (.NET 6+, ASP.NET or any server-side C#. NOT inside the Unity client) using System.Security.Cryptography; using System.Text; using System.Text.Json; public static class Quark { static readonly HttpClient Http = new(); static string Env(string n) => Environment.GetEnvironmentVariable(n)!; public static async Task<(int status, string json)> Call(string method, string path, Dictionary<string, object>? payload = null, string? eventId = null) { string body = ""; if (payload != null) { payload["eventId"] = eventId ?? Guid.NewGuid().ToString(); body = JsonSerializer.Serialize(payload); } string ts = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString(); string bodyHash = Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(body))).ToLowerInvariant(); using var h = new HMACSHA256(Encoding.UTF8.GetBytes(Env("QUARK_APP_SECRET"))); string sig = Convert.ToHexString(h.ComputeHash(Encoding.UTF8.GetBytes($"{ts}.{method}.{path}.{bodyHash}"))).ToLowerInvariant(); var req = new HttpRequestMessage(new HttpMethod(method), Env("QUARK_API") + path); req.Headers.Add("X-Quark-App", Env("QUARK_APP_ID")); req.Headers.Add("X-Quark-Timestamp", ts); req.Headers.Add("X-Quark-Signature", sig); if (body != "") req.Content = new StringContent(body, Encoding.UTF8, "application/json"); var res = await Http.SendAsync(req); return ((int)res.StatusCode, await res.Content.ReadAsStringAsync()); } } // await Quark.Call("POST", "/partner/v1/progress", new() { ["playerId"] = "player-123", ["level"] = 12 });

PHP

<?php // quark.php (PHP 8, curl) function quark(string $method, string $path, ?array $payload = null, ?string $eventId = null): array { $body = $payload ? json_encode(['eventId' => $eventId ?: bin2hex(random_bytes(16))] + $payload) : ''; $ts = (string) time(); $sig = hash_hmac('sha256', $ts . '.' . $method . '.' . $path . '.' . hash('sha256', $body), getenv('QUARK_APP_SECRET')); $ch = curl_init(getenv('QUARK_API') . $path); curl_setopt_array($ch, [CURLOPT_CUSTOMREQUEST => $method, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 15, CURLOPT_POSTFIELDS => $body ?: null, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'X-Quark-App: ' . getenv('QUARK_APP_ID'), 'X-Quark-Timestamp: ' . $ts, 'X-Quark-Signature: ' . $sig]]); $out = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return [$status, json_decode($out, true)]; }

10  Make the two calls

Example in Node.js (the same two requests in any language):

const { quark } = require('./quark'); // 1) A player typed the QUARK code in your game app.post('/game/connect-quark', async (req, res) => { const player = await getPlayer(req); // your own login / session const r = await quark('POST', '/partner/v1/links/confirm', { code: req.body.code, playerId: player.id, level: player.level }); res.json(r.data); // { success: true, linked: true, ... } or { error, code } }); // 2) Your server saved a new level for a player async function onLevelSaved(player) { const r = await quark('POST', '/partner/v1/progress', { playerId: player.id, level: player.level }); if (r.status === 503) { /* temporary: retry later with the SAME eventId */ } }
  • playerId is your own stable id for the player (1 to 128 characters). Do not use an e-mail address or a name.
  • level is the player's current level. You may skip reports; the next one catches up.
  • Report only after your server has validated the progress. Never trust a level sent by the game app.
  • If a call times out or returns 503, retry with the same eventId. A repeated eventId never pays twice.

Part C. In your game

11  Add a “Connect QUARK” screen

Add one button (for example in Settings) and one text box. The player opens the QUARK app, goes to Campaigns, Games, taps Get link code and gets an 8-character code that works for 15 minutes. The player types it into your text box and your game sends it to your server (step 10, call 1). Suggested wording:

Connect QUARK Open the QUARK app, go to Campaigns > Games, tap "Get link code", and type the code here. Rewards go to your QUARK account. [ ____-____ ] [Connect]

Show clear messages for the errors you can get: INVALID_CODE (wrong, used or older than 15 minutes: ask for a new code), PLAYER_ALREADY_LINKED (this game account is already connected to another QUARK account), USER_ALREADY_LINKED (this QUARK account is already connected to another game account) and NO_ACTIVE_CAMPAIGN.

12  Tell players how rewards work

Players should know: the tiers and rewards, that rewards unlock after the hold period (24 hours by default), and that they claim them in the QUARK app, where the QRK goes to their Available QRK. They have 30 days after the campaign closes to claim. Never promise more than your tiers.

Part D. Test, then go live

13  Test with a small campaign

  1. Create a campaign with one tier (for example level 2 = 0.1 QRK) for 1 or 2 players.
  2. In the QUARK app: Campaigns, Games, your game, Get link code.
  3. Type the code in your game. Your server should receive { "success": true, "linked": true }.
  4. Play to level 2. The QUARK app shows the reward as earned and when it unlocks.
  5. After the hold, tap Claim. The QRK appears in Available QRK.

If the signature does not work, check your code against the test vector in the integration reference first.

14  Go-live checklist

  • The secret is only in server environment variables. It is not in the APK, the repository or a chat.
  • Levels are reported only from your server, after validation.
  • Retries reuse the same eventId.
  • Your game has a privacy policy that mentions sending a player id and level to QUARK.
  • The “Connect QUARK” screen handles every error message above.
  • The wallet holds enough QRK for the budget. Start with a small number of players, check the results, then grow.

Troubleshooting

What you seeWhat it means and what to do
HTTP 401Wrong signature or old timestamp. Check the App ID, the secret (no spaces), the method in capitals, the path without query string, and that you sign exactly the bytes you send. Your server clock must be within 5 minutes.
HTTP 503 or RETRYTemporary. Wait a few seconds and send the same request again with the same eventId.
INVALID_CODEThe code is wrong, already used, or older than 15 minutes. The player taps Get link code again.
NOT_LINKEDThis game account is not connected to a QUARK account yet. Ask the player to connect first.
NO_ACTIVE_CAMPAIGNThe app has no running campaign. Check the campaign is active (not paused or closed).
CAMPAIGN_FULLAll player slots are taken. The account stays linked but earns nothing in this campaign.
FLAGGEDA very large jump. The reward is held until our team reviews it. Nothing to do, but make sure the level was genuine.
BLOCKED / LINK_REVOKEDThe player was blocked or the link removed by the QUARK team. Contact us if you think this is a mistake.
The app is not in the portal list of campaignsThe app must be approved and its fee confirmed before a campaign can start.

Questions

Write to developer@qrknetwork.site with your app name and, if it is an API problem, the eventId and the time of the request. Never send us your secret.

Create a developer account