Skip to content
Snippets Groups Projects
Commit fb94f9bc authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Improved documentation and start.sh

parent a815008c
No related branches found
No related tags found
No related merge requests found
# Blockchain Federal Argentina
## TEST NETWORK
1. Install Ubuntu
2. `sudo apt install software-properties-common`
3. `sudo add-apt-repository -y ppa:ethereum/ethereum`
4. `sudo apt update`
5. `sudo apt install ethereum solc jq ncurses-bin`
6. `mkdir ~/bfa`
7. `PATH=${PATH}:${HOME}/bfa/bin`
8. run `start.sh`
9. create your contract (there is already one deployed, so **do not** confuse the two)
10. `insert.sh "I'm doing great today."`
11. wait for next block to be sealed/mined: `sleep 15`
12. `verify.sh "Hi there"`
13. `verify.sh "I'm doing great today."`
14. Try the basic `explorer.sh`
15. consider this crontab: @reboot bfa/network5445/start.sh
## network5445/start.sh
1. Install geth
1.1. For Debian read doc/compiling-geth-on-debian.txt
1.2. For Ubuntu read doc/installing-geth-on-ubuntu.txt
2. `sudo apt install jq ncurses-bin`
3. `mkdir ~/bfa`
4. `PATH=${PATH}:${HOME}/bfa/bin`
5. geth --password /dev/null --datadir $BFANETWORKDIR/node1 account new
6. geth --datadir $BFANETWORKDIR/node1 init $BFAHOME/src/genesis.json
7. run `start.sh`
8. create your contract (there is already one deployed, so do not confuse the two)
9. `insert.sh "I'm doing great today."`
10. wait a bit - if you are lucky 15 seconds only
11. `verify.sh "Hi there"`
12. `verify.sh "I'm doing great today."`
13. Try the basic `explorer.sh`
14. consider this crontab: @reboot bfa/network5445/start.sh
15. Have a look at walker.pl
## start.sh
requires: **geth**
Starts a node on the 5445 BFA test net. Creates a genesis.json if you don't have one already.
......@@ -50,3 +52,6 @@ Simple script to look at blocks
## src/contract.TimestampDocument.sol
The initial Timestamp service. Could be made better.
## walker.pl
requires: **geth**, **perl**
......@@ -115,8 +115,9 @@ function nodedir
fatal "Unable to guess \$BFANODEDIR . Consider setting it explicitly in ${BFAHOME}/bin/env"
test -d "${BFANODEDIR}" ||
fatal "$BFANODEDIR is not a directory."
gen_genesis
test -d "${BFANODEDIR}/geth/chaindata" ||
fatal "Node is not initialised. Consider running: geth --datadir $BFANODEDIR init ${BFANETWORKDIR}/genesis.json"
fatal "Node is not initialised. Consider running: geth --datadir $BFANODEDIR init ${BFAHOME}/src/genesis.json"
# Support migrating from "former" setups
if [ -r "${BFANODEDIR}/port" -a ! -r "${BFANODEDIR}/netport" ]
then
......@@ -179,3 +180,49 @@ function prereq
done
test $err -eq 0
}
function gen_genesis
{
local genesis="${BFAHOME}/src/genesis.json"
test -e "${genesis}" &&
return
SECONDS=$( date +%s )
bfaconfig account
nodes=$account
#echo "** If you want extra nodes added, add them to nodes.remote.txt and run $0 again."
test -r "nodes.remote.txt" &&
nodes="${nodes} $( cat nodes.remote.txt )"
allocs=
sealers=
for node in ${nodes}
do
test "${node:0:2}" = "0x" &&
node=${node:2}
allocs="${allocs}"$(
printf ', "%s": { "balance": "%s" }' \
$node \
0x200000000000000000000000000000000000000000000000000000000000000
)
sealers="${sealers}${node}"
done
# Get rid of leading comma-space
allocs="${allocs:2}"
cat <<-EOCONF > ${genesis}
{
"config": {
"chainId": ${BFANETWORKID},
"homesteadBlock": 0, "eip150Block": 0, "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 4,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"clique": { "period": 15, "epoch": 30000 }
},
"nonce": "0x0000000000000000",
"timestamp": "$( printf '0x%08x' $SECONDS )",
"extraData": "0x426c6f636b636861696e204665646572616c20417267656e74696e61204e4943${sealers}$( repeat 130 0 )",
"gasLimit": "0xffeeddcc", "difficulty": "0x1", "number": "0x0", "gasUsed": "0x0",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"alloc": { $allocs }
}
EOCONF
}
......@@ -8,55 +8,6 @@ function repeat
printf -- "$2%0.s" $( seq 1 $1 )
}
function gen_genesis
{
local genesis="${BFANETWORKDIR}/genesis.json"
test -e "${genesis}" &&
return
SECONDS=$( date +%s )
bfaconfig account
nodes=$account
echo "** If you want extra nodes added, add them to nodes.remote.txt and run $0 again."
test -r "nodes.remote.txt" &&
nodes="${nodes} $( cat nodes.remote.txt )"
allocs=
sealers=
for node in ${nodes}
do
test "${node:0:2}" = "0x" &&
node=${node:2}
allocs="${allocs}"$(
printf ', "%s": { "balance": "%s" }' \
$node \
0x200000000000000000000000000000000000000000000000000000000000000
)
sealers="${sealers}${node}"
done
# Get rid of leading comma-space
allocs="${allocs:2}"
cat <<-EOCONF > ${genesis}
{
"config": {
"chainId": ${BFANETWORKID},
"homesteadBlock": 0, "eip150Block": 0, "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 4,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"clique": { "period": 15, "epoch": 30000 }
},
"nonce": "0x0000000000000000",
"timestamp": "$( printf '0x%08x' $SECONDS )",
"extraData": "0x426c6f636b636861696e204665646572616c20417267656e74696e61204e4943${sealers}$( repeat 130 0 )",
"gasLimit": "0xffeeddcc", "difficulty": "0x1", "number": "0x0", "gasUsed": "0x0",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"alloc": { $allocs }
}
EOCONF
}
# Create a genesis.json if one does not already exist
gen_genesis
bootnodeid=6c81b38551fec2f1142b58ed65137cc1b7dfdc7b35bc556ef26604c41e30fcdeb12212b3c19913584f71dc7bf87d76cd67fa523e96996c0f148390fb76fdc5f7
bootnodev6=2800:40:1:6::135
bootnodev4=200.68.65.135
......
# Compiling geth on Debian
## Prerequisites
1. `mkdir ~/new ~/bin`
2. ` cd ~/new`
3. ` sudo apt install build-essential git`
4. ` git clone https://github.com/ethereum/go-ethereum`
## Compiling Go itself (takes less than 5 minutes)
Go is only needed for compiling geth - afterwards we can delete it
1. Download __go*.linux-amd64.tar.gz__ from [https://golang.org/dl/] e.g. [https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz]
2. `tar -xzf go*.tar.gz`
3. `export PATH=${HOME}/new/go:${PATH}:${HOME}/bin`
4. `cd go-ethereum`
5. `make geth`
6. `cp build/bin/geth ~/bin/`
7. `cd ..`
8. `rm -r ~/new/go`
## Compililng Solc takes a while (like 20-50 times longer than compiling geth)
If you wish to compile contracts too, compile Solidity as well.
$ `git clone --recursive https://github.com/ethereum/solidity`
$ `cd solidity`
$ `git submodule update --init --recursive`
$ `./scripts/install_deps.sh`
$ `mkdir build`
$ `cd build`
$ `cmake .. && make`
$ `cp -p solc/solc ~/bin/`
$ `su`
# `apt install software-properties-common`
# `add-apt-repository -y ppa:ethereum/ethereum`
# `apt update`
# `apt install ethereum`
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment