Blockchain for Web Developers
(upbeat music) (audience applauding) - Thanks for inviting me here.
So quick raise of hand anyone here have heard of Blockchain? Probably everyone.
Anyone here have a wallet account? They're all respective wallets.
Anyone here is a Bitcoin millionaire? (audience laughing) All right so my talk will be about Blockchain and why is it relevant for web developers, specifically. I've had fair amount of battle scars with Blockchain. And, it's a very painful experience for the past two years. Dealing with Blockchain, and a lot of lessons learned and a lot of things that I wish I knew, when I started. And which, at the end of the slides I'm gonna show a very quick slide where it's probably good to have Blockchain and when it's actually bad, to implement Blockchain. So just a quick one, I work for Readify.
I am also a Microsoft MVP.
I'm blockchaining since 2015 and I'm, you know, I might be of same name as the guy from Ant-Man but I'm not that guy.
So, the question of everyone, even me up until today is, why the heck do we need to care about Blockchain? When I started my training with Blockchain, I came from a mobile developer, web developer, slash, also become interested with distributed systems.
So, with Aha! and all those bicentene fault-tolerance concepts.
And you'll come to a point where Blockchain will be an inevitable force of nature that will just suck everything up because it's just somehow relevant, to everything. It's like becoming the web direction of JavaScript. So, it's very relevant, I would say.
I think we're currently in a state where we have surpassed the hype cycle.
It's not about proving what worked and what is not working. It's a very exciting time to actually get yourself on board, because three years ago the two links are not there. It's very, I would say, the two links are not very intuitive compared to what we have today.
All because with the help of the progression as well, with web developments as just you know, ReAct, Redux, and Node.js in particular.
But then to answer, why Blockchain? I guess the reasoning for that, for on my journey, is that I've worked with financial industries for quite some time and a lot of the pain points are happening between reconciliations.
Either it's gonna be a private Blockchain or a public Blockchain or private transaction or a public transaction. There's always a problem with reconciliation. I've actually worked with a specific product about making sure that the credits are aligned. You know that the credits that happen from one database, same with the credits that happened to another database and it's also the same with the credit that happened to the provider.
The payment provider.
And it's very expensive and it's very tedious to compare those data, and often times that actually results to why our financial transaction systems are not that real time.
It probably takes days or weeks to actually reconcile. So I think that's where I came from and that's my reason why I have that belief that Blockchain has a space in this world.
Besides that it actually became more than just that. It's now the number one most growing skill, or the most in demand skill now a days.
At least in the Q1 of 2018.
Mostly because of ICO's and a lot of investments from BC's putting their monies in Blockchain and they need a lot of Blockchain engineers. It takes a couple of mix and match between technologies to actually become a Blockchain engineer.
And it's also an avenue for start-ups, so traditionally start-ups actually run into VC funding and stuff like that.
I'll try to figure out if it's through and ICO which is you create your own tokens and actually wish that people actually trade their token or Bitcoin or ether, or whatever, to your token and they believe in your product and so eventually and your product become successful, that actually, you know, get something in return. And my specialty lately is it's also a catalyst for business.
When I first thought about Blockchain I thought it's always just gonna be about public distributive letters. But it turns out there are used cases.
Blockchain could also make sense between two different enterprise companies. So, hence, it doesn't really need to be public although that's gonna be disputed if that's really a Blockchain or not.
But, for me, the mere fact that there are parties participating, that's a Blockchain network for me, So just a quick run through, just a recap.
I know you guys probably have heard this a million times, what Blockchain is and probably attended some sessions of how to explain this to your kids, or how to explain to your grandma or granddad. There are just three things that you really need to know about Blockchain.
It all goes down to understanding what is a block? And what makes it a chain? And the whole concept of mining.
So, in essence a block is basically a collection of facts. So a fact could be your transaction records, anything. It could be, it's something you want to append to the series, that is immutable, it cannot be deleted, it cannot be updated.
All you can do from one block to another is just append and append.
Then where the chain comes in is that, all those blocks are chained together through their Consensus Algorithms, such as proof of work or proof of stake.
So in the case of proof of work, what that means that all participating nodes should agree that this is the real value of the blockchain. So, basically if one node is irrelevant it's fine. It's totally decentralised and what that means is that they have a consensus on what's the real value. So what that encompasses is that no central authority or no centralised database can actually take control of a master data, or master record.
Because everyone have their own copy of the letter. That's how it works for good or for bad.
And where the mining comes in is that there are pseudo transactions in the Blockchain. There are these facts that been waiting to be mined. And how the mining works is that there are different nodes participating so that they can probably guess what's gonna be the next mine.
And whoever were able to guess the sequence right will get a reward.
That's the reason why a lot of people wants to participate in creating their nods or to do mining is because they'll get a bitcoin or an ether.
Once they were able to predict it.
But it was designed in such a way that it's not that predictable.
You have very small odds of winning the guessing of the pattern.
Hence, that's why it's more appealing because there's more challenge to it.
It's like the more nodes participating the less odds you are going to win.
But then it provides more security and more network for the Blockchain.
So it's like all the nodes are helping each other to make the network alive.
And by random someone will win from time to time. And reep the reward.
So nowadays there are a lot of platforms now you can use in your blockchain development. My personal favourite is Ethereum mainly because, of the community group and it's widely adopted, not just in the public space but also in the private space.
Next would be Corda.
Corda is also gaining a lot of tractions in the enterprise space, and Neo is also becoming popular because of a wider range of audiences within the Asian region.
So just a very run through of what a Decentralised Application is, or we call it DApps. It's an app but with a D, because it's decentralised. That's why it's called a DApp.
The whole concept of a DApp is that it shouldn't reside on a central database.
There shouldn't be any centralised database in place. It should be distributed and it should be decentralised. So, that if one node crashes, if that server crashes, it's still alive.
The application still lives.
And here's a sample DApp Architecture, specifically, for Ethereum and how it works in your browser. So the way it works is that you do have a DApp web browser in this case it's not your Google Chrome or Firefox.
It's probably any sort of Blockchain browser but in the case of if you want to use Google Chrome, there is an extension called MetaMask that allows your Chrome instance to become a DApp browser. Then it communicates using your HTML, CSS, JavaScript. And it uses the web tree .JS, which is the next Java Script communication framework that allows you to communicate with Ethereum the EMP through RPC.
Then if you can see here is that this is the one instant and this is the other instant.
Hence, it's distributed but there's no central database or sort of data warehousing happening here. All the data are in those EVM's, so each EVM holds a master record of the whole sequence. And what really interests me with Blockchain, is that the whole concept of Smart Contracts and Smart Contracts, basically allows you to make sense out of the ledger. Because the ledger itself is just about appending records in sequence right? And it's immutable, you can not change it, it's forever there, it's fully transparent. But what makes it more intuitive is the idea of having Smart Contracts.
Smart Contracts allows you to process transactions. It eventually cuts the middle man, and it becomes the new middle man.
So, for example, if you think about it a lot of organisations are actually a bunch of middle men in order transact one asset to another, or one value to another.
So the whole point of Smart Contract is how can you facilitate the movement of assets and tokens across different participants.
In particular, for Ethereum, you use the programming language called Solidity. Solidity is inspired by C++, Python, and JavaScript. That's why it's very intuitive and formulary. Mostly for everyone.
This is a sample code of Solidity, if you kind of look at it, it's very C++ like syntax.
What's probably gonna be interesting is this guy, contract. So instead of having a class, a contract represents a class, sort of that analogy. Then you do inheritance here using the ERC keyword. So the ERC20 Basic comes from that one.
Using your import statement, then just a quick plug in what ERC20 is.
ERC20 is the protocol that each Smart Contract, not just those three that are in Solidity, but any participating Blockchain who wants to join the ICO. So if you are thinking of creating your own coin you might actually need to make sure you are ERC20 compliant.
So, what tools can you use? These are probably the very basic tools that you can start with.
Coming from the Truffle framework, which is Truffle, Ganache, and Drizzle.
Truffle actually allows you to, it's all dessert, it's very sweet.
Truffle allows you to create a mock Ethereum client in your developer machine.
So instead of actually setting up your whole infrastructure of Blockchain you can just create a local instance. You know using truffle.
It also comes with demands to compile and integrate your Smart Contracts.
Ganache is a very minimum instance of an Ethereum network, it's like you have your initial accounts, you have your mining happening.
And lastly Drizzle is a way to make it more intuitive, by connecting it to read offs and react.
So, for web developers here, Drizzle might be a good way to start or a good way to go.
Continuing you can use any text editor.
Just like what I mentioned earlier, you need to have a special browser which can be accomplished using MetaMask and you can use Etherscan to actually scan records across the whole chain.
Environments, so this is where it becomes more interesting. There are now a lot of ways to deploy your Blockchain. You can use the MainNet which is the public Ethereum network, which you know Ether is, the whole cryptocurrency of Ethereum is.
Or you can use the TestNets.
There are a lot of TestNets such as: Ropsten, Kovan, and Rinkeby.
Here's where it gets more interesting.
The cloud providers are actually racing against IAM. In terms of private Blockchain, or the consortium Blockchain, because we have actually come to a point where Blockchain is not just for public, it could also work between companies.
So they're all racing against time of creating the IAAS templates or the whole Scaffold.
And a more advanced Scaffold solution we have right now is also coming from Azure which is their product called Azure Blockchain Workbench.
Something you need to understand about Blockchain is that not everything should actually happen inside the Blockchain.
Some stuff, you're gonna hear it often, some stuff, will happen off chain.
So off chain means your own database, your own private keys, your own sets of public and active directory, and stuff like that.
And you're just utilising the Blockchain for anything that you want to actually share amongst different parties.
So that's a very important terminology that you probably need to explore further.
So we've come, after two years of doing Blockchain, the good use cases, I would say, if there are parties who wants to participate and don't actually treat each other as enemies or rivals. And if you think the current transaction flow or movement from one asset to another takes really, really long time, or is so expensive. And lastly, it's that if auditing aspect or being transparent is actually part of your business. It does make sense to do Blockchain.
But then on the latter part, it's that for me it doesn't make sense if you are treating the Blockchain as a Centralised Database or a key value pair, just for a look up table, it totally doesn't make sense. If you're approaching it in that way.
And if there are no partnership or inter-business transactions, you don't need Blockchain for that.
You just need a database.
Lastly, it cost something to set up all the nodes, all the VM's communicating to each other.
There's a cost alongside with it.
And if the cost is too high for you that it doesn't really bring a lot of business impact. Then, again, Blockchain is not the right fit for you. And so we have five more minutes left, I'm gonna say thank you, and I'm open for any questions.
(audience applauding) (upbeat music)