Launching a private Ethereum blockchain

Let's launch our private Ethereum blockchain using geth. We will not use Ganache here, because events are not supported in the stable version of Ganache yet (however, the beta version of Ganache (v 2.0.0 beta 2) already supports events):

  1. We will use the following code block to launch the block:
(videos-venv) $ cd videos_sharing_smart_contract
(videos-venv) $ populus chain new localblock
(videos-venv) $ ./chains/localblock/init_chain.sh
  1. Now edit chains/localblock/run_chain.sh. Find --ipcpath, then change the value (the word after --ipcpath) to /tmp/geth.ipc.
  2. Then edit the project.json file. The chains object points to four keys: tester, temp, ropsten, and mainnet. Add another key, localblock, in the chains object:
    "localblock": {
"chain": {
"class": "populus.chain.ExternalChain"
},
"web3": {
"provider": {
"class": "web3.providers.ipc.IPCProvider",
"settings": {
"ipc_path":"/tmp/geth.ipc"
}
}
},
"contracts": {
"backends": {
"JSONFile": {"$ref": "contracts.backends.JSONFile"},
"ProjectContracts": {
"$ref": "contracts.backends.ProjectContracts"
}
}
}
}
  1. Run the blockchain using the following command:
(videos-venv) $ ./chains/localblock/run_chain.sh
  1. Compile our smart contract using the following command:
(videos-venv) $ populus compile
  1. Then, deploy our smart contract to our private blockchain using the following command:
(videos-venv) $ populus deploy --chain localblock VideosSharing

Write down the address in which our smart contract is deployed in address.txt. This file must be adjacent to videos_sharing_smart_contract directory.