Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add block cache, remove sqlite3 #149

Merged
merged 2 commits into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@
# To run container: make docker_image_run
#
# This will place you into the container where you can run zcashd, zcash-cli,
# lightwalletd ingester, and lightwalletd server etc..
# lightwalletd server etc..
#
# First you need to get zcashd sync to current height on testnet, from outside container:
# make docker_img_run_zcashd
#
# Sometimes you need to manually start zcashd for the first time, from insdie the container:
# zcashd -printtoconsole
#
# Once the block height is atleast 280,000 you can go ahead and start lightwalletd components
# make docker_img_run_lightwalletd_ingest
# Once the block height is atleast 280,000 you can go ahead and start lightwalletd
# make docker_img_run_lightwalletd_insecure_server
#
# If you need a random bash session in the container, use:
Expand Down Expand Up @@ -57,7 +56,7 @@ RUN git clone ${LIGHTWALLETD_URL}
#ADD . /home

RUN cd ./lightwalletd && make
RUN /usr/bin/install -c /home/lightwalletd/ingest /home/lightwalletd/server /usr/bin/
RUN /usr/bin/install -c /home/lightwalletd/server /usr/bin/

# Setup layer for zcashd and zcash-cli binary
FROM golang:1.11 AS zcash_builder
Expand Down Expand Up @@ -95,8 +94,8 @@ RUN mkdir -p /home/$ZCASHD_USER/.zcash/ && \
USER $ZCASHD_USER
WORKDIR /home/$ZCASHD_USER/

# Use lightwallet server and ingest binaries from prior layer
COPY --from=lightwalletd_base /usr/bin/ingest /usr/bin/server /usr/bin/
# Use lightwallet server binary from prior layer
COPY --from=lightwalletd_base /usr/bin/server /usr/bin/
Copy link
Collaborator Author

@LarryRuane LarryRuane Dec 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test these changes to Dockerfile

COPY --from=zcash_builder /usr/bin/zcashd /usr/bin/zcash-cli /usr/bin/
COPY --from=zcash_builder /root/.zcash-params/ /home/$ZCASHD_USER/.zcash-params/

Expand Down
10 changes: 2 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,9 @@ docker_img_run_zcashd:
docker_img_stop_zcashd:
docker exec -i zcashdlwd zcash-cli stop

# Start the lightwalletd ingester in the zcashdlwd container
docker_img_run_lightwalletd_ingest:
docker exec -i zcashdlwd ingest --conf-file /home/zcash/.zcash/zcash.conf --db-path /db/sql.db --log-file /logs/ingest.log

# Start the lightwalletd server in the zcashdlwd container
docker_img_run_lightwalletd_insecure_server:
docker exec -i zcashdlwd server --very-insecure=true --conf-file /home/zcash/.zcash/zcash.conf --db-path /db/sql.db --log-file /logs/server.log --bind-addr 127.0.0.1:18232
docker exec -i zcashdlwd server --no-tls-very-insecure=true --conf-file /home/zcash/.zcash/zcash.conf --log-file /logs/server.log --bind-addr 127.0.0.1:18232
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test this yet


# Remove and delete ALL images and containers in Docker; assumes containers are stopped
docker_remove_all:
Expand All @@ -91,11 +87,9 @@ dep:

# Build binary
build:
GO111MODULE=on CGO_ENABLED=1 go build -i -v ./cmd/ingest
GO111MODULE=on CGO_ENABLED=1 go build -i -v ./cmd/server

build_rel:
GO111MODULE=on CGO_ENABLED=1 GOOS=linux go build -ldflags="-s -w" -i -v ./cmd/ingest
GO111MODULE=on CGO_ENABLED=1 GOOS=linux go build -ldflags="-s -w" -i -v ./cmd/server

# Install binaries into Go path
Expand All @@ -104,4 +98,4 @@ install:

clean:
@echo "clean project..."
#rm -f $(PROJECT_NAME)
#rm -f $(PROJECT_NAME)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(for some reason this was missing a newline)

26 changes: 5 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

[lightwalletd](https://github.com/zcash-hackworks/lightwalletd) is a backend service that provides a bandwidth-efficient interface to the Zcash blockchain. Currently, lightwalletd supports the Sapling protocol version as its primary concern. The intended purpose of lightwalletd is to support the development of mobile-friendly shielded light wallets.

lightwalletd consists of three loosely coupled components: an "ingester", a "frontend", and an arbitrary storage layer (such as a SQL database) that connects the two. The ingester receives raw block data, parses out the transactions and block metadata, then stores them in a format convenient for the frontend to serve to clients. Thus, these components can operate and scale independently of each other and are connected only by a shared storage convention.
lightwalletd is a backend service that provides a bandwidth-efficient interface to the Zcash blockchain for mobile and other wallets, such as [Zecwallet](https://github.com/adityapk00/zecwallet-lite-lib).

Lightwalletd has not yet undergone audits or been subject to rigorous testing. It lacks some affordances necessary for production-level reliability. We do not recommend using it to handle customer funds at this time (October 2019).

Expand All @@ -18,24 +18,16 @@ To view detailed [Codecov](https://codecov.io/gh/zcash-hackworks/lightwalletd) r

First, ensure [Go >= 1.11](https://golang.org/dl/#stable) is installed. Once your go environment is setup correctly, you can build/run the below components.

To build ingest and server, run `make`.
To build the server, run `make`.

This will build the ingest and server binaries, where you can use the below commands to configure how they run.

## To run INGESTER

Assuming you used `make` to build INGESTER

```
./ingest --conf-file /home/zcash/.zcash/zcash.conf --db-path /db/sql.db --log-file /logs/ingest.log
```
This will build the server binary, where you can use the below commands to configure how it runs.

## To run SERVER

Assuming you used `make` to build SERVER:

```
./server --very-insecure=true --conf-file /home/zcash/.zcash/zcash.conf --db-path /db/sql.db --log-file /logs/server.log --bind-addr 127.0.0.1:18232
./server --no-tls-very-insecure=true --conf-file /home/zcash/.zcash/zcash.conf --log-file /logs/server.log --bind-addr 127.0.0.1:18232
```

# Production Usage
Expand Down Expand Up @@ -66,20 +58,12 @@ certbot certonly --standalone --preferred-challenges http -d some.forward.dns.co
```
5) Pass the resulting certificate and key to frontend using the -tls-cert and -tls-key options.

## To run production INGESTER

Example using ingest binary built from Makefile:

```
./ingest --conf-file /home/zcash/.zcash/zcash.conf --db-path /db/sql.db --log-file /logs/ingest.log
```

## To run production SERVER

Example using server binary built from Makefile:

```
./server --tls-cert cert.pem --tls-key key.pem --conf-file /home/zcash/.zcash/zcash.conf --db-path /db/sql.db --log-file /logs/server.log --bind-addr 127.0.0.1:18232
./server --tls-cert cert.pem --tls-key key.pem --conf-file /home/zcash/.zcash/zcash.conf --log-file /logs/server.log --bind-addr 127.0.0.1:18232
```

# Pull Requests
Expand Down
1 change: 0 additions & 1 deletion cmd/ingest/README.md

This file was deleted.

8 changes: 0 additions & 8 deletions cmd/ingest/ingest_test.go

This file was deleted.

Loading