Trusted Nodes List
Browse the approved nodes of each environment, check their health, and copy the URL of the node you want to send your requests to. New to the Trusted Nodes List? Read Trusted Nodes List.
Downloading and verifying the Trusted Nodes List…
Verify the list in your code
The @europeum-ebsi/trusted-nodes-list library downloads the list and verifies its whole chain of trust, as described in Verify the Trusted Nodes List. It works in Node.js and in browsers.
npm install @europeum-ebsi/trusted-nodes-list
loadTrustedNodesList checks that trusted-keys.json is signed by the pinned Europeum key-list key, that tnl.json is signed by enough custodians, and that the content is valid: the TNL JSON Schema (draft 2020-12), validity window, keysVersion, node URLs and rollback protection. It throws a TrustedNodesListError on any failed check, so it fails closed.
import {
checkNodesHealth,
loadTrustedNodesList,
} from "@europeum-ebsi/trusted-nodes-list";
const { list } = await loadTrustedNodesList({
// Fail unless these environments have at least one node (optional)
requiredEnvironments: ["preprod"],
});
for (const { url, country, organisation } of list.environments.preprod ?? []) {
console.log(url, country, organisation);
}
// A node is healthy when its latest block (POST <url>/v1/ledger, eth_getBlockByNumber)
// is less than 1 minute old
const { healthy, unhealthy } = await checkNodesHealth(
list.environments.preprod ?? [],
);
| Option | Default | Description |
|---|---|---|
url | https://tnl.ebsi.eu | TNL base URL, for example https://tnl-test.ebsi.eu for the test list |
requiredEnvironments | [] | Environments that must have at least one node |
lastAccepted | none | { version, sha256, trustedKeysVersion } of the last list you accepted, to reject rollbacks |
fetch | globalThis.fetch | Custom fetch implementation (proxy, tests, etc.) |
cache | none | cache of a previous result, to skip unchanged files (backend only) |
keyListKey | Europeum key | { armoredKey, fingerprint } of the key-list key |
signal | none | AbortSignal that aborts the requests when triggered |
timeout | 10000 | Timeout of each request, in milliseconds |
checkNodesHealth asks each node for its latest block (POST <url>/v1/ledger, JSON-RPC eth_getBlockByNumber) and returns { healthy, unhealthy }, where each unhealthy entry is { node, reason }. A node that redirects, answers with an error or has a stale block is unhealthy. It accepts these options:
| Option | Default | Description |
|---|---|---|
maxBlockAge | 60000 | Maximum age of the latest block, in milliseconds |
futureBlockTolerance | 60000 | How far in the future the latest block may be dated, in milliseconds |
timeout | 10000 | Timeout of each request, in milliseconds |
signal | none | AbortSignal; aborting it rejects the call |
The check compares the block timestamp with your local clock, so keep it synchronised with NTP.
In a browser, the library works under a strict Content-Security-Policy (its validators are generated ahead of time, so nothing is compiled at runtime). It needs WebCrypto, which is only available over HTTPS or on localhost.
Prefer verifying the list on your backend and passing the verified node URLs to your frontend: the browser then downloads and verifies the list on every visit. Verify in the browser when you have no backend, as the tool above does, or in a wallet.
To verify files you downloaded yourself, use verifyTrustedNodesList, which does no network I/O. See the library README for all options and error codes.