Python helper to generate new private/public keys pair to run RChain node as validator
Current implemented workflow:
- run RNode in standalone mode for one validator with a temporary data folder
- a thread interrupt the node process running when keys have been generated
- copy and parse the
.sk
key file from data folder - remove temporary data folder
Here's a brief overview on how to use the package
- rnode package installed (see official instructions)
- rnode binary in
PATH
- python3.5+ installed (together with pip package system)
Installation is done via the official Python package manager:
pip3 install rchain-keygen
After installing you will be able to use the binary as:
$ rchain-keygen --help
usage: rchain-keygen [-h] [--save-as-source]
RChain 'ed25519' signed keys generator
optional arguments:
-h, --help show this help message and exit
--save-as-source enable saving variables for bash env sourcing
Having rnode
installed you just need to run:
rchain-keygen
[...]
Launching: rnode.
[...]
VALIDATOR_PUBLIC_KEY=...
VALIDATOR_PRIVATE_KEY=...
That would be as easy as:
docker run --rm -it --entrypoint /bin/bash rchain/rnode:release-rnode-v0.7
# container shell
export PATH=/opt/docker/bin:$PATH
apt update && apt install -y python3-pip
pip3 install rchain-keygen
cd $HOME
rchain-keygen
- missing
rnode
installation (or not being found in PATH) would end up execution with Exception:
$ rchain-keygen
Temporary dir: ...
Launching: rnode.
[...]
FileNotFoundError: [Errno 2] No such file or directory: 'rnode'
- changed data dir parameter
This happened in last docker testing image. Fix is:
sed -i '79s/data_dir/data-dir/' /usr/local/lib/python3.6/dist-packages/rchain_keygen/app.py
- implement it
docker-compose build --pull
docker-compose up -d
docker-compose exec rchain bash
pip3 install -e .
rchain-keygen
# [...]
# when finished
docker-compose down --volumes --remove-orphans
black
formatter:
docker run --rm -it \
-v (pwd):/code -w /code \
unibeautify/black -S ./rchain_keygen
- working first version based only on standard library
- parameter to output to file to be sourced
- setup as package
- formatter
- docs
- publish manually on pypi + first tag
- better options support with backwards compatibility
- unittests
- travis ci
- automatic pypi publishing from tags