walletpress/backend/requirements.txt
Rug Munch Media LLC d3f95e67c9
fix(wallet_engine): WP-055 Cardano via pycardano
Add Cardano (ADA) address generation using the official pycardano
library which implements IOHK's Kholaw (BIP32-Ed25519) derivation
correctly. Hand-rolled Kholaw implementations tend to get subtle
details wrong (HMAC ordering, scalar addition mod L, network byte
values), so we delegate to pycardano.

Verified against:
- pycardano's own Address() output (matches byte-for-byte)
- The official `cardano-address` CLI from IOHK (v4.0.6) — verified
  that the spending_key_hash matches exactly:
    payment: 9b206f67cc03a2f3cb97988759878715eb387a9eeff9247fedbeb2b8
    stake:   45dd8424772e4a23936f6dd23d3e459d8f036a84825dedeff8d26cbc

Implementation:
- chain_addresses.py: cardano_address, cardano_enterprise_address,
  cardano_reward_address (all via pycardano)
- generator.py: ada added to CHAIN_ADDRESS_OVERRIDES with curve
  'ed25519_kholaw'. The raw 32-byte ed25519 signing key is extracted
  from xsk[:32] and returned as private_key_hex. Public key derived
  via nacl.crypto_sign_seed_keypair.
- _generate_mnemonic() now always returns str() (was sometimes
  Bip39Mnemonic object, which pycardano rejects).
- Added test_cardano_matches_pycardano, test_cardano_testnet,
  test_cardano_enterprise_matches_pycardano.

Cardano address types supported:
- Base (addr1... mainnet, addr_test1... testnet) — payment + stake
- Enterprise (addr1v... mainnet) — payment only
- Reward / stake (stake1... mainnet) — stake only

Derivation per CIP-1852:
- payment key: m/1852'/1815'/0'/0/0
- stake key:   m/1852'/1815'/0'/2/0

pycardano's actual disk footprint is only 1.1 MB + 9 MB of small deps
(asn1crypto, certvalidator, oscrypto, etc. — most are < 2 MB each).
That's well within budget for a wallet product that needs correct
Cardano addresses.

Test results:
  pytest tests/test_address_vectors.py
  # 22 passed (was 19)
  pytest tests/
  # 80 passed, 5 skipped, no regressions

Refs: ADDRESS_GENERATION.md, BUILDER.md
Closes: WP-055
2026-06-30 20:06:55 +07:00

29 lines
600 B
Text

fastapi>=0.115.0
uvicorn[standard]>=0.30.0
pydantic>=2.5.0
pydantic-settings>=2.1.0
coincurve>=18.0.0
ecdsa>=0.19.0
base58>=2.1.1
pynacl>=1.5.0
cryptography>=42.0.0
httpx>=0.27.0
aiosqlite>=0.20.0
bip-utils>=2.9.0
qrcode>=7.4.0
argon2-cffi>=23.0.0
pyyaml>=6.0
apscheduler>=3.10.0
alembic>=1.13.0
sqlalchemy>=2.0.0
# Per-chain address encoders (WP-040..WP-058 fixes)
bech32>=1.2.0
stellar-sdk>=10.0.0
xrpl-py>=5.0.0
py-algorand-sdk>=2.0.0
tonsdk>=1.0.0
bitcash>=1.2.0
monero>=0.0.4
substrate-interface>=1.8.0
coincurve>=18.0.0
pycardano>=0.19.0 # Cardano Kholaw (BIP32-Ed25519 IOHK) — 1.1 MB disk