Translate

Monday 30 April 2018

Some Truffle tips and Blockchain blocks

Platform: node.js/Windows
Technology: BlockChain

Smart Contracts, Smart Money and Smart Wallets - be your own bank!


The BlockChain is now a famous Go-To-Technology that has innumerable possibilities for peer-to-peer interactions for exchanges of various kind like a currency, a representation of an asset, a virtual share, a proof of work, ownership etc. 

The path to adopting a new technology or framework can be really vexing if the resources online are less.

Ironing out the vexes

One very simple problem with Truffle, on Windows ie., is caused by how Windows processes the file extensions from the command line as well as a possible buggy Ganache GUI distribution bundle. Edit: Instead of the .appx file, download from this link, which provides a fully working installer for Windows.

First, the most common problem with truffle.


On node.js, after installing truffle, the first thing that you need to do is remember to either,

1. Use truffle.cmd because, by default, the Windows command-line processor runs the truffle.js file instead of the .cmd file. Simply use truffle.cmd compile or truffle.cmd migrate or any other command when using truffle.

2. Exclude the .js extension from the PATHEXT environment variable

3. Change the .js filename to something else so that the .cmd file gets executed.

Second, git clone the ganache-cli from  https://github.com/trufflesuite/ganache.git

Once cloned, open the node.js command prompt (this is assuming that you have npm installed truffle), you can do npm install and npm start from the git clone repository folder. 


Commands after cloning ganache-cli:
  1. npm install 
  2. npm start
from the cloned repository.

If you face the Microsoft Script runtime error, make sure that ganache is added to your PATH environment variable.


The cli will start and listen in to a port configured in the truffle.js with values as below:


 networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*" // Match any network id
    }
  }



What Ganache does is, it creates a virtual Ethereum based blockchain that acts as a Private net (the mainnet is the live or the production network) with some dummy accounts, which you can use for testing and development without having to use any real ethers, the gas!
A personal Ethereum Blockchain.


The mnemonic is a 12-word combination that can be used to recover a wallet if you have forgotten the details required to access your wallet. Of course, using the mnemonic combination will result in creating a new wallet.






Once your personal blockchain is created, you can download and install the 
geth and Ethereum Wallet to work with your Ethereum based blockchain apps.


What all this means is that you can act as a bank by issuing your own token that will become a cryptocurrency that you can use for interchanges between your friends, club, for betting platforms etc.


Happy creating your own bank with cryptocurrency!

No comments: