---
title: "CLI"
description: "The curves command runs every tool from a terminal and prints the same JSON a model gets"
canonical_url: "https://curves.agntn.dev/guide/cli"
---
# CLI

> The curves command runs every tool from a terminal and prints the same JSON a model gets

## Commands and a server

```bash
npx @agntn/curves compute log --a 2 --b 2 --p 17 --point '{"x":"5","y":"1"}' --other '{"x":"16","y":"4"}'
```

```text
{"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.

<table>
<thead>
  <tr>
    <th>
      Command
    </th>
    
    <th>
      Does
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        curves compute <operation>
      </code>
    </td>
    
    <td>
      add, double, negate, multiply, lift, check, order, count, points, log on a curve you give
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        curves secp256k1 <operation>
      </code>
    </td>
    
    <td>
      add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on secp256k1
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        curves bip340 <operation>
      </code>
    </td>
    
    <td>
      keypair, sign, verify with BIP340 Schnorr and x-only keys
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        curves p256 <operation>
      </code>
    </td>
    
    <td>
      add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on P-256
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        curves p384 <operation>
      </code>
    </td>
    
    <td>
      add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on P-384
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        curves p521 <operation>
      </code>
    </td>
    
    <td>
      add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on P-521
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        curves brainpoolp256r1 <operation>
      </code>
    </td>
    
    <td>
      add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on brainpoolP256r1
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        curves brainpoolp384r1 <operation>
      </code>
    </td>
    
    <td>
      add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on brainpoolP384r1
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        curves brainpoolp512r1 <operation>
      </code>
    </td>
    
    <td>
      add, subtract, negate, multiply, lift, check, sign, nonce, verify, recover on brainpoolP512r1
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        curves sr25519 <operation>
      </code>
    </td>
    
    <td>
      keypair, sign, verify, derive with Polkadot keys
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        curves ed25519 <operation>
      </code>
    </td>
    
    <td>
      keypair, sign, verify with Ed25519 keys, ZIP 215 or strict rules
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        curves ed448 <operation>
      </code>
    </td>
    
    <td>
      verify with Ed448 keys, under a context when the signer set one
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        curves mcp
      </code>
    </td>
    
    <td>
      the MCP server over stdio
    </td>
  </tr>
</tbody>
</table>

Where do the flags come from? From the tool schemas, the same ones MCP lists. The CLI is `runCli` from [`@agntn/tools`](https://tools.agntn.dev/guide/cli), 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.

```bash
curves compute multiply --a 2 --b 2 --p 17 --point '{"x":"5","y":"1"}' --scalar -2 --json
```

```text
{
  "operation": "multiply",
  "point": {
    "x": "6",
    "y": "14"
  }
}
```

`secp256k1` takes SEC1 hex, compressed or not. `--no-compressed` writes 65 bytes instead of 33.

```bash
curves secp256k1 lift --x 79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
```

`sr25519` reads `--message` as text. Got bytes? `--encoding hex`.

```bash
curves sr25519 verify --public-key d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d --message hello --signature dcd271ee89206ca33f53e56e69947f54bc4642c5088eb13a55520f38f89ffd1236edd2fc8bcb13d8fab81a455fbd2f0d86d05bd805ea42299e2a75cd346f5885
```

```text
{"operation":"verify","valid":true}
```

## When it says no

A refusal is one line on stderr and exit code 1. No stack trace.

```bash
curves secp256k1 subtract --point 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 --other 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
```

```text
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.


## Sitemap

See the full [sitemap](https://curves.agntn.dev/sitemap.md) for all pages.
