-
The home page
-
The home page requesting a transaction
-
The transaction while it is pending. Block has not been mined.
-
A block that has been mined. Low difficulty for early blocks.
-
The home page after the block was mined and the transaction was logged.
-
The block chain after the transaction
-
You are able to mine blocks from other computers
Inspiration
I wanted to make my own cryptocurrency, mostly as a joke and just to learn more about using blockchain and decentralized networks.
What it does
Currently, it does not do much. It serves as a ledger that anyone can add any "from", "to", and "amount". After the transaction is requested, computers have to _ mine _ blocks to add the transactions to the blockchain. My program _ theoretically _ works as a P2P network, meaning other computers can run the server program and contribute to the same blockchain, but I am not so sure that works as of now.
How I built it
I followed multiple tutorials about creating a blockchain and P2P(peer-to-peer) networks in Python.
The blockchain acts as a linked list of blocks that store transactions as data and cryptographically secure hashes to prevent the blockchain from being rewritten. The blockchain and other information was accessible through a webpage. Peers can access the necessary information to get the blockchain and necessary information to contribute to the network. Once a block is mined and transactions go through, each node broadcasts the block's information so other nodes add the block to the blockchain.
Challenges I ran into
Going into this project, I was not familiar with how blockchain worked, or how to use flask to make dynamic websites. It was a struggle understanding the concepts before implementing them. I implemented a similar _ proof-of-work _ algorithm as Bitcoin and Hashcash where each user has to find some value that, when hashed, returns a hash less than some value. The largest challenge was trying to create a wallet. Bitcoin uses ECC (Elliptic-curve cryptography) to verify users, but I could not implement that while I was working on the project. Maybe someday...
Accomplishments that I'm proud of
I can run a program that has some semblance of a working cryptocurrency. Yay.
What I learned
I learned about how blockchain is supposed to work and how it can be applied, as well as how cryptocurrencies can be used and mined. I also gained experience working with flask to create a dynamic website.
What's next for PremCoin
Eventually, I will add a login with wallets that use public-private key pairs for verification so that transactions are actually recorded and meaningful. I will also add some reward for people that mine blocks. After that, making sure that the P2P aspect works is important for being decentralized.