IBEXHub is an API service designed to integrate Bitcoin and Lightning Network functionalities into applications. The service manages a cluster of Lightning nodes, liquidity, and channels to ensure proper operation. The focus of this project is to implement and test five of IBEXHub's APIs, alongside thorough documentation to support the testing process. This includes testing account creation, Bitcoin and Lightning address generation, fee estimation, invoice generation, and payment splits.
This project is implemented using Python, with the key functionality relying on HTTP requests made using the requests library. The project is structured with different Python files for each API's functionality and test cases. Each test function is isolated in its own script to make it easy to test and execute individually.
- Python 3.x
requestslibrary (for making HTTP requests)
If requests is not installed, use the following command to install it:
pip install requestsIBEXHub-API-Test/
│
├── .gitignore # ignore file
├── README.md # Project documentation
├── account.py # Contains the Account class with various API methods
├── test.ipynb # Jupyter notebook to easly test
├── test_account_creation.py # Test for creating an account
├── test_auth.py # Test for authentication
├── test_btc_address_generation.py # Test for generating Bitcoin addresses
├── test_create_btc_splits.py # Test for creating btc payment splits
├── test_create_ln_address.py # Test for generating Lightning Network addresses
├── test_create_ln_splits.py # Test for creating LN payment splits
├── test_estimate_fee.py # Test for fees estimation
├── test_invoice_from_lnaddress.py # Test for the invoice generation from a ln address
├── test_refresh_access_token.py # Test for refreshing the access token
├── utils.py # useful functions for interaction with the API
├── requirements.txt # dependencies file- Clone this repository to your local machine:
git clone https://github.com/giancpl/IBEXHub-API-Test.git cd IBEXHub-API-Test - Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
Execute each test file with:
python <test-file.py>Examples:
- Account Creation: tests the creation of a new account using a name and access token
python test_account_creation.py
- Authentication: verifies user authentication via the access token
python test_auth.py
- Bitcoin Address Generation: tests generating a Bitcoin address for a specific account
python test_btc_address_generation.py
The test code can also be launched from a Jupyter Notebook, thanks to the script collected in the file test.ipynb.
To run the notebook:
- Install Jupyter Notebook (if not already installed):
# Download Jupyter Notebook
$ pip install notebook- Launch Jupyter:
# Launch
$ python -m notebook- Select test.ipynb from the Jupyter interface, or run the cells individually to test the APIs interactively.
