# sourceless — the SourceLess client SDK for Python Key derivation, addresses, canonical encoding, record signing and the JSON-RPC transport for a SourceLess node. **Self-custody by construction: no method here sends a private key anywhere.** > Proprietary. Copyright (c) 2026 **Alexandru Marius Stratulat and the SourceLess team**. > All rights reserved — see [`LICENSE`](LICENSE), which travels inside this package. ## Installing ```sh pip install ./sdk/python # from a clone python -m build sdk/python # or build the wheel and install that ``` **There is deliberately no `pip install sourceless` here, and that is a security decision rather than an oversight.** The name `sourceless` is not registered on PyPI by this project. Printing that command in a README does not make it resolve to this package — it makes it resolve to whatever anyone chooses to upload under that name, which is the ordinary shape of a dependency-confusion attack and is worse here than in most places: this is a wallet SDK, and the package a reader installs is the code that touches their private key. The line will appear here when the name is registered and a release is signed, and not before. Until then, install from a clone you have checked out yourself. ## Versioning **The two SDKs carry the SAME version number on purpose.** `@sourceless/sdk` and `sourceless` implement one protocol surface — the same addresses, the same canonical encoding, the same record signatures, checked against the same `spec/conformance-vectors.json` — so a reader holding one of each has to be able to tell at a glance whether they agree. They were 0.1.0 and 0.3.0, which answers that question with a number that means nothing. The version tracks the protocol surface, not the repository: `package.json` at the root is a different artifact with a different life, and a match between them would be a coincidence rather than a promise. A client that reproduces every vector in `spec/conformance-vectors.json` is compatible. One that does not is wrong in a way its own tests cannot see, which is why the vectors are generated by the implementation the chain actually runs and not written by hand. ## 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. ```python 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. ```python 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) ``` `send`, `claim_domain`, `prove_domain`, `rotate_key`, `grant_delegation`, `delegated_spend`, `authorized_call` and `authorized_deploy` all sign **locally** and post the finished record. There is no method that takes a key and asks the node to do the rest, because that method would be the whole of a custodial wallet. `expect_genesis_hash_hex` is worth setting in anything that moves value: a chain id is self-declared and separates nothing, so the client refuses to sign for a node whose genesis does not match and pointing a script at the wrong network fails loudly. It covers `chainBinding` and `identityChainBinding` too, and plain `http://` is refused for anything but this machine unless `allow_insecure_http=True` is passed. A failed write whose outcome is unknown raises `OutcomeUnknown` with the signed `record` on it: re-post it with `submit_transaction_once`, never by calling `send` again. See `sdk/README.md` §3.5 and §3.6. ## Two things that surprise people, and both are the chain's rules **An account spends under a proved STR.domain, and the chain can give it one.** A fresh key can receive forever. Its first spend goes one of two ways: - **It holds less than 1,000 STR available, or a name booked and not yet proved:** the chain refuses the transfer — *sender has no proved STR.domain; SourceLess requires one to spend* — until `claim_domain` and then `prove_domain` have both settled. They are two records, in that order. - **It holds 1,000 STR or more available and no name:** the chain admits the transfer, and the block that carries it locks 1,000 STR and gives the account a name the chain generates. An account holds one proved name, so that name stands where a chosen one would. `send` asks `domain_of` first and refuses to sign such a transfer, saying so, unless `accept_derived_name=True` is passed. 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. This README said a fresh key could *spend never* until both records settled, until 2026-11-23. That is false for any account holding the lock: a live send of 5 minor units from an unnamed key holding 1,200 STR was accepted and left it named, with 1,000 STR locked. **The 1,000 STR a proof locks is not a fee.** It stays the holder's, frozen, and comes back through Helgrind if the name is ever burned. A balance that drops by a thousand with no explanation is read as money taken, so the SDK says so where a caller can see it. ## Following the chain ```python from sourceless.follower import BlockFollower follower = BlockFollower(node, from_height=0) for block in follower.blocks(follow=True): print(block["header"]["height"], len(block["transactions"])) ``` `follower.next_height` is a plain integer a caller can store and hand back: an indexer that crashes must resume from what it **committed**, not from whatever this object happened to hold. The parent hash of every block is checked, so a chain that reorganises under the cursor raises `ReorganisationDetected` instead of quietly writing a ledger from two histories. ## 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. ## Correctness Every derivation, encoding and payload here is checked against `spec/conformance-vectors.json`, generated from the implementation the chain itself runs — never against this library's own output, because a client tested only against itself agrees with its own bugs and both failures that causes are silent: an address derived one bit differently shows an empty wallet, and a payload canonicalised differently produces *"invalid signature"* about a transaction signed correctly. ```sh python -m unittest discover -s sdk/python/tests -t sdk/python # every test; the run prints the count python sdk/python/tests/report.py # 98 vectors, one line each node sdk/conformance-report.mjs # both clients, and each other python sdk/python/live_check.py http://127.0.0.1:8083 # opt-in, needs a node ``` `tests/report.py` walks the vector file itself rather than counting test methods, so a failure names the vector, the expectation and the value this client produced. `sdk/conformance-report.mjs` runs the JavaScript client over the same ids and compares the two byte for byte: agreeing with the vectors and agreeing with each other are two different questions, and the second is what catches a value no vector pins. `../README.md` states what this SDK cannot do and why — a Gemini (post-quantum) record, an AresLang compilation, fourteen record kinds that have no vector yet, and a v2 address.