To trigger the tests you can use make test-python
make target.
To trigger the linting of the codebase use make lint-python
make target.
The following installation guide is for Linux Ubuntu machines.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git
sudo apt-get install python3.9
- Navigate to
/usr/bin
- Run
ls -lrth /usr/bin/python*
and check if/usr/bin/python3.9
is in the directory - Check for a Python symlink pointing to a specific Python version other than Python 3.9
- Unlink python symlink using
sudo unlink python
- Link python using
sudo ln -s /usr/bin/python3.9 python
- Unlink python3 symlink using
sudo unlink python3
- Link python3 using
sudo ln -s /usr/bin/python3.9 python3
- Check default Python versions via
python --version
andpython3 --version
. Both should show the same Python version Python 3.9.x
sudo apt-get install curl
sudo apt-get install python3-pip
- Move to the directory you want to repository to be placed in (f.e. ~)
- Run
git clone https://github.com/onezerobinary/BeezX.git
- Move to BeezX
- Run
pip install -r requirements/requirements.txt
- Run
pip install -r requirements/requirements.in
- Open
~/.bashrc
- Add
export BEEZ_NODE_KEY_PATH=path/to/privatekey.pem
- Add
export NODE_API_PORT=80
- Add
export FIRST_SERVER_IP=213.171.185.198
- Add
export P_2_P_PORT=5444
- Relead bash by running
source ~/.bashrc
- Navigate to
BeezX
- Run
nohup python main.py &
- Check if Node is running via
curl yourip:5445/info
you should see an output similar to `This is Beez Blockchain!. 🦾 🐝 🐝 🐝 🦾
Every Beez Blockchain node exposes a dedicated API on port 5445. The endpoints enable information requests as well as transaction requests. The following listing explains how to use the endpoints.
/blockchain
Returns all blocks of the blockchain in the following form:
{
"blocks":[
"blockCount": Int, // Starting with 0
"forger": String, // PublicKey
"lastHash": String, // Hash of last block
"signature": String, // Signature of forger
"timestamp": Timestamp,
"transactions": List[Transction]
]
}
/accountstatemodel
Returns information about the blockchain’s users public keys and their corresponding balances:
{
"accounts": List[PublicKey],
"balances": Dict[PublicKey, Int]
}
/blockindex
Returns a combination of blocks and account information:
[
{
"header":
{
"beezKeeper": Dict,
"accountStateModel": {
"accounts": List[PublicKey],
"balances": Dict[PublicKey, Int]
}
}
"transactions": List[Transaction],
"blockCount": Int,
"forger": String,
"lastHash": String,
"signature": String,
"timestamp": Timestamp,
}
]
/transaction
This endpoint is used to pass transactions to the blockchain:
{
"id": UUID, // Transaction's id
"senderPublicKey": PublicKey,
"receiverPublicKey": PublicKey,
"amount": Int,
"type": Literal["EXCHANGE", "TRANSFER", "STAKE"],
"timestamp": Timestamp,
"signature": String,
"py/object": "beez.transaction.transaction.Transaction" // internal
}
The endpoint returns:
{
"message": "Received transaction"
}