All the things needed to make Bitcoin work on embedded µpy platforms like ESP32.
Name is "Number Go Up" ... because need that.
Absoletely none of SHITCOINS allowed here
NEW POLICY If I don't know you, I don't merge you! Thanks XZ!
- using libsecp256k1 for everything, except:
- mbedtls if already present on target (ESP32 uses for TLS)
- otherwise use cifra
- generic EC, certificates stuff, disabled if no mbedtls
- AES submodule disabled if you have mbedtls, because ucryptolib is same
- libwally-core used for testing only
-
might need, see issue
export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig setenv PKG_CONFIG_PATH /usr/local/opt/libffi/lib/pkgconfig
make one-timedoes submodule bullshit, configures K1 libmake quickcompiles Unix micropython port, runs tests- can play with
./ngu-micropythonbinary on your desktop - ESP32 builds stop until the integrator attests that true entropy stays
active whenever
ngu.randomis used (see below). Once that is established, compile and burn onto the TTGO board:
make -f makefile.esp32
make -f makefile.esp32 deploy
- on target, do:
>>> import ngu_tests.run
or for single test:
>>> import ngu_tests.test_hash
- STM32 port builds, but untested:
make -f makefile.stm32
ngu.random uses Cifra Hash_DRBG, initially seeded with 128 bytes from the
target entropy source. Generated bytes are also XORed with fresh source words.
There is no software fallback:
- STM32 uses
rng_get()only when the board enables MicroPython's hardware RNG withMICROPY_HW_ENABLE_RNG=1, or supplies an external implementation and setsNGU_STM32_EXTERNAL_RNG_GET=1. Without either source, the build fails. A zero word is rejected; MicroPython's STM32 implementation uses zero to report a peripheral timeout. - ESP32 uses
esp_random()only when the build setsNGU_ESP32_RNG_IS_TRUE_RANDOM=1. This is the integrator's attestation that a true entropy source remains active whenever random data is requested. Without active RF or another enabled entropy source, ESP-IDF documents the output as pseudo-random. See the ESP-IDF RNG documentation. - macOS and FreeBSD use
arc4random(). Linux usesgetrandom(2). Unknown targets fail to build.
The runtime rejects zero and an immediate repeated word. This is a narrow failure check, not a substitute for validating the raw entropy source on each hardware target.
ngu.random.reseed() accepts bytes-like values of at least 32 bytes and mixes
them into the existing state. The module keeps mutable DRBG and source-check
state, so calls must be serialized. Python calls require the VM's GIL when
threads are enabled; direct C callers own that synchronization.