Watts Kendall

Watts Kendall

1548295618

Blockchain made easy

Introduction

Bitcoin and cryptocurrencies made a lot of noise lately. I have been rather disappointed by the turn the cryptocurrencies took, from an amazing concept to what seems just another way to make quick money ( or not... ).

But I became very interested by the technologies enabling cryptocurrencies, and obviously by the concept of a blockchain. The concept is fascinating, and not limited to Bitcoin and friends. We could imagine many applications for such a technology. So, in a proper developer manner, I decided to code one blockchain, or what I think is a blockchain, to understand better what it is.

A simple project

So, what do we need to create a very simple blockchain?

  • A block

A block is what the blockchain is made of. In our case, a block will be composed of a date, an index, some data ( a message in our case ), and the hash of the previous block.

  • Cryptography

To keep informations secure, we need to encrypt our data. For our little project, we will use the js-sha256 package. This process will create a string of 64 characters. Ultimately, our blockchain will be a series of hashes, each composed of 64 characters. As I said earlier, we use the hash of the previous block to encrypt a new block ( that is why we call it a chain ).

  • Difficulty and nonce

We don't just create one hash per block and that's it. A hash must be valid. In our case, a hash will be valid if the first four characters of our hash are 0. If our hash starts with '0000......', it is considered valid. This is called the difficulty. The higher the difficulty, the longer it takes to get a valid hash.

But, if the hash is not valid the first time, something must change in the data we use right? If we use the same data over and over, we will get the same hash over and over and our hash will never be valid. You are right, we use something called nonce in our hash. It is simply a number that we increment each time the hash is not valid. We get our data (date, message, previous hash, index) and a nonce of 1. If the hash we get with these is not valid, we try with a nonce of 2. And we increment the nonce until we get a valid hash.

  • Genesis block

Their must be a first block in our chain. It is called the genesis block. Of course, this block can't use the hash of the previous block because it doesn't exist. We will just give it some arbitrary data to create its hash.

And that is pretty much what we need for our blockchain.

The methods

We will need a few methods to make a functional blockchain:

  • initialize our blockchain => creates the genesis block
  • hash our blocks => a function responsible for creating a valid hash
  • check the validity of a hash => does our hash starts with 'OOOO' ?
  • get the last hash => we need the previous hash to create a new block
  • add a new block => We need to do that at one point, if we want a chain

THE COOOOODE !!

Let's get coding now.

For this little project, I will create two files, one called index.js and another called blockchain.js. The second one will hold our little module to create a blockchain. It's straightforward, let's take a look at it:

const sha256 = require('js-sha256').sha256

const blockchain = (function(){
const blocks = []

const initBlockchain = () => {
const data = ‘Hello World!’
const timestamp = new Date()
const previousHash = 0
const index = 0
hashBlock(data, timestamp, previousHash, index)
}

const hashBlock = (data, timestamp, prevHash, index) => {
let hash = ‘’, nonce = 0

while( !isHashValid(hash) ){
  let input = `${data}${timestamp}${prevHash}${index}${nonce}`
  hash = sha256(input)
  nonce += 1
}
console.log(nonce)
blocks.push(hash)

}

const getLastHash = blocks => blocks.slice(-1)[0]

const isHashValid = hash => hash.startsWith(‘0000’) // Difficulty

const addNewBlock = data => {
const index = blocks.length
const previousHash = getLastHash(blocks)
hashBlock(data, new Date(), previousHash, index)
}

const getAllBlocks = () => blocks

return {
initBlockchain,
getLastHash,
blocks,
getAllBlocks,
addNewBlock
}
})()

module.exports = blockchain


So, in this module, I have a few methods. At the top, I import the module that will handle the cryptography part. I have an empty array that will hold my blockchain’s blocks, called blocks.

initBlockchain: This method starts the blockchain by creating the first block, the genesis block. I give it a timestamp, a message, the block’s index in the blockchain ( 0 ) and a arbitrary previous hash because there are no previous blocks in the chain yet. With all these informations, I can now create the hash for the genesis block.

hashBlock: This method takes all the block’s data and creates a hash. As you can see, the first time we run the function for a specific block, the nonce is set to 0. We encrypt our block and check if the hash is valid with isHashValid. In our case, a hash is valid if the four first characters are 0. This is called the difficulty. This is the problem we have to solve to make sure the block can be part of the blockchain. Once the hash is valid, we add it to our blocks array.

addNewBlock: This method is responsible for creating a new block. We only need to give it the message as an argument, because all the other arguments ( index, previousHash, and timestamp) can be found in the blockchain. The method calls hashBlock with the data to create and validate the new block.

getLastHash: The method I call to get the previous hash. We always need the previous hash to create a new block.

getAllBlocks: Just returns all the blocks currently in the blockchain

Great, so let’s move to index.js to use our new blockchain!

const blockchain = require(‘./blockchain’)

blockchain.initBlockchain()
blockchain.addNewBlock(‘First new block’)
blockchain.addNewBlock(‘I love blockchains’)
blockchain.addNewBlock(‘Make me a new hash!!’)

console.log(blockchain.getAllBlocks())

We initialize our blockchain, then we create three new blocks. When I run this, I get the following chain in response:

Initializing the blockchain
139355
30720
68789
51486
[ ‘0000d87875f12e8c00d60cdfc8c21c4867eb1e732d3bb0e4d60bd0febcfafbaf’,
‘0000331d80f4e83461bad846e082baa08c5e739edfa19a4880c1dcbe4eed1984’,
‘00000dcab247410050e357158edc20555cc0110429023fdadb1d8cda3e06da5e’,
‘0000a16968811cf75c33d877e99f460d396c46b5485f669c8e55b193b862106d’ ]

The array represent the four blocks. As you can see, every single one of them starts with four zeros, so every single hash is valid. If one of those hashes didn’t start with four zeros, I would know right away the hash was invalid, therefore, the data in the corresponding block should probably not be trusted.

There are four numbers here: 139355307206878951486. These are the nonce for each block. I printed them out to see how many times the function hashBlock ran to come to a valid hash.

The first block, the genesis block, ran 139355 times before having a valid hash! The second, 30720 times. The third 68789 times and the fourth 51486 times.

Conclusion

This is a very simple example of a blockchain. I’m pretty sure I missed a few things here. I also kept things pretty simple because hey, I’m learning! This little project made me understand a few things:

  • If one person decides to modify a previous block, she would have to change every single block after that one. Each block inherits from its parent ( previous hash ), so trying to cheat a blockchain seems complicated.
  • But if a majority of the blockchain’s users decide to cheat, they could modify a previous block and all agree to change the rest of the blockchain accordingly. A blockchain seems to work only if the majority decides to follow the rules. Or you could end up with two different blockchains, one where the users decided to stick with the original data, and the other where the users decided to use the modified blockchain.
  • I’ve heard about the Bitcoin enormous use of power where it came to mining. Mining is the concept of solving the difficulty problem when you encrypt the data. You get the transaction and you try to find a valid hash for that block. As a reward for your effort, you get some bitcoin. I can only imagine the amount of power you would use when the blockchain becomes huge.

Well, that’s about what I got from that. It made things a lot clearer for me. Feel free to correct me if i got things wrong!

#blockchain #bitcoin #cryptocurrency

What is GEEK

Buddha Community

Devin Pinto

1606217442

Blockchain Certification | Blockchain Training Course | Blockchain Council

In all the market sectors, Blockchain technology has contributed to the redesign. The improvements that were once impossible have been pushed forward. Blockchain is one of the leading innovations with the ability to influence the various sectors of the industry. It also has the ability to be one of the career-influencing innovations at the same time. We have seen an increasing inclination towards the certification of the Blockchain in recent years, and there are obvious reasons behind it. Blockchain has everything to offer, from good packages to its universal application and futuristic development. Let’s address the reasons why one should go for Blockchain certification.

5 advantages of certification by Blockchain:

1. Lucrative packages- Everyone who completes their education or upskills themselves wants to end up with a good bundle, not only is one assured of a good learning experience with Blockchain, but the packages are drool-worthy at the same time. A Blockchain developer’s average salary varies between $150,000 and $175,000 per annum. Comparatively, a software developer gets a $137,000 per year salary. For a Blockchain developer, the San Francisco Bay area provides the highest bundle, amounting to $162,288 per annum. There’s no point arguing that learning about Blockchain is a smart decision with such lucrative packages.

2. Growing industry- When you select any qualification course, it becomes important that you choose a growing segment or industry that promises potential in the future. You should anticipate all of these with Blockchain. The size of the blockchain market is expected to rise from USD 3.0 billion in 2020 to USD 39.7 billion by 2025. This will see an incredible 67.3 percent CAGR between 2020-2025. To help business processes, several businesses are outsourcing Blockchain technologies. This clearly demonstrates that there will be higher demand in the future for Blockchain developers and certified Blockchain professionals.

3. Universal application- One of the major reasons for the success of Blockchain is that it has a global application. It is not sector-specific. Blockchain usage cases are discovered by almost all market segments. In addition, other innovations such as AI, big data, data science and much more are also supported by Blockchain. It becomes easier to get into a suitable industry once you know about Blockchain.

**4. Work protection-**Surely you would like to invest in an ability that ensures job security. You had the same chance for Blockchain. Since this is the technology of the future, understanding that Blockchain can keep up with futuristic developments will help in a successful and safe job.

**5.**After a certain point of your professional life, you are expected to learn about new abilities that can help enhance your skills. Upskilling is paramount. Upskilling oneself has become the need for the hour, and choosing a path that holds a lot of potential for the future is the best way to do this. For all computer geeks and others who want to gain awareness of emerging technology, Blockchain is a good option.

Concluding thoughts- opting for Blockchain certification is a successful career move with all these advantages. You will be able to find yourself in a safe and secured work profile once you have all the knowledge and information. Link for Blockchain certification programme with the Blockchain Council.

#blockchain certificate #blockchain training #blockchain certification #blockchain developers #blockchain #blockchain council

5 Blockchain Applications That Have Transformed the World of Technology

The blockchain is the decentralized database of the blocks of information, which gets recorded in the chain format and linked in a secured crypto graphical manner. This technology ensures proper safety of the data due to its secure nature, and it totally changes how people carry out transactions. It also brings about a faster and secure process of validating information needed to establish reliability.

Though blockchain technology came into the market to carry out only digital transactions, it is now used in various industries like supply chain, finance, health care, and many more.

The blockchain technology has made its position in mobile app development as well. Blockchain applications are transparent and accountable. From getting easy access to medical records and buying insurance, you can see blockchain applications everywhere.

Here are some of the areas where you can see the use of blockchain applications and how they have changed various industries.

1. Ripple

Ripple is useful for increasing banking transactions. The implementation of blockchain technology in the financial sector is much more profound than any other sector. Ripple proves this. It is one of the greatest tools to record and complete financial transactions.

It develops a large network despite strict physical boundaries. As there is no such third-party involvement present, the cost of these transactions is lower than usual. At the same time, the network also remains transparent and quite secured.

It is normally seen that financial transactions that happen globally are

error-prone and take a lot of time. In addition to this, when the transaction

fees and exchange rates get added up, the total cost usually gets high.

However, Ripple offers real-time international transactions without spending too much money. It has the network of about 200+ institutions making the process affordable, secure, and fast for all sorts of international transactions.

2. Etherisc

This blockchain application helps in automating flight insurance. Insurance is another area where blockchain is gaining popularity. Through this application, insurers can make smart contracts rather than getting involved in the traditional contracts that are usually complex. Etherisc is the blockchain application that helps customers buy flight insurance. If the flight gets canceled or delayed, they do not have to wait for months to get the payment back. This application ensures an on-time payout.

#blockchain #blockchain-technology #blockchain-development #blockchain-use-cases #blockchain-a #blockchain-technologies #technology #decentralization

Devin Pinto

1606971339

Certified Blockchain Expert™ | Blockchain Certification | Blockchain Council

A multitude of use cases around the numerous industrial segments are now contained in the blockchain technology that once began as the underlying system for Bitcoin trading. One of the main impacts on the financial sector has been felt. Blockchain technology has been publicly adopted by businesses like JP Morgan. The financial sector is suffering from data protection problems, faster transactions, transparency and other bottlenecks that hamper the growth of businesses that rely on monetary transactions from banks and NBFCs. Blockchain could therefore be a possible solution here. Banks and financial sectors can easily solve the disadvantages that hold back the banks’ smooth functioning with Blockchain’s involvement.

Some of the biggest developments we have seen in the Blockchain sector are the development of Blockchain platforms such as Hyperledger Sawtooth, Hyperledger Fabric, Corda, etc This approved Blockchain not only ensures that the system operates efficiently, but also ensures that transactions take place at a faster rate. It actually helps the banking system work much better and in a more effective way.

How the financial sector is impacted by Blockchain:

1. Providing a safe platform-
The need for a secured platform is one of the greatest challenges facing most banking and financial institutions. As most of the transactions and other work have now been digitised, most banks and other allied companies are looking for a stable platform that is free of any mistakes or defects. In addition, there is also a high rise in the need for a network that can efficiently combat data breach problems, and so we have Blockchain. By time-stamping all information or data on it this DLT platform works. This guarantees full security. And with the introduction of approved Blockchain networks, the security feature is even more assured.

2. No third party- Time lag and paperwork are two weaknesses of the financial sector that appear to hold up the processes and ultimately influence the company’s efficiency as well. We can solve these problems with the assistance of Blockchain technology and thus ensure quicker transactions. Blockchain technology operates on peer-to-peer transactions, ensuring that for authentication and approval, there is no need to rely on a third party, which speeds up the transaction process.

3. Tracking and tracing- For banking firms, these features can be highly beneficial. Banks invest a large amount of money on authentication and verification, amid all the efforts of false identity cases, and fraud reports are growing, we can easily put an end to it with Blockchain. As data tracking and tracing becomes simpler and history can be easily traced back, compared to the traditional technologies that banks use, it becomes easier to rely on this platform.

These are the three big benefits that Blockchain can reap from the banking and financial field. Blockchain developers and Blockchain experts are in high demand because of this, and we will see an increase in this number in the times to come.

Conclusion- The Blockchain Council provides Blockchain with the best online certificate programme. This detailed curriculum will allow you to absorb all Blockchain-related knowledge while also learning how to incorporate it. Then what are you going to wait for? Register for today’s Blockchain certification.

#blockchain technology #blockchain development #blockchain expert #blockchain professional #blockchain developer

Ajay Kapoor

1623918965

Custom Blockchain Development & Outsourcing Company India

Being one of leading blockchain development companies in India, we have marked a niche by providing some successful Blockchain based software solutions on ethereum, hyperledger, Smart Contracts, and much more. You can leverage Blockchain technology to enhance data security, complete process automation, reduce data storage cost, eliminates duplication of data and reduce time,

We have industry best experts to provide you feature packed Blockchain development services catering to your business challanges. Get in touch now to explore the benefits of Blockchain for your business!

#blockchain-development-company-in-india #blockchain #blockchain-companies-india #blockchain-outsourcing-companies #blockchain-development-services #blockchain-development-company

Abigail betty

Abigail betty

1624384800

What is Blockchain? Blockchain Technology Explained Simply

Blockchain technology is a way of managing a ledger of records in a decentralized manner. It means that everyone participates in maintaining and updating the ledger, which makes it practically impossible to falsify.

While Blockchain technology is a good solution to the issue of centralization, it’s also very inefficient and slow, therefore it should only be used if the problem at hand is indeed centralization.

That’s Blockchain technology in a nutshell. If you want a more detailed explanation about the Blockchain and how Blockchain technology watch the complete video , here’s what I’ll cover:

0:54 - What blockchain aims to solve
2:48 - Bitcoin: the decentralization of money
3:10 - Decentralization opportunities
4:04 - Blockchain explained in a nutshell
5:16 - How does blockchain technology work
10:05 - Ethereum in a nutshell
10:26 - Private blockchains
11:40 - Public blockchains
11:58 - Is blockchain the next big thing?
13:12 - Conclusion

📺 The video in this post was made by 99Bitcoins
The origin of the article: https://www.youtube.com/watch?v=2yJqjTiwpxM
🔺 DISCLAIMER: The article is for information sharing. The content of this video is solely the opinions of the speaker who is not a licensed financial advisor or registered investment advisor. Not investment advice or legal advice.
Cryptocurrency trading is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#bitcoin #blockchain #what is blockchain #blockchain technology #what is blockchain? blockchain technology explained simply