jjfattz / crypto-coin

A bare minimum implementation of cryptocurrency

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crypto Coin

This is a simple implementation of a cryptocurrency using TypeScript. This doesn't include any network implementation, just the blockchain instance on the local machine.

preview

File Structure

.
├── index.ts
├── jest.config.js
├── LICENSE
├── package.json
├── package-lock.json
├── README.md
├── src
│   ├── Blockchain.ts
│   ├── Block.ts
│   ├── MerkleNode.ts
│   ├── MerkleTree.ts
│   ├── NETWORK_WALLET.ts
│   ├── Transaction.ts
│   ├── utils.ts
│   └── Wallet.ts
├── tests
│   └── Merkle.test.ts
└── tsconfig.json
  • src/Blockchain.ts contains the Blockchain class implementation.
  • src/Block.ts contains the Block class implementation.
  • src/MerkleNode.ts contains the MerkleNode for the node definition of the MerkleTree.
  • src/MerkleTree.ts contains the full MerkleTree implementation.
  • src/NETWORK_WALLET contains the wallet address the Blockchain instance.
  • src/Transaction.ts contains the Transaction class implementation.
  • src/Wallet.ts contains the wallet class implementation.
  • src/utils.ts contains the needed functions for the other files.
  • tests directory contains the automated tests.
  • index.ts initialises the blockchain instance and tests a demo transfer of coins between two demo users.

Full step by step expanation is available in this Medium article.

About

A bare minimum implementation of cryptocurrency

License:MIT License


Languages

Language:TypeScript 98.7%Language:JavaScript 1.3%