Become an NFT Developer with Best Practice Way Part 2: Implement How Blockchain works using Python

image from Unsplash

in the previous chapter, we discuss the fundamental of blockchain, so in this chapter, we will discuss how to implement Blockchain Works using Python, so let’s see the table of content

  • Creating Blockchain Class and Constructor
  • Creating Method to get Transaction
  • Creating Sample Transaction

Creating Blockchain Class and Constructor

in first step creating blockchain class and the constructor

in this constructor, we have a previous hash property and transaction list parameter, and we join all the transaction list with the previous hash and separate them with -

after separating the string we created a hash with the sha256 method from the hashlib module on python.

Creating a method to get Transaction

after creating the constructor, we need to get transaction result so creating a method for it

in this method, we print the result of the transaction

Creating Sample Transaction

now creating simple transactions to see how blockchain works

and we see if we changed data the hash is changed differently

if data changed the token is changed frequently


In this simple program, we explain how blockchains work and create the unique token using hash, so we can easily understand it, thanks for reading, source code available on Github, see you in the next chapter

Make Indonesia World #1 Remote Worker Provider

Recommended from Medium

{UPDATE} jacht & overleven Hack Free Resources Generator

How to Build a Slack Bot with only Google Sheets

Intro to Zurb Foundation 6

Hack&Talent 2018: Jobandtalent Engineering Hackathon

Docker Desktop Has Been Hiding Things From You

Clean Architecture in Go

Quick Tip — How to convert a Java jintArray to a C++ std::vector

Keep Quarantined and Start developing

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Feri Lukmansyah

Feri Lukmansyah

Interesting with Blockchain and Opensource Project my journal:

More from Medium

How to upload your KCC NFT image using Python?

Nightingale Discord Bot

Top 5 smart contract platforms

How to Create Your Own Crypto Token