mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
commit
d24335048a
29 changed files with 98 additions and 14 deletions
10
README.md
10
README.md
|
|
@ -277,6 +277,16 @@ Which will start mining blocks and transactions on a single CPU thread, creditin
|
|||
the account specified by `--etherbase`. You can further tune the mining by changing the default gas
|
||||
limit blocks converge to (`--targetgaslimit`) and the price transactions are accepted at (`--gasprice`).
|
||||
|
||||
## SHYFT NOTES
|
||||
|
||||
#### CLI
|
||||
Run `./shyft-geth.sh` with one of the following flags:
|
||||
|
||||
- `--setup` - Setups postgres and the shyft chain db.
|
||||
- `--start` - Starts geth.
|
||||
- `--reset` - Drops postgress and chain db, and reinstantiates both.
|
||||
- `--js [web3 filename]` - Executes web3 calls with a passed file name. If the file name is `sendTransactions.js`, `./shyft-geth.sh --js sendTransactions`.
|
||||
|
||||
## Contribution
|
||||
|
||||
Thank you for considering to help out with the source code! We welcome contributions from
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ HTTPHost = "127.0.0.1"
|
|||
HTTPPort = 8545
|
||||
HTTPCors = ["*"]
|
||||
HTTPVirtualHosts = ["localhost"]
|
||||
HTTPModules = ["net", "web3", "eth", "shh"]
|
||||
HTTPModules = ["net", "web3", "eth", "shh", "admin", "debug"]
|
||||
WSPort = 8546
|
||||
WSModules = ["net", "web3", "eth", "shh"]
|
||||
|
||||
|
|
|
|||
|
|
@ -42,8 +42,3 @@ CREATE TABLE IF NOT EXISTS accounts (
|
|||
CREATE TABLE IF NOT EXISTS contracts (
|
||||
txHash text
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS mined_blocks (
|
||||
blockNumber bigint,
|
||||
addr text
|
||||
);
|
||||
|
|
@ -2,4 +2,3 @@ DROP TABLE txs;
|
|||
DROP TABLE blocks;
|
||||
DROP TABLE accounts;
|
||||
DROP TABLE contracts;
|
||||
DROP TABLE mined_blocks;
|
||||
|
|
@ -1 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd ./shyft-cli/postgres_setup
|
||||
psql -U postgres -d shyftdb -f drop_tables.psql
|
||||
|
|
@ -1 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd ./shyft-cli/postgres_setup
|
||||
psql -U postgres -d shyftdb -f create_tables.psql
|
||||
4
shyft-cli/postgres_setup/initdb.sh
Normal file
4
shyft-cli/postgres_setup/initdb.sh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd ./shyft-cli/postgres_setup
|
||||
psql -U postgres -f create_shyftdb.psql
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
file=$1
|
||||
echo $file
|
||||
echo Executing "${file}"...
|
||||
runthing="./build/bin/geth --exec 'loadScript(\""$file"\")' attach http://127.0.0.1:8545"
|
||||
eval $runthing
|
||||
17
shyft-cli/setup.sh
Normal file
17
shyft-cli/setup.sh
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
if ! psql -lqt | cut -d \| -f 1 | grep -qw shyftdb; then # Check if db is instantiated
|
||||
echo Creating postgres db...
|
||||
sh ./shyft-cli/postgres_setup/initdb.sh && # Init DB
|
||||
echo Successfully created postgres db! &&
|
||||
sh ./shyft-cli/postgres_setup/init_tables.sh && # Init tables
|
||||
sh ./shyft-cli/resetShyftGeth.sh && # Reset geth data
|
||||
sh ./shyft-cli/initShyftGeth.sh # Init Shyft Geth
|
||||
else
|
||||
echo Postgres DB found!
|
||||
sh ./shyft-cli/postgres_setup/drop_tables.sh && # Drop tables
|
||||
sh ./shyft-cli/postgres_setup/init_tables.sh && # Init tables
|
||||
sh ./shyft-cli/resetShyftGeth.sh && # Reset geth data
|
||||
sh ./shyft-cli/initShyftGeth.sh # Init Shyft Geth
|
||||
fi
|
||||
|
||||
12
shyft-cli/shyftFullReset.sh
Normal file
12
shyft-cli/shyftFullReset.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
if ! psql -lqt | cut -d \| -f 1 | grep -qw shyftdb; then
|
||||
echo Creating postgres db...
|
||||
sh ./shyft-cli/postgres_setup/initdb.sh &&
|
||||
echo Successfully created postgres db!
|
||||
fi
|
||||
|
||||
sh ./shyft-cli/postgres_setup/drop_tables.sh && # Drop tables
|
||||
sh ./shyft-cli/postgres_setup/init_tables.sh && # Init tables
|
||||
sh ./shyft-cli/resetShyftGeth.sh && # Reset geth data
|
||||
sh ./shyft-cli/initShyftGeth.sh # Init Shyft Geth
|
||||
47
shyft-geth.sh
Executable file
47
shyft-geth.sh
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo
|
||||
echo Shyft-Geth: No flags detected, see help:
|
||||
echo
|
||||
echo " --setup: Setups postgres and the shyft chain db."
|
||||
echo " --start: Starts geth."
|
||||
echo " --reset: Drops postgress and chain db, and reinstantiates both."
|
||||
echo " --js [filename]: Executes web3 calls with a passed file name. If the file name is sendTransactions.js, $ ./shyft-geth.sh --js sendTransactions"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
illegalCommands=()
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
case $key in
|
||||
--setup)
|
||||
sh ./shyft-cli/setup.sh
|
||||
shift # past argument
|
||||
;;
|
||||
--start)
|
||||
sh ./shyft-cli/startShyftGeth.sh
|
||||
shift # past argument
|
||||
;;
|
||||
--js)
|
||||
sh ./shyft-cli/runJs.sh ./shyft-cli/web3/$2.js
|
||||
shift # past argument
|
||||
shift # past argument
|
||||
;;
|
||||
--reset)
|
||||
sh ./shyft-cli/shyftFullReset.sh
|
||||
shift # past argument
|
||||
;;
|
||||
*) # unknown option
|
||||
illegalCommands+=("$1") # save it in an array for later
|
||||
shift # past argument
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "${#illegalCommands[@]}" -gt "0" ]]; then
|
||||
echo Shyft-Geth: The following commands are not supported: "${illegalCommands[*]}"
|
||||
fi
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
psql -U postgres -f create_shyftdb.psql
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
cd ./shyftDb/postgres_setup
|
||||
sh drop_tables.sh && sh init_tables.sh
|
||||
cd ..
|
||||
cd ..
|
||||
sh resetShyftGeth.sh && sh initShyftGeth.sh
|
||||
Loading…
Reference in a new issue