Sandbox for experiments and code samples pertaining to all things Solidity
-
install nodeJS
-
install npm (does this come with node?)
-
update npm to the latest using
sudo npm i -g npm -
install homebrew
-
install truffle
sudo npm install -g truffle -
install Ganache (https://truffleframework.com/ganache)
- alternatively install Ganache CLI
npm install -g ganache-cli
- alternatively install Ganache CLI
-
OPTIONAL: install
gethEthereum client by runningbrew install ethereum(can take a while)- WARNING: you may not wanna run a full node on laptop (takes a lot of hared drive space and days to sync from Internet the first time)
-
OPTIONAL: Mist Ethereum Wallet (install from from `https://github.com/ethereum/mist/releases) - user friendly UI to interact with Ethereum (Mist = wallet + built-in own browser, and Etherum Wallet = exactly the same wallet, but the built-in browser is disabled.) WARNING: you may not wanna run a full node on laptop (takes a lot of hared drive space and days to sync from Internet the first time)
-
install metamask in your browser
-
install Octotree (usefull for easily navigating www.github.com on LHS of browser)
-
copy
https://github.com/ethereum/web3.js/blob/develop/dist/web3.min.jsto a local directory to use Web3- always choose the latest beta (not the 'develop' branch. Instead pick the tag with the highest release version)
-
install lite-server (very simple web server) by running
sudo npm install -g lite-server- run
lite-serverto get it running - configure lite-server using bs-config.json to include path to web app source and contract Solidity build files
- run
-
to use Infura with Truffle, install the following
npm install truffle-hdwallet-provider
--update 25/11/2018
- install VirtualBox & Vagrant
- install Blockgeeks development environment: https://app.vagrantup.com/blockgeeks/boxes/env
- run
vagrant init blockgeeks/envin the root of your development environment folder - update 'VagrantFile' to include the following:
config.vm.box = "blockgeeks/env"config.vm.box_version = "0.0.1"config.vm.synced_folder ".", disabled: false - run
vagrant upto provision the Vagrant environment - run
vagrant sshto connect to the vagrant environment - In vagrant shell
cd /vagrantto go to the folder that launched the vagrant instance to provide access to all the files in that folder
- run
??????CHECK ALL BELOW????????
- Note: Latest versions of these
nodejsdependencies insetup/package.jsontaken from github at the time of writing. Later versions may be available when running this - run
npm installfromsetupfolder wherepackage.jsonresides - run
sudo npm install -g remixd --unsafe-perm=true --allow-rootto allow Remix use source code from hard drive then run the following to choose a shared folderremixd -s /Users/bgaughran/IdeaProjects/solidity_sandbox/contractsthen click the 'link' icon in remix to load the files. See https://remix.readthedocs.io/en/latest/tutorial_remixd_filesystem.html for more details
-
start
ganache-clifrom the command line in the project root by running:ganache-cli(should start a local Ethereum node) -
confirm
web3jsis available from thenodecommand line by running in the project root:nodethenrequire("solc")and require("web3") and require("ganache-cli") -
confirm
ethereumjs-utilis available from thenodecommand line by running in the project root:nodethenrequire("ethereumjs-util")util = require("ethereumjs-util") -
run
geth version
mkdir election
cd election
truffle init (Truffle command to initialize empty Truffle project in current directory)
truffle version (prints out currently installed Truffle version)
truffle compile (Truffle command to compile all Solidity smart contracts located in contracts folder)
truffle compile --all (Truffle command to force compilation of all Solidity smart contracts)
truffle migrate (Truffle command to run all migration scripts located in migrations folder)
truffle migrate --reset (Truffle command to force running all migrations from beginning)