BUILDING A CRYPTOCURRENCY WITH BLOCKCHAIN

BUILDING A CRYPTOCURRENCY WITH BLOCKCHAIN

If you have a cryptocurrency, then you own something digitally, you have an asset, considered to be a coin because it is relatively rare, hard to get and everybody also wants to have it. That’s what makes this digital property be considered money, hence has value and you can exchange for other things (goods or services) that you also desire.

Basically, that’s the same thing that happens with the printed paper you have in your wallet/pocket, it has value because the govern (the owner of the printer) it says so, and you trust them (don’t you?). Let’s not forget our internet banking account balance, that numbers are completely virtual (digital, there’s nothing concrete behind), it is money because you (and the others) trust in your Bank (as long as they are considered economically “healthy”).

In its not-so-technical version explanation, normally directed to business people interested in this subject, usually, blockchain is presented as a distributed ledger, a decentralized database with encrypted transactions. That’s perfectly fine, there’s no centralized server controlling the information (like a Bank, Govern, etc.), there’s no master, every participating node has its own copy, and when new data is appended, all of them has to come to a consensus that the new block is trustable, valid and consistency to be part of the chain. With the word consensus I mean, a complex mathematical cryptographic calculation that must be solved, otherwise the block is not valid and will not be appended.

By the way, the blockchain it is an append-only repository, nothing can be modified, only added.

For us, as software engineers, regarding this subject the most interesting to check out, is actually, what’s behind the scenes, that is, the technology that makes possible the existence of cryptocurrencies, the blockchain, I am referring to the software pattern called blockchain.

The blockchain is a pattern that allows constructing interconnected information (blocks) that are linked to each other using cryptography to ensure security and integrity. Any modification to any one of the blocks will turn all the chain invalid. It was made to be resistant to modification, getting the characteristic of being an append-only repository.

Check the image below, they are interconnected by their hashes, each block generates its identification (its hash) based on the identification of the previous one (previous hash), any modification on one of them impacts them all, invalidating and turns the chain untrustable.

In addition to that, the generation of the block’s hash might also take into consideration in the equation some other data (for instance, the total amount of the transactions in the block), this way the integrity would be impacted if any of the transactions is touched.

With this vision in mind… sounds like it is something suitable to build a chain of money transactions, isn’t it? So, let’s do it!

Here in this article, the aim is to analyze blockchain with a software perspective, and we will perform this implementing our own simplified version of a cryptocurrency.

CODING OUR CRYPTOCURRENCY

Let’s start with the Block, defining the data necessary that it should have to work a chain of blocks. The attributes below represents the block header information.

public abstract class AbstractBlock {
     
    @Getter @Setter(AccessLevel.PUBLIC)    private Integer height;
    @Getter @Setter(AccessLevel.PROTECTED) private String  hash;
    @Getter @Setter(AccessLevel.PUBLIC)    private String  previousBlock;
    @Getter @Setter(AccessLevel.PUBLIC)    private String  nextBlock;
    @Getter @Setter(AccessLevel.PROTECTED) private Long    timeStamp;
    @Getter @Setter(AccessLevel.PROTECTED) private Integer nonce;
    @Getter @Setter(AccessLevel.PROTECTED) private String  merkleRoot;
     
    ...
 
} 
 
  

We generalize all the information of a block in an Abstract Class, this way we can create later other types of blockchains for different scenarios, we’ll see (in a future article, hope so) that cryptocurrency is only one of them, and we will use this same abstraction to handle blocks for different solutions of Blockchain...

Read the whole article at... (the source code is at GitHub)

https://ualterazambuja.com/2018/05/15/building-a-cryptocurrency-with-blockchain/

Leonardo Reyes

PMO, PMO Consultant & PMO Trainer Implementing PMO, IA, Blockchain, Web3, NFT Advisor-Speaker-Author Top 4 (2022) & Top 8 (2021) PMO Global Influencer by PMOGA PMP PMI-PMOCP PMO-CC PMO-AU PMO-SR PMO-BR PMO-ST PMO-FO

6 年

Ualter Otoni Azambuja Junior muy buen artículo porque no lo compartes en el grupo PMOfficers?

要查看或添加评论,请登录

Ualter Otoni Pereira的更多文章

  • AWS Terraform Snitcher

    AWS Terraform Snitcher

    Snitch (chivato in Spanish, “dedo-duro” in slang Portuguese), if you usually watch CNN, mainly political subjects…

  • KUBERNETES OPERATORS IN GO

    KUBERNETES OPERATORS IN GO

    An Operator is a software application written to run over Kubernetes, extending its functionalities to manage other…

  • Microservices: Quarkus vs. Spring Boot

    Microservices: Quarkus vs. Spring Boot

    In the era of containers (the “Docker Age“) Java still keeps alive, being struggling for it or not. Java has always…

    3 条评论
  • AWS ECS EC2, Cloud & Containers, Part II

    AWS ECS EC2, Cloud & Containers, Part II

    In this two-part article about Cloud and Containers working together, here in the second part we will try out the AWS…

    1 条评论
  • AWS ECS Fargate, Cloud & Containers, Part I

    AWS ECS Fargate, Cloud & Containers, Part I

    Let’s talk about Cloud and Containers working together, in this article we’ll see (in practice) how to run, scale and…

  • REACTIVE PROGRAMMING WITH SPRING WEBFLUX

    REACTIVE PROGRAMMING WITH SPRING WEBFLUX

    REACTIVE PROGRAMMING Recently we are frequently hearing about a new paradigm of coding that is gaining more and more…

  • OAUTH2 & GOOGLE API PART II

    OAUTH2 & GOOGLE API PART II

    In the first part of this article we have seen an introduction regard some basic concepts of this industry-standard…

  • OAUTH2 & GOOGLE API PART I

    OAUTH2 & GOOGLE API PART I

    OAuth 2.0, commonly pronounced “oh-auth”, is an industry-standard framework for *authentication and *authorization…

  • Web Services Asynchronous

    Web Services Asynchronous

    Perhaps something very different and weird to see around is an asynchronous web services, but yes! This beast really…

  • Messaging Request/Reply

    Messaging Request/Reply

    Messaging Integration Style Fire-and-Forget Pattern When we think integration using messaging style, what usually comes…

    1 条评论

社区洞察

其他会员也浏览了