Verylot API

Verylot API 为会员提供任意过往数字及其证明。每个接口都需要使用你的 API 密钥签名的请求。

基础

  • 基础 URL: https://api.verylot.online——所有路径均以 /v1 开头。
  • 时间: 一律使用 UTC。时间采用 ISO 8601 格式(2026-10-07T06:00:00Z)。
  • 时隙: 时间被划分为 10 秒的时隙,slot = unix_seconds / 10。每个时隙一个数字;时隙 179135280 即 2026-10-07 06:00:00 UTC。
  • 缓存: 已结束的范围永远不会改变。/v1/stream/block 会为其发送 Cache-Control: public, max-age=600。
  • 费用: 免费。适用合理使用限制(参见限制)。

接口

每个接口的参数、多种语言的请求示例和响应示例。所有接口都面向会员,需要签名请求(见下文 签名请求)。

如何逐步验证证明:工作原理。

签名请求

会员接口使用 API 密钥对(Ed25519),而非共享密钥:

  1. 在会员面板中创建密钥。密钥对在您的浏览器中生成;Verylot 只保存公钥。私钥由您保管(仅显示一次,或以 .pem 文件下载)。您也可以粘贴自己生成的公钥。 → /panel/api-keys · 指南中有分步说明
  2. 每个请求都携带四个请求头:
请求头 值
X-Verylot-Key 密钥 ID,例如 vk_7Qm2xR9a
X-Verylot-Timestamp 当前 UTC 时间;误差在 ±5 分钟内才会被接受
X-Verylot-Nonce 16 个随机字节,base64url 编码;每个请求使用新的值
X-Verylot-Signature 对下方文本的 Ed25519 签名,base64 编码

待签名文本是以下五行以 \n 连接而成:

GET
/v1/stream?at=2026-10-07T06:00:00Z&digits=6
2026-10-07T10:15:00Z
q8Jm1Xb3oV0p9nW2rT5yZA
<hex SHA-256 of the request body; of an empty string for GET>
REQ='/v1/stream?at=2026-10-07T06:00:00Z&digits=6'
TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
NONCE=$(openssl rand -base64 16 | tr '+/' '-_' | tr -d '=')
HASH=$(printf '' | sha256sum | cut -d' ' -f1)
printf 'GET\n%s\n%s\n%s\n%s' "$REQ" "$TS" "$NONCE" "$HASH" > signed.txt
SIG=$(openssl pkeyutl -sign -inkey verylot.pem -rawin -in signed.txt | base64 -w0)

curl "https://api.verylot.online$REQ" \
  -H "X-Verylot-Key: vk_7Qm2xR9a" -H "X-Verylot-Timestamp: $TS" \
  -H "X-Verylot-Nonce: $NONCE" -H "X-Verylot-Signature: $SIG"
import { createHash, createPrivateKey, randomBytes, sign } from 'node:crypto'
import { readFileSync } from 'node:fs'

const key = createPrivateKey(readFileSync('verylot.pem'))
const path = '/v1/stream?at=2026-10-07T06:00:00Z&digits=6'
const ts = new Date().toISOString().replace(/\.\d+Z$/, 'Z')
const nonce = randomBytes(16).toString('base64url')
const text = ['GET', path, ts, nonce, createHash('sha256').update('').digest('hex')].join('\n')
const signature = sign(null, Buffer.from(text), key).toString('base64')

const res = await fetch('https://api.verylot.online' + path, {
  headers: {
    'X-Verylot-Key': 'vk_7Qm2xR9a', 'X-Verylot-Timestamp': ts,
    'X-Verylot-Nonce': nonce, 'X-Verylot-Signature': signature,
  },
})
const result = await res.json()
import base64, datetime, hashlib, os
import requests
from cryptography.hazmat.primitives.serialization import load_pem_private_key   # pip install cryptography

key = load_pem_private_key(open('verylot.pem', 'rb').read(), None)
path = '/v1/stream?at=2026-10-07T06:00:00Z&digits=6'
ts = datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')
nonce = base64.urlsafe_b64encode(os.urandom(16)).rstrip(b'=').decode()
text = '\n'.join(['GET', path, ts, nonce, hashlib.sha256(b'').hexdigest()])
signature = base64.b64encode(key.sign(text.encode())).decode()

result = requests.get('https://api.verylot.online' + path, headers={
    'X-Verylot-Key': 'vk_7Qm2xR9a', 'X-Verylot-Timestamp': ts,
    'X-Verylot-Nonce': nonce, 'X-Verylot-Signature': signature}).json()
// dotnet add package NSec.Cryptography   (Ed25519)
using System.Security.Cryptography;
using System.Text;
using NSec.Cryptography;

var key = Key.Import(SignatureAlgorithm.Ed25519, File.ReadAllBytes("verylot.pem"), KeyBlobFormat.PkixPrivateKeyText);
var path = "/v1/stream?at=2026-10-07T06:00:00Z&digits=6";
var ts = DateTime.UtcNow.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'");
var nonce = Convert.ToBase64String(RandomNumberGenerator.GetBytes(16)).TrimEnd('=').Replace('+', '-').Replace('/', '_');
var hash = Convert.ToHexStringLower(SHA256.HashData([]));
var text = string.Join('\n', "GET", path, ts, nonce, hash);
var signature = Convert.ToBase64String(SignatureAlgorithm.Ed25519.Sign(key, Encoding.UTF8.GetBytes(text)));

using var http = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.verylot.online" + path);
request.Headers.Add("X-Verylot-Key", "vk_7Qm2xR9a");
request.Headers.Add("X-Verylot-Timestamp", ts);
request.Headers.Add("X-Verylot-Nonce", nonce);
request.Headers.Add("X-Verylot-Signature", signature);
var response = await http.SendAsync(request);
// Ed25519 with PHP's built-in sodium; the PEM (PKCS#8) ends with the 32-byte seed.
$der = base64_decode(preg_replace('/-----[^-]+-----|\s/', '', file_get_contents('verylot.pem')));
$secret = sodium_crypto_sign_secretkey(sodium_crypto_sign_seed_keypair(substr($der, -32)));

$path = '/v1/stream?at=2026-10-07T06:00:00Z&digits=6';
$ts = gmdate('Y-m-d\TH:i:s\Z');
$nonce = rtrim(strtr(base64_encode(random_bytes(16)), '+/', '-_'), '=');
$text = implode("\n", ['GET', $path, $ts, $nonce, hash('sha256', '')]);
$signature = base64_encode(sodium_crypto_sign_detached($text, $secret));

$ch = curl_init('https://api.verylot.online' . $path);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'X-Verylot-Key: vk_7Qm2xR9a', "X-Verylot-Timestamp: $ts",
        "X-Verylot-Nonce: $nonce", "X-Verylot-Signature: $signature",
    ],
]);
$result = json_decode(curl_exec($ch), true);

即使数据库泄露,也无法以您的名义签署请求;被截获的请求也无法被重放。

错误

错误采用 RFC 7807 problem details 格式。code 保持稳定;title 会翻译为 Accept-Language 指定的语言。

{ "status": 401, "code": "error.auth.signature-invalid", "title": "The request signature is missing or invalid." }
状态码 何时出现
400 输入无效
401 缺少签名或签名无效 — error.auth.signature-required, error.auth.signature-invalid, error.auth.timestamp-invalid, error.auth.nonce-reused, error.api-key.invalid
403 会员未激活 — error.tenant.inactive
404 未找到
429 已达到限制;参见 Retry-After

限制

每个密钥都有请求次数限制:

限制 默认值
每分钟 API 请求数(每个密钥) 10

如需更多额度,请通过联系页面与我们联系。

只有正确签名的请求才计入密钥的限额。失败的尝试(未知密钥、签名错误、时间戳过旧、nonce 重复)按 IP 计数:一分钟内 30 次会使该 IP 被封禁 15 分钟(返回 429 及 Retry-After)。

工具

  • 验证工具: @verylot/verifier 可在浏览器或命令行中重新计算并检查任意范围的数字:
verylot-verify --file verylot-proof.json
verylot-verify --api https://api.verylot.online --key vk_7Qm2xR9a --pem verylot.pem --at 2026-10-05T12:00:00Z --digits 6