Server backend for indexed ETH IPLD objects
f97c75828a
Update Travis to create a database from a schema |
||
---|---|---|
core | ||
fakes | ||
integration_test | ||
migrations | ||
scripts | ||
.gitignore | ||
.private_blockchain_password | ||
.travis.yml | ||
Gopkg.lock | ||
Gopkg.toml | ||
main.go | ||
README.md |
Vulcanize DB
Development Setup
Dependencies
- Go 1.9+
- https://github.com/golang/dep
brew install dep
works for Homebrew users
- Postgres 10
Cloning the Repository
git config --global url."git@github.com:".insteadOf "https://github.com/"
- By default,
go get
does not work for private GitHub repos. This will fix that.
- By default,
go get github.com/8thlight/vulcanizedb
go get github.com/ethereum/go-ethereum
- This will take a while and gives poor indication of progress.
go install github.com/ethereum/go-ethereum/cmd/geth
cd $GOPATH/src/github.com/8thlight/vulcanizedb
dep ensure
Setting up the Development Database
- Install Postgres
- Create a superuser for yourself and make sure
psql --list
works without prompting for a password. go get -u -d github.com/mattes/migrate/cli github.com/lib/pq
go build -tags 'postgres' -o /usr/local/bin/migrate github.com/mattes/migrate/cli
createdb vulcanize
cd $GOPATH/src/github.com/8thlight/vulcanizedb
migrate -database 'postgresql://localhost:5432/vulcanize?sslmode=disable' -path ./migrations up
Adding a new migration: migrate -database postgresql://localhost:5432/postgres create -dir ./migrations -ext sql <migration-name>
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/setup
to create a private blockchain with a new account.- This will result in a warning.
- Run
./scripts/start_private_blockchain
.
Connecting to the Public Blockchain
./scripts/start_blockchain
IPC File Paths
The default location for Ethereum is:
$HOME/Library/Ethereum
for Mac$HOME/.ethereum
for Ubuntu$GOPATH/src/gihub.com/8thlight/vulcanizedb/test_data_dir/geth.ipc
for private blockchain.
Note the location of the ipc file is outputted when you connect to a blockchain. It is needed to start the listener below
Running Listener
- Start a blockchain.
- In a separate terminal start listener (ipcDir location)
go run main.go --ipcPath /path/to/file.ipc
Running the Tests
Integration Test
In order to run the integration tests, you will need to run them against a real blockchain.
- Run
./scripts/start_private_blockchain
as a separate process. go test ./...
Unit Tests
go test ./core