Ethereum Dev Chain - Private Chain


To develop and test an Ethereum smart contract we need a test network. The easiest way is go get spin off our own test chain with sufficient amount ethers. Below are the steps for spinning a development chain.

First download the latest Geth from the below URL



As I am using a windows machine, I downloaded the windows version. Install the Geth on your machine as per the installation guide.

Create a folder called DevChain where you can keep the chain data.

After that let’s create an account using command prompt. Specify the password when prompted.


Now create a genesis file to define the genesis block, which is the start of the block chain. Here is the genesis file (“genesis_dev.json”) I am using. Replace the account number with number you got in the previous step.

{
  "nonce": "0x0000000000000042",
  "difficulty": "0x200",
  "config": {
    "chainId": 15,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
  },
  "alloc": {
    "0x0bd615694d433424c292599f080bda45b0c257fc": {
      "balance": "100000000000000000000000"
    }
  },
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x0000000000000000000000000000000000000000",
  "timestamp": "0x00",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "gasLimit": "0x8000000"
}

Now create a batch file (“startgeth.bat”) which will initialize the network every time you run.

RD /S /Q %~dp0\devChain\geth

geth.exe --datadir=devChain init genesis_dev.json
geth.exe --mine --networkid=12345 --cache=2048 --maxpeers=0 --datadir=devChain --rpc --rpccorsdomain "*" --rpcapi "eth,web3,personal,net,miner,admin,debug" console 

Now run the batch file to initialize and start the test network.


Now our development network is ready to start deploying and testing smart contracts.



19 comments:

  1. Hi,
    I have a problem when deploy smart contract. Because my account have 0 ETH with balance so I have error when deploy: gas price.
    I try to use rinkeby account and make it have 3ETH, but when I use function get my balance, it equal 0.
    Please help me !
    Thanks !

    ReplyDelete
    Replies
    1. You need to set the default account to be used for collecting gas price
      eth.defaultAccount = eth.coinbase;
      Alternatively you can pass in the account to be used while deploying the contract.

      Delete
  2. individuals from all kinds of different backgrounds are putting resources into computerized monetary standards. Ricona ICO

    ReplyDelete
  3. Once encoded, the exchange is changed over to something many refer to as a block, which is essentially the term utilized for a scrambled gathering of new exchanges.ıco

    ReplyDelete
  4. It is nothing unexpected that money related organizations are investigating the one of a kind abilities of blockchain. QProfit System

    ReplyDelete
  5. And afterward envision that these systems are intended to refresh this spreadsheet every now and then. This is precisely what blockchain is. Btc double

    ReplyDelete
  6. For best trading in crypto code that's very real trading system in all click reference

    ReplyDelete
  7. Icopulse One of the main cryptocurrency uses is payments, with https://icopulse.com/ico-list/category/banking we make it possible in an efficient and simple way. By donwloading our app you will be able to access your coins to make all sorts of instant transactions wherever you are and whenever you want

    ReplyDelete
  8. Above all else, the cryptographic forms of money made it to the standard as of late, hence all the news with respect to them and bits of gossip are "hot".http://icowatchers.co

    ReplyDelete
  9. If you are sure that Bitcoin will appreciate it,https://www.jetwin.com/en-us/bitcoin-casino we suggest you pay in cash to buy it. click this link that is mentioned and explore the bitcoin world.

    ReplyDelete
  10. This is the primary site for arranging face-to-face transactions and prices negotiated https://bitcoinvest.cc

    ReplyDelete
  11. To get your feet somewhat wetter, you can go prospecting. There are various administrations and sites out there that will pay you in bitcoin to do things like go to specific sites, https://howcc.to/ round out online overviews, or watch supported recordings.

    ReplyDelete
  12. i want to ask if there is any tutorial for a full solution who use a smart contract in youtube

    ReplyDelete
  13. A few people may defer until the esteem they'd get jumps up by 5 percent. Affirm the swapping scale continually on the web or sign up expected for an administration that refreshes you on the bitcoin-to-dollar conversion standard so you can comprehend when it improves. coin mixers

    ReplyDelete
  14. This is a brilliant blog! I'm very happy with the comments!.. smart art contract

    ReplyDelete
  15. Mining pools appear to be a feasible arrangement as individuals collaborate to contribute hash power and machines. In this way coins get mined at an extraordinary speed.https://reviewcloudmining.com/iqmining-review/

    ReplyDelete
  16. At last, implement a conversion service that permits two-factor identification, making certain that simply you will likely be able to confirm bitcoin conversions.https://cryptalker.com/buy-bitcoin-with-cash/

    ReplyDelete
  17. By removing the banks from the condition, you are likewise wiping out the a lot of every exchange expense. Furthermore, the measure of time required to move cash from indicate A point B, is diminished considerably.
    bitcoin revolution

    ReplyDelete
  18. Thicker chain interface fences will cost somewhat higher for they are harder and sturdier. Likewise, hope to spend somewhat more for vinyl-covered chain connect fences. They ordinarily cost twice or thrice as much standard chain fencing.
    Chain link fencing Mission

    ReplyDelete

Ethereum Solidity Compiler

Ethereum contracts are written in the high level language called Solidity and compiled into bytecode using the Solidity compiler. This ...