Tag: Cryptocurrency

I was interested in Bitcoin and Blockchain technologies for a while and in theory things look pretty simple yet so powerful. I really admire genius of Satoshi Nakamoto or whoever invented Blockchain based Crypto Currency and eventually I decided to implement my own simple cryptocurrency to study it better, as for me the best way to learn is to do it myself.

And the result is My Little Bitcoin – a simple cryptocurrency implementation on JavaScript in just about 650 lines of code (without comments and client). It also includes WEB GUI written on Vue.js where you can send coins and explore blockchain.

The structure

The project is based on Node.js and has following basic structure:

Library – consist of functions to help handle crypto currency in a simplest way

Store – this in-memory storage for blockchain, wallets, mempool and few other things

// Input
{
tx, // Points to transaction of referenced output
index, // Index of the output in the referenced transaction
amount, // Amount of the referenced output
address, // Address of the referenced output and also public key
signature, // Signature, signed by private key and can be verified by included public key
}
// Output
{
index, // Output index in current transaction
amount, // Amount of the output
address, // Address of the wallet (public key)
}

For demo purpose I created special mode that disables peer-to-peer module, reduces proof of work difficulty and adds one minute block timeout.