Create a .env
file with your bitcoind
and lnd
configuration. See the .env_sample
file for all configuration options.
- Python in version 3.7
- Redis
- Polar
If you need an easy option to run a simple bitcoind & lnd client
make install
or
python -m pip install -r requirements.txt
py -m pip install -r requirements.txt
make run
or
python -m uvicorn app.main:app --reload
py -m uvicorn app.main:app --reload
Setup of pyenv, poetry & VScode inspired by: https://www.youtube.com/watch?v=547Jr26duHQ
On MacOS its recommended to used pyenv
to manage different python versions. Simply install with brew:
brew update
brew instally pyenv
Add pyenv
shims to your terminal/shell environment by adding the following lines to your .zshrc
:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
Exit shell and reopen. Now install & set the recommended python version for the blitz_api with:
pyenv install 3.7.12
pyenv global 3.7.12
Now install poetry with in that pyenv version with:
pip install poetry
Now open the blitz_api folder in VScode and type in the VScode terminal:
poetry shell
poetry env info --path
Copy the resulting path info and with the VScode plugin Phython
click in left down corner on Python interpreter and choose + Enter interpreter path
and Paste the path info. In the VScode terminal now run:
poetry install
Now copy the .env_sample
to .env
and edit the config values matching your setup. To then run the blitz_api call in VScode terminal:
python -m uvicorn app.main:app --reload
Check in local browser is swagger docs can be loade:
http://127.0.0.1:8000/latest/docs
It is recommended to have python-poetry installed.
From within the blitz_api
folder open a poetry shell via:
poetry shell
(To exit the poetry shell use: exit
)
poetry install
or
make install_dev
If python dependencies have been changed it's necessary to freeze all requirements to requirements.txt:
poetry export -f requirements.txt --output requirements.txt
ℹ️ This will skip all dev dependencies by default.
This step is required to avoid having to install poetry for final deployment.
Make sure to include tests for important pieces of submitted code.
make tests
make coverage
This will run tests and generate a coverage html file in this folder: ./htmlcov
Once the API is running swagger docs can be found here:
http://127.0.0.1:8000/latest/docs
curl -N http://127.0.0.1:8000/v1/sse/subscribe
curl -N http://127.0.0.1:8000/v1/bitcoin/getblockchaininfo
curl -X POST -N http://127.0.0.1:8000/v1/setup/type/1
curl --header "Content-Type: application/json" \
--request POST \
--data '{"password":"12345678"}' \
http://127.0.0.1:8000/system/login
Integrated Libraries: