Monday, 30 July 2018

Install Ethereum Mist on Ubuntu

Installing Ethereum Mist On Ubuntu

The Mist browser is the tool of choice to browse and use Ðapps or blockchain apps. So you are a beginner at ethereum development then you will require to install Mist for better development view.

So let's start with installing Mist.

Install ethereum mist on ubuntu


  • Now I will show it on Ubuntu installation.
  • Go to Download folder and run following command.
  • $ sudo dpkg --install Mist-linux32-0-11-1.deb 
  • if this will not work then run the same command with force as follow.
  • $ sudo dpkg --install --force-all Mist-linux64-0-11-1.deb
Now when you run mist command then it will open the mist browser.



Thanks if you have any queries please comment it out.

  

Saturday, 28 July 2018

Install Java JDK 10 on ubuntu 18.04

Java JDK is the essential part of developer life to run & develop applications. In this tutorial, we are going to see how to install Java JDK on Ubuntu 18.04.


  • Open Terminal by pressing Ctrl+ Alt+ T  or directly searching from the search bar.
  • Run following commands

vikas@machine:~$ sudo add-apt-repository ppa:linuxuprising/java

vikas@machine:~$ sudo apt-get update

vikas@machine:~$ sudo apt-get install oracle-java10-installer

  • It will ask you to accept the License Agreement 


Java License Agreement

Java License Agreement

  • After this, you will see the following type of message on the terminal.
Ubuntu JDK 10 Installed

  • Now we need to run a command to set JDK 10 as default JDK, run the following command for it.


vikas@machine:~$ sudo apt-get install oracle-java10-set-default

  • Now run java --version on the terminal you will see the following message when you have configured JDK successfully.
Ubuntu JDK version


Here your JDK is ready for you. 

Please comment it out, if you stuck anywhere or you have doubts or issues with it.

Friday, 27 July 2018

Upgrade Ubuntu 16.04 to 18.04

Following are the steps to  Upgrade Ubuntu 16.04 to 18.04 :


ubuntu 18.04,ubuntu 18.04 lts,how to upgrade ubuntu 16.04 to 18.04,upgrade to ubuntu 18.04,upgrade ubuntu 17.10 to 18.04,upgrade ubuntu 16.04 lts to 18.04 lts



If you are planning to upgrade to Ubuntu 18.04 and you don't know how to upgrade ubuntu 16.04 to 18.04 then you are the perfect place. I will show you how to do it,  follow the following steps to install it.

  • Search Software Updater & Select Software Updater.
  • Go to Software Updater
  • Select Setting from Software Updater.

  • Go to Updates tab and Then select the following version selection as we are going for LTS(Long Term Support) select Long term Support.


  • After that close this window and click on Install Now.



  • The installation will start we have to wait to complete this installation.

 
  • After this click on Restart Now Button.




  • You will think that after restart it will finish but not we have just updated the packages, We have to install it.

  • To install it open the terminal and run following command

mymachine@yourmachine:~$ sudo update-manager -d

  • It will again check for update.


  • Click on Upgrade Button



  • You will see Release Note Pop up window, then click on Upgrade. 


  • Again it will ask for confirmation, click on Start Upgrade.


  • It will Ask you to remove obsolete Packages, it is up to you if you want to keep it or not.



  • Now Upgradation will start and it will take time when it will complete it will ask you to Restart Machine click on it.

  • You can see the changes on the login screen only, to confirm, Open terminal run following command.
    • mymachine@yourmachine:~$ lsb_release -a 

  • Here is your Ubuntu 18.04 is upgraded from 16.04...................



!!!!!!!!!!!!!!!!!!!!!!!!!!!Yeppie We are done !!!!!!!!!!!!!!!!!!!!!!!!!!!

Please do comment if you have any queries.

You may want to install Java on your latest Ubuntu version then click here to check post. 
Thanks...

Flutter fails on `flutter` command : Invalid version constraint

Image Source: Wikipedia

As you have started to learning flutter and you have tried to install their dependencies from flutter official document.

And when you tried to install it and if you get the following error. you can fix it easily.

flutter init -o my_app
Resolving dependencies...
Error on line 17, column 16 of pubspec.yaml: Invalid version constraint: Could not parse version "^1.4.0". Unknown text at "^1.4.0".
  stack_trace: ^1.4.0

you will get Invalid version contraint error then the following are the possibilities.


  • Your Dart version can be outdated so you can install it using following command

brew install dart@2

sudo apt-get install dart
  • Set your path properly:
export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH


Thats it...

I hope this will fix your issue.

Monday, 11 June 2018

IONIC Build: Failed to find 'ANDROID_HOME' environment variable

Hello All,

When we are creating a build at that time, we may face the following issue:

$ ionic cordova build android


Running command: 

/demoApp/hooks/after_prepare/010_add_platform_class.js /demoApp
  add to body class: platform-android
  ERROR building one of the platforms: Failed to find 'ANDROID_HOME'  environment variable. Try setting it manually.
  Failed to find 'android' command in your 'PATH'. Try to update your 'PATH' to include a path to valid SDK directory.
You may not have the required environment or OS to build this project
Error: Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Failed to find 'android' command in your 'PATH'. Try to update your 'PATH' to include the path to valid SDK directory.




Let us try to fix this issue:

  • First, check whether you have installed Android SDK or not, Install or check to do following steps:
    • Download & unzip the correct version of the Android SDK for your operating system.
    • Configure the ANDROID_HOME environment variable based on the location of the Android SDK. Additionally, consider adding  ANDROID_HOME/tools, and ANDROID_HOME/platform-tools to your PATH.
    • Export the path as follows:


Mac OS X

export ANDROID_HOME=//android-sdk-macosxexport PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools


Linux

export ANDROID_HOME=//android-sdk-linuxexport PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools


Windows

set ANDROID_HOME=C:\\android-sdk-windowsset PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools



    • Now download specific Android platforms.


    • Select the Tools check box.
    • Select the checkbox for the latest Android SDK.
    • From the Extras folder, select the checkbox for the Android Support Library.
    • Click the Install packages... button to complete the download and installation.

Now you are done with it.

Just now run the following commands to create the build.

$ ionic cordova platform rm android

$ ionic cordova platform add android

$ ionic cordova build android


I hope this will fix your issue.

Thanks & Cheers !!!!

Thursday, 24 May 2018

MacOS Downgrade or Upgrade MongoDB Versions

By Source, https://en.wikipedia.org/w/index.php?curid=48498452


As we are working on different projects, it may happen that we require the two different mongodb versions to run on same machine or you may get following type of error which I get today only:


name: 'MongoError',
  message: 'The \'cursor\' option is required, except for aggregate with the explain argument',
  operationTime: Timestamp { _bsontype: 'Timestamp', low_: 24, high_: 1527143887 },
  ok: 0,
  errmsg: 'The \'cursor\' option is required, except for aggregate with the explain argument',
  code: 9,
  codeName: 'FailedToParse',
  '$clusterTime':
   { clusterTime: Timestamp { _bsontype: 'Timestamp', low_: 24, high_: 1527143887 },
     signature: { hash: [Object], keyId: [Object] } } }
(node:65062) UnhandledPromiseRejectionWarning: MongoError: The 'cursor' option is required, except for aggregate with the explain argument
    at Function.MongoError.create (/var/www/html/node_modules/mongodb-core/lib/error.js:31:11)


After trying to do some google, I go to know that after MongoDB upgrade this issue has occurred, so I need to downgrade the current MongoDB versions.

My Current MongoDB version is 3.6.X and I need to downgrade it to 3.4.X, so I have done following commands to do this.




As I use brew to install MongoDB I have followed following commands to downgrade the MongoDB.


$ brew update

$ brew install mongodb@3.4


Now it will install it on our machine but we need to force brew to use MongoDB 3.4 version instead of MongoDB 3.6 so we need to run following commands.

$ brew unlink mongodb

$ brew link --force mongodb@3.4  (--force required because it is a keg, which is it's a binary.)


Now when you are done with that project and need to again revert mongodb to latest version then you can use following commands to return back to original


$brew unlink mongodb@3.2


$brew link mongodb


Please let me know if you have any issues or queries regarding it.

Thanks.






Monday, 12 March 2018

Flutter.io Tutorials - Introduction & Setup

Hello Friends,

As Google launched flutter.io for rapid cross-platform mobile app development. Let's start with some hands-on on it.


What is flutter?

It is an SDK, which supports cross-platform mobile app development that is same source code an compile and runs on Android and iOS as well. as flutter still in development (current version is 0.1.5), It does not support 32 bit ARM devices.


What differentiate from other cross-platform frameworks?

Native OEM

Native OEM is nothing but our native application framework like we write an android app in Java and iOS/iPhone apps in Objective-C.
Native app creates widgets to communicate between widgets and platform services.

 


WebViews


Initially, cross-platform app development is done using Javascript and WebViews like PhoneGap, jQuery Mobile, ionic etc.

As you know (I hope) before Apple releases their iOS SDK they asked devs to use web apps to develop their app.

The main structure of WebView app is using html5, CSS, and JS you can create your beautiful cross-platform apps.




Reactive Views

Reactive web frameworks like ReactJS or mercury have become popular because of the creation of web views through programming which is borrowed from reactive programming.


Flutter

Flutter also does the same thing like react native does by using reactive-style views, but flutter takes a different approach to reduce performance due to JavaScript bridge
Flutter uses compiled programming language called Dart. Dart has compiled ahead of time(AOT) for native platforms, which allows flutter to communicate with the platform without JS bridge.


PROS:

  • Fast Development
  • Expressive and Flexible UI
  • Native Performance
  • Hot Reload
  • Reactive view without javascript bridge
  • Great beautiful and customizable widgets

CONS:

  • It's still in beta version(not sure when it will release).
  • Yet it still not support 32-bit iOS devices (iPhone 4, 4s, 5, 5c)

Setup:

  • Let's start with the basic installation of flutter.io on your system.

MacOS &Linux Installation:

To get flutter started you need to clone the git repo.
git clone -b beta https://github.com/flutter/flutter.git
$ export PATH=`pwd`/flutter/bin:$PATH
above command will set your PATH variable temporarily, so let's add in global.
  • Open/create bash_profile.
nano $HOME/.bash_profile
  • Add the following path in bash profile
export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
  • Then run following command to refresh current window.
source $HOME/.bash_profile
  • To check whether your basic setup is completed or run following command.
flutter doctor

  • The first time you run a flutter command, it downloads its own dependencies and compiles itself.

Windows Installation:


  • Clone the Git repo
  • Then you need to set your PATH environment variable.

IDE:


  • You can use any IDE to develop your app, but I would suggest use Visual Studio Code with dart code plugin which support code validation and basic syntax.

Android & iOS setup:


  • Install Android SDK  & XCode and required tools as well.

Reference:







Now we are done with basics of flutter and its installation, Now its time to run our first flutter program.

I will post our first flutter app soon.

Please follow to get updates for new posts.

Thanks.

Tuesday, 6 March 2018

Hello World in Solidity Programming

Hello Friends,

After the completion of our installation lets start with creating Hello World program in Solidity.

To start solidity we need to run first truffle command to initialize our basic app structure.


$ truffle init


This will create our basic app structure.


I am using Visual Studio Code as IDE, you can use any IDE.


Now let's go through the folder structure.

  • contracts:
    • contracts is the main folder where we will write our all contracts.
  • migrations:
    • migration is used to configure migration and deployment.
  • test:
    • test is folder used to write test cases for our smart contracts
  • truffle-config.js:
    • if you want to customize your truffle configuration then you can edit this file.
  • truffle.js :
    • its also used to configure truffle for development or production etc.


Create the first file in contracts folder with name HelloWorld.sol file
Write down following code  :


pragma solidity ^0.4.13;
contract HelloWorld {
function sayHello() public returns (string) {
return ("hello World");
}
}


Now let's create a new file in migration folder for deployment.

var HelloWorld = artifacts.require("./HelloWorld.sol");
module.exports = function(deployer) {
deployer.deploy(HelloWorld);
};

Lets edit  our truffle file :

module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
}
}
};

Now we have written our first Hello world program, to run it we need to run our testrpc server:

just run following command in terminal:


$ testrpc



Now open a new tab to compile our app, run following command to compile our app.

$ truffle compile


if there isn't any errors or warnings then it will compile properly and return to the terminal.

then run following command:

$ truffle compile


usersolidityHelloWorld webwerks$ truffle migrate
Using network 'development'.


Running migration: 1_initial_migration.js
Deploying Migrations...
... 0xea12dd3b0517asdf37e4cb3fcc64basdf61230a59378d68995asdf988cacd0d2c601e5364687
Migrations: 0xea35asdf5bff5e555c9asdf76f5a22008asdfd57a3f898d20f65
Deploying HelloWorld...
... 0xb649d108b056bd929dbeasdfc5fa87599379896d681294f6881f6eb2265f3bc0d211
HelloWorld: 0x8e5afbafe5b411d568f7767516c3aff0ccfde562
Saving successful migration to network...
... 0x77ccddddbe064bcecasdf53271965f135eac424741243515d6bb4c25f7c9470c54aca8a9
Saving artifacts...
Running migration: 2_deploy_contracts.js
Replacing Migrations...
... 0x5a711d3296b18f8c8040ed1a8e6a5ad700aaef6234112c0cd501aed066c5734218f14cc
Migrations: 0x4119bd0f8676625asd412329ca0b4bbdf763ae673865c3
Replacing HelloWorld...
... 0x10bb38b7eee7e234be872abcfeaasd1ga72350d288066c0829db4ed0212fd5bfef8dc330
HelloWorld: 0x9f11755a4ec076de0c8368e18ead4247570f38cb
Saving successful migration to network...
... 0xbc358f6d9b4aeb99952fbf8bf31324asdfvtde5996d21224e2f33f66ab18abc1e38780fed0
Saving artifacts...
user: solidityHelloWorld webwerks$




So lets run our program with truffle console.


user: solidityHelloWorld webwerks$ truffle console
truffle(development)> var hw
undefined
truffle(development)> HelloWorld.deployed().then(function(deployed){hw=deployed})
undefined
truffle(development)> hw.SayHello().call();
'Hello World'




 Cheers, Finally we have run our first Hello World program with solidity Programming.


Please comment if you get some errors or issues.

Thanks .....

Wednesday, 28 February 2018

Introduction to Solidity a Smart Contracts

Hello JS Rockstars,
Solidity
Source: Wikipedia


As I am curious about blockchain and cryptocurrency.


I want to get more details about cryptocurrency and technology stack behind this whole blockchain.


So from my colleague, I got to know about Solidity so I want to get some hands-on on it.


So I went through some sites and created my some sample contracts,


as I already mentioned in my Introduction to blogspot post I am sharing my knowledge here only,


I am not covering what is blockchain and cryptocurrancy as this are already covered by many sites,


So I will start directly blockchain development and ethereum based smart contracts only with Solidity.


What is Solidity :

From Official Document, Solidity is a contract-oriented, high-level language for implementing smart contracts.
It was influenced by C++, Python, and JavaScript and is designed to target the Ethereum Virtual Machine (EVM).
Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.
As you will see, it is possible to create contracts for voting, crowdfunding, blind auctions, multi-signature wallets and more.

So let's do some basic setup on your system.


Mac OS Installation:

Install Node modules:  

$ npm install -g solc

This is solidity compiler with javascript.


$ npm install -g truffle
Truffle is a development environment, testing framework and asset pipeline for Ethereum.
$ npm install -g ethereumjs-testrpc


testrpc is a Node.js based Ethereum client for testing and development.


Install required tools or software with brew:

$  brew update

$ brew upgrade

$ brew tap ethereum/ethereum

$ brew install solidity

$ brew linkapps solidity

Ubuntu Installation:

 

Install Node modules: 


$ npm install -g solc

$ npm install -g truffle
$ npm install -g ethereumjs-testrpc



$ sudo add-apt-repository ppa:ethereum/ethereum
$ sudo apt-get update
$ sudo apt-get install solc

Now you are done with your basic setup for developing your smart-contracts.


So click here to start your first solidity programming.

Reference Links: