CLI
Commands and a server
npx @agntn/curves compute log --a 2 --b 2 --p 17 --point '{"x":"5","y":"1"}' --other '{"x":"16","y":"4"}'
{"operation":"log","order":"19","scalar":"13"}
That one line is exactly what a model reads. Want it pretty? Add --json.
From here on it's plain curves. In a project that means pnpm exec curves. Or pnpm add -g @agntn/curves once.
| Command | Does |
|---|---|
curves compute <operation> | add, double, negate, multiply, lift, check, order, count, points, log on a curve you give |
curves secp256k1 <operation> | add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on secp256k1 |
curves bip340 <operation> | keypair, sign, verify with BIP340 Schnorr and x-only keys |
curves p256 <operation> | add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on P-256 |
curves p384 <operation> | add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on P-384 |
curves p521 <operation> | add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on P-521 |
curves brainpoolp256r1 <operation> | add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on brainpoolP256r1 |
curves brainpoolp384r1 <operation> | add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on brainpoolP384r1 |
curves brainpoolp512r1 <operation> | add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on brainpoolP512r1 |
curves sr25519 <operation> | keypair, sign, verify, derive with Polkadot keys |
curves ed25519 <operation> | keypair, sign, verify with Ed25519 keys, ZIP 215 or strict rules |
curves ed448 <operation> | verify with Ed448 keys, under a context when the signer set one |
curves mcp | the MCP server over stdio |
Where do the flags come from? From the tool schemas, the same ones MCP lists. The CLI is runCli from @agntn/tools, so a new argument shows up here without anyone writing it twice.
Points and numbers
compute takes a point as JSON, the very object the tool gets. A bit more typing than 5,1, sure. But it's the same shape everywhere. Integers are decimal or 0x hex. Negative a? --a -3 works, and so does --a=-3. It's reduced mod p anyway.
curves compute multiply --a 2 --b 2 --p 17 --point '{"x":"5","y":"1"}' --scalar -2 --json
{
"operation": "multiply",
"point": {
"x": "6",
"y": "14"
}
}
secp256k1 takes SEC1 hex, compressed or not. --no-compressed writes 65 bytes instead of 33.
curves secp256k1 lift --x 79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
sr25519 reads --message as text. Got bytes? --encoding hex.
curves sr25519 verify --public-key d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d --message hello --signature dcd271ee89206ca33f53e56e69947f54bc4642c5088eb13a55520f38f89ffd1236edd2fc8bcb13d8fab81a455fbd2f0d86d05bd805ea42299e2a75cd346f5885
{"operation":"verify","valid":true}
When it says no
A refusal is one line on stderr and exit code 1. No stack trace.
curves secp256k1 subtract --point 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 --other 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
The result is the point at infinity, which is no public key, as with P minus P
An option the operation doesn't take is refused too. count with a --scalar? It says so instead of quietly ignoring it. A typo like --nmae gets the list of flags the command does take. curves <command> --help lists them with their descriptions.