SOV · Regulatory Technology — Sovereign Data Residency
Sovereign Compliance Gateway — Verifiable Payment-Data Residency
C++20 reference implementation that attests where payment data is stored, seals each attestation into an RFC 6962 transparency log, and lets a supervisor check a record against a signed root. Written for the CBN payment-data localisation circular.
Maturity. A reference implementation, not a production deployment. The findings from Vlaander's review that the earlier source left open are fixed in the source you receive (commit 60d78fc, 10 October 2026): the witness and provenance tools no longer derive signing keys from a public character and refuse to run without a key file or PKCS#11 token; the central plane no longer lets an unsigned empty posture replace the signed violation count; signed heads and proofs no longer recompute the whole tree; and payload hashes use a secret per-tenant key instead of a static salt. Medium-severity findings remain open and are listed under Pending below, among them that residency is taken as declared, that the verifier does not require a witness signature, and that the central plane serves plain HTTP.
Overview
The source includes a research brief (REGULATION.md, marked partial) on CBN circular PSS/DIR/PUB/CIR/001/004. The brief reads it as requiring payment transaction data generated in Nigeria to be stored and managed in Nigeria from 1 January 2027. The gateway is built to produce evidence of that, record by record.
It works out of band. An inventory scanner reads exports that list where stored artefacts live, such as an object-store inventory or a database catalogue export. It never opens the data and does not sit in a payment flow. Each entry is classified, checked against the residency policy, and recorded as an attestation that holds keyed hashes and metadata, not payloads.
Attestations go into a hash-chained, signed ledger and an RFC 6962 Merkle transparency log. The source also includes a witness service, an N-of-M witness quorum, threshold co-signed tree heads, a multi-tenant central plane with an HTTP API, a return renderer, and a standalone verifier that checks a record's inclusion proof and the operator's Ed25519 signature on the root.
The verifier proves that a record was attested and sealed under the operator's key. It does not re-run the policy, require a witness signature, or confirm that the region declared in the inventory is true.
The problem
A supervisor receiving a bank's self-attestation of data residency has nothing to check it against. This code gives each residency decision a signed, sealed record that a supervisor can verify independently and that cannot be silently changed later. That is not the same as proving the declared location is correct.
What it does
- Out-of-band inventory scanner: reads store inventories (locator, region, data class, content reference) and never opens the stored objects.
- Classification and policy for payment, personal and non-regulated data. An unrecognised declared data class is treated as the strictest category, and approved Nigerian facilities are matched as whole tokens rather than substrings (both fixed 8 October 2026).
- Attestation records with keyed hashes (HMAC-SHA-256 under a secret per-tenant key) of the storage locator and content reference, chained into a signed ledger with a durable file store and crash recovery.
- RFC 6962 Merkle transparency log with inclusion and consistency proofs, kept as an incremental tree so that each signed head and proof costs O(log n) rather than a pass over the whole log. The consistency check includes the RFC 9162 final-step check (fixed 8 October 2026).
- Witness service over a Unix socket that refuses heads with a timestamp earlier than the last one it signed, an N-of-M quorum that verifies co-signatures against witness keys pinned from configuration, split-view detection for heads of the same size, and a 2-of-3 threshold co-signing demonstration (operator, witness, bank).
- Signing through libsodium Ed25519 or a PKCS#11 module. Keys come from a key file made by scg_keygen (random seed, owner-only permissions) or from a PKCS#11 token; the witness and provenance tools refuse to start without one. A libsodium-backed soft token exercises the PKCS#11 path without hardware and labels itself as not an HSM.
- Multi-tenant central plane over plain HTTP that re-verifies each tenant's seal signature, append-only consistency and signed posture, keeps tenants separate and aggregates posture.
- Return renderer for a draft CBN return format (marked v1-draft in the code), and signed build provenance over a source manifest.
- Standalone verifier (scg_verify) that checks a record's inclusion under a signed root against the operator's public key.
Performance
Measured 2026-10-11| Metric | Figure | Basis |
|---|---|---|
| Signed head after one append, 1,000,000 entries | 9.1 µs median (transparency-dev/merkle: 4.1 µs at v0.0.2, 2.5 µs at current main) | Measured by Vlaander |
| Inclusion proof, generated and verified, 1,000,000 entries | 20.1 µs median (transparency-dev/merkle: 10.5 µs at v0.0.2, 6.6 µs at main) | Measured by Vlaander |
| Consistency proof, generated and verified, 1,000,000 entries | 25.6 µs median (transparency-dev/merkle: 11.3 µs at v0.0.2, 6.7 µs at main) | Measured by Vlaander |
| Versus transparency-dev/merkle, 10,000 to 1,000,000 entries | 1.5–2.9× the time of v0.0.2 and 1.7–3.8× the time of current main on every operation, with byte-identical roots; 3.5–8.3× at 10,000,000 entries | Measured by Vlaander |
- Date
- 2026-10-11
- Hardware
- AMD EPYC 7763, GitHub Codespace (shared Azure VM), 4 vCPU (2 cores), 15 GiB
- Toolchain
- g++ 13.3.0 and clang 18.1.3, CMake 3.28.3, CMake Release (-O3) with the project's warning and hardening flags plus -Werror; Debug builds with AddressSanitizer and UndefinedBehaviorSanitizer; libsodium 1.0.18 and the p11-kit 0.25.3 header; Ubuntu 24.04 host, no container
- Source archive SHA-256
- 10c5c25b0cc3d276050e2e70ab1f01859bb59d341cd700617e560777efe696b7
- Method
- Built from the delivered source archive, extracted into an empty directory. Builds and ctest with g++ and clang, each in Release and under ASan+UBSan, all with -Werror (10 October 2026). Demonstrations rerun from the g++ Release build: scg_demo then scg_verify (unchanged bundle, one changed field, all-zero key); scg_pilot with and without key files; scg_trust; scg_quorum_demo against three scg_witness processes with key files. Log cost (11 October 2026): scg_mlog_bench, which ships in the source, pinned to one core, two interleaved runs at 10,000, 100,000 and 1,000,000 entries; leaf values SHA-256 of the little-endian index; 20 timed operations of each kind at 1,000,000. The same benchmark file, added as a build target to the previous archive (c65d0edc…a79c), gives the before figures. Performance figures: a head-to-head on 11 October 2026 between the shipped TransparencyLog (driven by the shipped bench/mlog_bench.cpp with one untimed setup change, compiled -O2, libsodium 1.0.18, g++ 13.3) and the in-memory tree of transparency-dev/merkle (v0.0.2, the latest tag, and main at 21 September 2026; Go 1.27.2, default build), each pinned to one core, 1,000 operations per measurement, interleaved over 15 rounds at 10,000 to 1,000,000 entries and 5 rounds at 10,000,000; the medians across rounds are shown.
- Measured on the archive above. The archive delivered since 21 October 2026 (SHA-256 b4c4ae87380255277a686781b7d7dcfbf2f38c80450a6bfce867b5b8054afcd2) was rebuilt from it with only its LICENSE file and the licence line of README.md rewritten for licensing; the code, tests and benchmark tools are byte-identical. The archive delivered since 17 November 2026 (SHA-256 ae90baefbae2b98d88ddb2b5ebc79d9ffa4c7f53725b682f57c40f1ccde1c873) adds a sixth test suite for the Engine pipeline and the default stubs the shipped tools use (tests/test_engine.cpp, with its CMake entry and README line); the library code is unchanged.
- Every operation is dominated by SHA-256. SOV uses its own portable implementation without the CPU's SHA-NI instructions, while Go's crypto/sha256 uses them on this CPU; a hardware-accelerated SHA-256 would probably close much of the gap, but that was not tried. SOV's log is slower than that library on every operation measured; no performance lead is claimed.
- The Performance figures come from the head-to-head (1,000 operations per measurement, 15 rounds). The Value and Assurance rows quote SOV's shipped benchmark (fewer operations, two runs each, under heavier load), which is why their ranges are wider. The head-to-head harness for transparency-dev/merkle is Vlaander's own and is not in the archive; the shipped bench/mlog_bench.cpp reruns SOV's side.
- The previous scalability figures (about 1.3 s per signed head on 7 October 2026) were measured with a different harness on the earlier source. The before figures here come from the same benchmark as the after figures, on the same machine.
- The VM was shared (1-minute load average 3–8 during the log benchmark), so the before figures vary by up to about 1.6× between runs; the after figures stayed in the microsecond range in every run.
- Building a log of 1,000,000 entries still hashes every entry once (about 2.5–2.7 s in these runs, before and after). What changed is the cost of each signed head and proof after that.
- The roots at 10,000, 100,000 and 1,000,000 entries equal those that matched transparency-dev/merkle on 7 October 2026 (first 12 hex digits compared). The test suite also checks the incremental tree byte for byte against the original algorithm on random input.
Value in your own metrics
- Supervisor verification
- With the evidence bundle and the operator's public Ed25519 key, scg_verify reports VERIFIED. Changing one field of the sealed record makes it fail, and with the wrong key it reports authenticity unconfirmed (checked by Vlaander on the delivered source, 10 October 2026). It does not check witness signatures or re-run the policy.
- Payment-path dependency
- None by design. The scanner reads inventory exports out of band, so if it fails, evidence arrives late but payments are not affected.
- Customer-data exposure
- Records hold keyed hashes and metadata, never payloads, but they name the jurisdiction and facility in plain text. The hashes use HMAC-SHA-256 under a secret key that each tenant generates (scg_keygen --tenant-key); the scanner refuses short keys, and the static test salt is gone.
- Rewriting sealed history
- Detectable. In the scg_trust demonstration, a forged root fails the consistency check from the earlier head and the witness flags the equivocation (checked by Vlaander on the delivered source, 10 October 2026). Witnesses now refuse backdated timestamps. Split views at different tree sizes are still not flagged.
- Crash recovery
- In scg_pilot, a ledger rebuilt from its durable store verifies its chain and reproduces the live Merkle root (checked by Vlaander on the delivered source, 10 October 2026). A torn write at the end of the log is now set aside and the intact records are recovered, instead of recovery stopping.
- Regulatory return
- Generated from the sealed records. The schema is a draft, pending the circular's final schedule. Violation counts are signed by the tenant key, and the central plane now requires that signature on every seal and refuses a different posture for a head it has already accepted.
- Transparency-log cost
- At 1,000,000 entries, a new signed head took 8–13 µs and an inclusion or consistency proof, generated and verified, 22–37 µs, against 1.8–2.9 s for the same operations in the previous source (scg_mlog_bench, one core, two runs each, measured by Vlaander, 11 October 2026).
- Dependency surface
- Two optional system libraries, both detected at build time and linked from the system, not vendored: libsodium for Ed25519 and key generation, and the p11-kit PKCS#11 header for HSM signing. OpenSSL is not used. Without libsodium only a test signer is built. Nothing is downloaded during the build; THIRD_PARTY_NOTICES.md carries the notices.
Assurance and build
- Language
- C++20 (CMake 3.20 or later)
- Size
- About 6,800 lines of C++ in src and include, plus about 1,500 lines of tests and a 110-line benchmark (counted by Vlaander)
- Build
- No warnings with g++ 13.3 or clang 18.1.3 under the project's warning flags plus -Werror, in Release and sanitizer builds, on Ubuntu 24.04 (checked by Vlaander on the delivered source, 10 October 2026). The 20 clang warnings reported earlier are fixed.
- Tests
- With libsodium 1.0.18 and the p11-kit header, all 6 ctest suites pass: unit, transparency log (including randomised byte-for-byte checks of the incremental tree against the original algorithm), central plane, signing-key checks on the shipped tools, PKCS#11 signing through the soft token, and the Engine pipeline. The first five pass with g++ 13.3 and clang 18.1.3, in Release and under AddressSanitizer and UndefinedBehaviorSanitizer (checked by Vlaander on the delivered source, 10 October 2026); all six pass with g++ 13.3 in Release on the archive delivered since 17 November 2026 (checked by Vlaander that day). Without libsodium only 3 suites are built. They report passing, but the central-plane suite skips all its checks and the other two skip their Ed25519 checks
- Test coverage
- Lines 84.9%, functions 89.3%, branches 70.4% (excluding exception paths) of the library code in src and include (command-line tools and the test PKCS#11 token excluded), from the project's own test suite (ctest 6/6 passing). g++ 13.3 and gcovr 8.8, measured by Vlaander on 17 November 2026 on the archive delivered since that day, which added the Engine-pipeline tests (on the earlier archive, 16 November 2026: lines 81.3%)
- Not included
- No fuzzing harness and no ThreadSanitizer configuration ship with the source
- Transparency log
- RFC 6962 Merkle tree. Roots were byte-identical to transparency-dev/merkle at 10,000, 100,000 and 1,000,000 entries (measured by Vlaander, 7 October 2026), and the incremental tree in the delivered source produces the same roots (measured by Vlaander, 11 October 2026)
- Scalability
- Signed heads and proofs are served from an incremental tree. At 1,000,000 entries: 8–13 µs per signed head and 22–37 µs per inclusion or consistency proof (generate and verify), against 1.8–2.9 s with the previous source on the same machine (measured by Vlaander on one pinned core of a shared AMD EPYC 7763 Codespace, 11 October 2026). The tree keeps about two hashes per entry in memory.
- Internal review
- Vlaander quality review, 7 October 2026: 1 critical, 4 high, 7 medium and 11 low findings. Fixed in the delivered source: the critical finding and all 4 high findings (offshore storage recorded as an approved Nigerian facility; unknown data classes approved; fake tree sizes accepted; signing keys derived from a public character; violation counts replaceable through the central plane), the medium scalability finding, backdated witness timestamps, and several low findings (commits 131ae45 and 60d78fc, 8 and 10 October 2026). Still open: the medium and low findings listed under Pending.
- Source archive SHA-256
- ae90baefbae2b98d88ddb2b5ebc79d9ffa4c7f53725b682f57c40f1ccde1c873
Releases are not yet cryptographically signed, and no release manifests or external audit summaries are published. Check the source tarball you receive against its SHA-256 in Schedule 1 of your Licence Agreement, which you see before you sign.
Scope and maturity
What is real today, what is deliberately excluded, and what is pending — published unprompted.
Included today
- Source code of a reference implementation, with its own security audit (SECURITY_AUDIT.md, which records the status of every review finding), threat model (SECURITY.md), third-party notices, and design, architecture and regulation notes.
- The core engine (observe, classify, apply policy, attest, seal), the transparency log and witness tools, a key generator, the central plane, the return renderer, the standalone verifier and a transparency-log benchmark, with a demonstration program for each part.
Explicitly scoped out
- Connections to bank systems, cloud topology and data formats sit behind pluggable interfaces (observer, classifier, geo resolver, store, signer, return renderer) and are wired by the operator.
- HSM key custody and independent witness operators are deployment tasks. The source includes the PKCS#11 path and a key generator, but no production keys or witnesses.
Pending
- Open medium findings: residency is taken from the inventory's declared region without a cross-check, and any non-empty lawful-basis string approves a cross-border transfer of personal data; the verifier needs no witness signature; split views at different sizes go undetected; the 5 s socket timeouts apply per read, so one slow client can block the single-threaded witness; recovery checks the hash chain but not record signatures, and the central plane stores heads without their signatures.
- Open low findings: records name the jurisdiction and facility in plain text; provenance skips build directories and some file types; plane threads can outlive the plane at shutdown; a partial-period seal signs the same bytes as a full seal of the same size; without libsodium the tests pass with signature checks skipped; libsodium is not version-pinned.
- The central plane serves plain HTTP without TLS, and tenant registration is open unless SCG_PLANE_ADMIN_TOKEN is set.
- Final CBN return schedule: the return schema is a draft, and the source's regulation brief is marked partial.
Who it's for
- Nigerian deposit money banks and other institutions covered by the CBN payment-data localisation circular.
- Switches, payment solution service providers (PSSPs) and payment terminal service providers (PTSPs) with residency obligations under the same circular.
- Institutions under other data-residency rules, which would need their own policy, geo-resolver and return-renderer modules.
- Supervisory technology vendors looking for a signed-attestation and transparency-log base rather than a self-attestation workflow.
Before you buy
- Confirm with counsel what the circular requires and that the rendered return meets the form and cadence the supervisor expects. Whether a supervisor accepts cryptographic evidence is a regulatory question, not an engineering one.
- Check the out-of-band model against your own payment topology. The evidence covers only what appears in the inventories you feed it, and the region in those inventories is taken as declared.
- Plan the witness set and key custody before relying on the quorum. Each witness needs its own key, ideally in an HSM, run by an independent party; the shipped soft token is for testing only.
- Read the security audit shipped with the source (SECURITY_AUDIT.md) together with the open findings listed above. It records which review findings are fixed, partly fixed or open.
What you get
- The asset's source, licensedSubject to the Licence Agreement, Vlaander grants the verified Buyer a perpetual, worldwide, non-exclusive, non-transferable licence to use, copy and modify the Asset, build it into the Buyer’s own products, and run, host and distribute those products to the Buyer’s customers in non-source form. The licence is for one company: it doesn’t cover affiliates. The source code stays confidential to the Buyer’s own staff and contractors, and may not be passed on, published or resold. Vlaander keeps ownership and licenses the same Asset to other businesses.
- Its testsThe test suite the published assurance claims rest on, as delivered in the source archive.
- Its audit artefactsSpecifications, model-checking output, reviews and the software bill of materials, where the asset has them.
- Not includedThird-party and open-source materials are not sold, assigned or licensed by Vlaander. They remain under their own licences, listed in each asset’s software bill of materials (SBOM.md in the archive), and the Buyer is responsible for complying with those licences.
Licence
$2,400 paid once · or ₦3,240,000
Included
- The engine's source archive, with its tests and audit artefacts, matching the SHA-256 in Schedule 1
- A perpetual, non-exclusive licence for one company under the Licence Agreement
Not included
- No updates
- No support
One price per engine, in US dollars, paid once. The source is what you get: Vlaander does not sell updates, support or bundles. The Licence Agreement you sign is the binding text.
First described in: VLA-GEN catalogue, 3 August 2026, §3.4. Revised by Vlaander against the delivered source; every figure is labelled with its basis.
From test to source
- 01
Check
Read the engine's page: what Vlaander measured and on which hardware, what it has not measured, and the open review findings. Nothing runs before purchase.
- 02
Buy
Verified businesses only. Choose an engine, give your company's details, have your authorised signatory sign the Licence Agreement, then pay the invoice in naira by bank transfer, or in USDC on Polygon. Once the payment is verified, your account shows Paid.
- 03
Receive
We confirm the funds and release the source tarball to you. Delivering, then Download ready. Check it against the SHA-256 in Schedule 1, then rerun the tests and benchmarks yourself.