High-Performance Modular Blockchain Framework Powered by Kotlin with Proof of Stake
Kokonut is a lightweight and scalable blockchain framework written in Kotlin. Designed for educational and research purposes, it implements Proof of Stake (PoS) consensus with core blockchain principles (Staking, Validation, Wallets) using an intuitive multi-module architecture.
This project is organized as a Gradle multi-module project, where each module plays a distinct role in the blockchain network.
:library (Core)Contains the core logic and data structures of the blockchain.
:fuelnode (Bootstrap Node)Acts as the network entry point and provides Node Discovery services.
:fullnode (Main Node)The core node that maintains and operates the actual blockchain network.
:lightnode (Wallet Client)A desktop wallet application for users (built with Compose Desktop).
.pem key files.Run the following command in the project root to build the entire project.
# Windows
./gradlew.bat build
# Mac/Linux
./gradlew build
Each node can be run individually. The recommended order is Fuel Node β Full Node (Multiple) β Light Node.
./gradlew.bat :fuelnode:run
http://[::]:80 (Dual Stack IPv4/IPv6) by default.http://[2001:db8::1]:80).:: (dual stack), IPv4-only clients may experience limitations in P2P scenarios../gradlew.bat :fullnode:run
./gradlew.bat :lightnode:run
.pem key files to log in.Full Nodes and the Fuel Node interact via HTTP APIs.
| Method | Endpoint | Description |
|:β:|:β|:β|
| GET | / | Node status and information dashboard (HTML) |
| GET | /getLastBlock | Get the last block of the current chain |
| GET | /getChain | Get the entire blockchain data |
| GET | /isValid | Check the integrity of the local blockchain |
| GET | /getTotalCurrencyVolume | Get the total supply of KNT |
| POST | /startMining | Start mining (Miner key required) |
| POST | /addBlock | Submit a mined block (Network propagation) |
| Method | Endpoint | Description |
|:β:|:β|:β|
| POST | /submit | Register to participate in the Full Node network |
| GET | /getGenesisBlock | Download the Genesis Block data |
| GET | /getFullNodes | Get the list of active Full Nodes |
git checkout -b feature/amazing-feature).git commit -m 'Add some amazing feature').git push origin feature/amazing-feature).License
This project is licensed under the MIT License. See the LICENSE file for details.
Official Docker images are available on Docker Hub.
volta2030/knt_fuelnodevolta2030/knt_fullnodeTo ensure data persistence (blockchain data, keys), you must mount a volume to /data.
The Fuel Node acts as the network bootstrapper.
# -p 80:80 : Bind container port 80 to host port 80
# -v ./data:/data : Persist blockchain data to host's ./data directory
docker run -d \
--name knt_fuelnode \
-p 80:80 \
-v $(pwd)/data_fuel:/data \
volta2030/knt_fuelnode
Full Nodes connect to the network. You can specify a peer to connect to using KOKONUT_PEER.
# -e KOKONUT_PEER : Address of a known node (e.g., Fuel Node or another Full Node)
# -v ./data_full:/data : Use a separate data directory for the Full Node
docker run -d \
--name knt_fullnode \
-p 8080:80 \
-e KOKONUT_PEER="http://<FUEL_NODE_IP>:80" \
-v $(pwd)/data_full:/data \
volta2030/knt_fullnode
Critical Note: Full Nodes MUST configure
KOKONUT_PEERto join an existing network. IfKOKONUT_PEERis omitted or the target peer is unreachable, the Full Node will fail to start (throw an exception). This mechanism prevents accidental network splitting (Split Brain). Only the Fuel Node is allowed to start without a peer to generate the Genesis Block.Note: Replace
<FUEL_NODE_IP>with the actual IP address or domain of your Fuel Node. If running on the same machine, use the hostβs local network IP.