aff2ad2b09
Update build badge url |
||
---|---|---|
cmd | ||
db | ||
environments | ||
integration_test | ||
libraries/shared | ||
pkg | ||
scripts | ||
test_config | ||
utils | ||
vendor | ||
.gitignore | ||
.private_blockchain_password | ||
.travis.yml | ||
Gopkg.lock | ||
Gopkg.toml | ||
LICENSE | ||
main.go | ||
Makefile | ||
README.md |
Vulcanize DB
About
Vulcanize DB is a set of tools that make it easier for developers to write application-specific indexes and caches for dapps built on Ethereum.
Dependencies
- Go 1.9+
- Postgres 10
- Ethereum Node
- Go Ethereum (1.8+)
- Parity 1.8.11+
Installation
go get github.com/vulcanize/vulcanizedb
Setting up the Database
-
Install Postgres
-
Create a superuser for yourself and make sure
psql --list
works without prompting for a password. -
createdb vulcanize_public
-
cd $GOPATH/src/github.com/vulcanize/vulcanizedb
-
Run the migrations:
make migrate HOST_NAME=localhost NAME=vulcanize_public PORT=5432
- See below for configuring additional environments
Configuration
-
To use a local Ethereum node, copy
environments/public.toml.example
toenvironments/public.toml
and update theipcPath
andlevelDbPath
.-
ipcPath
should match the local node's IPC filepath:-
when using geth:
- The IPC file is called
geth.ipc
. - The geth IPC file path is printed to the console when you start geth.
- The default location is:
- Mac:
$HOME/Library/Ethereum
- Linux:
$HOME/.ethereum
- Mac:
- The IPC file is called
-
when using parity:
- The IPC file is called
jsonrpc.ipc
. - The default location is:
- Mac:
$HOME/Library/Application\ Support/io.parity.ethereum/
- Linux:
$HOME/.local/share/io.parity.ethereum/
- Mac:
- The IPC file is called
-
-
levelDbPath
should match Geth's chaindata directory path.- The geth LevelDB chaindata path is printed to the console when you start geth.
- The default location is:
- Mac:
$HOME/Library/Ethereum/geth/chaindata
- Linux:
$HOME/.ethereum/geth/chaindata
- Mac:
levelDbPath
is irrelevant (andcoldImport
is currently unavailable) if only running parity.
-
-
See
environments/infura.toml
to configure commands to run against infura, if a local node is unavailable
Start syncing with postgres
Syncs VulcanizeDB with the configured Ethereum node.
- Start node (if fast syncing wait for initial sync to finish)
- In a separate terminal start vulcanize_db
./vulcanizedb sync --config <config.toml> --starting-block-number <block-number>
Alternatively, sync from Geth's underlying LevelDB
Sync VulcanizeDB from the LevelDB underlying a Geth node.
- Assure node is not running, and that it has synced to the desired block height.
- Start vulcanize_db
./vulcanizedb coldImport --config <config.toml> --starting-block-number <block-number> --ending-block-number <block-number>
- Optional flags:
--starting-block-number
/-s
: block number to start syncing from--ending-block-number
/-e
: block number to sync to--all
/-a
: sync all missing blocks
Running the Tests
Unit Tests
go test ./pkg/...
Integration Tests
go test ./...
to run all tests.