No description
Find a file
Stefan Stammberger 71f87e06d7
feat: implement local cookie authentication
This is only useful for application running directly on the Raspiblitz.
This will create a file in ~/.blitz_api/.cookie with a valid JWT token.
Local applications can use this to authenticate to the API without
having to ask for the password. This is similar to how Bitcoin Cores
cookie auth works.
2021-11-28 08:42:52 +01:00
.github/workflows chore: exclude lnd grpc files from code scanning 2021-08-14 13:08:34 +02:00
.vscode chore: update vscode config files 2021-10-02 10:01:43 +02:00
app feat: implement local cookie authentication 2021-11-28 08:42:52 +01:00
tests feat: implement handling of locked wallets 2021-11-24 11:12:10 +01:00
.coveragerc test: Add testing dependencies and first tests 2021-10-02 12:00:44 +02:00
.env_sample feat: implement local cookie authentication 2021-11-28 08:42:52 +01:00
.gitignore test: Add testing dependencies and first tests 2021-10-02 12:00:44 +02:00
LICENSE Create LICENSE 2021-09-23 21:03:34 +02:00
Makefile feat: add a "make export" command to Makefile 2021-11-18 10:57:27 +01:00
poetry.lock chore: update dependencies 2021-11-18 11:01:26 +01:00
pyproject.toml fix: install problem due to include from git repo 2021-11-18 08:31:46 +01:00
README.md fix: problems with included external packages 2021-11-18 11:30:48 +01:00
requirements.txt chore: update dependencies 2021-11-18 11:01:26 +01:00

blitz_api

Configuration

Create a .env file with your bitcoind and lnd configuration. See the .env_sample file for all configuration options.

Please note that you will also need to install Redis.

If you need a easy option to run a simple bitcoind & lnd client, Polar makes that pretty easy.

Installation

You will need to have Python in version 3.7 installed and have the .env see Configuration configured correctly first.

⚠️ To setup a development environment for BlitzAPI skip to the Development section.

To install the dependencies, run

make install or python -m pip install -r requirements.txt on Linux / macOS or

py -m pip install -r requirements.txt on Windows.

After that, you can run the application with

make run or python -m uvicorn app.main:app --reload on Linux / macOS or

py -m uvicorn app.main:app --reload on Windows.

Development

For development it is recommended to have python-poetry installed. Install instructions can be found here

From within the blitz_api folder open a shell via poetry shell.

Install dependencies with all dev dependencies: make install_dev or poetry install

If any dependencies have changed it becomes 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.

Testing

Make sure to include test for important pieces of code submitted. To run the tests run make tests to test with pytest or run make coverage to test and generate a coverage html file in a folder called htmlcov

Useful cURL commands to test the API

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

Acknowledgements

Integrated Libraries: