cryptnox-sdk-esp32 1.0.0
ESP32 SDK for Cryptnox Hardware Wallet
Loading...
Searching...
No Matches
examples Directory Reference
Directory dependency graph for examples:

Directories

 
BasicUsage
 
Connect
 
Sign
 
UsdcSigning
 
VerifyPin

Detailed Description

cryptnox-sdk-esp32

ESP32 SDK for managing Cryptnox smart card wallets

Examples

Standalone ESP-IDF projects that exercise the Cryptnox Hardware Wallet over NFC (PN532). Each project ships with its own focused README so a reader landing on a single example gets everything needed end-to-end.

Prerequisites

Component Details
Hardware Wallet Cryptnox Hardware Wallet (firmware ≥ v1.6.0), initialised with a PIN — and a seed loaded for the signing examples
NFC reader PN532 NFC module wired over SPI (default) or I²C — see hardware setup
Board ESP32-S3-DevKitC-1 (Espressif reference dev kit)
Toolchain ESP-IDF v5.5 installed and sourced (. $IDF_PATH/export.sh)
Repository This repository cloned with submodules (git clone --recurse-submodules …)

Provision a card from a host with a PC/SC reader and the Cryptnox CLI:

cryptnox init # sets the PIN + PUK
cryptnox seed generate # generates a BIP39 seed (required for signing)
Note
Every example starts Wi-Fi on boot so the radio feeds the ESP32 hardware TRNG with full entropy. Even the non-networked examples (Connect, VerifyPin, Sign, BasicUsage) need a valid WIFI_SSID / WIFI_PASSWORD in their main/config.h.

Available examples

Example What it does
Connect Opens the secure channel and reads back the card owner's name & email. Safest first example — no PIN, no signing, can't lock the card.
VerifyPin Opens the secure channel and submits a PIN. Halts on a wrong PIN to protect the on-card retry counter.
Sign Signs a 32-byte hash with the card's secp256k1 key. Returns the raw r ‖ s signature ready to broadcast.
BasicUsage End-to-end walkthrough in one project: pick SPI or I²C, open the channel, sign a hash. Good reference for production wiring.
UsdcSigning Real-world flow: build an EIP-1559 USDC transfer, sign it on the card, broadcast it on Sepolia.

How to build and run an example

From the project root (where idf.py's parent CMakeLists.txt lives):

. $IDF_PATH/export.sh # source ESP-IDF env (once per shell)
cd examples/<ExampleName>
cp main/config.h main/config.h.bak # if you want to keep the template
$EDITOR main/config.h # fill WIFI_SSID / WIFI_PASSWORD (+ extras for UsdcSigning)
idf.py set-target esp32s3 # once, writes sdkconfig
idf.py build flash monitor # build, flash, open serial @ 115200 baud

Exit the monitor with Ctrl-]. Place the card on the PN532 antenna when the firmware prompts for it.

Note
All examples default to PIN 000000000 (nine zeros). If your card was initialised with a different PIN, edit the DEFAULT_PIN / DEMO_PIN / CARD_PIN macro at the top of the relevant source file before building.

Adding a new example

Follow the conventions used by the existing projects:

  • Place each project in its own subdirectory under examples/, named in PascalCase.
  • Lay it out as an ESP-IDF project: CMakeLists.txt at the project root, a main/ subdirectory with main/CMakeLists.txt + sources, and a sdkconfig.defaults capturing the project's build options.
  • Start every source file with the SPDX + copyright header used by the rest of the repository.
  • Add Doxygen tags (@file, @example, @brief) so the project surfaces correctly in the generated docs.
  • If the project needs external secrets (Wi-Fi credentials, RPC keys, recipient addresses), ship a config.template.h next to it and add the runtime config.h to .gitignore. Never commit credentials.
  • Ship a README.md next to the project and register it in the Available examples table above.

License

cryptnox-sdk-esp32 is dual-licensed:

  • LGPL-3.0 for open-source projects and proprietary projects that comply with LGPL requirements
  • Commercial license for projects that require a proprietary license without LGPL obligations (see COMMERCIAL.md for details)

For commercial inquiries, contact: conta.nosp@m.ct@c.nosp@m.ryptn.nosp@m.ox.c.nosp@m.om