Difference between revisions of "Mac Solidity Setup"

From rbachwiki
Jump to navigation Jump to search
 
(12 intermediate revisions by the same user not shown)
Line 26: Line 26:
** If you have older version YOU MUST REMOVE IT
** If you have older version YOU MUST REMOVE IT
  npm uninstall -g truffle
  npm uninstall -g truffle
= Setting up the Ethereum Node =
* Create Folders
mkdir -p ~/ChainSkills/private
* Define Genesis Block ( run from the private Directory)
puppeth
# Network Name
## whatevername
# Option 2 to configure new genesis
# Option 1 (Ethash proof of work)
# Which account to be funded
## Just Hit Enter
# Specify your chain/network id
## 4224 (has to be different for the other networks)
# What would you like to do
## Option 2 (manage existing genesis)
# OPtion 2 (export genesis Config)
# Accept default filename
# Ctrl C to Quit
=Initialize Private Node =
Must be in the Private Directory
geth --datadir ~/ChainSkills/private init chainskills.json
==Prepare for Mining==
Create some accounts ( make sure you are in the private directory) run multiple times to create more accounts
geth --datadir . account new
// create password the . means current directory
Accounts are stored in an array [0], [1] Etc.
List accounts
geth --datadir . account list
==Create a Script to Start the Mining Node==
This must be on one line
startnode.sh do chmod +x to make it executable
geth --networkid 4224 --mine --minerthreads 1 --datadir "~/ChainSkills/private" --nodiscover --rpc --rpcport "8545" --port "30303" --rpccorsdomain "*" --nat "any" --rpcapi eth,web3,personal,net --unlock 0 --password ~/ChainSkills/private/password.sec --ipcpath "~/Library/Ethereum/geth.ipc"
Create the password.sec file and add your password to the file then save it
Start The node
./startnode.sh
Connect to the node when mining starts
* Open new terminal winow
geth attach
Some commands
eth.accounts // list accounts
eth.coinbase // get a specific account
eth.getBalance(eth.accounts[1])
web3.fromWei(eth.getBalance(eth.coinbase),"ether") // convert wei to ether
miner.stop // stop mine process
miner.start(2) // start miner using 2 threads
net.version // network identifier
personal.unlockAccount(eth.accounts[1], "outwater", 300) // unlock account makes the private key available for signing transactions for sending trans
Transfer funds between accounts
eth.sendTransaction({from: eth.coinbase, to: eth.accounts[1], value: web3.toWei(10, "ether)})
Type Exit to quit
==[[#top|Back To Top]]-[[Main_Page| Home]] - [[Solidity_ethereum_Language|Category]]==

Latest revision as of 22:33, 13 March 2018

Solidity Programming setup

  • Install Xcode
  • Open xcode to accept the license agreement.
  • Close xcode
  • Open terminal
xcode-select --install

this will install command line tools, which is needed to install homebrew

  • Install homebrew
  • Copy and paste script from brew into terminal
  • Install Geth
brew update // update catalog
brew tap ethereum/ethereum // add the ethereum repository to catalog
brew install ethereum

To upgrade an existing installation

brew upgrade ethereum
  • Install Ganache Ganache
  • New version has a bug so install Ganache Version 1
    • Ganache is like testrpc
  • Install NodeJs NodeJs
    • This installation will also upgrade older versions
  • On a new system you can use
brew install node
sudo npm install truffle
    • If you have older version YOU MUST REMOVE IT
npm uninstall -g truffle

Setting up the Ethereum Node

  • Create Folders
mkdir -p ~/ChainSkills/private
  • Define Genesis Block ( run from the private Directory)
puppeth
  1. Network Name
    1. whatevername
  2. Option 2 to configure new genesis
  3. Option 1 (Ethash proof of work)
  4. Which account to be funded
    1. Just Hit Enter
  5. Specify your chain/network id
    1. 4224 (has to be different for the other networks)
  6. What would you like to do
    1. Option 2 (manage existing genesis)
  7. OPtion 2 (export genesis Config)
  8. Accept default filename
  9. Ctrl C to Quit

Initialize Private Node

Must be in the Private Directory

geth --datadir ~/ChainSkills/private init chainskills.json

Prepare for Mining

Create some accounts ( make sure you are in the private directory) run multiple times to create more accounts

geth --datadir . account new
// create password the . means current directory

Accounts are stored in an array [0], [1] Etc. List accounts

geth --datadir . account list

Create a Script to Start the Mining Node

This must be on one line startnode.sh do chmod +x to make it executable

geth --networkid 4224 --mine --minerthreads 1 --datadir "~/ChainSkills/private" --nodiscover --rpc --rpcport "8545" --port "30303" --rpccorsdomain "*" --nat "any" --rpcapi eth,web3,personal,net --unlock 0 --password ~/ChainSkills/private/password.sec --ipcpath "~/Library/Ethereum/geth.ipc"

Create the password.sec file and add your password to the file then save it

Start The node

./startnode.sh

Connect to the node when mining starts

  • Open new terminal winow
geth attach

Some commands

eth.accounts // list accounts
eth.coinbase // get a specific account
eth.getBalance(eth.accounts[1])
web3.fromWei(eth.getBalance(eth.coinbase),"ether") // convert wei to ether
miner.stop // stop mine process
miner.start(2) // start miner using 2 threads
net.version // network identifier
personal.unlockAccount(eth.accounts[1], "outwater", 300) // unlock account makes the private key available for signing transactions for sending trans

Transfer funds between accounts

eth.sendTransaction({from: eth.coinbase, to: eth.accounts[1], value: web3.toWei(10, "ether)})

Type Exit to quit

Back To Top- Home - Category