Each BitKeelmark devnet authorization requires ECDSA on secp256k1 and ML-DSA-44. The signer takes a byte message supplied by consensus, including any transaction or protocol fields that consensus requires.
Run locally
OpenSSL 3.5 or later must provide ECDSA and ML-DSA-44 through its default provider. The signer uses BITKEELMARK_OPENSSL if set. On Windows it then checks the standard Git for Windows installation before using PATH. On other systems it uses PATH.
Generation requires an existing parent directory and a new wallet directory. Place wallets under the ignored .local/ directory in a location accessible only to the intended user. Legacy demo wallets contain two unencrypted PEM private key files and public.json. On POSIX, the signer creates the directory with mode 0700 and the files with mode 0600. On Windows, these files inherit the containing directory's ACL. Keep both PEM files out of Git, shared storage and diagnostics. The public key file may be shared.
Run the wallet integration checks from the repository root.
python -m unittest chain.test_crypto -v
Wire format
Both records contain exactly two fields. Each value is lowercase hexadecimal without a prefix, whitespace or separators. Object field order has no effect on the signer.
| Field | Public key bytes | Signature bytes |
|---|---|---|
secp256k1 |
56-byte DER SubjectPublicKeyInfo with id-ecPublicKey, named curve secp256k1 and a compressed 33-byte point |
64-byte `r |
ml-dsa-44 |
1,334-byte DER SubjectPublicKeyInfo with id-ML-DSA-44, absent parameters and a 1,312-byte raw key |
2,420-byte pure ML-DSA-44 signature using the empty context. |
The address is bkmk followed by lowercase hex for SHA256(b"BitKeelmark/address/v1\0" || ec_spki || ml_spki). Both key encodings have fixed lengths, and the compressed secp256k1 point must lie on the named curve.
The two algorithms sign b"BitKeelmark/hybrid-signature/v1\0" || ec_spki || ml_spki || message, where \0 denotes a single zero byte and || denotes byte concatenation. ECDSA uses SHA-256 and pure ML-DSA-44 takes the full byte string. Including both public keys in each signed payload prevents a valid pair from being assembled from signatures issued by different wallets for the same message.
Use protected wallet creation for encrypted private keys. Existing demo keys stay unchanged.
Versions and sources
- Tested with Python 3.14 and OpenSSL 3.5.9 bundled with Git for Windows 2.56.1. The repository invokes OpenSSL as an external executable. OpenSSL is licensed under Apache License 2.0. OpenSSL tagged source, OpenSSL license.
- OpenSSL documents key generation, public key export and the separate message modes used for ECDSA and ML-DSA. openssl-genpkey, openssl-pkey, openssl-pkeyutl.
- SEC 2 version 2.0 defines secp256k1. RFC 5480 defines the EC public key container. Standards for Efficient Cryptography 2 (SEC 2), RFC 5480.
- FIPS 204 defines ML-DSA-44 and RFC 9881 defines its public key container. FIPS 204, RFC 9881.