Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
91112d5
Merge pull request #89 from SIDDHANTCOOKIE/feature/genesis-config
Zahnentferner Jun 12, 2026
eb8e75d
Merge pull request #92 from SIDDHANTCOOKIE/feat/smart-contracts
Zahnentferner Jun 12, 2026
8c77b89
docs: clean up and rewrite README with clear instructions
SIDDHANTCOOKIE Jun 15, 2026
2e61d45
Merge pull request #99 from SIDDHANTCOOKIE/docs/readme-update
Zahnentferner Jun 22, 2026
8fdb02d
Merge pull request #100 from StabilityNexus/feat/fork-choice
Zahnentferner Jun 25, 2026
3ed033d
Merge pull request #98 from SIDDHANTCOOKIE/feat/json-rpc
Zahnentferner Jun 25, 2026
bec83df
Merge pull request #101 from StabilityNexus/feat/contract-transfers
Zahnentferner Jun 26, 2026
95f6089
Merge pull request #102 from StabilityNexus/feat/libp2p
Zahnentferner Jun 26, 2026
459724b
minichain ascii art
SIDDHANTCOOKIE Jun 26, 2026
ca7fff8
align the helper box
SIDDHANTCOOKIE Jun 28, 2026
3ea9909
Merge pull request #105 from StabilityNexus/feat/cli
Zahnentferner Jun 29, 2026
9c83bd3
Merge pull request #104 from StabilityNexus/feat/difficulty
Zahnentferner Jul 2, 2026
251ad68
Merge pull request #106 from StabilityNexus/feat/peer-blacklisting
Zahnentferner Jul 2, 2026
baadfbb
Merge pull request #110 from StabilityNexus/feat/difficulty
SIDDHANTCOOKIE Jul 3, 2026
127b008
Merge branch 'main' into feat/libp2p
SIDDHANTCOOKIE Jul 3, 2026
569b728
Merge pull request #111 from StabilityNexus/feat/libp2p
SIDDHANTCOOKIE Jul 3, 2026
e54e378
feat: implement P2P interception layer for peer misbehavior detection
g-k-s-03 Jun 28, 2026
b1e277b
fix: address all CodeRabbit review comments on PR #107
g-k-s-03 Jun 28, 2026
2ba2809
fix: address remaining CodeRabbit comments mine_and_process_block boo…
g-k-s-03 Jun 29, 2026
83c1e28
fix: address all remaining CodeRabbit comments on PR #107
g-k-s-03 Jun 29, 2026
8486dda
fix: use peer: prefix when disconnecting peer after manual ban
g-k-s-03 Jun 30, 2026
a0e688d
refactor: simplify p2p misbehavior handler per Bruno's review
g-k-s-03 Jul 2, 2026
9f861f3
fix: address CodeRabbit comments - await disconnect, prune decayed co…
g-k-s-03 Jul 2, 2026
bfc1c9d
feat: implement basic keystore persistence and CLI wallet commands
SIDDHANTCOOKIE Jul 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 69 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,68 @@ MiniChain is a minimal fully functional blockchain implemented in Python.
implementing MiniChain in Python aligns with MiniChain's educational goal.


### Overview of Tasks
### Resources

* Develop a fully functional minimal blockchain in Python, with all the expected components:
peer-to-peer networking, consensus, mempool, ledger, ...
* Read this book: https://www.marabu.dev/blockchain-foundations.pdf

* Bonus task: add smart contracts to the blockchain.
---

Candidates are expected to refine these tasks in their GSoC proposals.
It is encouraged that you develop an initial prototype during the application phase.
## Getting Started

### Requirements
### Prerequisites

* Use [PyNaCl](https://pynacl.readthedocs.io/en/latest/) library for hashing, signing transactions and verifying signatures.
* Use [Py-libp2p](https://github.com/libp2p/py-libp2p/tree/main) for p2p networking.
* Implement Proof-of-Work as the consensus protocol.
* Use accounts (instead of UTxO) as the accounting model for the ledger.
* Use as few lines of code as possible without compromising readability and understandability.
* For the bonus task, make Python itself be the language used for smart contracts, but watch out for security concerns related to executing arbitrary code from untrusted sources.
- Python 3.10+
- Install dependencies:
```bash
pip install -r requirements.txt
```

### 1. Creating a New MiniChain
To bootstrap a brand new blockchain network from scratch, simply start a node. By default, this creates a new Genesis block.
```bash
python main.py --port 9000 --datadir ./node1_data
```
*Note: Keep this terminal open to interact with the node via the CLI.*

### 2. Connecting to an Existing Chain
To connect a secondary node to the network, start a new instance on a different port and point it to the seed node using the `--connect` flag.
```bash
python main.py --port 9001 --connect 127.0.0.1:9000 --datadir ./node2_data
```
The node will automatically sync the blockchain state via the P2P network using the Fork-Choice rule.

### 3. Mining Blocks
To confirm pending transactions, you need to mine blocks. In the interactive CLI of your node, simply type:
```text
minichain> mine
```
This runs the Proof-of-Work algorithm, validates transactions, computes the new state root, updates your wallet with the block reward + fees, and broadcasts the block to all connected peers.

### Resources
---

* Read this book: https://www.marabu.dev/blockchain-foundations.pdf
## Basic Operations (Interactive CLI)

Once your node is running, you can perform basic blockchain operations directly in your terminal.

**Making a Transfer**
Send coins to another public key:
```text
minichain> send <receiver_address> <amount> <fee>
```
*Example: `send 8b3401abedb875aff7279b5ab58cb9a0c... 100 1`*

**Checking Balances**
View the state of all active accounts and contracts on the chain:
```text
minichain> balance
```

**Viewing Network State**
```text
minichain> chain # View all blocks
minichain> peers # View connected P2P nodes
minichain> address # View your own public key
```

---

Expand All @@ -118,26 +157,28 @@ Check out the `/examples` directory for tutorials:

### Interacting via CLI
Start the interactive node using `python main.py` and use the following commands:
1. **Deploy:** `deploy <filepath> [amount] [gas_limit]`
2. **Call:** `call <contract_address> <payload> [amount] [gas_limit]`

---
1. **Deploy:** `deploy <filepath> [amount] [fee]`
2. **Call:** `call <contract_address> <payload> [amount] [fee]`

## Tech Stack

TODO:
Example deployment:
```text
minichain> deploy examples/counter.py 0 100
```

---

## Getting Started

### Prerequisites
## JSON-RPC 2.0 Server

TODO
MiniChain automatically spins up a JSON-RPC 2.0 server alongside the P2P node. By default, it binds to `port 8545` (the standard EVM RPC port). External wallets and dApps can use this to interact with the chain asynchronously.

### Installation
**Example Request (Get Block Number):**
```bash
curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "mc_blockNumber", "id": 1}'
```

TODO
Available endpoints include: `mc_blockNumber`, `mc_getBlockByNumber`, `mc_getBalance`, and `mc_sendTransaction`.

---

Expand Down
Loading