What exactly is blockchain and how you can engage it in your business? Learn more: https://dac.digital/software-development/blockchain/

    Hi uh my name is Chris and I serve as CTO at DAC digital and I’m here today to talk to you about blockchain now before we proceed uh a few remarks this is a primary on blockchain but more uh targeting the technical audience so you’ll hear a lot of technical terms

    Here but you should use this as a baseline if you want to dive deeper into the Technologies revolving around blockchain if you’re new to blockchain overall there are better sources but if you want to understand and the technical intricacies this is the place for you without further Ado let’s proceed we

    Should cover some Basics uh before we delve into technical details so a first question that you might ask yourself even if you’re a technical person what is blockchain there are plenty of definitions but the one that I like the most is it is simply a database it’s a

    Temper uh resistant uh and immutable database and it’s structured in something called blocks where information is played bed in a blog that is cryptographically linked to its predecessor so if you create such a chain you create a temp resistant uh record of information blockchains are guarded by uh consensus algorithms and

    We’re going to discuss those in a few minutes blockchain would make little sense if it was just hosted on one computer then you can simply use a database obviously blockchain makes uh a lot of sense a ton of sense if you create a network of nodes that collaborate with each other where each

    Note can protect the security of the network where each note can uh store information from the blockchain and where each node is part of consensus algorithm that uh protects the network blockchain has some key characteristics that make it uh Stand Out among other Technologies first and foremost it’s

    Decentralized which means that there is no one single Authority that can overrule the decisions that were created as part of the network protocol it’s also distributed which means that ideally you do not host entire data set in one data center or on one note but obviously on network of noes it is also

    Based on a consensus which means that any information that is going to be committed to blockchain has to be agreed upon by the entire network by the rules of the protocol it’s also temper proof which means that once the information is stored uh you cannot uh fill with it you

    Cannot change it um and obviously by extension of that it’s also immutable technically if you change something on the blockchain the network would find that immediately because the the hash of that block would change and hence the entire chain going onwards will become invalid and it’s also transparent and

    Trustless and I particularly like the term trustless here which means that parties that do not trust each other by definition can still collaborate using blockchain Tech Technologies because the the transparent rules guard uh guiding the blockchain uh consensus guiding the blockchain protocol make it very easy to build relationships with parties that do

    Not have mutual trust uh as uh as core component of the relationships plenty of websites try to explain how blockchain works but I particularly like this one uh where we uh are delving into details that uh correspond to relevant blockchain Technologies u in a step-by-step manner so let’s do it

    Together first before we even explain what blockchain is it’s it makes a ton of sense to explain what is a hash now hash is in its simplest form a digital fingerprint of anything of information data an image a PDF document entire encyclopedia it’s always obviously dependent on the type of the hashing

    Algorithm it’s always of constant length which means that regardless of the input put I’m going to place you will always uh we will always yield the same uh length of the chain so here’s the letter a and you can see I have a hash of that letter it’s fingerprint take note of the

    Last uh four uh these are technically digits because it’s hexadecimal so take a note of the L last four digits D ffd so if I type it yet again it changes into the same hash which means it’s deterministic for the same input a has is always going to yield the same output

    And it’s also uh unidirectional which means that I can simply create a hash using input data but with just the hash itself I cannot recreate the input imagine I had uh this uh length of of numbers here of those hexadecimals you cannot imply what was the source if you

    Do not have the source if you have the source you can validate very easy hey that hash corresponds to that input but if you don’t have the source you cannot come back to it and to put some more context into this imagine uh that the risk of blindly finding the this the the

    Right uh input is less than 10 to the power uh of around 78 or 80 it’s a huge number uh for reference the amount of atoms invisible universe is around 10 to the^ of 8 more less so uh risk of blindly finding something here is far less significant than finding the right

    The same uh sent Grain on a beach or in a Sahara Desert after you’ve flown back to Europe and try to find it back again okay so that’s uh hash now what is a block a block is uh a data container where you can place again any amount of

    Data in blockchain it’s typically in form of text but imagine I’m putting here hello and uh as you can see um any information I’m going to place in the in the data uh frame uh corresponds to a hash being changed if I had an exclamation mark it changes now there is

    Another Concept in blockchain called Mining and Mining is basically trying to solve a mathematical riddle as a way to uh Safeguard the technology go into mining in in details thereof in a second but here just for the sake of explaining how mining a block works in this demonstration mining means trying to

    Find the nons which is a uh additional set of characters that will yield together with the data component a hash that has in this demonstration four leading zeros so when we Min it the process yields announce of 37,6 4 which uh concatenated with the data hello blockchain yields a hash

    Where first in this case even five leading uh digits are zeros and that’s how mining works in the proof of work and again we’ll discuss it in a in a second but uh what’s the point of it the point is to um give the entire network

    Um a task to solve and the first participant to do it will uh be rewarded now that’s the block this is block number one and we have a hash calculated for the blog as part of a mathematic riddle and we can then maybe even understand how blockchain Works uh

    Fairly easy because uh blockchain as the name implies is simply a set of blocks connected together in a particular way in blockchain this connection is referred by a predecessors hash as being part of the current current block hash so now we have here uh a simple demonstration with uh three chains the

    First block um has a predecessor has something called a Genesis block and here I can also write hello world and you’ll see I’ve calculated or I’ve Place information in the block and now I can mine it and upon mining uh you’ll see I have four leading zeros uh

    And the block is considered mined now at this time a point in time it could still be technically manipulated it’s the Lisk is really low but it still exists because there is no uh uh succeeding blog still linking to it and this lasts only a few seconds or few minutes

    Depending on the network but obviously there is much more than just that that safeguards the the blockchain but this is just you know to illustrate the potential risks so this is um The Block is considered mine and now we are starting to mine the second block so one two three

    Oops uh and as you can see here two uh uh components three in fact uh the data one where we store information uh the nons that’s going to be calculated in a second and also as a static component the previous blocks hash so now when I mine and the block is

    Considered mined uh what happens is that information linking it to a previous blog becomes part of that block in the blockchain so changing something uh in the first one would uh already make this one invalid and that goes on and on for the same process happens here you can

    See the previous block DP links to this uh block number two dbe and the hash is calculated with the nons being changed to 100, 557 and that goes on and on and on so you can see the blockchain is simply a way of making sure that you cannot temper with history you cannot

    Temper with previous information and hence creates a very long set of chained components uh that are easily searchable through certain apis and through certain providers available on the net but are constantly growing so unlike a typical database where you can Purge data you can trate data remove it in the

    Blockchain you cannot remove history from from the blockchain it stays there forever it’s embedded in history and will not be removed under no circumstances which is something to be considered when designing applications that are gdpr privacy sensitive but that’s just a a side step now let’s come

    Back to our main lecture so blockchain is typically two U types much like we had uh the late 90s and early 2000s the intranets and the internet we have the same history in blockchain repeating itself we have permissionless blockchains also called public blockchains that are what they should be

    They are decentralized there is no there are no entry barriers uh anyone can participate and run their own note anyone can interact with the Ledger anyone can submit transactions and um um mine cryptocurrency or be part of the crypto economics that is connected to blockchain and then there are permission

    Ones also called uh private blockchains sometimes referred to as consortion blockchains uh where a large Consortium typically looking into that technology but hesitant to share it with the general public creates an internal blockchain gu Guided by different rules with entry barriers with permissions required to participate and typically with no

    Cryptoeconomics uh we’ll talk about crypto economics in a second why it’s relevant uh for for now just understand that crypto economics or using cryptocurrencies and tokens is relevant only in the public blockchains there’s another term that’s very technical but it’s also crucial to understand um meaning blockchain uh especially

    Ethereum based blockchains as a global State machine now a state machine is a fancy word for computer Global computer you get a set of inputs and using those inputs you move from one state to another state like imagine like a function that takes few arguments and changes the output of that function

    Think of it in a larger grander scale of global uh ecosystem Global Network blockchain is a just as I said a set of nodes that are connected to each other in the network and each holds a copy of that ledger and stores a new copy of that state being changed the challenge

    When designing blockchains is to create it in such a manner that those states are promptly synchronized across the entire network so when uh one node receives information that a cryptocurrency should be sent from wallet a to wallet B that information has to propagate promptly throughout the entire network but um there’s much more

    Than just cryptocurrencies blockchain being a state machine can also run programs and we’ll discuss that also further uh later in the lecture now transact transacting with the blockchain requires um wallets which is a fancy way to just say requires a private and public key public and private key

    Cryptography is one of the core foundations of blockchain but there’s there’s been a lot of efforts to make it easy to understand and easier to work with for people who are not at home uh with cryptography in its uh most understandable form I wallet address is

    The public part of the key that connects uh that gives you right to transact with whatever is part of a wallet or as part belongs to you on the blockchain there was a common misconcep ception that you know wallet is just either Hardware component or a piece of paper that I

    Have and that’s it wall it’s not like that it’s just a way to help you understand how blockchain Works wallet is just a key that unlocks the right to perform certain actions with things that are connected to that particular key on the blockchain so you don’t physically hold cryptocurrency on your Ledger on

    Your piece of paper no that’s not the case what is is the case is that on the blockchain on the public blockchain there is information that a certain amount of cryptocurrency or tokens is connected to a certain key and that key has the right to work with it hence it’s

    Always visible which Keys have how many cryptocurrencies or which wallets have how many cryptocurrencies uh and um these wallets can then transact or work with that cryptocurrency basically by signing a new transaction and allowing that cryptocurrency to flow from qy a or wallet a to wallet B since cryptography

    Makes a lot of effort to safeguard uh information and at the same time we try to make it easy to understand for General audience or web three audience the blockchain community has created process called pneumonics where um from a set of I believe 248 uh pre-selected words that are um

    Distinct from each other so there’s no like cat and cats so from those 2048 words we generate something called aonic which you can see here on the left and that pneumonic uh then is used to recreate uh Master private key and from that Master private key subsequent private keys and then wallet addresses

    Are recreated which again gives you the right to um interact with whatever belongs to that uh private key on the blockchain in evm Chains or ethereum chains uh um wallet uh address looks like that it starts with ZX and then there’s a set of uh hexadecimals that

    Identify the public part of um of the wallet of of the key uh now like I said um previously we have coins and tokens as part of uh the blockchain uh component and they are typical of public blockchains now why is that um imagine that in order to run a sec

    Secure network all those computers have to be connected to uh to internet so any every node um that runs a full blockchain node full etherum node has to be connected which also means it consumes a certain amount of energy now it will be very difficult to incentivize

    People bar the True Believers of of blockchain to uh run a computer constantly 247 uh pay for electricity and be happy with that so one way to do it is to is by incentivizing the people uh who run the network using crypto economics using using coins and

    Tokens uh although this term is probably slowly fading away initially coins were the cryptocurrencies Native to a network and tokens could have been built on top of existing uh network but forget it for a second um what I want you to take away from this is um if you want to uh

    Incentivize people to be part of the blockchain um you should uh give them some sort of a reward for safeguarding the ecos system the entire uh uh Network and that’s where crypto economics kicks in um another term that’s also important to understand uh before we go into conrete examples are zero knowledge

    Proofs uh they’ve been part of uh cryptography for a long time I actually I don’t even know how long but there’s been a lot of working with them uh in the crypto uh graphics uh um sphere but they’ve come to uh uh gain traction and attention in the blockchain

    Ecosystem um in recent years uh particularly as a way to mitigate exploding costs so in order to understand how uh how they work with blockchain first we need to understand what are Z knowledge proofs and that’s very simple so imagine you you have a cave um you have two uh actors two

    Participants you have uh Bob here on the left and you have Alice in the cave now uh Bob wants to uh see that Alice has a key that opens the door at the end of the cave Alice would like to prove that she has the key

    But she doesn’t want to reveal that key to Bob much like I don’t want to reveal information to a bank maybe or to a government’s official but I want him to uh be sure that I have information for example I am full of age and I can

    Participate in election but I don’t want to show my ID card so Alice has the same dilemma she doesn’t want to show the key to Bob maybe Bob wants to run away with a key maybe she’s just shy but she like to prove to Bob that she has the key so

    Bob and Alice come up with an experiment okay um so if you do have the key then uh I’ll just step outside the cave and so he does and tells Ellis I would like you to come from Corridor a uh now he doesn’t know where Ellis

    Went did she go through the B Corridor and is here at that part of the door or maybe she went in here and she’s just waiting here at that part of uh of the corridor so he comes in and says hey Alis please come out through uh Corridor a and so she

    Does now at this time he might presume she has the key but you might also presume it was a 50/50% chance that she really had the key uh so maybe it makes sense to repeat the experiment maybe she was just lucky and I’m about to lose uh an

    Experiment so they repeat that two three four five seven thousand a million times with with each consecutive repeat uh when Alice still does the the same thing as she’s supposed to so they always challenge themselves with through which Corridor you’re supposed to exit uh Bob can be almost certain again

    It’s statistics so there is no 100% but he can be as good as certain that she does have the key uh and that’s how zero knowledge uh proofs work it’s it’s a way of proving um having something having some information having some having a key without truly revealing the key or the

    Information to the uh recipient the person I’m talking to okay so now let’s talk about blockchain consensus and as we move on right now in the discussion uh this will become much more ethereum or evm specific so as we’ve been discussing right now something more general in general

    Terms um as we move on in that presentation you’ll see much more information that is typical of evm chains and um for a good reason it’s become a def facto standard for blockchain development uh like I said there is one key characteristics uh of blockchain uh being that they are based on

    Consensus uh like I said during early parts of that lecture um there is no Central Authority governing over blockchain there is no uh admin there is no super admin there is no DBA that can change information arbitrarily there is consensus there’s a network of equally important notes or

    Participants but since there is no Central Authority they have to agree um on how things should happen on blockchain and these rules are guided uh U by the protocol rule Set uh but uh in its simplest form and its simplest explanation they make sure that if we all follow those guidelines

    The information that we put on the blockchain we all agree upon so there is no way of me saying I have for example 10,000 ethers if if I don’t because um the rules that are coded in the protocol rule set including the network that is um incentivized to safeguard those rules

    Will say and will call my bluff and say well you don’t have those 10,000 uh ethers uh and there are probably probably even more but three core like basic components basic consensus algorithms that are part of blockchain uh um ecosystem the first being proof of work uh and it’s typical of

    Permissionless or public networks and this is basically the demonstration I showcased you uh previously with hash block and blockchain where uh the entire network all nodes are incentivise to solve a certain riddle and if that riddle is um uh solved by first participant very easy the rest of the

    Network can confirm that the solution is valid and that a person or that note will receive reward from the network as coded in the protocol go for Sol solving the riddle um this is typically a set amount of native currency and then we move on to the next

    Block uh what’s the problem with this technology well as you can imagine and doing a lot of comp computations especially cryptographic computations is very expensive in terms of costs you need equipment you need to run this equipment you need to have it connected to the network and you need it to draw

    Power from from the grid so as the technology became more um popular among uh the audience globally uh the energy costs for Running P networks like Bitcoin for example uh have gotten some um negative negative traction negative uh publicity um throughout the media um it’s consum it’s time consuming it’s energy

    Consuming it’s um often times energy waste because well the value of blockchain is not easily recognizable by everybody so uh in order to mitigate it um there were few evolutions of uh consensus the most popular one being proof of stake where instead of uh solving a riddle doing mathematical equations uh miners or

    Validators uh will um give a set amount of their own currency as as uh as a way to hedge risk they will put it in in a contract and from there on they will be able to validate transactions uh again as Guided by the the protocol rule set they will be

    Randomly awarded the role of validator and they will uh adhere to the rules and say that under certain uh conditions um the block you’re trying to uh add attach to the blockchain is valid and if they try to uh to cheat the system and work in their own Advantage the network can

    Always challenge them and uh they will lose a certain amount of their stake uh that was quote unquote hostage uh for their for for for them to behave properly so there is a financial incentive they will get rewarded or when they validate correct blocks then and the network confirms that there was no

    Cheating and they’ll be uh uh punished financially if they do something that does not adhere to the rules this is much more energy efficient you do not you do not need heavy equipment to mine and to solve uh equations so no gpus no uh strong wattage required to run uh machine or machines

    All you need is just a server that has a Noe uh full node synchronized and then you can become validator if you are willing to B 32 e in part of in in the uh in the example of ether uh as as your hostage uh and then there’s also POA or

    Proof of authority which is typical of permission networks where a validator is pre-selected uh from all Network participants you can have set amount of validators ideally no no less than three and then based on a certain uh associations or certain rules they will be granted the role of

    Validator uh every now and then and they will perform the same action as validator and POS and proof of stake uh does who uses those uh typically again public uh private uh consortia like Banks or like shipping companies but we’re seeing um less and less significant uh adoption

    Of uh public of of private blockchains uh so I see this more as a as a Nuance as something interesting something worth noting but not something relevant to the entire uh uh ecosystem of blockchain as we see it fit okay so now that we’ve talked about consensus you understand more less the

    Rules that that guide attaching information to blockchain let’s focus now on ethereum and evm chains and then obviously smart contracts and uh decentralized applications ethereum was conceived uh by vital buin it’s a Russian Canadian uh that saw certain uh shortcomings of Bitcoin that he actually was in a Mor

    With uh first and foremost uh Bitcoin was limited simply to sending uh Financial transactions e- money or digital money uh vitalik had a grander vision for blockchain being it a global computer which is a I think that’s difficult to wrap your head around with uh but bear with me for a second it

    Makes sense a ton of sense uh so he came up with his proposal for uh bit for ethereum uh around 2015 uh and him and a bunch of uh very talented programmers uh including U Gavin Hood um created etherum protocol uh now ethereum is public uh blockchain

    Uh it is uh enhanced with scripting functionalities uh and allows you to create uh the centralized applications you’ve probably seen them you’ve heard about them you might have you in touch them without knowing that you’re working with the centralized application much like I said that blockchain is a global State machine

    Ethereum is This Global computer we were talking about and uh it’s become a de facto foundation for the centralized internet or web3 Internet initially it was uh very much focused on uh P or proof of work with a fairly low amount of transactions it was still conceivable but as uh the network of

    Participants uh grew as the use cases around evm or ethereum uh grew as well it became uh crucial to guarantee um low costs and also uh allow the amount of throughput and the amount of transactions that was increasing with the adoption of blockchain so um since evm and um

    Writing smart contract codes on ethereum became the facto standard more similar Networks uh also um came to surfaced um some of them basically copying um the rules that guide uh etherum chain as a compatible chain like being bed uh some tried to uh do the same with

    U building a second layer on top of block on top of ethereum uh much like uh arbitrum or optimism did uh with zy rollups and optimistic rollups and that’s why I said it’s so crucial to understand what zero knowledge is because if you want to understand layer

    To um and the rollups zero knowledge rollups you should also understand what zero knowledge is obviously so now we have a plethora of networks that are compatible to ethereum that can run the same code that might have different way to create consensus that might have different way to torent bundle

    Transactions but on the surface they are compatible to evm and uh the the root uh of their technology lies with ethereum so that’s why ethereum is so important to really understand uh blockchain as the technology we are discussing today now um why I’m repeating so much about decentralized applications and and

    Decentralization well it’s because ethereum enabled us to move from web 2 to web 3 if you recall web 2 it was that Network that allowed us people also to create content not just consume what’s already on the web but also to actively participate in creating and providing value like submitting Instagram pictures

    Uh writing uh Facebook posts or blog posts uh but it still reli heavily on centralized infrastructure web three is trying to address the last part to decentralized infrastructure uh so blockchain uh when we discuss blockchain in the context of uh web we will oftentimes hear the term

    Web3 uh web3 uh can be connected to using certain libraries that are part of um JavaScript framework uh one of them being web3js the other one being ether’s uh JS and um it allows us to uh interact with blockchain as if it was just a storage layer or or information hosting

    Layer um as I said there are cryptocurrencies involved in ethereum ecosystem as well um the native currency of etherum is ether and uh it can be subdivided into one and 18 zeros away and each further unit has then um slightly different name obviously to correspond to the the amount of basic

    Units as part of it now unlike uh Bitcoin where there’s a fixed and defined maximal amount of um cryptocurrency that’s going to be mined in in Bitcoin that’s 21 million ethereum doesn’t have that limitations although it has um slowly stabilized around 120 million currently uh why is it relevant because

    When there’s demand increasing for uh certain Network um interacting with this network will call for this currency also to be part of uh uh of your wallet uh which also will create uh probably price increase pressure on the market for since everybody wants to have that currency in your wallet and that’s why

    We see those uh demands uh spikes and downs in cryptocurrency demand it’s basically to cover cost to interact with the blockchain with the network and why do we need that well for gas uh much like our computer Burns electricity um to run programs to execute code or we also need to provide

    That that energy that electricity uh to blockchain so when we want to transact with the blockchain we want to uh change something on the blockchain we need to supply it with um electricity that is going to be uh it’s called gas that is going to be then

    Awarded to the miners uh as the ones who are actively participating in running the network uh you purchase gas with your ether and it’s pretty transparent uh in terms of how it works it’s basically every operation that that is executed on the evm um can be translated into basic op

    Code it’s just like in Assembly Language you have some codes for subtraction adding logical uh ORS ands uh exclusive ores all that and every operation that you perform um can be translated into basic operation codes uh each of those codes has a gas price attached to it for

    Example the most expensive operation you can get is s store or uh storing on the blockchain so putting information on the blockchain um and so if you want to save something on the blockchain you have to submit a lot of uh gas as the price for the transaction much cheaper

    Transactions are like uh adding subtracting or creating U memory variable uh why is it relevant well because in the end we want to create new products on on blockchain using blockchain uh those products are programmed and when they need to be programmed there’s also a need for a programming

    Language uh which in case of evm chains uh has two uh versions the one that’s more popular is called solidity and the one that’s uh more pythonic in design uh is called uh Viper uh so using solidity using Viper you can create any conceivable program that will be executed on the

    Blockchain um blockchain and and solidity are touring complete languages which means that uh anything that you can think about can be coded using solidity and can be run on ethereum blockchain uh the things that you create and the things that you run are called uh decentralized applications sometimes

    Called simply dabs and this can include things like um exchanging um cryptocurrencies using decentralized process this can be creating um art galleries this can be having a game or even gambling or um things like that uh adap is somewhat different from a typical application that we know from uh our development

    Process when we have a very traditional application like web application think here Facebook think Instagram you have a consumer that can be browser it can be a mobile application then you have server or backend that um guarantees that user connecting from a certain session is authenticated is authorized that server also has static

    Components like htmls uh JavaScript and CSS documents uh that are static in nature so they don’t hold any information uh it serves those components to the browser or to mobile device and uh using program executed based on Those comp components the user can interact again through backand and store information in

    A persistence layer uh being a database be mongodb can be your SQL database uh DBS are different uh the only thing that in an ideal scenario is pulled from uh the server are static components so anything that does not hold uh user specific information we have again htmls javascripts uh

    CSS and that is then run again in the browser but from the browser you connect to the ethereum network or to blockchain network it’s like receiving a a token from from your back end here that allows you to write directly on AWS S3 that’s somewhat comparable so when

    You have those uh assets loaded when you’re application is started or the application you will connect through a web3 injector um wallet can be metamask can be today even coinbase wallet uh and number of other wallets and using if you want to uh change something you are the

    One who is making commits to the database commits to the network commits to the blockchain so you sign a transaction locally in the the comfort of your browser and then send it onwards to the etherum network here uh in a typical application you send the data

    And it’s the server the back end that makes sure that you are authorized to change the data and uh then based on that author authorization changes the state in the database in a application or tab uh you are the one who basically says hey it’s my data so I can change it

    I’m the one who’s triggering a change and no middleman no server has anything to say about that uh like I said to languages uh solidity is the one that’s more popular uh in um in in the case of uh syntax it somewhat resembles um JavaScript um but uh it is still more uh

    U adjusted to uh to blockchain it’s a static language so there it’s you know what JavaScript was supposed to be uh solidity has really implemented there is uh the types are statically defined uh and um well yeah looks like that um now um in terms of information

    And and calling or changing data uh reading data and writing data there are two types of transactions that are taking place as part of evm one are being called calls and calls are simply readon operations which are um typically free of charge if you see a

    Function that has a a view modifier this means that this function only reads data from the blockchain and this will cost you nothing reading data from the chain is a free operation if you have your own noes the only costs that you have are associated with running that node if you

    Connect to U public nodes like infura or like Alchemy the cost will be probably defined by the amount of calls that you can make free of charge under up to a certain limit and then there are transactions and transactions are the state changing operation so if I transact with the

    Blockchain it means I am changing its state I’m sending something sending currency sending new information uh calling a uh smart contract uh on the blockchain and I need to pay for that because as I said since it’s a global database Global Network of noes uh changing information uh um on ethereum requires

    Me to pay for that um it’s also asynchronous while calls are synchronous which means means when I uh uh call A View function I will get the result immediately um in the transactions that has to be Min that has to go through the entire um blockchain interaction process

    With block being packed into a block or actually well first into the manool then from the M Pool into uh a transaction and then uh into a block uh it also means that when I create a transaction I will not get immediately confirmation that this transaction was successfully

    Executed um now in terms of how do I write blockchain codes well there are a number of uh Frameworks the best way to start is to use remix IDE it’s uh it’s a web application uh available under this address and it allows us to sim ulate running a local blockchain using the

    Browser environment it allows us to connect to test Nets which will cover in a second and it allows us also to cover to connect with the main net using uh injectors like like metamask um remix is great for your first uh initial touch with uh with blockchain uh gives you all the bells

    And whistles that you require in order to write and deploy code into um eum or evm compatible network now as your skills progress uh you’ll be wanting to write code also locally and there are a number of um established Suites U the older one is called travel Su suite and uh has

    Three core components travle is well basically the framework to build smart contracts uh ganach is a local U test net test net Dev net difficult to name and drizzle with their frontend libraries that make building applications easier uh it grew over time with all the historical technical Deb that still

    Remained so a way to mitigate it was to build something new uh and that’s where hardhead came to scene which has gained a lot of uh attention and traction over the past years and has uh become probably a tool of choice to develop smart contracts for most of web3 developers

    Nowadays um there’s also um framework called open Zeppelin which uh gives us readymade libraries that you can use in your uh web 3 uh Adventure uh certain contracts certain standards like a token contract erc20 nft contract ERC 721 can be already imported from from open Zeppelin and

    Fairly easy deployed as your own new cryp cryptocurrency or your own uh nft token uh what’s the benefit well open Zeppelin contracts are audited if you see solidity code written using um open Zeppelin libraries you can be fairly certain that it’s of good quality uh it’s uh already audited unless someone

    Has really changed a lot of um uh features or functions available from open zeppin in their own code it’s uh it’s a good building block to start your adventure with uh now if you want to really run your own own notes locally then there are some options available you can do it

    Really uh using the native uh the official uh ethereum client it was provided by eth foundation and it’s written in go it’s called G then there’s uh one that used to be called parity written by Gavin wood and it was written in Rust uh but since Gavin wood has um

    Switched his Focus uh on poka dot um the community has taken over parity and released it as open ethereum so you have two established ways of running local noes there’s also Java based hyperledger Basu that you can also use probably uh a good amount of others as

    Well but these two are your good choice if you want want to run your own notes now bear in mind today to run your own Noe you need very expensive equipment with SSD and a lot of SSD space because the blockchain is growing so you might

    Uh want to skip that part and utilize hosted notes and the two ones I can recommend if you really want to start your adventure with uh with with blockchain would be infura and Alchemy uh Alchemy in my opinion being fairly better than infura with good amount of products and libraries also

    Made available by them to the Developers now when you build code uh you do not want to deploy it on the main net so the main Network um from day one um an old prb I used to hear over and over was uh who is uh who releases

    To production directly uh is the Courageous one which is obviously stupid you should never test in production you should always test in a very safe environment uh and for that reason we have something called has Nets uh that try to emulate how a network behaves it’s it’s also run uh in a decentralized

    Manner it can be also deployed locally if you want to have a private test net and uh using those test Nets you can T Test the behavior of your smart contract and your application in a safe environment that will cost you nothing um like I said one of the most

    Expensive operations uh when it comes to blockchain to come when it comes to evm is to store information on the network on the blockchain why because imagine all of us wanted to save our movies or images on the blockchain and blockchain is hosted in the same size on all full nodes that

    Would mean that the the amount of uh space required would grow exponentially so we are punished for storing too much data on the blockchain so what is a good practice well good practice is to use uh decentralized storage uh systems like ipfs which stands for interplanetary

    File system I kid you not and um images or asset stored there can be linked through their hash because ipfs addresses data using hash of that data and then stored uh as this hash link um on the Block so as a good example imagine I have a wedding recording that

    I want to share with uh my family and since I’m hip I want to share it using blockchain for whatever reason that is so I would put this wedding video on on ipfs probably I would use a service like pinata to also pin that information to ipfs because if that information is not

    Distributed across all the nodes it will vanish when the note that hosts it goes offline uh and then the the hash of that wedding video would be part of a contract uh that I can read and then upon reading I can get that uh image or that video uh

    Um well I can get it found um then there’s also the topic of forks uh Forks happen when blockchain diverges into two potential paths forwards um it can relate to network transaction history it can be a new rule that is being decided uh upon which we deciding which

    Transaction is valid it can be um users showing their support for one or the other way of blockchain moving forward which we’ve seen in the case of um ethereum and ethereum classic um and we have two types of fors a hardw fork is caused by a software

    Upgrade that introduces a new rule into the network makes it also incompatible with the with the old software meaning that if you want to run network using that particular uh version uh or that particular note you would have to uh update your infrastructure and the soft Forks are the ones that are still

    Backward Compatible they might change some logic but not to a huge extent uh now another important topic I told you that you cannot uh that I I said that anything that changes the state of blockchain has to be put there as a transaction blockchain program programs smart

    Contracts don’t have the way to see outside of of uh blockchain so what is an arle oracle is a trusted provider of data that is external to blockchain it can answer a question that is external to the network but crucial to the uh Network’s execution why are they needed well some

    Programs are um requiring outside information for example in logistics you might have a smart contract that says if the temperature of your goods being transported exceeded a certain amount of degrees you would want that contract to be voided and you don’t want to pay for that transport because maybe the

    Shipment of oranges has gotten rotten now that information has to be provided to the smart contract by a trusted Source by someone who can vouch with their reputation for that information and that’s where oracles come in oracles provide data upon request from the blockchain smart contract can request information saying hey quote

    Unquote I need temperature readout from track ABC and that information can be then conveyed through an oracle that will wrap this as a transaction and send information back to the blockchain as a transaction so that a we have origin of that information and then um the payload that is crucial

    To to contract execution again it all boils down to the fact that consensus rules and the execution of the evm must be deterministic it must be based only on the shared context of the information that was provided to all participants not just one reaching out and saying I

    Need that information as a closing uh process of our today’s lecture um um we have a very simple contract uh here on um on remix that’s the tool I told you about it’s uh basically just a small owner contract uh sorry it’s the one I wanted

    To that’s the one I wanted to show you the storage contract where I have uh just a small variable and I can hold u a number in that variable and I have two functions one is uh just a retrieve function which is a view function reading data from that uh um from that

    Blockchain from that uh uh variable and the other one is a storage function uh that um puts that information onto uh into the contract now first we can compile it and you’ll see that solidity has compiled this as a valid code and then I could deploy it I

    Already have have done this but let me do it once again and I will deploy it using metamask and I should have it connected I do it’s on a test net um and then allow me to deploy I will confirm that transaction now we need to wait for it

    To get mined it can take up to 15 seconds depending on the network when it gets mined you will see that there is a contract deployed here so bear with me for the next few minutes minutes or seconds now we can see it’s already deployed and there’s an contract

    Address just like your wallet contract has its own address it start with zerx and I uh can interact with this contract based on the methods exposed to the outside or functions exposed to the outside first one let’s first let’s store something well let’s let’s retrieve something first nothing it’s no

    Data there so let’s write an information one to three uh as you’ll see writing information will call for a transaction to happen so again I need to sign that transaction and then wait for this transaction to be mined by the network which means to be confirmed by the

    Network it’s still uh in pending State and now it’s mine and if I retrieve the the data you’ll see that I have retrieved the one 12 three version now what happens if I try to retrieve data before it was mined you can see this right now 999 store again sign the

    Transaction and now until it’s mind it’s still going to be 123 eventually when the transaction gets mined so in a window of around 15 seconds in this particular Network you’ll see that this value here will have changed to the one I have mined so now it’s 999 okay thanks so much for uh

    Participating in this lecture today I hope you have had fun with those initial demonstrations and initial steps into the blockchain Technic 101 if you have any questions if you would like to dive deeper don’t hesitate to reach out to me or to DC Digital we’re happy to help we

    Are the experts in blockchain and we’re there for you thanks so much

    Leave A Reply
    Share via