AppLayerLabs / bdk-cpp

MIT License
7 stars 12 forks source link

orbitersdk

build status chat on Discord follow on Twitter chat on Telegram

Sparq subnet source code. See the docs for a more thorough look at the project.

If you are a developer, fill this form out for free support and additional incentives: https://forms.gle/m83ceG3XoJY3fpwU9

Developing on Docker

The project has a Dockerfile at the root of the repository that will build the project and deploy the network. It will also install tmux and vim for convenience. To develop on Docker, follow these steps:

Remember that we are using our local SDK repo as a volume, so every change in the local folder will be reflected to the container in real time, and vice-versa.

Also, you can integrate the container with your favorite IDE or editor, e.g. VSCode + Docker extension.

Developing manually

Install the following dependencies on your system:

If building with AvalancheGo support, you'll also need:

One-liners

For Debian 12 Bookworm or newer:

Documentation

We use Doxygen to generate documentation over the current source code. Run doxygen inside the project's root folder. Docs should be inside docs/html.

You should do this after running cmake .. in the build directory, as some header files need to be generated first.

For a more detailed explanation of the project's structure, check the docs repository.

Compiling

Deploying

Go back to the project's root directory and run ./scripts/AIO-setup.sh. The script will deploy a local testnet with 5 Validator nodes, 6 normal nodes and 1 discovery node. All of them will be rdPoS. Run the script again to re-deploy, or call tmux kill-server to stop it entirely.

You can use the following flags on the script to customize deployment:

Flag Description Default Value
--clean Clean the build folder before building false
--no-deploy Only build the project, don't deploy the network false
--debug=\<bool> Build in debug mode true
--cores=\<int> Number of cores to use for building Maximum available

Example: ./scripts/AIO-setup.sh --clean --no-deploy --debug=false --cores=4 will clean the build folder, only build the project, build in release mode and use 4 cores for building. Remember that GCC uses around 1.5GB of RAM per core, so, for stability, it is recommended to adjust the number of cores to the available RAM on your system.

Once deployed, you can connect any Web3 client to it (we recommend Metamask). See below for details.

Note that, when re-deploying, if your wallet or RPC client keeps track of account nonce data, you must reset it as a network reset would set back their nonces to 0. Here's how to do it in MetaMask, for example.

Testnet defaults

The deployed chain will have the following information by default:

Nodes are all deployed on the same machine, under the following ports and tmux sessions:

Session Name Node Type P2P Port HTTP Port Validator Key
local_testnet_discovery Discovery 8080 8090 XXXX
local_testnet_validator1 Validator 8081 8090 0xba5e6e9dd9cbd263969b94ee385d885c2d303dfc181db2a09f6bf19a7ba26759
local_testnet_validator2 Validator 8082 8091 0xfd84d99aa18b474bf383e10925d82194f1b0ca268e7a339032679d6e3a201ad4
local_testnet_validator3 Validator 8083 8092 0x66ce71abe0b8acd92cfd3965d6f9d80122aed9b0e9bdd3dbe018230bafde5751
local_testnet_validator4 Validator 8084 8093 0x856aeb3b9c20a80d1520a2406875f405d336e09475f43c478eb4f0dafb765fe7
local_testnet_validator5 Validator 8085 8094 0x81f288dd776f4edfe256d34af1f7d719f511559f19115af3e3d692e741faadc6
local_testnet_normal1 Normal 8086 8095 XXXX
local_testnet_normal2 Normal 8087 8096 XXXX
local_testnet_normal3 Normal 8088 8097 XXXX
local_testnet_normal4 Normal 8089 8098 XXXX
local_testnet_normal5 Normal 8110 8099 XXXX
local_testnet_normal6 Normal 8111 8100 XXXX