You are on page 1of 38

A Beginner’s Guide to Blockchain

Programming
Workshop 5th July

• Follow the instructions and send your answers to my mail:


eliana.quinonez@o365.unab.edu.co

*Check the following recording to understand better what to do: you


can check our class in teams (también puedes abrir la clase en teams y
encontrar la grabación en el chat de la clase)

• https://unabedu-my.sharepoint.com/:v:/g/personal/eliana_quinonez_
o365_unab_edu_co/EVu9NpNeI19LrCUJTBwHTKUB3n7CKQKzCtF2rUj
BzKLJ2g?email=eliana.quinonez%40o365.unab.edu.co
Video Activity
• (50 words) See the following video and write a paragraph about the
concept of Blockchain.
• What is Blockchain and how it works?

• https://www.youtube.com/watch?v=SSo_EIwHSd4
Answer:
Now, let’s read…

Use scanning and skimming strategies and share your ideas in a speaking way next class:
Introduction
You’ve likely heard of the concept of cryptocurrency and their mining process, which means
you have likely heard the term “blockchain” at least once or twice.

If you still aren’t really sure what it’s all about, don’t worry. You aren’t alone, as there are
many programmers out there who can’t accurately describe blockchain and cryptocurrency,
and a far smaller number actually puts one or both terms to use on a regular basis.
As you might have deduced from the name, a blockchain is a type of digital ledger that stores blocks of
data in an interconnected fashion. New data is added to the blockchain from a theoretically limitless
number of nodes that a blockchain can support. As the digital ledger is also decentralized, these nodes
can be located anywhere in the world.

Being decentralized also means that there does not need to be a single controlling authority telling the
blockchain how to operate; it will go through the motions of taking in data, offloading the verification
process, adding new blocks to the chain, and updating the nodes with the newest version of the chain,
all automatically.

Aside from storing a wide variety of data, each block also includes a timestamp about its generation
along with other classification data to ensure the chain easily knows how to sort the data. This is only
one of the ways in which blockchain technology promotes automation and ensures its decentralized
nature never needs to be compromised.
Blockchain offers an unprecedented ability to allow users access to their own transactions while at the same
time ensuring that all of the data in the blockchain remains both secure and immutable. If a transaction ends
up not matching what the chain expects, either when the block is first added to the chain or at a later point, it
is automatically deleted and replaced with an earlier, already verified, version of the corrupted data (if
applicable).
Additionally, if somehow a block is added that includes false data, it will still be detected, as 51 percent of all
currently active nodes have to sign off on the logical legitimacy of the new block before it will be accepted
permanently into the blockchain as a whole.
While this security protocol makes blockchain technology virtually tamper-proof these days, this may not
always be the case. The way to successfully crack blockchain’s security is well-known; it is just a matter of
someone coming along who is able to execute it.
Now, let’s move on to learn how one can become a blockchain programmer. Remember, learning to program a
blockchain is not a sprint. It’s a marathon. You first need to learn programming languages, take blockchain
programming courses online, and read eBooks and the latest news to come up with a working protocol.
Activities for Tuesday 6th July

• The following activities are going to be answered on 6th


July
Blockchain Maze
https://wordwall.net/es/resource/16821283
https://wordwall.net/es/resource/16720223

Capítulo 2
Introducción al tema
Answers
Vocabulary practice
• https://quizlet.com/_9q08rw?x=1jqt&i=2dfwo0
Problem
Answers
Let´s play a game
• https://view.genial.ly/60ac09d84cf10d0cfaa66a15/interactive-content
-quiz-arcade
Cryptocurrency Price

Do you think it is important to learn how to code blockchain?


Do you think it is difficult to learn to code blockchain?
Part 2 – Programming Languages
What I know What I don´t know
The Best Programming Languages for
Blockchain

Here is a look at a few blockchain programming languages, the purpose


they serve, and some resources for further learning. Each section will
be purely introductory, as the topic can get pretty extensive and full of
code.
C++
Let’s start with the oldest of them all, C++. The language came to life in 1985 through the efforts of
Bjarne Stroustrup. By then, the rudimentary C language existed, but it was process-oriented; C++
cropped up as an upgraded extension that is object-oriented (where data and functions are bundled
up into a package called “Objects”). For the complete freshman, an object-oriented product can be
reused on other platforms without the need for fresh coding.
C++ retained the efficiency, security, and flexibility of C. Its evergreen nature has made it the core
language for blockchain coding, including the bitcoin blockchain. Warning to the newbies, though:
As a type-only language with fairly outdated syntax, the learning curve is a bit steep. However, as
most blockchain technologies are written in this language, any efforts you put in to learn this
language will pay forth abundantly.
Here are a few more reasons why C++ is
preferred for blockchain coding
Better memory control. There are a lot of demands in the blockchain ecosystem. For instance, the
platform needs to be a secure fortress but at the same time execute transactions and interact with
all the nodes at a faster speed. For all these to happen, you need to have better control over
memory and CPU usage. C++ can offer you that.
Superb multithreading. Threads are a bundle of instructions that are to be executed at the same
time. During blockchain development, you will come across tasks that parallelize and those that do
not. Most languages can only handle one of these tasks and not both. Guess what, C++ allows you
to handle both simultaneously.
Compile time polymorphism. As was said before, C++ is an object-oriented programming (OOP)
language. It also happens that polymorphism (using a certain feature in several ways) is a property
of OOP. Now, by coding your blockchain through C++, you will be able to execute some tasks
separately, thus enhancing the performance of the entire digital ledger.
Code isolation. This archaic but revolutionary coding language has namespace features that can be
shipped from one place to another. But at times, collisions can occur and distort the entire system.
However, thanks to the language’s segmentation ability that groups various APIs differently, code
isolation/separation can become a little easier.
Maturity. As one of the oldest coding languages, C++ is mature and gets updated on a regular basis.
Besides that, the language sports practical features like debuggers and special analytical tools that
can detect or optimize various functions. This complexity and up-to-dateness of the language may
be some of the reasons why Satoshi used it for bitcoin’s source code.
Python
Python is another simple coding language for a beginner programmer who is afraid of C++’s complex
nature. It was developed in 1991 by a Dutch programmer by the name of Guido van Rossum. The
language’s structure is based on a simple premise: simplicity, readability, and minimalism.
The simple nature of this language has seen it be supported by a massive crowd of both new and
established developers. Rather than the curly brackets and keywords used in C++ to represent code
blocks, Python uses simple and less-scary white spaces.
Simplicity can be easily translated to mean inefficiency. However, Python is good enough to build
complex digital ledgers that are stable and reliable. And here is the best part: This language is
scripted and can be compiled and uncompiled. For instance, when you find a bug in your code, you
just fix it and reload your application.
For other languages like C++, you need to stop the app, fix the bug in your source code, and
recompile it before restarting the application. It’s quite a lot of work that can be avoided by choosing
Python. Additionally, the language offers developers a vast, free resource center that they can use to
write their blockchain code.
JavaScript
JavaScript is one of the most-used languages on the World Wide Web. If you want an interactive site
with beautiful UIs, this is the language to use. All the major browsers such as Google Chrome and
Firefox support it.
We already said that a blockchain is, roughly put, a system of blocks placed one after the other.
However, there is something special about this ledger—it’s immutable, meaning once data has been
written, there is no undoing. JavaScript is one of the go-to languages when making a simple but
tamperproof blockchain that is impossible for hackers and other deceitful individuals to alter. Just
one setback, though: The language lacks the SHA256 hash function.
Solidity
• This is the most complex, high-level language that applies JavaScript’s scripts and functions as
well as C++’s classes. The language is not only beginner-friendly but also offers tips and
instructions on how to go about using its code. While the language is not very complicated, those
who have a fair grasp of modern programming languages have an advantage.
• Even though Solidity is still trying to establish its footing in the coding world, Ethereum (the
second-biggest cryptocurrency after bitcoin) is already using it. Well, they made the language, so
it makes sense that they be the first ones to use it. Nevertheless, Ethereum blockchain is one of
the most efficient when it comes to speed and ease of creating smart contracts.
• So if you are looking to create a decentralized app, hold an initial coin offering, or build a secure,
immutable, and multipurpose blockchain, Solidity is the language to use. It's a must-know
language for anyone who wishes to integrate smart contracts in their digital ledger.
Go
GO is the short form of GOLang, a relatively modern coding language that was developed in 2007 at
Google and officially released for public use in 2012. This robust and multipurpose coding language
was created in an effort to combine both the syntax and user-friendliness of other common
languages like JavaScript while retaining the reliable security aspects of older languages like C and
C++.
GO inherently runs in an operating system, and this means maximum flexibility, especially when
dealing with several parts of a blockchain simultaneously. Ethereum’s SDK protocol is written in GO,
and there are many other blockchain applications of this language.
Reading Comprehension
• https://create.kahoot.it/share/blockchain-day-4/a929e9b6-ea04-4f46
-a956-2024aeb0f6c6
SPACE DOGGOS AND CRYPTOZOMBIES
What do you think Space doggos and cryptozombies are about?
Do you think you can learn about blockchain by using video games?
How to Become a Blockchain Developer
Although blockchain represents only a single item, there are different parts in it that developers can work on.
No one is restricting you from learning everything there is to a digital ledger, but it’s usually easier to start with
a smaller branch and master it fully before moving to the next. The core parts of a blockchain you can develop
include:
• Decentralized applications (Dapps)
• Smart contracts
• ICOs
Don’t roll up your sleeves just yet. The most skilled programmers usually browse through a storm of resources
on anything before getting started. So, once you are familiar with your preferred programming language, the
next best thing to do would be to read bitcoin’s white paper (unless you don’t dream of becoming as good as
Satoshi) and check out several books that go deeper into the technical details of the blockchain.
It doesn’t hurt to familiarize yourself with some of the terms and lexicons within the industry. If you want to
immerse yourself deeper into the blockchain world, then you need to buy some cryptocurrencies (just a few)
and play around with them to see how the platform works.
There are many entertaining yet in-depth courses out there that will teach you blockchain programming step
by step. Space Doggos and CryptoZombies are some of the gamified courses that turn work into play so
beginners can have an easier time coding.
Space Doggos is a space adventure game that teaches learners how to develop the Ethereum blockchain. The
game is detailed with several chapters and notes for gamers. The player will code the game’s characters (the
Dog, its costume, mood, etc.) and the environment in Solidity language.
As you move on to the next chapters of Space Doggos’ adventure, the code gets more complex. The concept is
almost the same with CryptoZombies. Take a look at the next section for places where you can learn to code a
blockchain in detail.
Now, let´s play a game!
https://view.genial.ly/60add8c1920d0f0dae999105/interactive-content-escape-impostor
EXAM TIME!
Programming Languages Answers
• Answers: (These characteristics do not belong to the programming
language)
• C++: simple (python), minimalist (python)
• Python: not so popular (solidity), misses 1 hash function (JavaScript)
• JavaScript: Process oriented (C++), Not so popular (Solidity)
• Solidity: Hard to learn (C++)
• Go: Expensive (none), popular (JavaScript)

You might also like