DNSCrypt DNS Stamps Specification Deep Dive
Published 2026-11-22Category: Guides
Comprehensive guide to DNS Stamps encoding, protocol differences (DNSCrypt/DoH/DoT/DoQ/ODoH), property bitmasks
Table of contents
- 1.Introduction & Key Highlights
- 2.Core Parameters & Protocol Comparison
- 3.Deep Dive & Operational Details
- 3.1.Encoding Primitives & Length-Prefix Rules
- 3.2.DNSCrypt Stamps Structure & Property Bitmask
- 3.3.DoH/DoT/DoQ/Oblivious DoH Multi-Protocol Differences
- 4.Scenario-Based Selection & Pitfall Checklist
- 5.FAQ
- 6.Sources & References

Introduction & Key Highlights
The DNS Stamps specification published by DNSCrypt.info provides the authoritative reference for standardized encoding of encrypted DNS server connection parameters. This specification compresses IP addresses, ports, public keys, provider names, and protocol attributes into a single Base64URL string — effectively a “QR code for DNS” — dramatically simplifying client configuration distribution and cross-platform interoperability. This article targets Linux operators, container network engineers, and self-hosted DNS service developers, breaking down the binary layout of Stamps, property bitmask definitions, encoding differences across DNSCrypt, DoH, DoT, DoQ, and Oblivious DoH protocols, and providing practical toolchains and a pitfall checklist for generation, validation, and conversion.
Core Parameters & Protocol Comparison
| Dimension | DNSCrypt (sdns://) | DoH (sdns://) | DoT (sdns://) | DoQ (sdns://) | Oblivious DoH (sdns://) |
|---|---|---|---|---|---|
| Protocol Identifier | 0x01 | 0x02 | 0x03 | 0x04 | 0x05 |
| Core Payload | props(8B) + addr + pk + providerName | addr + hash + host + [path] + [bootstrapIPs] | addr + hash + host + [bootstrapIPs] | addr + pk + [bootstrapIPs] | addr + hpk + host + [path] + [bootstrapIPs] |
| Key Crypto Material | Public key pk (32 bytes) | SHA-256 hash (32 bytes) | SHA-256 hash (32 bytes) | Public key pk (32 bytes) | HPK public key (32 bytes) |
| Default Port | 443 | 443 | 853 | 853 | 443 |
| Property Bitmask props | Supported (DNSSEC=1, NoLogs=2, NoBlock=4) | Not applicable | Not applicable | Not applicable | Not applicable |
| Bootstrap IPs | None | Optional list | Optional list | Optional list | Optional list |
| Online Calculator | Supported | Supported | Supported | Supported | Supported |
Deep Dive & Operational Details
Encoding Primitives & Length-Prefix Rules
The specification defines three core primitives: LP(x) = len(x) || x for single-element length prefixing; vlen(x) where the last element uses len(x) and preceding elements use 0x80 | len(x) to mark continuation; and VLP(x1..xn) which concatenates the collection in order. All strings are raw bytes — not individually Base64 encoded. Only after final concatenation is the entire binary blob subjected to a single base64url encoding. Example: LP("10.0.0.1") yields [0x08, '1','0','.','0','.','0','.','1']; VLP("10.0.0.1","10.0.0.2") yields [0x88,...ip1..., 0x08,...ip2...], with final base64url result iDEwLjAuMC4xCDEwLjAuMC4y. In practice, always use unsigned single-byte lengths; oversized fields require chunking or a protocol version upgrade.
DNSCrypt Stamps Structure & Property Bitmask
Full format: "sdns://" || base64url(0x01 || props(8B LE) || LP(addr[:port]) || LP(pk) || LP(providerName)). The props field is a little-endian 64-bit integer combined via bitwise OR: 1=DNSSEC validation, 2=NoLogs, 4=NoBlock. For example, enabling only DNSSEC and NoBlock gives props = 0x05, byte sequence [0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00]. The addr field includes port as "ip:port"; IPv6 must use brackets like "[2001:db8::1]:8443". The pk is a 32-byte raw Ed25519 public key binary — never hex or Base64 wrapped. Generation command example (encoder implementation required):
# Pseudo-code demonstrating encoding flow
printf '\x01' > stamp.bin
printf '\x05\x00\x00\x00\x00\x00\x00\x00' >> stamp.bin # props=5
printf '\x0c1.2.3.4:443' >> stamp.bin # LP(addr)
cat pk.bin >> stamp.bin # LP(pk) already length-prefixed
printf '\x0cexample.com' >> stamp.bin # LP(providerName)
base64 -w0 stamp.bin | tr '+/' '-_' | tr -d '=' # base64url
DoH/DoT/DoQ/Oblivious DoH Multi-Protocol Differences
- DoH (0x02):
LP(addr) || LP(hash) || LP(host) || [LP(path)] || VLP(bootstrapIPs). Thehashis the certificate SHA-256 (32 bytes),hostused for SNI and Host header,pathdefaults to/dns-query. - DoT (0x03):
LP(addr) || LP(hash) || LP(host) || VLP(bootstrapIPs). No path field, default port 853. - DoQ (0x04):
LP(addr) || LP(pk) || VLP(bootstrapIPs). Uses QUIC,pkis 32-byte public key, default port 853. - Oblivious DoH (0x05):
LP(addr) || LP(hpk) || LP(host) || [LP(path)] || VLP(bootstrapIPs). Thehpkis the HPKE public key (32 bytes) targeting the relay server.
All protocols start with a single-byte identifier 0x02–0x05, have no props field, and use whole-blob base64url encoding. The online calculator at https://stamps.dnscrypt.info and its Vue component support visual editing for all five protocol types.
Scenario-Based Selection & Pitfall Checklist
- Client Distribution Scenarios: Prefer generating DNSCrypt Stamps (with props transparency) for unified import into dnscrypt-proxy, AdGuard Home, NextDNS CLI via
sdns://, avoiding manual TOML/JSON errors. - Containerized Network Stacks: When injecting DoH/DoT Stamps into Kubernetes CoreDNS or sidecars, always populate
bootstrapIPswith upstream recursive resolver IPs to prevent startup-time circular dependencies. - IPv6-Only Environments: The
addrfield must be written as"[::1]:853"— remember the brackets are part of the string and included in length calculation. - Public Key/Hash Source Verification: The
pk/hash/hpkfields are all 32-byte raw binaries. Strictly forbidden to paste hex or Base64 strings directly. Must first restore viaxxd -r -porbase64 -dbefore writing intoLP. - Version Evolution Compatibility: The specification reserves high bits for extensions. Parsers encountering unknown protocol identifiers should gracefully degrade rather than crash. Generation tools should pin to the official
dnscrypt.infolibrary version to avoid community fork incompatibilities.
FAQ
How to quickly validate an sdns:// string?
Paste the full string into the online calculator at https://stamps.dnscrypt.info. The page auto-decodes and displays protocol type, IP, port, public key fingerprint, props bitmask, and other fields; format errors are reported immediately. Alternatively, test connectivity with dnscrypt-proxy -resolve example.com -stamp "sdns://...".
How to correctly calculate the props field in DNSCrypt Stamps?
props is a little-endian 64-bit unsigned integer combined via bitwise OR as needed: DNSSEC=1, NoLogs=2, NoBlock=4. For example, enabling all three yields props=7, written as 8 bytes [0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00]. Do not use big-endian or omit high-order zero bytes.
What is the fundamental difference between DoH hash and DNSCrypt pk?
The DoH hash is the SHA-256 fingerprint (32 bytes) of the server’s TLS certificate, used for certificate pinning. The DNSCrypt pk is the protocol-layer long-term Ed25519 public key (32 bytes), used for key exchange and authentication. The two are not interchangeable. When generating, verify the source: the former from openssl x509 -pubkey -noout | openssl dgst -sha256 -binary, the latter from the DNSCrypt server config or dnscrypt-wrapper export.
Sources & References
- Lobsters DevOps/Linux: DNS Stamps Specification (2026-11-21)
Spotted outdated pricing, stock, or expired coupons?See methodology & report an update →


