Skip to content

Install MacOSX

janie_shao edited this page Sep 13, 2018 · 4 revisions

Dappley Installation Instructions - Mac OS X

Install Go Language

Ref: https://golang.org/doc/install#osx

  1. Download Go from golang.org for the latest 1.10 version.
  2. Extract the downloaded archive and install it according to instructions
  3. Setup Go environment
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin

Tips: To make the GOROOT variable permanent, add export PATH=$PATH:/usr/local/go/bin to the bottom of the ~/.bash_profile file and run command source ~/.bash_profile

  1. Verify Go installation
go version

# Expected output:
go version go1.10.3 darwin/amd64
go env

# Output should contain:
GOROOT="/usr/local/go"

Setup Go Workspace and Install dep

Ref: https://golang.github.io/dep/docs/installation.html

  1. Create a workspace specifically for Go
mkdir go
cd go
mkdir bin pkg src
  1. Set up the path to Go workspace
go env GOPATH

# Expected output:
/path/to/go/workspace

# Run the following if NOTHING showed up in the output:
export GOPATH=/path/to/go/workspace

Tips: To make the GOPATH variable permanent, add export GOPATH=/path/to/go/workspace to the bottom of the ~/.bash_profile file and run source ~/.bash_profile

  1. Install the binary for dep (the dependency management tool for the Go language) Ref: https://golang.github.io/dep/docs/installation.html
brew install dep
brew upgrade dep
  1. Make sure dep command is available.
which dep

# Expected output:
/usr/local/bin/dep

# Run the following if NOTHING showed up in the output:
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

Tips: To make the PATH variable permanent, change it and append to the bottom of the ~/.bash_profile file and run source ~/.bash_profile

Download and Run dappley in Go Workspace

  1. Get the Go project from github
cd /path/to/go/workspace/src
go get -u -v github.com/dappley/go-dappley
  1. Check, install dependencies and run tests.
cd /path/to/go/workspace/src/github.com/dappley/go-dappley
make # do this with every commit in case there’s new library installed;
     # all tests should run and pass (ask for help if not)
  1. Try to run it!
cd dapp
./dapp

# Output should contain similar messages as follow:
```bash
Usage:
createwallet
getbalance -address ADDRESS
addbalance -address ADDRESS -amount AMOUNT
listaddresses
printchain
send -from FROM -to TO -amount AMOUNT
setListeningPort -port PORT
addPeer -address FULLADDRESS
sendMockBlock
syncPeers
setLoggerLevel -level LEVEL
exit
Enter command: INFO[0000] PoW started...
  1. To stop the program, type exit then press "Enter".

Run a Test Network of dappley Nodes

  1. Run a seed node
cd /path/to/go/workspace/src/github.com/dappley/go-dappley/dapp
./dapp -f conf/seed.conf
  1. Write down the full address from console output. e.g. If you see:
INFO[0000] Full Address is /ip4/127.0.0.1/tcp/37297/ipfs/QmbvPuDp447S4BDJpohsaYdctuk2KjUoKxUTKXRkt6xi8C

Then write down /ip4/127.0.0.1/tcp/37297/ipfs/QmbvPuDp447S4BDJpohsaYdctuk2KjUoKxUTKXRkt6xi8C

  1. On a new terminal, edit conf/node.conf file.
# On the new terminal
cd /path/to/go/workspace/src/github.com/dappley/go-dappley/dapp
nano conf/node.conf
  1. Replace the seed configuration in nodeConfig with the full address you wrote down. Save the file after editting.
// In `conf/node.conf`, look for:
nodeConfig{
  seed: "/ip4/127.0.0.1/tcp/37297/ipfs/QmbvPuDp447S4BDJpohsaYdctuk2KjUoKxUTKXRkt6xi8C"
  /*...some more configs*/
}
  1. Run another dapplet node. Check if the 2 nodes are connected.
./dapp -f conf/node.conf

# You should find the following messages in the output
INFO[0000] Stream Connected! Peer Addr:/ip4/127.0.0.1/tcp/12345
  1. Try out the following commands on both nodes by typing it then press "Enter":
  • syncPeers (synchronize the blockchain from peers)
  • createwallet
  • addbalance -address WALLETADDRESS
  • getbalance -address WALLETADDRESS
  • send -from WALLETADDRESS1 -to WALLETADDRESS2 -amount 1