forked from cerc-io/ipld-eth-server
* Add cmd line tool and Makefile * Add shared utils pkg * Add cmdline README * Update godo for new structure |
||
|---|---|---|
| .. | ||
| cmd | ||
| main.go | ||
| README.md | ||
Vulcanize DB
Development Setup
Dependencies
- Go 1.9+
- Postgres 10
- Go Ethereum
Cloning the Repository
git config --global url."git@github.com:".insteadOf "https://github.com/"- By default,
go getdoes not work for private GitHub repos. This will fix that.
- By default,
go get github.com/8thlight/vulcanizedbcd $GOPATH/src/github.com/8thlight/vulcanizedbdep ensure
Setting up the Databases
- Install Postgres
- Create a superuser for yourself and make sure
psql --listworks without prompting for a password. createdb vulcanize_privatecd $GOPATH/src/github.com/8thlight/vulcanizedbHOST_NAME=localhost NAME=vulcanize_public PORT=5432 make migrate- See below for configuring additional environments
Adding a new migration: ./scripts/create_migration <migration-name>
Building
make build
Creating/Using a Private Blockchain
Syncing the public blockchain takes many hours for the initial sync and will download 20+ GB of data. Here are some instructions for creating a private blockchain that does not depend on having a network connection.
- Run
./scripts/setupto create a private blockchain with a new account.- This will result in a warning.
- Run
./scripts/start_private_blockchain. - Run
godo run -- --environment=privateto start listener.
Connecting to the Public Blockchain
./scripts/start_blockchain
IPC File Paths
The default location for Ethereum is:
$HOME/Library/Ethereumfor Mac$HOME/.ethereumfor Ubuntu$GOPATH/src/gihub.com/8thlight/vulcanizedb/test_data_dir/geth.ipcfor private blockchain.
Note the location of the ipc file is outputted when you connect to geth. It is needed to for configuration
Start Vulcanize DB
- Start geth
- In a separate terminal start vulcanize_db
vulcanize sync --config <config.toml> --starting-block-number <block-numbe>
Watch contract events
- Start geth
- In a separate terminal start vulcanize_db
vulcanize sync --config <config.toml> --starting-block-number <block-numbe>
- Create event filter
vulcanize addFilter --config <config.toml> --filter-filepath <filter.json>
Configuring Additional Environments
You can create configuration files for additional environments.
- Among other things, it will require the IPC file path
- See
environments/private.tomlfor an example - You will need to do this if you want to run a node connecting to the public blockchain
Running the Tests
Unit Tests
go test ./pkg/...
Integration Test
In order to run the integration tests, you will need to run them against a real blockchain. At the moment the integration tests require Geth v1.7.2 as they depend on the --dev mode, which changed in v1.7.3
- Run
./scripts/start_private_blockchainas a separate process. go test ./...to run all tests.