This repository contains the core logic and associated tools to issue and manage verified carbon credit units on the Bitgreen parachain.
- 1. Introduction
- 2. Overview
- 3. Building
- 4. Run local testnet
- 5. Development
- 6. Run a Collator
- 7. Bugs Reporting ๐
- 8. Contribute
Bitgreen is an open and permissionless blockchain built to meet the needs of NGOs, corporate ESG groups, and purpose-driven innovation in Web3. Bitgreen makes it easy to finance, originate and purchase high quality, transparent Carbon Credits that conserve nature, remove atmospheric CO2 and send financial benefits to local communities.
Bitgreen provides a convenient and easy-to-use platform for the aforementioned Carbon Credit management processes and the Bitgreen Impact Investment Platform delivers the first blockchain marketplace for discovering and buying digital green bonds.
Each Carbon Credits represents a reduction or removal of one tonne of carbon dioxide equivalent (CO2e) achieved by a project. Carbon Creditss are characterized by a number of quality assurance principles which are confirmed through the project validation and verification process. Carbon Credits are ultimately purchased and retired by an end user as a means of offsetting their emissions. The Carbon Credits pallet manages the creation and retirement of Carbon Credits units for the bitgreen runtime. Credits in a project are represented in terms of batches, these batches are usually seperated in terms of 'vintages'. The vintage refers to the age
of the credit. For more details, see the pallet documentation
The Carbon Credits Pool pallet lets users create and manage Carbon Credits pools. A Carbon Credits pool is a collection of Carbon Credits tokens of different types represented by a common pool token. A user holding any Carbon Credits tokens (subject to the Carbon Credits pool config) can deposit Carbon Credits tokens to the pool and receive equivalent pool tokens in return. These pool tokens can be transferred freely and can be retired. When retire function is called, the underlying Carbon Credits credits are retired starting from the oldest in the pool. For more details, see the pallet documentation
We developed a light cache engine to query the transactions by account date/time limits and transaction id (txhash).
It's reachable at: https://testnet.bitgreen.org:9443. You can install in your node as from instructions here
Follow these steps to get started with the BitGreen parachain:
Install Rust:
curl https://sh.rustup.rs -sSf | sh
You may need additional dependencies, checkout substrate.io for more info
sudo apt-get install -y git clang curl libssl-dev llvm libudev-dev
You can build without launching:
git clone https://github.com/bitgreen/bitgreen-node
cd bitgreen-node
cargo build --release -p bitgreen-parachain
Since Bitgreen is a parachain, you can only run it alongside a relaychain, the following steps describe how to get the parachain and relaychain running with polkadot-launch
-
Install polkadot-launch
npm i polkadot-launch -g
-
Clone the polkadot repo and build the relaychain, follow instructions in cumulus repo
-
Ensure the relaychain build path matches the path insde
polkadot-launch/config.json
-
Run
polkadot-launch ./polkadot-launch/config.json
Bitgreen is following the Substrate code style.
In addition, we incorporate several tools to improve code quality. These are integrated into our CI and are expected to pass before a PR is considered mergeable. They can also be run locally.
- clippy - run with
cargo clippy --release --workspace
- rustfmt - run with
cargo fmt -- --check
- dprint - run with
dprint fmt
The following is a list of directories of interest in development.
Directory | Purpose |
---|---|
doc/ | High level documentation |
cache-engine/ | Cache engine source (js) |
parachain/ | Bitgreen's main node (rust) |
pallets/ | Bitgreen's Substrate runtime pallets (rust) |
primitives/ | Base types used in runtime |
runtime/ | Bitgreen's runtime (on-chain) code (rust, compiled to WASM) |
scripts/ | Utilities for launching and interacting with a Bitgreen chain (typescript) |
tools/ | Various tools generally related to development (typescript) |
git clone https://github.com/bitgreen/bitgreen-node
cd bitgreen-node
# Build the node (The first build will be long (~30min))
cargo build --release
(Run tests for entire chain)
cargo test
(Run tests for pallet)
cargo test -p <pallet-name>
(Run benchmark tests for entire chain)
cargo test --features runtime-benchmarks
(Run benchmark tests for pallet)
cargo test -p <pallet-name> --features runtime-benchmarks
Collators aggregate transactions on parachains into blocks and then propose these to the relay chain validators for finalization. Collators do not contribute to network security and only fill the role of a proposer and aggregator. Collators in theory have a power to censor transactions by not including them in their block proposals.
The Bitgreen network is a parachain and therefore only requires collators as it is secured by the Polkadot relay chain validators. You can build and run a bitgreen parachain collator, for detailed instructions, refer collator guide.
For bug reporting, please open an issue in our repo : https://github.com/bitgreen/bitgreen-node/issues. For security issues, kindly report issues to [email protected].
Bitgreen is open source under the terms of the MIT. We welcome contributions. Please review our CONTRIBUTIONS.md document for more information.