Web3 ethereum blog
For those who don't know about KryptoWar , it's a war game based entirely on the Ethereum Blockchain. We grab the army names, soldiers count, battles results directly from the Blockchain using Web3.
If you want to build a website or an app right now and want to store some data like usernames or recipes you will need to have your own database that will let you store and retrieve data.
This is very effective but it has some drawbacks:. Let's take the example of KryptoWar. Since we built our game on the Blockchain, any decentralized app could connect to our smart contract with Web3. Here are a few Web3. Following the same logic, they could then grab more data about the KryptoArmy and build their own game on top of this ownership. Building on an open system like the Ethereum Blockchain allows a new form of collaboration between companies.
It also makes anything that is built on the blockchain much more valuable, for example our armies are not limited to KryptoWar but could possibly be used in hundreds of games! There are still a few things that needs to be addressed for decentralized apps to really take off:.
This article also provides explanation of various pieces of technology involved in developing DApps. Decentralized Applications or DApps are applications that do not rely on a centralized backend running in AWS or Azure that power traditional web and mobile applications outside of hosting the frontend code itself.
These blockchain nodes do not require a leader which would defeat the purpose of being truly decentralized. These nodes are untrusted nodes running in an arbitrary sized network on various compute devices around the world.
DApps are the frontend apps which interact with these blockchain over an API. Ethereum is an implementation of blockchain technology that can run smart contracts. The Ethereum virtual machine is Turing complete and can run arbitrary computation directly on the blockchain network.
Whereas Bitcoin has a limited set of commands, an Ethereum contract allows an application developer to specify exactly what transactions can be performed on a contract. Smart contracts can enable an blockchain users exchange money and property or perform other actions among a group of users such as voting without any central authority.
For the Ethereum platform, the smart contracts are defined using a language called Solidity. Does the DApp have an UI? Unless your DApp is an automated process. DApps often have a UI component such as a web or mobile app, since often its a way for humans to interact with the smart contracts or the Ethereum network.
The Truffle framework provides a boilerplate called boxes , truffle-react , which derived from the create-react-app boilerplate code generator.
Have you designed your Smart Contract? The smart contracts defines the rules and transitions for your DApp and is the piece that runs within the Ethereum virtual machine. Avoid putting unnecessary logic into your Smart Contracts, as the gas to run its computation can be very expensive. It stores an unsigned integer storedData and provides a setter and getter. Truffle frameworks calls boilerplates boxes. The react boilerplate is based on the create-react-app boilerplate from Facebook.
This start two things. First, Ethereum Node emulator at http: Second it starts the truffle command line prompt. This will deploy the contracts to the emulated Ethereum network. Note, you can deploy to real Ethereum network later on by modifying the truffle-config. Now, you can add some interactive features into the DApp such as edit the App.
First all, we need to connect to an Ethereum network by getting a handle on the Web3 object and setting the provider. If you want to see how the DApp connects to the Web3.