From 9f31aad6d8d650dd53d4398782d18bb43968265c Mon Sep 17 00:00:00 2001 From: MarcoOl94 Date: Thu, 29 Oct 2020 14:11:44 +0100 Subject: [PATCH 01/15] Managed coinbase output coins with SubAccount --- services/account_service_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/account_service_test.go b/services/account_service_test.go index 0b78801b..0afe02d1 100644 --- a/services/account_service_test.go +++ b/services/account_service_test.go @@ -105,7 +105,7 @@ func TestAccountBalance_Online_Current(t *testing.T) { assert.Equal(t, &types.AccountBalanceResponse{ BlockIdentifier: block, - Coins: expectedCoins, + Coins: coins, Balances: []*types.Amount{ { Value: "25", From 4982cc23d9b4fd4f8c64e66372cfdd96c07c362a Mon Sep 17 00:00:00 2001 From: cronicc Date: Mon, 26 Oct 2020 11:48:24 +0000 Subject: [PATCH 02/15] Refactor Dockerfile: * add entrypoint.sh for trusted setup download * run as unprivileged user nobody:nogroup * add /data volume --- .dockerignore | 6 +- Dockerfile | 160 ++++++++++++++++++++++---------------------------- entrypoint.sh | 12 ++++ 3 files changed, 86 insertions(+), 92 deletions(-) create mode 100755 entrypoint.sh diff --git a/.dockerignore b/.dockerignore index cee942d6..9e09df36 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,7 @@ rosetta-bitcoin zen-data -cli-data \ No newline at end of file +cli-data +Dockerfile* +*.sh +!entrypoint.sh +*.md diff --git a/Dockerfile b/Dockerfile index 1c3de90b..807c53ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ # Copyright 2020 Coinbase, Inc. +# Copyright 2020 Zen Blockchain Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,119 +13,96 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Build bitcoind -FROM ubuntu:18.04 as bitcoind-builder - -RUN mkdir -p /app \ - && chown -R nobody:nogroup /app -WORKDIR /app - -# Source: https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md#ubuntu--debian -RUN apt-get update && apt-get install -y make gcc g++ autoconf autotools-dev bsdmainutils build-essential git libboost-all-dev \ - libcurl4-openssl-dev libdb++-dev libevent-dev libssl-dev libtool pkg-config python python-pip libzmq3-dev wget +## Build zend +FROM ubuntu:18.04 as zend-builder +MAINTAINER cronic@horizen.io -RUN apt-get -qqy update \ - && apt-get -qqy --no-install-recommends install \ - bzip2 \ - ca-certificates \ - sudo \ - unzip \ - wget \ - && rm -rf /var/lib/apt/lists/* /var/cache/apt/* +SHELL ["/bin/bash", "-c"] +# Latest release zen 2.0.22 +ARG ZEN_COMITTISH=2a5e4bc40180bbcb72a0fdc003a52b6812301d98 -RUN apt-get -qqy update \ - && apt-get -qqy --no-install-recommends install \ - curl \ - bc \ - vim \ - git \ - binutils \ - xz-utils \ - python3-pip \ - build-essential \ - pkg-config \ - libc6-dev \ - m4 \ - g++-multilib \ - autoconf \ - libtool \ - ncurses-dev \ - zlib1g-dev \ - bsdmainutils \ - automake \ - ssh-client \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get -qyy clean +RUN set -euxo pipefail \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get update \ + && apt-get -y --no-install-recommends install apt-utils \ + && apt-get -y --no-install-recommends dist-upgrade \ + && apt-get -y --no-install-recommends install autoconf automake \ + bsdmainutils build-essential ca-certificates cmake curl fakeroot \ + git g++-multilib libc6-dev libgomp1 libtool m4 ncurses-dev \ + pkg-config zlib1g-dev \ + && git clone https://github.com/HorizenOfficial/zen.git \ + && cd /zen && git checkout "${ZEN_COMITTISH}" \ + && export MAKEFLAGS="-j $(($(nproc)+1))" && ./zcutil/build.sh $MAKEFLAGS +## Build Rosetta Server Components +FROM ubuntu:18.04 as rosetta-builder +MAINTAINER cronic@horizen.io -# VERSION: Bitcoin Core 0.20.1 -RUN git clone https://github.com/HorizenOfficial/zen.git +SHELL ["/bin/bash", "-c"] -RUN cd zen \ - && zcutil/build.sh -j2 +ARG GOLANG_VERSION=1.15.3 +ARG GOLANG_DOWNLOAD_SHA256=010a88df924a81ec21b293b5da8f9b11c176d27c0ee3962dc1738d2352d3c02d +ARG GOLANG_DOWNLOAD_URL="https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz" -RUN mv zen/src/zend /app/zend \ - && rm -rf zen +COPY . /go/src -# Build Rosetta Server Components -FROM ubuntu:18.04 as rosetta-builder +RUN set -euxo pipefail \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get update \ + && apt-get -y --no-install-recommends install apt-utils \ + && apt-get -y --no-install-recommends dist-upgrade \ + && apt-get -y --no-install-recommends install ca-certificates curl g++ gcc git make \ + && curl -fsSL "$GOLANG_DOWNLOAD_URL" -o /tmp/golang.tar.gz \ + && echo "${GOLANG_DOWNLOAD_SHA256} /tmp/golang.tar.gz" | sha256sum -c - \ + && tar -C /usr/local -xzf /tmp/golang.tar.gz \ + && export GOPATH="/go" && export PATH="${GOPATH}/bin:/usr/local/go/bin:${PATH}" \ + && mkdir "${GOPATH}/bin" && chmod -R 777 "${GOPATH}" \ + && cd "${GOPATH}/src" && go build -RUN mkdir -p /app \ - && chown -R nobody:nogroup /app -WORKDIR /app - -RUN apt-get update && apt-get install -y curl make gcc g++ git -ENV GOLANG_VERSION 1.15.2 -ENV GOLANG_DOWNLOAD_SHA256 b49fda1ca29a1946d6bb2a5a6982cf07ccd2aba849289508ee0f9918f6bb4552 -ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz - -RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \ - && echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \ - && tar -C /usr/local -xzf golang.tar.gz \ - && rm golang.tar.gz - -ENV GOPATH /go -ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH -RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" -# Use native remote build context to build in any directory -COPY . src -RUN cd src \ - && go build \ - && cd .. \ - && mv src/rosetta-zen /app/rosetta-zen \ - && mv src/assets/* /app \ - && rm -rf src ## Build Final Image FROM ubuntu:18.04 -RUN apt-get update && \ - apt-get install --no-install-recommends -y libevent-dev libboost-system-dev libboost-filesystem-dev libboost-test-dev libboost-thread-dev net-tools vim git && \ - apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +MAINTAINER cronic@horizen.io -RUN mkdir -p /app \ - && chown -R nobody:nogroup /app \ - && mkdir -p /data \ - && chown -R nobody:nogroup /data \ - && mkdir -p /data/.zcash-params \ - && chown -R nobody:nogroup /data/.zcash-params +SHELL ["/bin/bash", "-c"] WORKDIR /app -# Copy binary from bitcoind-builder -#COPY --from=bitcoind-builder /app/zend /app/zend +# Copy zend and fetch-params.sh +COPY --from=zend-builder /zen/src/zend /zen/zcutil/fetch-params.sh /app/ + +# Copy rosetta-zen and assets +COPY --from=rosetta-builder /go/src/rosetta-zen /go/src/assets/* /app/ + +# Copy entrypoint script +COPY entrypoint.sh /app/ + +# Install runtime dependencies and set up home folder for nobody user. +# As it's best practice to not run as root even inside a container, +# we run as nobody and change the home folder to "/data". +RUN set -euxo pipefail \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get update \ + && apt-get -y --no-install-recommends install apt-utils \ + && apt-get -y --no-install-recommends dist-upgrade \ + && apt-get -y --no-install-recommends install ca-certificates curl libgomp1 \ + && apt-get -y clean && apt-get -y autoclean \ + && rm -rf /var/{lib/apt/lists/*,cache/apt/archives/*.deb,tmp/*,log/*} /tmp/* \ + && mkdir -p /data \ + && for path in /data /app; do chown -R nobody:nogroup $path && chmod 2755 $path; done \ + && for file in /app/{entrypoint.sh,rosetta-zen,fetch-params.sh,zend}; do chmod 755 $file; done \ + && sed -i 's|nobody:/nonexistent|nobody:/data|' /etc/passwd + +VOLUME ["/data"] -# Copy binary from rosetta-builder -COPY --from=rosetta-builder /app/* /app/ -RUN cd /root \ - && ln -sf /data/.zcash-params .zcash-params +USER nobody -# Set permissions for everything added to /app -RUN chmod -R 755 /app/* +ENTRYPOINT ["/app/entrypoint.sh"] CMD ["/app/rosetta-zen"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 00000000..69bb5b69 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -euo pipefail + +if [ "$(stat -c '%u:%g' /data)" != "65534:65534" ]; then + echo "Folder mounted at /data is not owned by nobody:nogroup, please change it's permissions on the host with 'sudo chown -R 65534:65534 path/to/zen-data'." + exit 1 +fi + +/app/fetch-params.sh + +exec "$@" From 303a537d8e60f8a2fbf2ef7725317c77f7c5b2bb Mon Sep 17 00:00:00 2001 From: cronicc Date: Mon, 26 Oct 2020 11:52:50 +0000 Subject: [PATCH 03/15] Change datadir to /data/.zen, zend log to stdout instead of debug.log, change bitcoin references to zen --- assets/zen-mainnet.conf | 15 +++++++++------ assets/zen-testnet.conf | 23 +++++++++++++---------- configuration/configuration.go | 14 +++++++------- configuration/configuration_test.go | 2 +- go.sum | 1 + indexer/indexer.go | 14 +++++++------- indexer/indexer_test.go | 2 +- install.sh | 2 +- services/construction_service.go | 12 ++++++------ services/errors.go | 8 ++++---- services/network_service_test.go | 2 +- services/types.go | 6 +++--- zen/node.go | 2 +- 13 files changed, 55 insertions(+), 48 deletions(-) diff --git a/assets/zen-mainnet.conf b/assets/zen-mainnet.conf index 17caf0a0..02d1e2eb 100644 --- a/assets/zen-mainnet.conf +++ b/assets/zen-mainnet.conf @@ -1,18 +1,19 @@ ## -## bitcoin.conf configuration file. Lines beginning with # are comments. +## zen.conf configuration file. Lines beginning with # are comments. ## # DO NOT USE THIS CONFIGURATION FILE IF YOU PLAN TO EXPOSE -# BITCOIND'S RPC PORT PUBLICALLY (THESE INSECURE CREDENTIALS -# COULD LEAD TO AN ATTACK). ROSETTA-BITCOIN USES THE RPC PORT +# ZEND'S RPC PORT PUBLICALLY (THESE INSECURE CREDENTIALS +# COULD LEAD TO AN ATTACK). ROSETTA-ZEN USES THE RPC PORT # FOR INDEXING AND TRANSACTION BROADCAST BUT NEVER PROVIDES THE -# CALLER ACCESS TO BITCOIND'S RPC PORT. +# CALLER ACCESS TO ZEND'S RPC PORT. -datadir=/data/bitcoind +datadir=/data/.zen bind=0.0.0.0 rpcbind=0.0.0.0 bantime=15 rpcallowip=0.0.0.0/0 +rpcallowip=::/0 rpcthreads=16 rpcworkqueue=1000 disablewallet=1 @@ -21,6 +22,8 @@ port=9033 rpcport=8231 rpcuser=rosetta rpcpassword=rosetta +showmetrics=0 +printtoconsole=1 -# manual pruning is not supported in the zend +# manual pruning is not supported in zend #prune=1 diff --git a/assets/zen-testnet.conf b/assets/zen-testnet.conf index 1fceb629..020828ea 100644 --- a/assets/zen-testnet.conf +++ b/assets/zen-testnet.conf @@ -1,27 +1,30 @@ ## -## bitcoin.conf configuration file. Lines beginning with # are comments. +## zen.conf configuration file. Lines beginning with # are comments. ## # DO NOT USE THIS CONFIGURATION FILE IF YOU PLAN TO EXPOSE -# BITCOIND'S RPC PORT PUBLICALLY (THESE INSECURE CREDENTIALS -# COULD LEAD TO AN ATTACK). ROSETTA-BITCOIN USES THE RPC PORT +# ZEND'S RPC PORT PUBLICALLY (THESE INSECURE CREDENTIALS +# COULD LEAD TO AN ATTACK). ROSETTA-ZEN USES THE RPC PORT # FOR INDEXING AND TRANSACTION BROADCAST BUT NEVER PROVIDES THE -# CALLER ACCESS TO BITCOIND'S RPC PORT. +# CALLER ACCESS TO ZEND'S RPC PORT. -datadir=/data/bitcoind +datadir=/data/.zen +bind=0.0.0.0 +rpcbind=0.0.0.0 bantime=15 rpcallowip=0.0.0.0/0 +rpcallowip=::/0 rpcthreads=16 rpcworkqueue=1000 disablewallet=1 txindex=0 +port=19033 +rpcport=18231 rpcuser=rosetta rpcpassword=rosetta +showmetrics=0 +printtoconsole=1 testnet=1 -port=19033 -bind=0.0.0.0 -rpcport=18231 -rpcbind=0.0.0.0 -# manual pruning is not supported in the zend +# manual pruning is not supported in zend #prune=1 diff --git a/configuration/configuration.go b/configuration/configuration.go index 1379a835..b28ab343 100644 --- a/configuration/configuration.go +++ b/configuration/configuration.go @@ -51,11 +51,11 @@ const ( // Regtest is Zen Regtest. Regtest string = "REGTEST" - // mainnetConfigPath is the path of the Bitcoin + // mainnetConfigPath is the path of the Horizen // configuration file for mainnet. mainnetConfigPath = "/app/zen-mainnet.conf" - // testnetConfigPath is the path of the Bitcoin + // testnetConfigPath is the path of the Horizen // configuration file for testnet. testnetConfigPath = "/app/zen-testnet.conf" @@ -88,7 +88,7 @@ const ( // persistent data. DataDirectory = "/data" - bitcoindPath = "bitcoind" + zendPath = ".zen" indexerPath = "indexer" // allFilePermissions specifies anyone can do anything @@ -129,7 +129,7 @@ type Configuration struct { ConfigPath string Pruning *PruningConfiguration IndexerPath string - BitcoindPath string + ZendPath string Compressors []*storage.CompressorEntry } @@ -152,9 +152,9 @@ func LoadConfiguration(baseDirectory string) (*Configuration, error) { return nil, fmt.Errorf("%w: unable to create indexer path", err) } - config.BitcoindPath = path.Join(baseDirectory, bitcoindPath) - if err := ensurePathExists(config.BitcoindPath); err != nil { - return nil, fmt.Errorf("%w: unable to create bitcoind path", err) + config.ZendPath = path.Join(baseDirectory, zendPath) + if err := ensurePathExists(config.ZendPath); err != nil { + return nil, fmt.Errorf("%w: unable to create zen data directory path", err) } case Offline: config.Mode = Offline diff --git a/configuration/configuration_test.go b/configuration/configuration_test.go index f7d2e635..6e5e8ef7 100644 --- a/configuration/configuration_test.go +++ b/configuration/configuration_test.go @@ -143,7 +143,7 @@ func TestLoadConfiguration(t *testing.T) { assert.Contains(t, err.Error(), test.err.Error()) } else { test.cfg.IndexerPath = path.Join(newDir, "indexer") - test.cfg.BitcoindPath = path.Join(newDir, "bitcoind") + test.cfg.ZendPath = path.Join(newDir, ".zen") assert.Equal(t, test.cfg, cfg) assert.NoError(t, err) } diff --git a/go.sum b/go.sum index b9eb2141..fff31759 100644 --- a/go.sum +++ b/go.sum @@ -333,6 +333,7 @@ golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTk golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= diff --git a/indexer/indexer.go b/indexer/indexer.go index 5a0dad91..431f3fcf 100644 --- a/indexer/indexer.go +++ b/indexer/indexer.go @@ -219,7 +219,7 @@ func Initialize( return i, nil } -// waitForNode returns once bitcoind is ready to serve +// waitForNode returns once zend is ready to serve // block queries. func (i *Indexer) waitForNode(ctx context.Context) error { logger := utils.ExtractLogger(ctx, "indexer") @@ -230,14 +230,14 @@ func (i *Indexer) waitForNode(ctx context.Context) error { return nil } - logger.Infow("waiting for bitcoind...") + logger.Infow("waiting for zend...") if err := sdkUtils.ContextSleep(ctx, nodeWaitSleep); err != nil { return err } } } -// Sync attempts to index Bitcoin blocks using +// Sync attempts to index Horizen blocks using // the bitcoin.Client until stopped. func (i *Indexer) Sync(ctx context.Context) error { if err := i.waitForNode(ctx); err != nil { @@ -272,7 +272,7 @@ func (i *Indexer) Sync(ctx context.Context) error { return syncer.Sync(ctx, startIndex, indexPlaceholder) } -// Prune attempts to prune blocks in bitcoind every +// Prune attempts to prune blocks in zend every // pruneFrequency. func (i *Indexer) Prune(ctx context.Context) error { logger := utils.ExtractLogger(ctx, "pruner") @@ -300,16 +300,16 @@ func (i *Indexer) Prune(ctx context.Context) error { continue } - logger.Infow("attempting to prune bitcoind", "prune height", pruneHeight) + logger.Infow("attempting to prune zend", "prune height", pruneHeight) prunedHeight, err := i.client.PruneBlockchain(ctx, pruneHeight) if err != nil { logger.Warnw( - "unable to prune bitcoind", + "unable to prune zend", "prune height", pruneHeight, "error", err, ) } else { - logger.Infow("pruned bitcoind", "prune height", prunedHeight) + logger.Infow("pruned zend", "prune height", prunedHeight) } } } diff --git a/indexer/indexer_test.go b/indexer/indexer_test.go index eaa6f685..231e066f 100644 --- a/indexer/indexer_test.go +++ b/indexer/indexer_test.go @@ -75,7 +75,7 @@ func TestIndexer_Pruning(t *testing.T) { i, err := Initialize(ctx, cancel, cfg, mockClient) assert.NoError(t, err) - // Waiting for bitcoind... + // Waiting for zend... mockClient.On("NetworkStatus", ctx).Return(nil, errors.New("not ready")).Once() mockClient.On("NetworkStatus", ctx).Return(&types.NetworkStatusResponse{}, nil).Once() diff --git a/install.sh b/install.sh index 828f5f9d..fff92575 100755 --- a/install.sh +++ b/install.sh @@ -20,7 +20,7 @@ set -e usage() { this=$1 cat < Date: Mon, 26 Oct 2020 11:53:57 +0000 Subject: [PATCH 04/15] Update Makefile, README.md to reflect the need for correct ownership of zen-data dir --- Makefile | 15 +++++++++------ README.md | 18 ++++++++++++------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 5bca81b9..f091334d 100644 --- a/Makefile +++ b/Makefile @@ -14,30 +14,33 @@ GO_FOLDERS=$(shell echo ${GO_PACKAGES} | sed -e "s/\.\///g" | sed -e "s/\/\.\.\. TEST_SCRIPT=go test ${GO_PACKAGES} LINT_SETTINGS=golint,misspell,gocyclo,gocritic,whitespace,goconst,gocognit,bodyclose,unconvert,lll,unparam PWD=$(shell pwd) +GZIP_CMD=$(shell command -v pigz || echo gzip) NOFILE=100000 deps: go get ./... build: - docker build -t rosetta-zen:latest https://github.com/HorizenOfficial/rosetta-zen + docker build --pull -t rosetta-zen:latest https://github.com/HorizenOfficial/rosetta-zen build-local: - docker build -t rosetta-zen:latest . + docker build --pull -t rosetta-zen:latest . build-release: # make sure to always set version with vX.X.X - docker build -t rosetta-zen:$(version) .; - docker save rosetta-zen:$(version) | gzip > rosetta-zen-$(version).tar.gz; + docker build --pull --no-cache -t rosetta-zen:$(version) .; + docker save rosetta-zen:$(version) | ${GZIP_CMD} > rosetta-zen-$(version).tar.gz; run-mainnet-online: - docker run -d --rm --ulimit "nofile=${NOFILE}:${NOFILE}" -v "${PWD}/zen-data:/data" -e "MODE=ONLINE" -e "NETWORK=MAINNET" -e "PORT=8080" -p 8080:8080 -p 8333:8333 rosetta-zen:latest + docker run --rm -v "${PWD}/zen-data:/data" ubuntu:18.04 bash -c 'chown -R nobody:nogroup /data'; + docker run -d --rm --ulimit "nofile=${NOFILE}:${NOFILE}" -v "${PWD}/zen-data:/data" -e "MODE=ONLINE" -e "NETWORK=MAINNET" -e "PORT=8080" -p 8080:8080 -p 9033:9033 rosetta-zen:latest; run-mainnet-offline: docker run -d --rm -e "MODE=OFFLINE" -e "NETWORK=MAINNET" -e "PORT=8081" -p 8081:8081 rosetta-zen:latest run-testnet-online: - docker run -d --rm --ulimit "nofile=${NOFILE}:${NOFILE}" -v "${PWD}/zen-data:/data" -e "MODE=ONLINE" -e "NETWORK=TESTNET" -e "PORT=8080" -p 8080:8080 -p 18333:18333 rosetta-zen:latest + docker run --rm -v "${PWD}/zen-data:/data" ubuntu:18.04 bash -c 'chown -R nobody:nogroup /data'; + docker run -d --rm --ulimit "nofile=${NOFILE}:${NOFILE}" -v "${PWD}/zen-data:/data" -e "MODE=ONLINE" -e "NETWORK=TESTNET" -e "PORT=8080" -p 8080:8080 -p 19033:19033 rosetta-zen:latest; run-testnet-offline: docker run -d --rm -e "MODE=OFFLINE" -e "NETWORK=TESTNET" -e "PORT=8081" -p 8081:8081 rosetta-zen:latest diff --git a/README.md b/README.md index e412ded6..dd89543d 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ ## Overview -`rosetta-zen` provides an implementation of the Rosetta API for -Hotizen network in Golang. If you haven't heard of the Rosetta API, you can find more +`rosetta-zen` provides an implementation of the Rosetta API for the +Horizen network in Golang. If you haven't heard of the Rosetta API, you can find more information [here](https://rosetta-api.org). ## Usage @@ -42,11 +42,15 @@ make build-local Running the following commands will start a Docker container in [detached mode](https://docs.docker.com/engine/reference/run/#detached--d) with a data directory at `/zen-data` and the Rosetta API accessible -at port `8080`. +at port `8080`. Please make sure that `/zen-data` has `nobody:nogroup` ownership. +You can also use a named volume which will be created with the correct ownership using: `-v "zen-data:/data`. #### Mainnet:Online ```text -docker run -d --rm --ulimit "nofile=100000:100000" -v "$(pwd)/zen-data:/data" -e "MODE=ONLINE" -e "NETWORK=MAINNET" -e "PORT=8080" -p 8080:8080 -p 8333:8333 rosetta-zen:latest +# create /zen-data with correct ownership +docker run --rm -v "$(pwd)/zen-data:/data" ubuntu:18.04 bash -c 'chown -R nobody:nogroup /data' +# start rosetta-zen +docker run -d --rm --ulimit "nofile=100000:100000" -v "$(pwd)/zen-data:/data" -e "MODE=ONLINE" -e "NETWORK=MAINNET" -e "PORT=8080" -p 8080:8080 -p 9033:9033 rosetta-zen:latest ``` _If you cloned the repository, you can run `make run-mainnet-online`._ @@ -58,7 +62,10 @@ _If you cloned the repository, you can run `make run-mainnet-offline`._ #### Testnet:Online ```text -docker run -d --rm --ulimit "nofile=100000:100000" -v "$(pwd)/zen-data:/data" -e "MODE=ONLINE" -e "NETWORK=TESTNET" -e "PORT=8080" -p 8080:8080 -p 18333:18333 rosetta-zen:latest +# create /zen-data with correct ownership +docker run --rm -v "$(pwd)/zen-data:/data" ubuntu:18.04 bash -c 'chown -R nobody:nogroup /data' +# start rosetta-zen +docker run -d --rm --ulimit "nofile=100000:100000" -v "$(pwd)/zen-data:/data" -e "MODE=ONLINE" -e "NETWORK=TESTNET" -e "PORT=8080" -p 8080:8080 -p 19033:19033 rosetta-zen:latest ``` _If you cloned the repository, you can run `make run-testnet-online`._ @@ -139,7 +146,6 @@ you can find a high-level overview of how everything fits together: ``` ### Optimizations -* Automatically prune bitcoind while indexing blocks * Reduce sync time with concurrent block indexing * Use [Zstandard compression](https://github.com/facebook/zstd) to reduce the size of data stored on disk without needing to write a manual byte-level encoding From 6b8fda80e1d84da49148c347150ecad5a71c22e5 Mon Sep 17 00:00:00 2001 From: cronicc Date: Mon, 26 Oct 2020 10:11:32 +0000 Subject: [PATCH 05/15] Linter fixes from `make check-comments` --- zen/client.go | 2 +- zen/types.go | 2 +- zenutil/doc.go | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/zen/client.go b/zen/client.go index 81e406f8..270ffb50 100644 --- a/zen/client.go +++ b/zen/client.go @@ -385,7 +385,7 @@ func (b *Client) getBlockchainInfo( return response.Result, nil } -// GetBestBlock performs the `getblockchaininfo` JSON-RPC request +// GetBestBlock performs the `getbestblock` JSON-RPC request func (b *Client) GetBestBlock( ctx context.Context, ) (int64, error) { diff --git a/zen/types.go b/zen/types.go index 8e2ef5e1..28e3e658 100644 --- a/zen/types.go +++ b/zen/types.go @@ -225,7 +225,7 @@ type BlockMetadata struct { Difficulty float64 `json:"difficulty,omitempty"` } -// Transaction is a raw Bitcoin transaction. +// Transaction is a raw Horizen transaction. type Transaction struct { Hex string `json:"hex"` Hash string `json:"txid"` diff --git a/zenutil/doc.go b/zenutil/doc.go index 4cdb66a8..e6851a63 100644 --- a/zenutil/doc.go +++ b/zenutil/doc.go @@ -3,26 +3,26 @@ // license that can be found in the LICENSE file. /* -Package zenutil provides bitcoin-specific convenience functions and types. +Package zenutil provides horizen-specific convenience functions and types. Block Overview -A Block defines a bitcoin block that provides easier and more efficient +A Block defines a horizen block that provides easier and more efficient manipulation of raw wire protocol blocks. It also memoizes hashes for the block and its transactions on their first access so subsequent accesses don't have to repeat the relatively expensive hashing operations. Tx Overview -A Tx defines a bitcoin transaction that provides more efficient manipulation of +A Tx defines a horizen transaction that provides more efficient manipulation of raw wire protocol transactions. It memoizes the hash for the transaction on its first access so subsequent accesses don't have to repeat the relatively expensive hashing operations. Address Overview -The Address interface provides an abstraction for a Bitcoin address. While the -most common type is a pay-to-pubkey-hash, Bitcoin already supports others and +The Address interface provides an abstraction for a Horizen address. While the +most common type is a pay-to-pubkey-hash, horizen already supports others and may well support more in the future. This package currently provides implementations for the pay-to-pubkey, pay-to-pubkey-hash, and pay-to-script-hash address types. From df53c78a58baba0cc088a494aab49a69438ebdbf Mon Sep 17 00:00:00 2001 From: cronicc Date: Mon, 26 Oct 2020 10:39:42 +0000 Subject: [PATCH 06/15] Linter fixes from `make spellcheck` --- zenutil/address.go | 6 +++--- zenutil/address_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zenutil/address.go b/zenutil/address.go index 5ddfba49..6b03e40e 100644 --- a/zenutil/address.go +++ b/zenutil/address.go @@ -21,7 +21,7 @@ var ( // ErrUnknownAddressType describes an error where an address can not // decoded as a specific address type due to the string encoding - // begining with an identifier byte unknown to any standard or + // beginning with an identifier byte unknown to any standard or // registered (via chaincfg.Register) network. ErrUnknownAddressType = errors.New("unknown address type") @@ -180,7 +180,7 @@ func (a *AddressPubKeyHash) String() string { } // Hash160 returns the underlying array of the pubkey hash. This can be useful -// when an array is more appropiate than a slice (for example, when used as map +// when an array is more appropriate than a slice (for example, when used as map // keys). func (a *AddressPubKeyHash) Hash160() *[ripemd160.Size]byte { return &a.hash @@ -246,7 +246,7 @@ func (a *AddressScriptHash) String() string { } // Hash160 returns the underlying array of the script hash. This can be useful -// when an array is more appropiate than a slice (for example, when used as map +// when an array is more appropriate than a slice (for example, when used as map // keys). func (a *AddressScriptHash) Hash160() *[ripemd160.Size]byte { return &a.hash diff --git a/zenutil/address_test.go b/zenutil/address_test.go index f306c158..257341f2 100644 --- a/zenutil/address_test.go +++ b/zenutil/address_test.go @@ -616,7 +616,7 @@ func TestAddresses(t *testing.T) { // Encode again and compare against the original. encoded := decoded.EncodeAddress() if test.encoded != encoded { - t.Errorf("%v: decoding and encoding produced different addressess: %v != %v", + t.Errorf("%v: decoding and encoding produced different addresses: %v != %v", test.name, test.encoded, encoded) return } From b7e8758db59046e0a9f146674b66e6990d813223 Mon Sep 17 00:00:00 2001 From: cronicc Date: Mon, 26 Oct 2020 11:39:11 +0000 Subject: [PATCH 07/15] Re-add license files of submodules --- zend/LICENSE | 16 ++++++++++++++++ zenutil/LICENSE | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 zend/LICENSE create mode 100644 zenutil/LICENSE diff --git a/zend/LICENSE b/zend/LICENSE new file mode 100644 index 00000000..53ba0c56 --- /dev/null +++ b/zend/LICENSE @@ -0,0 +1,16 @@ +ISC License + +Copyright (c) 2013-2017 The btcsuite developers +Copyright (c) 2015-2016 The Decred developers + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/zenutil/LICENSE b/zenutil/LICENSE new file mode 100644 index 00000000..3e7b1679 --- /dev/null +++ b/zenutil/LICENSE @@ -0,0 +1,16 @@ +ISC License + +Copyright (c) 2013-2017 The btcsuite developers +Copyright (c) 2016-2017 The Lightning Network Developers + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. From 62a904f0c33f94c44d1d0211f232d95e238fe6bd Mon Sep 17 00:00:00 2001 From: cronicc Date: Tue, 27 Oct 2020 13:06:19 +0000 Subject: [PATCH 08/15] Add travis-ci pipeline --- .circleci/config.yml | 103 ------------------------------------------- .dockerignore | 1 + .travis.yml | 69 +++++++++++++++++++++++++++++ ci/setup_env.sh | 15 +++++++ 4 files changed, 85 insertions(+), 103 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .travis.yml create mode 100644 ci/setup_env.sh diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 0516391d..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright 2020 Coinbase, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -version: 2.1 -executors: - default: - docker: - - image: circleci/golang:1.13 - user: root # go directory is owned by root - working_directory: /go/src/github.com/coinbase/rosetta-bitcoin - environment: - - GO111MODULE: "on" - -fast-checkout: &fast-checkout - attach_workspace: - at: /go - -jobs: - setup: - executor: - name: default - steps: - - checkout - - run: make deps - - persist_to_workspace: - root: /go - paths: - - src - - bin - - pkg/mod/cache - test: - executor: - name: default - steps: - - *fast-checkout - - run: make test - lint: - executor: - name: default - steps: - - *fast-checkout - - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.30.0 - - run: make lint - check-license: - executor: - name: default - steps: - - *fast-checkout - - run: make check-license - check-format: - executor: - name: default - steps: - - *fast-checkout - - run: make check-format - coverage: - executor: - name: default - steps: - - *fast-checkout - - run: make coverage - salus: - machine: true - steps: - - checkout - - run: make salus - -workflows: - version: 2 - build: - jobs: - - setup - - test: - requires: - - setup - - lint: - requires: - - setup - - check-license: - requires: - - setup - - check-format: - requires: - - setup - - coverage: - requires: - - setup - - salus - -notify: - webhooks: - - url: https://coveralls.io/webhook?repo_token=$COVERALLS_TOKEN \ No newline at end of file diff --git a/.dockerignore b/.dockerignore index 9e09df36..f4be7947 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,3 +5,4 @@ Dockerfile* *.sh !entrypoint.sh *.md +ci/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..b5fcf27e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,69 @@ +os: linux +dist: bionic +language: go +go: + - "1.15.3" +services: + - docker +addons: + apt: + packages: + - pigz + +env: + global: + - GO111MODULE=on + - ALLOW_FAIL=false + +# TODO remove || true +install: make deps || true + +# TODO fix failures +jobs: + allow_failures: + env: + - ALLOW_FAIL=true + include: + - stage: Tests + script: make test + - stage: Tests + env: + - ALLOW_FAIL=true + script: + - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.31.0 + - make lint + - stage: Tests + env: + - ALLOW_FAIL=true + script: make check-license + - stage: Tests + env: + - ALLOW_FAIL=true + script: make check-format + - stage: Tests + env: + - ALLOW_FAIL=true + script: make coverage + - stage: Tests + env: + - ALLOW_FAIL=true + script: make salus + - stage: Build + script: + - source ci/setup_env.sh + - if [ ! -z "${version}" ]; then make build-release; else make build-local; fi + +deploy: + edge: true + provider: releases + draft: false + overwrite: true + token: "${GITHUB_TOKEN}" + release_notes: "Release ${version}" + file_glob: false + file: + - "./rosetta-zen-${version}.tar.gz" + cleanup: false + on: + tags: true + condition: '! -z "${version}"' diff --git a/ci/setup_env.sh b/ci/setup_env.sh new file mode 100644 index 00000000..215cedaf --- /dev/null +++ b/ci/setup_env.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -eo pipefail + +if [ ! -z "${TRAVIS_TAG}" ]; then + export GNUPGHOME="$(mktemp -d 2>/dev/null || mktemp -d -t 'GNUPGHOME')" + echo "Tagged build, fetching maintainer keys." + gpg -v --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys $MAINTAINER_KEYS || + gpg -v --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys $MAINTAINER_KEYS || + gpg -v --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys $MAINTAINER_KEYS + if git verify-tag -v "${TRAVIS_TAG}"; then + echo "Valid signed tag" + export version="${TRAVIS_TAG}" + fi +fi From ef49c70502abd376234e2ab7d102512711aa33da Mon Sep 17 00:00:00 2001 From: cronicc Date: Tue, 27 Oct 2020 15:08:10 +0000 Subject: [PATCH 09/15] Verify zend release tags --- Dockerfile | 28 +++++++++++++++++++++++----- Makefile | 2 +- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 807c53ea..a75f19da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - ## Build zend FROM ubuntu:18.04 as zend-builder @@ -22,7 +21,11 @@ MAINTAINER cronic@horizen.io SHELL ["/bin/bash", "-c"] # Latest release zen 2.0.22 -ARG ZEN_COMITTISH=2a5e4bc40180bbcb72a0fdc003a52b6812301d98 +ARG ZEN_COMMITTISH=v2.0.22 +ARG IS_RELEASE=false +# cronic http://pool.sks-keyservers.net:11371/pks/lookup?search=0x219F55740BBF7A1CE368BA45FB7053CE4991B669&op=vindex +# Luigi Varriale http://pool.sks-keyservers.net:11371/pks/lookup?search=0x7C20EDC1CABFC9D1005EADBF3C80D9DD9F971AB6&op=vindex +ARG MAINTAINER_KEYS="219F55740BBF7A1CE368BA45FB7053CE4991B669 7C20EDC1CABFC9D1005EADBF3C80D9DD9F971AB6" RUN set -euxo pipefail \ && export DEBIAN_FRONTEND=noninteractive \ @@ -30,11 +33,26 @@ RUN set -euxo pipefail \ && apt-get -y --no-install-recommends install apt-utils \ && apt-get -y --no-install-recommends dist-upgrade \ && apt-get -y --no-install-recommends install autoconf automake \ - bsdmainutils build-essential ca-certificates cmake curl fakeroot \ - git g++-multilib libc6-dev libgomp1 libtool m4 ncurses-dev \ + bsdmainutils build-essential ca-certificates cmake curl dirmngr fakeroot \ + git g++-multilib gnupg2 libc6-dev libgomp1 libtool m4 ncurses-dev \ pkg-config zlib1g-dev \ && git clone https://github.com/HorizenOfficial/zen.git \ - && cd /zen && git checkout "${ZEN_COMITTISH}" \ + && cd /zen && git checkout "${ZEN_COMMITTISH}" \ + && if [ "$IS_RELEASE" = "true" ]; then \ + ( gpg2 --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --keyserver-options timeout=15 --recv-keys $MAINTAINER_KEYS || \ + gpg2 --batch --keyserver hkp://ha.pool.sks-keyservers.net --keyserver-options timeout=15 --recv-keys $MAINTAINER_KEYS || \ + gpg2 --batch --keyserver pgp.mit.edu --keyserver-options timeout=15 --recv-keys $MAINTAINER_KEYS || \ + gpg2 --batch --keyserver keyserver.pgp.com --keyserver-options timeout=15 --recv-keys $MAINTAINER_KEYS || \ + gpg2 --batch --keyserver pgp.key-server.io --keyserver-options timeout=15 --recv-keys $MAINTAINER_KEYS ) \ + && if git verify-tag -v "${ZEN_COMMITTISH}"; then \ + echo "Valid signed tag"; \ + else \ + echo "Not a valid signed tag"; \ + exit 1; \ + fi \ + && ( gpgconf --kill dirmngr || true ) \ + && ( gpgconf --kill gpg-agent || true ); \ + fi \ && export MAKEFLAGS="-j $(($(nproc)+1))" && ./zcutil/build.sh $MAKEFLAGS diff --git a/Makefile b/Makefile index f091334d..0dbc8548 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ build-local: build-release: # make sure to always set version with vX.X.X - docker build --pull --no-cache -t rosetta-zen:$(version) .; + docker build --pull --no-cache --build-arg IS_RELEASE=true -t rosetta-zen:$(version) .; docker save rosetta-zen:$(version) | ${GZIP_CMD} > rosetta-zen-$(version).tar.gz; run-mainnet-online: From 3f4d48b7c70bc9fce6cdc989aafb3bb0b22dd202 Mon Sep 17 00:00:00 2001 From: cronicc Date: Tue, 27 Oct 2020 17:53:29 +0100 Subject: [PATCH 10/15] Add shields to README.md --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dd89543d..30e6f303 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,12 @@

Rosetta Zen

- +

+ + + + +

## Overview From 439451e3845610abb6df9cd5f724d5ef82a5d493 Mon Sep 17 00:00:00 2001 From: cronicc Date: Thu, 29 Oct 2020 17:25:33 +0000 Subject: [PATCH 11/15] Bring assets/zen-regtest.conf in line with zen-testnet.conf --- assets/zen-regtest.conf | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/assets/zen-regtest.conf b/assets/zen-regtest.conf index 64669596..d408c639 100644 --- a/assets/zen-regtest.conf +++ b/assets/zen-regtest.conf @@ -1,26 +1,31 @@ ## -## bitcoin.conf configuration file. Lines beginning with # are comments. +## zen.conf configuration file. Lines beginning with # are comments. ## # DO NOT USE THIS CONFIGURATION FILE IF YOU PLAN TO EXPOSE -# BITCOIND'S RPC PORT PUBLICALLY (THESE INSECURE CREDENTIALS -# COULD LEAD TO AN ATTACK). ROSETTA-BITCOIN USES THE RPC PORT +# ZEND'S RPC PORT PUBLICALLY (THESE INSECURE CREDENTIALS +# COULD LEAD TO AN ATTACK). ROSETTA-ZEN USES THE RPC PORT # FOR INDEXING AND TRANSACTION BROADCAST BUT NEVER PROVIDES THE -# CALLER ACCESS TO BITCOIND'S RPC PORT. +# CALLER ACCESS TO ZEND'S RPC PORT. -datadir=/data/bitcoind +datadir=/data/.zen +bind=0.0.0.0 +rpcbind=0.0.0.0 bantime=15 rpcallowip=0.0.0.0/0 -rpcthreads=4 -rpcworkqueue=128 +rpcallowip=::/0 +rpcthreads=16 +rpcworkqueue=1000 #disablewallet=1 txindex=1 +port=19033 +rpcport=18231 rpcuser=rosetta rpcpassword=rosetta - +showmetrics=0 +printtoconsole=1 regtest=1 -port=19033 -bind=0.0.0.0 -rpcport=18231 -rpcbind=0.0.0.0 + +# manual pruning is not supported in zend +#prune=1 From 059f8255b3872efa166a71aed2762825f6dc9b6b Mon Sep 17 00:00:00 2001 From: cronicc Date: Thu, 29 Oct 2020 19:24:53 +0000 Subject: [PATCH 12/15] Fix error introduced in rebase conflict resolution --- services/account_service_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/account_service_test.go b/services/account_service_test.go index 0afe02d1..0b78801b 100644 --- a/services/account_service_test.go +++ b/services/account_service_test.go @@ -105,7 +105,7 @@ func TestAccountBalance_Online_Current(t *testing.T) { assert.Equal(t, &types.AccountBalanceResponse{ BlockIdentifier: block, - Coins: coins, + Coins: expectedCoins, Balances: []*types.Amount{ { Value: "25", From e8da1abcd6a47f3f3364a1f325bc9dd10f8f21dc Mon Sep 17 00:00:00 2001 From: cronicc Date: Thu, 29 Oct 2020 20:47:09 +0100 Subject: [PATCH 13/15] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 30e6f303..9af2cb09 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Running the following commands will create a Docker image called `rosetta-zen:la #### From GitHub To download the pre-built Docker image from the latest release, run: ```text -curl -sSfL https://raw.githubusercontent.com/HorizenOfficial/rosetta-zen/blob/mo/Data_API/install.sh | sh -s +curl -sSfL https://raw.githubusercontent.com/HorizenOfficial/rosetta-zen/rosetta-zen/install.sh | sh -s ``` _Do not try to install rosetta-zen using GitHub Packages!_ @@ -100,8 +100,8 @@ You should also modify your open file settings to `100000`. This can be done on with the command: `ulimit -n 100000`. ### Memory-Mapped Files -`rosetta-bitcoin` uses [memory-mapped files](https://en.wikipedia.org/wiki/Memory-mapped_file) to -persist data in the `indexer`. As a result, you **must** run `rosetta-bitcoin` on a 64-bit +`rosetta-zen` uses [memory-mapped files](https://en.wikipedia.org/wiki/Memory-mapped_file) to +persist data in the `indexer`. As a result, you **must** run `rosetta-zen` on a 64-bit architecture (the virtual address space easily exceeds 100s of GBs). If you receive a kernel OOM, you may need to increase the allocated size of swap space From 2b37e48fc23b91db0175c3fbbf96d8db02687af6 Mon Sep 17 00:00:00 2001 From: cronicc Date: Thu, 29 Oct 2020 21:08:17 +0100 Subject: [PATCH 14/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9af2cb09..206d4b56 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Running the following commands will start a Docker container in [detached mode](https://docs.docker.com/engine/reference/run/#detached--d) with a data directory at `/zen-data` and the Rosetta API accessible at port `8080`. Please make sure that `/zen-data` has `nobody:nogroup` ownership. -You can also use a named volume which will be created with the correct ownership using: `-v "zen-data:/data`. +You can also use a named volume which will be created with the correct ownership using: `-v "zen-data:/data"`. #### Mainnet:Online ```text From 8a2b78145f523154e72c47157b915128695a87c5 Mon Sep 17 00:00:00 2001 From: cronicc Date: Thu, 29 Oct 2020 20:52:57 +0000 Subject: [PATCH 15/15] Set mainnet and testnet tip_delay --- rosetta-cli-conf/zen_mainnet.json | 2 +- rosetta-cli-conf/zen_testnet.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rosetta-cli-conf/zen_mainnet.json b/rosetta-cli-conf/zen_mainnet.json index bde1a551..481ff5b2 100644 --- a/rosetta-cli-conf/zen_mainnet.json +++ b/rosetta-cli-conf/zen_mainnet.json @@ -9,7 +9,7 @@ "retry_elapsed_time": 0, "max_online_connections": 0, "max_sync_concurrency": 0, - "tip_delay": 1800, + "tip_delay": 2700, "log_configuration": false, "construction": { "max_offline_connections": 0, diff --git a/rosetta-cli-conf/zen_testnet.json b/rosetta-cli-conf/zen_testnet.json index c0293722..d487a6aa 100644 --- a/rosetta-cli-conf/zen_testnet.json +++ b/rosetta-cli-conf/zen_testnet.json @@ -9,7 +9,7 @@ "retry_elapsed_time": 0, "max_online_connections": 0, "max_sync_concurrency": 0, - "tip_delay": 1800, + "tip_delay": 72000, "log_configuration": false, "construction": { "max_offline_connections": 0,