Simple Blockchain Command Line Interface
- ⩩ SHA256
- 📦 Block: Index, Previous Hash, Timestamp, Data, Nonce, Hash
- ⛓️🧱 In memory array to store blockchain
- ⛏️ Proof Of Work
- 💻
↔️ 💻 Local Peer to Peer Network - 📜 Allow viewing event and protocol log entries
⚠️ Note: Data in the block is of typestring.
- Node.js ≥ v22
- NPM ≥ v11
- Git
# 1. Clone the repository
git clone https://github.com/whisky81/blockchain-cli.git
# 2. Navigate into the project folder
cd blockchain-cli
# 3. Install dependencies
npm install
# 4. Build and run the app
npm run build
npm run dev# Link the CLI globally for local testing
npm run link-cli
# Now you can run the CLI directly
blockchain- libp2p – Peer-to-peer networking framework
- chalk – Terminal string styling
- node:readline/promises – Promise-based CLI input handling
- node:crypto – Native cryptographic functionality
- node:fs/promises
📖 Part of the code and ideas were referenced from
https://github.com/0xs34n/blockchain
const config = {
addresses: {
listen: ["/ip4/0.0.0.0/tcp/0", "/ip4/0.0.0.0/tcp/0/ws"],
},
transports: [tcp(), webSockets()],
streamMuxers: [yamux()],
connectionEncrypters: [noise()],
peerDiscovery: [mdns({ interval: 2000 })],
};