Sunday, 31 March 2019

How to Integrate DApps and Cryptocurrency into Ethereum Network?



        There are two basic elements to be implemented when you build a DApp on Ethereum Blockchain. Those are smart contract and web interface. The smart contracts or multiple smart contracts that allow for customizing the access to Blockchain where we can store our data. Solidity helps for writing the smart contract in the Ethereum network. It also allows depositing ether into the contract only to be released by the third party. We could also modify to have the funds released based on some kind of chain event that won't require any user interaction. But, it is necessary to build a user interface that allows sending ether from one address to another.
Interacting with Ethereum Network:
        The basic difference from the traditional web application is that the Sequence it executes like User interface -> Smart Contracts  ->  BlockChain whereas the traditional application works as Front-End -> API -> MySql database. The heart of Ethereum power is EthereumVirtualMachine(EVM). It is co-located with full Ethereum Blockchain so anyone can download and run the node. EVM is the app server that's going to handle processing smart contracts and programming functionality. The other services through these nodes are SWARM for hosting files and Whisper for messaging in DApps. Every node runs the EVM. This syncs data to maintain the security and consensus of the Blockchain. Because of this, there is high fault tolerance and zero downtime which ensures immutability and block censorship.
Properties of EVM:
   1.  It is a run time Engine that processes smart contracts. Contracts are stored in byte code in blockchain so they can be compiled prior to deployment the blockchain. Also, it is limited access to other contracts.
   2. No Inherent access to file system, networks or processes
   3. Usually written in solidity. The other options available are Lisk, Bampoo,Viber.
   4. EVM does have non-persistent memory so you can run the variables that are used during the execution of a function and the function is completed executing they will no longer exist in the memory. If you want to maintain the data you can create the variables which will store the data in key-value pairs onto the blockchain.

     There are the number of different EVMs available that you can check at Github latest releases. The key to choose EVM is to an active community and contribute to those features that are available within that EVM. The Truffle and Ganache provide more of the visual interface in real time that how the wallets are changing and where the ether is flowing. Geth helps to run EVM on a testnet or mainnet.  The block explorer like Etherscan provides information that anything happened in the blockchain, whose mined them, what the block reward and how many transactions are in them etc., You can drill down the contracts and transactions that will provide you the information about from address, to address, current balance, the type of contracts,  bytecode processed by EVM, errors in executing transactions and warnings etc., In the contract, when you transfer tokens it actually sends it to contract and the contract is mediator for sending whatever the token is back and forth.

Building Simple DApp UI:  Ethereum Blockchain accepts programming instructions called smart contracts that are written in a language called solidity. Any Ethereum user can write smart contract put into the Ethereum network. This contract is performed by nodes on the Ethereum network which forms EVM. An application written using smart contract is called a distributed application or DAPP. The contracts creator pays participants in the Ethereum network to process that application using cryptocurrency called Ether. Your programming to be rock solid because you can't really change the smart contract once it is in motion. Fortunately,  the wallet's that are available on Ethereum.org includes options to try out your code on test network before any real money is involved so that you can check and double check your code for smart contracts.
       This is the basic interface for interacting with our smart contract. It used the bootstrap for simple layout purposes and using the jquery, we can interact with Ethereum network. It allows to
enter the Ethereum address and where we are sending it to and there is an approval process in the interim. This application will help you to deposit the ether into the contract. Also, we have the ability to get the balance and see who the approver is. Finally, we have the ability to approve the transaction which will clear the data out of the smart contract and send it to the recipient.

     It is all set up. Now, we are going to write our scripts to do all the action. Web3.Js is the javascript library that will interact with DApp. It is the standard for how we are going to interact with our client-side applications to the Ethereum network. Also, you can see different packages which allow interacting directly with blockchain. If you want to enable interaction with Metamask, Metamask should be injected its own web3.js. Web3 is easy to implement and enables to do a lot of interaction with Ethereum blockchain. It can create new accounts, send Ether, add signatures to transfers, get balances from accounts, get transactions and transaction IDs etc.,

Deploying to Ethereum Network: Once you developed and tested your app, the next step is to install Geth on windows. Once you installed in your system, you need to create your accounts
that you use for testing and confirm the Passphrase that will give you the address. This is how connecting and synching to Ethereum main network. If you want to sync to Ropsten testnet, create an account in the command line interface and say geth -testnet account new. Then, we are going to type our passphrase and get our address. This is our Ox address. Now, we can go ahead and fire up Geth. You just put your address in ropsten.be:3001 and say send test ether. Now, you can see that Ether sent to your address with the 0x and shows the transaction that's currently pending. It is the ropsten version of Etherscan and not the main network. Once your server syncs up, it pulls the transaction and you can see the ether in your account. Deploying to the main net is exactly the same process. The difference is we're going to have our local network sync with the main net and not the ropsten net. So make sure that network id matches the main net with our truffle settings of Ethereum client. The most popular Ethereum client is Go Ethereum called as Geth. This is going to run a node of Ethereum, as well as EVM on your machine that allows you to migrate smart contracts to different networks.


Initial Coin Offering(ICO) of a Company: It differs from the Initial Public Offering(IPO) that the company floats its shares on the stock market for everyone potentially to buy. It is a fundraising mechanism that is regulated and tried. Usually, it occurs at the later stages of the businesses or after several rounds of funding. The ultimate goal of this company is getting the stock market or essentially selling a company's part of the shares on the stock market. Whereas ICO's most part isn't regulated and unregulated. It is obviously the early days of the crypto-based platforms. It usually occurs at the early stages of a company of an idea. Usually what happens is a white paper published along with their idea. The white paper from the technical point of view explains their concept of how their ideas going to occur.and what we are doing with less of a marketing document.

            The first thing you need to know is what does it sells. It sells new cryptocurrency tokens that underly the new products. So, you know that new products that our company has that sell the new tokens. This is exchanged for cryptocurrency of Ether, Bitcoin or something else. Most of the time the Ether or Ethereum based platform that you do is ICO. This is great for engaging with the company or the community with more about the personal touch. It is more like crowdfunding platforms such as Kickstarter and Indiegogo have given way to companies like Oculus where you don't give the share in your company. What you do actually is sort of just like give rewards. It is not like shares and you don't have control of a portion of the company but can be traded. Also, you can spend tokens on the stuff. Sometimes, it can be used on the actual company's product itself.
           There are fraudsters that they publish 10 to 20 pages with the marketing presentation of documents and not actually doing technically. So, there are institutions that are trying to fix this in certain conditions in place by having an escrow account that needs several signatures by different private keys to be able to get the funds and use them impartially.

No comments:

Post a Comment