Time-locked encryption
Get an X25519 public key now. Timelock publishes the matching private key when its scheduled release slot opens.
API
These examples use slot 0, which has already opened. Use the slot finder to choose a different release time.
base='http://57.129.106.133:3064'
id='645e9d946efbf9b548173c3542009b5f811adc55920fc946635361c965b2dab1'
slot=0
Get the public key
curl -fsS "$base/v1/keys/$id/public/$slot"
public_key is a 32-byte X25519 public key in hex. release_at is the scheduled release time in Unix seconds. See the JSON response.
Get the private key
curl -fsS "$base/v1/keys/$id/private/$slot"
private_key is the matching X25519 private key in hex. The endpoint returns 403 before the scheduled time and 503 if the release is due and the key is still pending. See the JSON response.
Find a release slot
Enter a UTC date and time. The finder rounds up to the first scheduled release at or after that time.
Release status
Checking for updates…
- Latest released slot
- —
- Overdue slots
- —
- Next scheduled release
- —
Release schedule
Slot 0 opened on November 26, 2026 at 00:00 UTC. A new slot opens every 10 minutes through November 25, 2036 at 23:50 UTC.
release_at = 1795651200 + slot × 600
slot = ceil((target_unix_seconds − 1795651200) / 600)
The formula rounds up to the first slot at or after your target. Valid slot numbers run from 0 to 526,031.
Encrypt and decrypt with HPKE
Encryption runs in your client. Pin the keyset ID or Merkle root through a trusted channel, then verify the slot’s public key against the committed catalog.
The operator holds the seed and can derive future private keys. Once a private key is published, anyone who has the ciphertext can decrypt a message protected solely by that slot key.
Try the Python walkthrough
Use slot 0 to encrypt and open a message immediately, or choose a future slot to try a scheduled release.
1. Install the Python dependency
python3 -m venv .venv
.venv/bin/python -m pip install pycryptodome
2. Save the example as timelock.py
The script checks the slot’s public key against the pinned Merkle root. It writes the slot number, the HPKE encapsulation, and the ciphertext to timelock-message.json.
import hashlib
import json
import sys
from pathlib import Path
from urllib.error import HTTPError
from urllib.request import urlopen
from Crypto.Protocol import HPKE
from Crypto.Protocol.DH import import_x25519_private_key, import_x25519_public_key
ORIGIN = "http://57.129.106.133:3064"
KEYSET = "645e9d946efbf9b548173c3542009b5f811adc55920fc946635361c965b2dab1"
ROOT = "2f84eafd3c6861497d2a2517b252a0facc1005276a17d0a6f4afd62d682f850e"
SLOTS = 526032
AEAD = HPKE.AEAD.CHACHA20_POLY1305
BUNDLE = Path("timelock-message.json")
def fetch(kind, slot):
url = f"{ORIGIN}/v1/keys/{KEYSET}/{kind}/{slot}"
with urlopen(url, timeout=10) as response:
return json.load(response)
def slot_bytes(slot):
if not 0 <= slot < SLOTS:
raise ValueError("Slot is outside the key schedule")
return slot.to_bytes(4, "big")
def context(slot):
return (b"scheduled-release/v1/hpke" + bytes.fromhex(KEYSET)
+ bytes.fromhex(ROOT) + slot_bytes(slot))
def committed_public_key(slot):
index = slot_bytes(slot)
proof = fetch("proof", slot)
public = bytes.fromhex(proof["public_key"])
siblings = [bytes.fromhex(item) for item in proof["siblings"]]
if len(public) != 32 or len(siblings) != 20:
raise ValueError("Invalid proof size")
digest = lambda data: hashlib.sha256(data).digest()
node = digest(b"\x00" + index + public)
for level, sibling in enumerate(siblings):
if len(sibling) != 32:
raise ValueError("Invalid sibling size")
pair = sibling + node if (slot >> level) & 1 else node + sibling
node = digest(b"\x01" + pair)
if node.hex() != ROOT:
raise ValueError("Public key proof failed")
return public
def seal(slot):
public = import_x25519_public_key(committed_public_key(slot))
sender = HPKE.new(receiver_key=public, aead_id=AEAD, info=context(slot))
ciphertext = sender.seal(b"Hello from the future!")
BUNDLE.write_text(json.dumps({
"keyset": KEYSET, "root": ROOT, "slot": slot,
"enc": sender.enc.hex(), "ciphertext": ciphertext.hex(),
}, indent=2))
print(f"Wrote {BUNDLE} for slot {slot}")
def open_message():
bundle = json.loads(BUNDLE.read_text())
if (bundle["keyset"], bundle["root"]) != (KEYSET, ROOT):
raise ValueError("Unexpected keyset or catalog")
slot = bundle["slot"]
info = context(slot)
try:
release = fetch("private", slot)
except HTTPError as error:
if error.code == 403:
sys.exit("This slot is still locked. Try again at its release time.")
if error.code == 503:
sys.exit("The slot is due. Try again once the key arrives.")
raise
private = import_x25519_private_key(bytes.fromhex(release["private_key"]))
actual_public = private.public_key().export_key(format="raw")
if actual_public != committed_public_key(slot):
raise ValueError("Released key does not match the committed public key")
receiver = HPKE.new(receiver_key=private, aead_id=AEAD, info=info,
enc=bytes.fromhex(bundle["enc"]))
print(receiver.unseal(bytes.fromhex(bundle["ciphertext"])).decode("utf-8"))
if sys.argv[1:2] == ["seal"] and len(sys.argv) == 3:
seal(int(sys.argv[2]))
elif sys.argv[1:] == ["open"]:
open_message()
else:
sys.exit("Usage: python timelock.py seal SLOT | python timelock.py open")
3. Seal the message and open it
.venv/bin/python timelock.py seal 0
.venv/bin/python timelock.py open
Expected output
Wrote timelock-message.json for slot 0
Hello from the future!
Try a future release
Use the release-time formula to choose a future slot, or take release.due + 1 from live status if that number is below schedule.slots. Run seal with that number, then run open. Before release, the script says the slot is still locked. Keep the JSON file and run open again when the slot’s key arrives.