technologies2

Blogs

Told You, We Love Sharing!

  • A Compact Guide To Setting Up a BigChainDB Network

    bigchaindb Network

    Bigchaindb is a Decentralized (immutable) database and a combination of both traditional distributed Database & traditional blockchain database.
    It stores data in blocks like blockchain stores data of transactions.

    Let us suppose a requirement of Blockchain database:

    In any organization, the data of a user is stored in any Centralized database like (MySQL, MongoDB etc).
    So, here the organization will have full control of all data to easily modify it (the data is mutable).

    Due to this, the BigchainDB community created a distributed database that stores data in Decentralized(immutable) database like blockchain.
    Due to immutability, no one can modify data, only the owner of that data can change the ownership.

    The owner of that data will have a private key to change the ownership.
    If the owner wants to give ownership to another user then it simply makes a transaction like a blockchain and gives ownership to another user.

    Features ->
    BigchainDB is open source: It means anyone can use the platform without any third-party interference and gives full documentation about how to use it.
    Its official driver is present in PYTHON, JAVASCRIPT.

    2. BigchainDB node is a machine running BigchainDB server and related software. Each node is controlled by any single person or an organization.

    3. BigchainDB is decentralized that means no one can own and control all things, so there is no single point of failure.
    Each node of BigchainDB is controlled by different persons or organizations.

    4. BigchainDB is immutable. Thus, no one can change data after inserting it into blockchain.

    All data is copied to several different places (BigchainDB node holder). It means it is impossible to change the same data of all BigchainDB node holder.

    5. BigchainDB server uses Tendermint for consensus and transaction replication. Tendermint is Byzantine Fault Tolerance(BFT).

    6. Using BigchainDB with MongoDB, a BigchainDB node user can use MongoDB query engine to search for all sorted data. Like all transaction assets and metadata (we can use easily MongoDB query in Bigchaindb).

    7. User permission: With BigchainDB, only a valid owner of an asset can create and transfer assets. It means only owners can transfer asset as during the transfer, Bigchaindb uses owners’ private key.

    8. BigchainDB key: BigchainDB provides a user with a private and public key. Private key gets used to creating and transfer assets, while public key gets used to receiving resources.

    We are going to setup  Bigchaindb network in ubuntu 16.04
    
    1- first of all we will take pull code of Bigchaindb project from github
    
    $ export GIT_BRANCH=master
    $ curl -fOL https://raw.githubusercontent.com/bigchaindb/bigchaindb/${GIT_BRANCH}/pkg/scripts/stack.sh
    
    Now we will open file with command
    bash stack.sh -h 
    
    That looks like
    
    $ bash stack.sh -h
    
        Usage: $ bash stack.sh [-h]
    
        Deploys the BigchainDB network.
    
        ENV[STACK_SIZE]
            Set STACK_SIZE environment variable to the size of the network you desire.
            Network mimics a production network environment with single or multiple BDB
            nodes. (default: 4).
    
        ENV[STACK_TYPE]
            Set STACK_TYPE environment variable to the type of deployment you desire.
            You can set it one of the following: ["docker", "local", "cloud"].
            (default: docker)
    
        ENV[STACK_TYPE_PROVIDER]
            Set only when STACK_TYPE="cloud". Only "azure" is supported.
            (default: )
    
        ENV[STACK_VM_MEMORY]
            (Optional) Set only when STACK_TYPE="local". This sets the memory
            of the instance(s) spawned. (default: 2048)
    
        ENV[STACK_VM_CPUS]
            (Optional) Set only when STACK_TYPE="local". This sets the number of VCPUs
            of the instance(s) spawned. (default: 2)
    
        ENV[STACK_BOX_NAME]
            (Optional) Set only when STACK_TYPE="local". This sets the box Vagrant box name
            of the instance(s) spawned. (default: ubuntu/xenial64)
    
        ENV[STACK_REPO]
            (Optional) To configure bigchaindb repo to use, set STACK_REPO environment
            variable. (default: bigchaindb/bigchaindb)
    
        ENV[STACK_BRANCH]
            (Optional) To configure bigchaindb repo branch to use set STACK_BRANCH environment
            variable. (default: master)
    
        ENV[TM_VERSION]
            (Optional) Tendermint version to use for the setup. (default: 0.22.3)
    
        ENV[MONGO_VERSION]
            (Optional) MongoDB version to use with the setup. (default: 3.6)
    
        ENV[AZURE_CLIENT_ID]
            Only required when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure". Steps to generate:
            https://github.com/Azure/vagrant-azure#create-an-azure-active-directory-aad-application
    
        ENV[AZURE_TENANT_ID]
            Only required when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure". Steps to generate:
            https://github.com/Azure/vagrant-azure#create-an-azure-active-directory-aad-application
    
        ENV[AZURE_SUBSCRIPTION_ID]
            Only required when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure". Steps to generate:
            https://github.com/Azure/vagrant-azure#create-an-azure-active-directory-aad-application
    
        ENV[AZURE_CLIENT_SECRET]
            Only required when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure". Steps to generate:
            https://github.com/Azure/vagrant-azure#create-an-azure-active-directory-aad-application
    
        ENV[AZURE_REGION]
            (Optional) Only applicable, when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure".
            Azure region for the BigchainDB instance. Get list of regions using Azure CLI.
            e.g. az account list-locations. (default: westeurope)
    
        ENV[AZURE_IMAGE_URN]
            (Optional) Only applicable, when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure".
            Azure image to use. Get list of available images using Azure CLI.
            e.g. az vm image list --output table. (default: Canonical:UbuntuServer:16.04-LTS:latest)
    
        ENV[AZURE_RESOURCE_GROUP]
            (Optional) Only applicable, when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure".
            Name of Azure resource group for the instance.
            (default: bdb-vagrant-rg-2018-05-30)
    
        ENV[AZURE_DNS_PREFIX]
            (Optional) Only applicable, when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure".
            DNS Prefix of the instance. (default: bdb-instance-2018-05-30)
    
        ENV[AZURE_ADMIN_USERNAME]
            (Optional) Only applicable, when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure".
            Admin username of the the instance. (default: vagrant)
    
        ENV[AZURE_VM_SIZE]
            (Optional) Only applicable, when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure".
            Azure VM size. (default: Standard_D2_v2)
    
        ENV[SSH_PRIVATE_KEY_PATH]
            Only required when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure". Absolute path of
            SSH keypair required to log into the Azure instance.
    
        -h
            Show this help and exit.
    
    Run with Docker->
    
    Now if you dont need to change configuraton of bigchaindb & run it on docker with 4 node BigchainDB network then run simply by this command.
    
     sudo bash stack.sh
    
    After successfully exceution of above command the Bigchaindb network has been start
    You can check it with command.
    
    docker ps | grep bigchaindb
    
    Run on local->
    For local system you must setup some dependency so run this command
    vagrant plugin install vagrant-cachier vagrant-vbguest vagrant-hosts vagrant-azure
    
    To run Bigchaindb on local system use this code in 
    bash stack.sh -h file.
    
    $ export STACK_TYPE=local
    
    # Optional, since 4 is the default size.
    $ export STACK_SIZE=4
    
    # Optional, default is 2048
    $ export STACK_VM_MEMORY=2048 
    
    #Optional, default is 1
    $ export STACK_VM_CPUS=1
    
    #Optional, default is ubuntu/xenial64. Supported/tested images: bento/centos-7, fedora/25-cloud-base
    $ export STACK_BOX_NAME=ubuntu/xenial64
    
    #Optional, repo to use for the network deployment
    # Default: bigchaindb/bigchaindb
    $ export STACK_REPO=bigchaindb/bigchaindb
    
    #Optional, codebase to use for the network deployment
    # Default: master
    $ export STACK_BRANCH=master
    
    #Optional, since 0.22.3 is the default tendermint version
    $ export TM_VERSION=0.22.3
    
    #Optional, since 3.6 is the default MongoDB version.
    $ export MONGO_VERSION=3.6
    
    $ bash stack.sh
    
    After edit above code you can run simply command
    
    sudo bash stack.sh
    
    After successfully exceution of above command the Bigchaindb network has been start
    You can check it with command.
    
    $ ps -ef | grep bigchaindb
    
    This will show port number of bigchaindb thats are running.
    
    
    There are another method for setup Bigchaindb node with Ansible
    For set up Bigchaindb node with ansible we follow this method.
    
    1-> take clone of Bigchaindb project.
     
    $ git clone https://github.com/bigchaindb/bigchaindb.git
    
    For install project related dependency we navigate to this folder of project
    $ cd bigchaindb/pkg/scripts/
    $ bash bootstrap.sh --operation install
    
     This script install dependency related your OS.
    
    For run on local system
    We will change some file of project
     
    First of all we will go this directory 
    $ cd bigchaindb/pkg/configuration/hosts
    
    Now edit all file of project
    
    # Delete any existing configuration in this file and insert
    # Hostname of dev machine
    <HOSTNAME> ansible_connection=local
    
    
    For update configuration we will edit fie
    $ cd bigchaindb/pkg/configuration/vars/stack-config.yml
    
    & paste this code in file
    
    ---
    stack_type: "local"
    stack_type: "1"
    
    Now we will go this directory of project
    $ cd bigchaindb/pkg/configuration/
    
    & run projcet by this command
    
    $ ansible-playbook bigchaindb-start.yml -i hosts/all --extra-vars "operation=start home_path=$(pwd)"
     This will take some time because its setup project related dependency 
    After successfully run above command 
    You will check that process with command
    
    $ ps -ef | grep bigchaindb
    
    
    Refference ->
    https://docs.bigchaindb.com/projects/contributing/en/latest/dev-setup-coding-and-contribution-process/index.html
    


No Comments Yet.


Leave a Comment

Name is required

Comment is required




Latest Trends

Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.