Blog Back to all posts View all authors

Understand and use blockchain

by Kamil Przybyło
September 20. 2018

The blockchain is on everybody's tongues. There is plenty of videos explaining this subject. However, it's usually told in a way making you even more confused. How about a lecture from people using blockchain every day? Let us guide you through all its mysteries.

Get to know basics

The blockchain is a structure. The structure is made to store data. This data is stored in a decentralized network. There is no main database. Every user of the network stores a copy of the whole blockchain. This solution provides a higher level of data safety. Why? When there are so many copies of the blockchain, you can easily tell which are correct and which has been changed by hackers. All you have to do is to compare the suspicious copy with the others!

Blockchain's anatomy


A unit of blockchain is a block. Rocket science, right? The block consists of fields that include the block number, a hash, the hash of the previous block and a nonce. Apart from these obligatory positions, there are fields that you can fill with the data of your choice, without limits.
The block hash is an encrypted string generated by all fields in the block. For this purpose, you can use an algorithm, e.g. SHA256.

Blockchain challenge

The idea of blockchain brings a difficulty. To make it work out block hashes should be easy to determine but finding the correct block hash shouldn't. It prevents converting all hashes in the blockchain and makes impossible to edit the block data. Every change, even of a single character, causes hash change. Blocks appeal to previous ones by their previously converted hashes.


The challenge begins when it comes to determinate the character string which begins every hash. There comes a nonce parameter! It has an interesting feature. You can change it as many times as you want without changing the content of the previous blocks. Thank the nonce, finding the correct block hash is possible.

How do we do blockchain?

We decided to start a blockchain training in the company. The key of the training was to implement our own blockchain. Our basic pair programming tool was Visual Studio Code. We also used JavaScript and node.js environment. In short, we have chosen the technologies known and loved by the majority of ServoCode team.
Everybody has implemented a simple class which facilitated a "pushBlock" method. Thanks to this solution, we could add a new block to the blockchain instance. Then it was dug according to the current difficulty level. By the end of the training, everybody had a fully correct blockchain with a genesis block - it includes data about the author and an exemplary Json as a block payload.

How are we going to use our new skills? What are the benefits of blockchain? Stay tuned, we will talk about it soon!

contact us

Have an idea ? Let’s talk

Office in Rzeszow
Office in Warsaw
CONTACT US
CONTACT INFORMATION

GET IN TOUCH

Fill up the form and we will contact you shortly

Name
E-Mail
Message

Company information

Fill up the form and we will contact you shortly.

ServoCode Sp. z o.o.

Jasionka 954E, 36-002 Jasionka, Poland

NIP: 8133719852

REGON: 364182909

KRS: 0000611643

We are using cookies to provide statistics that help us give you the best experience of our site. You can find out more or switch them off if you prefer. However, by continuing to use the site without changing settings, you are agreeing to our use of cookies. Read more

close