SourceLess · AsgardAsgard · chain 1313

Part III · Building on the chain · Chapter 9 of 15

Client SDKs, and the line they sit on

The client libraries and the line they sit on: what a client may do, and what only a node may.

34,362 bytes 5,240 words newest date 2026-11-28

Verify: the published bytes are in the raw file SDK.md, whose SHA-256 is in SHA256SUMS.
c4afcc15bc9f73107429d4b83332393602fa20e51ca184ead6f749a394607a0b

Every language in this directory is a CLIENT. None of it is inside the state transition, the block validation path, the mempool, or the chain's runtime dependency budget. That boundary is the first thing to understand about this directory, because it decides what may be added here and what may not.


1. Why the languages are out here and not in the chain#

The node's runtime dependency budget is one direct package, enforced by scripts/check-deps.mjs, and its own comment says why: "every package inside the state transition is consensus-critical, and the largest losses of 2025 came through the supply chain." Raising it is a decision, not a merge.

There is a second reason that is harder to argue with than the first. Consensus code must produce byte-identical results on every node, forever. A chain whose state transition ran C++, Python and JavaScript would have to promise that three toolchains, three floating-point settings, three integer widths and three sorting implementations agree on every value, on every platform, for the life of the network — and src/core/canonical.ts already documents what happens when two implementations of one language disagree about ordering: Cardano split for fourteen and a half hours in 2025 over a deserialisation difference between two versions of the same client. Adding languages to the core multiplies that surface by the number of languages.

So the languages go where they are free: outside the boundary, talking to the node through its public JSON-RPC door. A client library cannot make a consensus rule wrong. It can only be wrong about what the consensus rule already decided — which is exactly what §2 exists to prevent.


2. The conformance vectors are the contract#

spec/conformance-vectors.json, generated by npm run vectors from the implementation the chain runs.

Writing a client is easy; being sure it agrees with the chain is not, and the failures when it does not agree are silent:

  • an address derived one bit differently shows its holder an empty wallet, with no error and no available explanation that is true;
  • a payload canonicalised differently produces a signature the node rejects, and the holder reads "invalid signature" about a transaction they signed correctly.

Neither is caught by testing a client against itself, because its own tests agree with its own bug. So the artifact that makes other languages tractable is not a library — it is the set of numbers a library has to hit. Anything that reproduces them is compatible by construction.

The file covers address derivation, the genesis-style seed derivation, BIP-39 and the Ariadne HKDF path, canonical JSON encoding, Ed25519 message signatures, four transaction payloads with their ids and signatures, nine record payloads that are not transfers, and the whole contract layer (compiler output, ABI behaviour, gas profile).

tests/integration/conformance-vectors.integration.test.ts re-derives the addresses, mnemonics, canonical encodings, transactions and signatures from the live code, so a derivation that moved shows up as a failing test in this repository rather than as a support queue six months later in somebody else's. The records section is not yet re-derived there, and closing that is owed: today a change to domainProofPayload would turn both SDK suites red only after npm run vectors was re-run.

The one convention worth knowing#

A bigint is written {"$big": "1234"}. JavaScript has two integer types and most languages have one, and the difference is visible in the bytes that get signed: canonicalStringify renders a bigint as a decimal string and a number as a number. A vector that wrote a bigint as a bare JSON number would be ambiguous exactly where being wrong is silent.

This is not theoretical. Every mistake listed below was made while writing an SDK in this directory and was caught by these vectors rather than by review:

The mistakeWhat it produced
Stringifying every integerchainId encoded as "1313"; no node accepts the payload
Dropping None from a map"payloadHashHex":null lost from every transfer payload
Wrapping a float in a bigintBig(0.5) was 0 — a silently truncated amount, signed
Enumerating the record's fieldspayloadHashHex folded into the payload and missing from the record: invalid signature about a transaction signed correctly
Counting code points, not UTF-16 code unitsa contract argument holding an emoji encodes as u:7:… where the chain computes u:8:…

The last two are new as of 2026-09-17, and each got a vector so it cannot come back: a transfer with a non-null payloadHashHex, and a call authorization whose arguments include key 🔑 é.


3. What is here#

LanguagePathStateSuite
Python 3.9+python/Built, conformance-tested, live-tested. One dependency191 tests — npm run sdk:python
JavaScript / TypeScriptjs/Built, conformance-tested, live-tested. Zero dependencies, Node and browser212 tests — npm run sdk:js
Browser, in the main treesrc/wallet/gna.ts, src/wallet/web-crypto.tsThe chain's own in-tab wallet. Not a published clientpart of npm test

Both counts are real pass counts from a real run on 2026-11-23, not a count of test functions: Ran 191 tests … OK and # pass 212 / # fail 0, after the name checks before signing, the deploy signer, the chunks parameter and the parameter-name and record-count checks were added. They read 170 and 182 on 2026-11-17. Reproduce them with the commands in the table. Not re-measured since: on 2026-11-28 js/test/http-refusals.test.mjs (25 tests) and python/tests/test_http_refusals.py (16 tests) were added and run on their own, so the whole-suite counts above are the 2026-11-23 run's until the next full run replaces them.

Running the Python suite#

npm run sdk:python        # the suite
npm run sdk:js            # the other suite
npm run sdk:conformance   # both clients against the vectors, and against each other

npm run sdk:python used to name python3 outright, and that one word made the first command in this document fail on two common hosts for a reason that had nothing to do with the caller's code: on Windows python3 is a Microsoft Store stub or a different install from python, and on macOS it is a system interpreter without cryptography. Either way a contributor ran the gate, read ModuleNotFoundError: No module named 'cryptography', and concluded the SDK was broken.

It now runs sdk/python/run-tests.mjs, which tries python3, python and py and uses the first one that can actually import cryptography. If none can, it says which candidates it tried and what each one did, and tells you the one thing to install. That probe is the same function sdk/conformance-report.mjs uses, exported rather than copied, so the two commands can never disagree about which interpreter on a host is the real one.

If you would rather name the interpreter yourself:

python -m unittest discover -s sdk/python/tests -t sdk/python

What each SDK covers#

Both cover all 97 JSON-RPC verbs the node publishes, with a named method for each — asserted against src/network/iris.ts by a test in each suite, in both directions, and checked against a running node by live_check.py and live.mjs. The count moves when the chain adds a door: submitFenrir, the validator-bond verb, was the sixty-third; the three read verbs succinctCheckpoint, addressHistory and attestationRetention brought it to sixty-eight. Nine more reached the chain without reaching either client, and both suites were red on main until 2026-11-15 because of it: domainTenure, spacesFor, spaceDeliverEnvelope, spaceEnvelope, occultationRekey, courierStatus, courierDeposit, courierFetch and courierAck. Each now has a named method and a wire test of the parameter names the door reads, and spaceList takes the after cursor the door had already gained. The four seat reads validatorBonds, seating, committee and seatStatus brought it to ninety-seven. A verb this SDK names and the node does not answer is a promise to an integrator who cannot see this tree, and they meet it as a -32601 in production.

A parameter can drift the same way a verb can. The hostless door gained chunks on spaceHolders and spaceManifest (whether a version of that many chunks would be kept), and both clients went on sending without it while both suites stayed green, because the catalogue test compared verb names only. Both methods now take an optional chunks, and each suite holds the parameter names it sends for the space verbs to the params the catalogue publishes.

Two more did the same, and both suites were red on main again until 2026-11-17: blockRecordsPreimage and inclusionLatency. Each is a read, and each now answers typed rather than as the raw wire:

  • blockRecordsPreimage(height) (Python block_records_preimage) hashes the preimage before it returns it and refuses one that does not hash to its root with RecordsRootMismatch. Pass the root from a header you verified yourself (expectRecordsRootHex / expect_records_root_hex) and it is held to that root; without one it is held only to the root the node sent beside it, which catches a damaged answer and not a consistent lie. null / None where the node holds no block, which is past its head or a height it pruned and has no archive for: the node does not say which.
  • inclusionLatency() (Python inclusion_latency) is one node's reading of how long the transactions it held waited to be sealed. Its lastHeight comes back as a bigint / int, and a window with nothing measured stays { status: 'unknown', reason } rather than becoming a zero. A node with no meter refuses with code -32001 and its own sentence, surfaced as RpcError.

Seven more did the same, and both suites were red on main until 2026-11-19: the STR.talk room and board verbs talkRoomsStatus, talkRoomList, talkRoomRead, talkRoomPost, talkRoomHide, talkBoardPost and talkBoardRead. Each now has a named method that hands the node the parameter names its door reads. talkRoomPost, talkRoomHide and talkBoardPost count as writes for OutcomeUnknown.retrySafe; talkBoardRead is priced as a write by the node, for the signature it verifies, and changes nothing, so it counts as a read like courierFetch.

Both can sign, locally, from a key that never leaves the process:

RecordVerbPayload
A transfersubmitTransactiontransactionSigningPayload
An STR.domain claimallocateDomaindomainClaimPayload
An STR.domain proof (locks 1,000 / 5,000 STR)submitRegistrationdomainProofPayload
An account key rotation, both handssubmitKeyRotationkeyRotationPayload
A Gefjon grant, revocation and spendsubmitGefjongefjonGrantPayload and the other two
A contract call authorizationcallContractcallAuthorizationPayload
A contract deploy authorization, over bytecode the caller suppliesdeployContractdeployAuthorizationPayload

Both also relay an already-signed record to every remaining write verb, for a caller holding one signed by something else — a CLI, a hardware signer, another service.

What neither can do, and why#

Stated rather than left as a gap, because a downloads page with a greyed-out button implies a promise.

  • Compile AresLang. A deploy authorization signs over compiled bytecode, and there is no AresLang compiler in either language. A client that asked a node to compile for it would be signing over bytes it never saw, which is the one thing a deploy authorization exists to prevent. Both SDKs sign a deployment over bytecode the caller supplies — spec/conformance-vectors.json publishes three compiled containers byte for byte, and strblk wallet deploy <file> --dry-run --json compiles any source locally and prints its bytecodeHex — and a node refuses a deployContract with no authorization at the door. This does not stop you deploying; it decides the shape of how. See §3.5 for the flow that works.
  • Sign a Gemini (ed25519 + ML-DSA-65) record. Neither language has a lattice implementation inside its dependency budget: Python's is one package, and JavaScript's is zero. Both build the classical half of the payload correctly, absent-when-absent, so a Gemini record can be verified against them; both refuse to sign one by name rather than dropping the fields and producing a digest no node computes.
  • Sign fourteen of the record kinds. A wNFT identity record, a governance proposal or ballot, a bridge mint, a bridge veto, an attestor suspension, a domain burn, a relinquish, a lapse burn, a domain sale (wnft-transfer), a WSTR wrap, a validator bond (submitFenrir — signed by the key that SEALS BLOCKS, which is a producer's keystore key and not a wallet's), a ring-signed ZK13 attestation, an Oort space record and an Occultation message each fold their own named payload, and none of them is in the conformance vectors. Fourteen is every submit… verb except the four this SDK signs (a transfer, a domain proof, a delegation and a key rotation); this read eleven here and eight in both language READMEs until 2026-11-23, and the JavaScript suite now holds all three to the count it computes from METHODS. A signer written from the prose rather than from a vector is the exact failure §2 exists to prevent, so each is a relay and not a builder. Adding one means adding its vector first.
  • Derive a v2 address. src/crypto/signing.ts carries a second address format — zk13str + 13 base58 characters, 68 payload bits and an 8-bit checksum — chosen at genesis and latched. Every chain that exists is v1 and both SDKs are v1-only. No vector pins v2, so a chain born at v2 would need both the derivation and a vector for it.
  • Verify a block, a state root or a consensus proof. These are clients. transactionProof gives a Merkle proof and a header root, and both SDKs now ship the checker for it — verifyTxMerkleProof / verify_tx_merkle_proof, the client-side inclusion primitive proof of existence rests on. It must be checked against a txRootHex from a header the caller trusts, never the one the same transactionProof call returned; the SDK does not fetch or authenticate that header for you. Verifying a producer's signature, a state transition or a consensus proof is still a node's work.

3.5 Deploying a contract: the bytes come from you#

Read this before your first deploy, not after. A deployContract with no authorization is refused at the door, before the node compiles anything, and nothing comes back but the refusal:

RpcError -32001: this ledger requires a signed deploy authorization; an unsigned deployer cannot be trusted

A ledger in its default mode (signed, the mode a node runs) refuses it every time, so there is no unsigned first step to take. This section described one until 2026-11-23: submit unsigned, take bytecodeHex off the receipt, sign it, submit again. That was measured on 2026-09-19, when the refusal came at the seal and the receipt still carried the bytecode. Since 2026-11-11 the node refuses it at the door, and since 2026-11-12 before it compiles anything (a stranger with no key could otherwise make a node compile a block's worth of source), so the first step returned nothing to take and both code samples stopped at the line that read bytecodeHex.

Neither SDK compiles AresLang, and a node that compiled for you would be handing you bytes to sign that you never checked. So the bytes come from your side, and there are two places to get them:

  1. Compile locally with strblk, opening no key and sending nothing:
    strblk wallet deploy counter.ares --dry-run --json --address <deployer> --salt v1

    The JSON carries bytecodeHex (the exact bytes you sign), source (the exact text that was compiled, line endings made LF; its sha256 is sourceSha256), bytecodeSha256, compilerInForce, exampleConstants and, with --address, the derivedAddress the contract will have. --template <name> in place of the file does the same for a catalogue template and says whether its bytes match the published vector.

  2. Or take a container from spec/conformance-vectors.json, which publishes three compiled containers byte for byte.

Then authorizedDeploy / authorized_deploy signs those bytes locally with the nonce from contractNonce (not nonce: they are different counters) and the binding from chainBinding, and submits deployContract with the name, source, deployer and salt. Send the same source text you compiled, byte for byte (the dry run's source): the node compiles exactly what it is sent and checks the signature over its own bytes. Both authorizedDeploy and strblk wallet deploy make CRLF line endings LF before they send, as the dry run does before it compiles, so a file saved on Windows deploys the bytes its dry run described.

Pin the genesis. The contract nonce and the chain binding the authorization signs over both come from the node you ask. Without expectGenesisHashHex / expect_genesis_hash_hex, a node on another network answers both, and you sign an authorization for that network.

from sourceless import crypto
from sourceless.client import Client

# The pin covers the chain binding and the contract nonce, which otherwise come from the node unchecked.
node = Client("http://127.0.0.1:8083", expect_genesis_hash_hex="1cf8655125cc1bbbc0ca06a491f53775499785c349b4d0f5748d5ea170e517bf")  # Asgard, all 64 characters
keys = crypto.derive_keypair_from_seed("...")          # or from_mnemonic
source = open("counter.ares", encoding="utf-8").read()  # or the dry run's "source"
bytecode_hex = "41524553..."                           # bytecodeHex from the dry run

receipt = node.authorized_deploy(keys, "Counter", source, bytecode_hex, salt="v1")
// The pin covers the chain binding and the contract nonce, which otherwise come from the node unchecked.
const node = new Client('http://127.0.0.1:8083', { expectGenesisHashHex: '1cf8655125cc1bbbc0ca06a491f53775499785c349b4d0f5748d5ea170e517bf' });  // Asgard
const source = await readFile('counter.ares', 'utf8');  // or the dry run's "source"
const bytecodeHex = '41524553...';                     // bytecodeHex from the dry run
const receipt = await node.authorizedDeploy(keys, { name: 'Counter', source, bytecodeHex, salt: 'v1' });

signDeployAuthorization / sign_deploy_authorization remain for a caller who wants to build the authorization separately and pass it to deployContract themselves.

Check the bytes before you sign them. The signer refuses anything that is not lowercase hex, but it cannot tell you the bytes are what you meant. The container starts 41524553 (ARES) followed by a two-byte bytecode version. A node running a different AresLang compiles different bytes, so the signature does not hold over them and the deploy is refused rather than misdeployed; compile with a strblk from the same release as the node. That refusal is the good outcome, and it is why the bytes are what gets signed. The command-line wallet refuses a real deploy whose source still carries a catalogue template's example constants; the node does not, so read exampleConstants in the dry run and replace them first.

A contract record waits for the submitting node's own slot rather than propagating immediately, so a sealed deploy can take several slots on a multi-node network. Poll contractCatalog for the address rather than reading the receipt as a deployment.

Raise the timeout, and read the failure class before you retry. Both clients default to 15 seconds, and a busy node can take longer than that to answer an ordinary read — measured on 2026-09-19 against a live node with a large validator roll: nonce returned in 0.05 s, 21 s and 39 s on consecutive calls. Client(endpoint, timeout=60) in Python and new Client(endpoint, { timeoutMs: 60000 }) in JavaScript.

A timeout used to read could not reach …: Nothing was sent, and that sentence paid twice: the node often HAD the transfer, its nonce had moved, and a caller who believed it called send again and signed a second transfer at the next nonce. A transport failure is now one of two classes, both still an RpcError:

ClassWhenWhat to do
NotDeliveredRefused, unresolvable, unroutable, a certificate refused in the handshake — the request provably never leftRetry freely. The message still says Nothing was sent, because now it is true
OutcomeUnknownA timeout, a reset, an answer cut off, a proxy's error page, or a status that is not 2xx carrying neither a result nor an error (an HTTP 500 answering {}) — the request may have arrivedFor a read, ask again (retrySafe is true). For a write, do not sign again: hand the record on the error to submitTransactionOnce / submit_transaction_once

A refusal carries the HTTP status and the wait it asked for. Every RpcError has httpStatus / http_status and retryAfterMs / retry_after_ms: the refusal's own retryAfterMs when it sent one, else a Retry-After of whole seconds or an IMF-fixdate in GMT, else undefined / None. A refusal written as a sentence ({"error": "…"}, which is how the wallet proxy and a gateway answer) is read by its HTTP status, the wallet's own rule (FATE_REFUSED_STATUS): on 400, 403, 401, 404, 405, 411, 413, 414, 415, 429 or 431 it is an RpcError with code -1 and that sentence as its message, because those statuses are answered instead of taking a call; with delivered: "never" beside it on a 502 it is NotDelivered; on any other status, the wallet's 502 "Whether it arrived is not known" above all, it is OutcomeUnknown, and for a write that means do not sign again. A JSON-RPC envelope refusal about a state write is held to the same rule (FATE_REFUSED_CODE): it is an RpcError with the node's code only on one of those statuses, or on a 200 carrying -32700, -32600, -32601, -32602, -32000, -32001 or -32002. A -32603, a missing code, or an envelope on a 5xx is OutcomeUnknown. A read's envelope is always an RpcError with the node's code. Until 2026-11-28 the JavaScript client read it as RpcError code 0 "refused" and dropped the sentence and the Retry-After, and the Python client raised an AttributeError that no except RpcError caught. A refused GET (/health, /rpc) now carries the body: the reason is in the message and the parsed body is data.

submitTransactionOnce is idempotent by nonce: it only ever re-posts the identical signed record, and between attempts it asks transaction(id) and then nonce(from). A record that landed comes back as its status with alreadyKnown: true; a nonce already taken raises NonceConflict instead of a re-post. send takes attempts and routes through it, so a retry inside send re-posts the same bytes rather than signing new ones.

3.6 What a client checks before it signs#

  • Plain http is for this machine. http:// to anything but loopback is refused at construction; use https://, or pass allowInsecureHttp: true / allow_insecure_http=True for a private network you control. Anybody on an http path can answer as the node.
  • The genesis pin covers both bindings. With expectGenesisHashHex set, chainBinding and identityChainBinding must equal it — the chain derives both from the genesis hash — or be pinned separately with expectChainBindingHex / expectIdentityChainBindingHex. Before this a node could report the right genesis and a foreign binding, and every grant, rotation and contract authorization was signed for the foreign one.
  • The follower recomputes every block hash. BlockFollower no longer links blocks by the node's hashHex; it computes the hash from the block (computeBlockHash / compute_block_hash), refuses a mismatch with BlockHashMismatch without moving its cursor, and links on the computed value. It does not verify the producer's signature or that the producer was seated.
  • A Python amount is exact or refused. Big refused a float and truncated everything else: Big(Decimal("1000.9")) was 1000. A fractional Decimal or Fraction, NaN, an infinity and a bool are now refused by name; an integral Decimal converts exactly.
  • A keypair does not print its private key. print(keys), console.log(keys) and JSON.stringify(keys) render it as <redacted …>. keys.private_key_hex / keys.privateKeyHex still read it, for the caller who asks by name.
  • One proved name per address, said before signing. A claim or proof from an address that already holds a proved name, or of a name another address holds, was answered accepted by the node, queued, and dropped at the seal with no refusal anywhere. claimDomain / claim_domain and proveDomain / prove_domain now ask domainOf and domainHolder first and refuse such a record in words, before anything is signed, as the command-line wallet does. A proof of the name the address already holds still goes through.
  • What a node answers is checked before it is relied on or repeated. A domainOf answer switches the naming check off only when it is a name, and a held name or a holder is put into a refusal only when it is a name or an address; anything else is quoted as JSON, so a node's prose or terminal escape codes never read as this SDK's words. When one of these reads made BEFORE signing fails, the error says Nothing was signed and that the call is safe to retry, rather than OutcomeUnknown, which is about a write that may have arrived.

Not built, and what each would need#

  • C / C++. Needs an Ed25519 implementation (libsodium), SHA-256, PBKDF2-HMAC-SHA512, HKDF and a JSON encoder that sorts keys by byte order. All of that is ordinary; none of it is written here, and shipping an untested C library that holds spending keys would be worse than shipping none.
  • Go, Rust, Java, C#. Same shape, and each has Ed25519 and PBKDF2 in its standard library or in one well-known package. Two parts to be careful with, both of which cost a day to find and five minutes to fix once named: sort canonical keys by byte order and never with a locale-aware comparison, and count a contract argument's string length in UTF-16 code units rather than in characters.

4. Python, in ten lines#

Read first. This needs no key and no account. expect_genesis_hash_hex is Asgard's whole genesis hash, the one its realm record pins (src/core/snotra.ts), and network(), chain_id() and signing refuse a node on any other chain. A read does not check, so a program that only reads must call network() first, as this one does. A shortened hash matches nothing, so copy all 64 characters.

from sourceless.client import Client

node = Client(
    "https://rpc.xplstr.org",
    expect_genesis_hash_hex="1cf8655125cc1bbbc0ca06a491f53775499785c349b4d0f5748d5ea170e517bf",
)

node.network()                        # stops here unless the node is on that chain
print(node.chain_id(), node.height())
print(node.domain_holder("STR.sourceless"))  # an address, or None

Then sign. phrase is the account's recovery words, taken from wherever your program keeps its secrets. Never write them into the source. These lines sign on this machine and post finished records.

from sourceless import crypto

keys = crypto.account_keypair_from_mnemonic(phrase)
# More accounts from the same words: account_keypair_from_mnemonic(phrase, "", n). Account 0 is the default.
print(keys.address, node.balances(keys.address))

node.claim_domain(keys, "STR.yourname")     # reserves the name; costs and locks nothing
node.prove_domain(keys, "STR.yourname")     # locks 1,000 STR and mints the wNFT
# Send once node.domain_of(keys.address) answers STR.yourname: a block has carried the proof.
# send() refuses an unnamed sender holding 1,000 STR, which the chain would name. The check is
# advisory (one node's read; a credit landing before the seal can still lock the 1,000 STR).
node.send(keys, to="zk13str_…", amount_minor=1_000)

An unnamed account holding 1,000 STR or more that spends is named by the chain: the block that carries the transfer locks 1,000 STR and gives it a generated name, which stands where a chosen one would. send refuses to sign that transfer, and says so, unless accept_derived_name=True / acceptDerivedName: true is passed. Claim and prove first. The check is advisory: it rests on one node's reads, and a credit that lands between the read and the seal can still lock 1,000 STR and name the account. Only a name proved before the spend rules that out.

Following the chain, which is what an indexer needs:

from sourceless.follower import BlockFollower

follower = BlockFollower(node)
for block in follower.blocks(follow=True):
    print(block["header"]["height"], len(block["transactions"]))

Its one dependency, and why#

cryptography (OpenSSL) for Ed25519. Everything else is the standard library — hashlib for SHA-256 and PBKDF2, hmac for a ten-line HKDF, json for the canonical encoder, urllib for the transport.

Ed25519 is not in Python's standard library, and a pure-Python implementation is the wrong answer for this particular job: it would be neither constant-time nor side-channel hardened, and this code holds spending keys. That dependency is the SDK's and never the chain's — see §1.


5. JavaScript, in ten lines#

The same two steps. Reading first, with no key:

import { Client } from '@sourceless/sdk';

const node = new Client('https://rpc.xplstr.org', {
  expectGenesisHashHex: '1cf8655125cc1bbbc0ca06a491f53775499785c349b4d0f5748d5ea170e517bf',
});

await node.network();   // stops here unless the node is on that chain
console.log(await node.chainId());
console.log(await node.height());
console.log(await node.domainHolder('STR.sourceless'));   // an address, or null

Then signing, on this machine, with phrase taken from wherever your program keeps its secrets:

import { crypto } from '@sourceless/sdk';

const keys = await crypto.accountKeypairFromMnemonic(phrase);
// More accounts from the same words: accountKeypairFromMnemonic(phrase, '', n). Account 0 is the default.
console.log(keys.address, await node.balances(keys.address));

await node.claimDomain(keys, 'STR.yourname');   // reserves the name; costs and locks nothing
await node.proveDomain(keys, 'STR.yourname');   // locks 1,000 STR and mints the wNFT
// Send once node.domainOf(keys.address) answers STR.yourname: a block has carried the proof.
// send() refuses an unnamed sender holding 1,000 STR, which the chain would name. The check is
// advisory (one node's read; a credit landing before the seal can still lock the 1,000 STR).
await node.send(keys, { to: 'zk13str_…', amountMinor: 1_000n });

Following the chain, which is what an indexer needs:

import { BlockFollower } from '@sourceless/sdk';

for await (const block of new BlockFollower(node).blocks({ follow: true })) {
  console.log(block.header.height, block.transactions.length);
}

Zero dependencies, and that was not luck#

Everything it needs is in WebCrypto, which is in every browser worth shipping to and in Node 18 and up: Ed25519, PBKDF2-HMAC-SHA512, HKDF-SHA256 and SHA-256. The transport is fetch. The usual answer — a curve library — would have been a dependency in a tree whose whole point is that it has none, and it turned out not to be needed.

Two consequences, both stated rather than discovered:

  • Every derivation is asynchronous, including deriveAddress, because crypto.subtle returns promises. That is the shape of having no dependencies.
  • Ed25519 in WebCrypto needs Chrome 137+, Safari 17+, Firefox 129+ or Node 18+. Anything older gets assertCryptoAvailable()'s refusal by name, up front, rather than a wallet that lets a holder write down a phrase and fund it and then cannot sign.

An amount is a bigint and a number is refused rather than coerced: canonicalStringify renders the two differently, so accepting 1000 where the chain signs 1000n would produce a payload that differs in the field carrying money.


6. Both SDKs, against a live node#

Neither suite needs a chain — a test that needs a running node is a test that does not run. Both carry an opt-in live check instead, which is the only thing that can answer whether the verbs an SDK names are the verbs a particular node answers:

python sdk/python/live_check.py http://127.0.0.1:8083
node   sdk/js/test/live.mjs     http://127.0.0.1:8083

Each exits non-zero only if the node refuses something on its signature, which would be the SDK's bug rather than a chain rule. A refusal that names a chain rule — self-transfer is not a value movement, has no proved STR.domain — is the answer they are looking for.


7. One wordlist#

sdk/build-wordlists.mjs generates the BIP-39 English list into both SDKs from src/crypto/bip39-wordlist.ts, and npm run sdk:wordlists fails if either copy is stale. It exists because sdk/python/sourceless/wordlist.py carried the line "GENERATED … by scripts/build-python-sdk.mjs. Do not edit" and that script was never in the tree — so the list was hand-maintained under a notice telling the next person not to maintain it. Each SDK's suite recomputes the published digest from the list it actually shipped, rather than trusting the generator to have run.


Attribution: Alex M Stratulat and the SourceLess team.