Inspiration
I wanted to challenge myself today by creating my first full-scale project in Python while simultaneously introducing myself to the syntax of blockchains. While I'm moderately well-versed in cryptocurrency on the surface-level, I have never interacted with the blockchain before in a coding environment. Thus, I hoped to establish my understandings of programming concepts which would allow myself to work with crypto APIs and functions in future projects!
What it does
PyCoin is a program which demonstrates the structure and usage of a basic blockchain within the Python language. It is a simple Proof-of-Work token which is capable of establishing nodes, creating and mining Blocks within its own Blockchain, and transferring tokens between two nodes.
PyCoin will automatically check for errors in transaction data before attempting to push through faulty sends. Additionally, PyCoin will check for mismatches between nodes and their balances, as well as invalid mining hashes. While it does not meet the expected security levels of a full-scale industrial cryptocurrency, it is sufficient for preventing unintentional errors from hacking seeking to conduct their first learning experience with blockchains.
How we built it
I used Repl as an online IDE/repository to code and compile the project using standard Python dependencies. The project runs on two Python files: main and blockchain (separated for clarity and convenience). Blockchain.py defines an object class for each Block and the overall blockchain, which is used to hash and store a non-malleable transaction record of our digital cryptocurrency. Main.py runs our tutorial and demonstration, utilizing our blockchain object and functions.
Challenges we ran into
Though I referenced several tutorials to help me construct my first blockchain, these tutorials did not detail how to properly call or interact with any functions within the Blockchain class, nor did they implement any protocol for handling nodes or balances.
On my own, I had to figure out how to implement nodes, balances, and transaction protocol with very little knowledge of the Python language beyond basic syntax. 48 hours ago, I did not even know how to index variables within a list. Now I'm calling complex functions in Python in a cryptocurrency environment!
Accomplishments that we're proud of
Completing my first full-length Python project, as well as my first coding experience within any blockchain!
What we learned
I now know how to define objects in Python, work with SHA-256 hash functionality, index variables within a list, build and access a block within a blockchain, send and receive transaction data, and communicate between two basic cryptocurrency nodes!
What's next for PyCoin
My next challenge will be learning Peer-to-Peer functionality, which allows for the sending of coins between two decentralized clients and the syncing of blockchains across platforms. With this knowledge, I'll be able to establish a standalone cryptocurrency project of my own and address social issues through the power of decentralization.
Log in or sign up for Devpost to join the conversation.