Table of Contents

    Blockchain technology is used in Bitcoin, Litecoin, Ethereum digital currency.Blockchain can be defined as distributing digital information across the network. It is immutable. Each Individual data has only one owner. Blockchain is one type of Digital ledger that stored in a distributed network. Blockchain technology allows to timestamp digital information so it can not possible to temper digital information. Any digital information (Ex. Transaction ) are stored in blocks. All the blocks are connected To each other using cryptographic algorithm.

    Manektech offers reliable Blockchain development & consulting services that streamline business operations as well as make them more secured. We have a pool of Blockchain experts at Manektech that provide strategic advice on the successful implementation of Blockchain technology to maximize business outcomes.

    What is Block in BlockChain?

    Block is one type of data structure that store digital information. Each block contains Data, Hash, and the previous hash of the block. Because of each block contain previous hash it becomes more secure from attacking Information in blocks.Suppose attacker change content in block 2 information, the hash of block 2 also changed. But block 3 has still old hash of block 2. So Block 3 and all other following block has not The correct hash of the previous block. So changing in a single block makes invalid all other blocks.

    So blockchain technology is secured against modification of data. It is immutable.The blockchain technology uses a peer-to-peer network for distributing information. In the distributed peer-to-peer network every one able to join the network. When someone Join in the network he gets a full copy of blocks. When a user creates a new block, it sent to all user in the node. Each node in the network needs to verify the blocks that it is not altered. After verifying blocks each node add new
    Blocks in the blockchain.

    How Transaction in Blockchain work?

    Someone request transaction in the blockchain network.The requested transaction broadcasted to the P2P network with the help of connected Computer in the network which we called nodes.P2P Network of nodes validates the transaction using algorithms. Once the transaction verified it is combined with other transactions in the network for Create a new block of data. The new block is then added to an existing blockchain network that is permanent and Unalterable.

    Block Structure SnapShot:

    Sample data structure for blocks

    Data: Any data that is included in the block
    Hash: A sha256 hash taken from the content of the block
    Previous hash: A reference to the hash of the previous block.

    Blockchain Version

    Blockchain version 1.0

    Version 1.0 used in blockchain in cryptocurrencies Eg. Bitcoin. Used in Decentralization of money and payments.

    Blockchain version 2.0

    Version 2.0 used in Smart Contracts, the deployment of smart properties, digital assets, and smart contracts.The program that written to perform execution on some condition from the blockchain.Eg. Ethereum

    Blockchain version 3.0

    Version 3.0 used in the decentralized application. It uses decentralized storage and decentralized communication and has their backend code running on a decentralized peer-to-peer network, a blockchain.

    Blockchain version 4.0

    Version 4.0 used in industry, enterprise resource planning, integration of different execution systems, supply chain management, IoT data collection, and asset management.

    Integrate Sample Ethereum Client App in Android

    Use open-source library web3j for integrating into an android app.
    Link:- https://github.com/web3j/web3j/tree/android

    Create new android studio project and implement a library in Gradle file

    compile ('org.web3j:core:3.1.1-android')

    Visit https://infura.io and register for api key

    Connect to ETH network node:

    Use permission :

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    private void connectToEthNode() {
    web3 = Web3jFactory.build(new HttpService("https://rinkeby.infura.io/v3/{YOUR API KEY}"));
    try {
            Web3ClientVersion clientVersion = web3.web3ClientVersion().sendAsync().get();
            if (!clientVersion.hasError()) {
                showToast("Connected");
            } else {
               showToast("Error to connecting");
         }
        } catch (Exception e) {
         showToast("Error to connecting");
       }

    }

    After Connecting to ETH node, You can create a wallet in your app local storage.

    Create wallet file path in app Ex. getFilesDir().getAbsolutePath()
    Use your external storage for storage path..

    Create Wallet

    private void createWallet(String password){
    try{
          fileName = WalletUtils.generateFullNewWalletFile(password, file path);
          walletDir = new File(walletPath + "/" + fileName);
          showToast("Wallet created");
       }
      catch (Exception e){
         showToast("Error in creating wallet");
       }
     }

    Use above code to create wallet using password.
    Use above all methods in async task or background thread.

    Load Wallet file and Get Etharium Address.
        Credentials credentials =
        WalletUtils.loadCredentials ( “password”, walletDir);

        Where walletDir is file path of wallet file stored in the device.
        You can get waller address from
        credentials.getAddress()

    Use this credential for further use for the transaction.

    Send Ether to Another Wallet Address.

    private void makeFundTransfer(Credentials credentials,String toAddress,Double amountInEther){

    Web3j web3 = Web3j.build(new HttpService("https://rinkeby.infura.io/v3/YOUR_TOKEN"));
    try {

              TransactionReceipt transactionReceipt = Transfer.sendFunds(
                   web3, credentials, toAddress,
                   BigDecimal.valueOf(amountInEther), Convert.Unit.ETHER)
                   .send();

        } catch (Exception e) {
          e.printStackTrace();
       }

      }

    Manektech is the right place to explore the gamut of Blockchain services that can help you increase your business productivity. Blockchain-based applications include any business transaction like; Business administration, Business order tracking, Supply chain, Banking and Finance, E-learning, Healthcare, Online shopping portals, Insurance, Travel, Music, Renewable energy, Contract validation and many other day-to-day transactions. Manektech is tuned for the Blockchain development demands that are driving true differentiation in today’s enterprise.

    About Author

    Manektech Team

    Milan Shah

    Chief Technical Officer

    Milan Shah is Chief Technical Officer at ManekTech, having 18+ years experience in .Net department and technical expertise with increasing leadership responsibility. Having an experience of business processes of various Domains like, Online ticket booking Industry, Law-Firm Industry and Transport & Logistics.

    Subscribe to Our Newsletter!

    Join us to stay updated with our latest blog updates, marketing tips, service tips, trends, news and announcements!

    Areas we serve

    USA

    4100 NW Loop 410, Suite 200, San Antonio, Texas, USA 78229

    UK

    7 Artisan Place Harrow, HA3 5DS

    India

    4th Floor, Timber Point, Prahaladnagar Road, Ahmedabad, Gujarat - 380015

    Germany

    Franz-Joseph-Strasse, 11,Munich, 80801, Germany

    PREV
    NEXT