-
Notifications
You must be signed in to change notification settings - Fork 0
Install MacOSX
janie_shao edited this page Sep 13, 2018
·
4 revisions
Ref: https://golang.org/doc/install#osx
- Download Go from golang.org for the latest 1.10 version.
- Extract the downloaded archive and install it according to instructions
- Setup Go environment
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
Tips: To make the
GOROOT
variable permanent, addexport PATH=$PATH:/usr/local/go/bin
to the bottom of the~/.bash_profile
file and run commandsource ~/.bash_profile
- Verify Go installation
go version
# Expected output:
go version go1.10.3 darwin/amd64
go env
# Output should contain:
GOROOT="/usr/local/go"
Ref: https://golang.github.io/dep/docs/installation.html
- Create a workspace specifically for Go
mkdir go
cd go
mkdir bin pkg src
- 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, addexport GOPATH=/path/to/go/workspace
to the bottom of the~/.bash_profile
file and runsource ~/.bash_profile
- 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
- 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 runsource ~/.bash_profile
- Get the Go project from github
cd /path/to/go/workspace/src
go get -u -v github.com/dappley/go-dappley
- 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)
- 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...
- To stop the program, type
exit
then press "Enter".
- Run a seed node
cd /path/to/go/workspace/src/github.com/dappley/go-dappley/dapp
./dapp -f conf/seed.conf
- 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
- 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
- Replace the
seed
configuration innodeConfig
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*/
}
- 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
- 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