# txidgen

`txidgen` generates **12-character**, **human-safe**, **lexicographically sortable** transaction IDs suitable for payment systems.

### Properties
- **Length**: 12 (`<PREFIX><PAYLOAD11>`)
- **Prefix**: 1 letter A–Z (never starts numeric)
- **Alphabet**: removes ambiguous chars `0 O I 1 U V`
- **Sortable**: string sort == creation time sort
- **Distributed**: supports multiple nodes without coordination
- **Throughput**: tuned for 10k TPS+ with a few nodes

### V2 layout (50-bit payload)
- `ts10` (38 bits): 10ms ticks since custom epoch (default 2026-01-01 UTC)
- `node` (4 bits): 0..15
- `currency` (4 bits): 0..15
- `seq` (4 bits): 0..15 per node per 10ms tick

### Install
```bash
pip install txidgen
```

### Usaage
```python
from txidgen import TxIdV2Generator, parse_txid_v2

gen = TxIdV2Generator(node_id=3)
txid = gen.generate(prefix="P", currency="BDT")
print(txid)

parts = parse_txid_v2(txid)
print(parts)
```

### CLI
```bash
txidgen gen --prefix P --currency BDT --node 3
txidgen parse P9JQ2H...   # prints decoded parts
```

### Note
This ID is not a **secret token**. It is time-ordered and may be partially guessable.
Use a separate opaque token if you require secrecy.