Voting: how to receive votes for your server
Players vote for the server on akvarium.space, and we immediately forward the vote to your server so you can issue a reward. There are two methods; both can be enabled: an HTTP request with JSON and an RCON command.
Who can vote
- Only a player whose nickname is linked to Akvarium: they log in to the site via /akvarium login on play.akvarium.space. Therefore, the nickname in the vote is always real: its owner has entered the game.
- 1 vote per day for one server per nickname (24 hours Moscow time).
- No more than 10 votes per day from one nickname for all servers and 20 from one IP.
- Between votes from the same nickname — at least 5 seconds.
- The rating considers votes from the last 30 days.
Method 1: HTTP JSON
For each vote, we send a POST request to your address. The body is JSON; the signature is in the X-Akv-Signature header: this is an HMAC-SHA256 of the string "timestamp.body" using your secret. The secret is shown on the server management page.
POST /akvarium-vote HTTP/1.1
Content-Type: application/json
User-Agent: akvarium.space-monitoring/1.0
X-Akv-Timestamp: 1764950400
X-Akv-Vote-Id: 1842
X-Akv-Signature: sha256=5d41402abc4b2a76b9719d911017c592...{
"type": "vote",
"server": "akvarium",
"nick": "Steve",
"voteId": 1842,
"timestamp": 1764950400,
"test": false
}- Respond with a 2xx code within 6 seconds: this lets us know the vote was accepted.
- If there is no response or the code is not 2xx, we will retry two more times: after 30 seconds and after 5 minutes. Therefore, verify the voteId and do not issue the reward twice.
- Verify the signature and time: the timestamp must not be older than 5 minutes.
- The test vote has "test": true and voteId 0 — do not issue a reward for it.
// Node.js 18+ (Express)
const crypto = require('crypto');
const express = require('express');
const app = express();
const SECRET = process.env.AKV_SECRET; // secret from the server settings page
const seen = new Set(); // keep voteIds in your DB in production
app.post('/akvarium-vote', express.raw({ type: 'application/json' }), (req, res) => {
const body = req.body.toString('utf8');
const ts = Number(req.get('X-Akv-Timestamp'));
const expected = 'sha256=' + crypto.createHmac('sha256', SECRET).update(ts + '.' + body).digest('hex');
const got = req.get('X-Akv-Signature') || '';
if (got.length !== expected.length || !crypto.timingSafeEqual(Buffer.from(got), Buffer.from(expected))) {
return res.status(401).send('bad signature');
}
if (Math.abs(Date.now() / 1000 - ts) > 300) return res.status(400).send('old');
const vote = JSON.parse(body);
if (vote.test) return res.send('test ok');
if (seen.has(vote.voteId)) return res.send('duplicate');
seen.add(vote.voteId);
// give the reward to vote.nick here
res.send('ok');
});
app.listen(8080);<?php
// PHP 7.4+
$secret = getenv('AKV_SECRET');
$body = file_get_contents('php://input');
$ts = (int)($_SERVER['HTTP_X_AKV_TIMESTAMP'] ?? 0);
$expected = 'sha256=' . hash_hmac('sha256', $ts . '.' . $body, $secret);
if (!hash_equals($expected, $_SERVER['HTTP_X_AKV_SIGNATURE'] ?? '')) {
http_response_code(401); exit('bad signature');
}
if (abs(time() - $ts) > 300) { http_response_code(400); exit('old'); }
$vote = json_decode($body, true);
if ($vote['test']) { exit('test ok'); }
// check that $vote['voteId'] is new, then reward $vote['nick']
echo 'ok';# Python 3 (Flask)
import hmac, hashlib, json, os, time
from flask import Flask, request
app = Flask(__name__)
SECRET = os.environ["AKV_SECRET"].encode()
@app.post("/akvarium-vote")
def vote():
body = request.get_data()
ts = request.headers.get("X-Akv-Timestamp", "0")
expected = "sha256=" + hmac.new(SECRET, ts.encode() + b"." + body, hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, request.headers.get("X-Akv-Signature", "")):
return "bad signature", 401
if abs(time.time() - int(ts)) > 300:
return "old", 400
data = json.loads(body)
if data["test"]:
return "test ok"
# check that data["voteId"] is new, then reward data["nick"]
return "ok"Method 2: RCON
We connect to your server's RCON and execute one command. Write the command without the leading slash "/". The player's nickname is automatically substituted for {nick}; if {nick} is missing from the command, the nickname will be appended to the end with a space.
# server.properties
enable-rcon=true
rcon.port=25575
rcon.password=long-random-passwordgive {nick} diamond 3
eco give {nick} 100
lp user {nick} permission settemp vote.bonus true 1d
broadcast {nick} voted for the server!- Votes (HTTP and RCON) come from IP 185.192.247.15: you can open the RCON port only for it.
- The RCON password is stored encrypted and is never shown to anyone, not even you.
- The host must be a public address: local and internal networks are not accepted.
Test on this same management page
On the server management page, there is a "Send Test" button: it sends a test vote to all configured endpoints and shows whether it arrived; if not, it indicates at which step the error occurred (address, connection, RCON password, server response).
- No more than one test every 10 seconds.
- Total of 50 tests allowed; afterwards, testing is locked for 48 hours, then the counter resets.
